인텔 어셈블리어 공부하다가 리눅스 32비트에서 해보려니 잘 안되네요.
스택오버플로우에서 물어물어 해본 결과
어셈블과 링크하는 방법은 다음과 같습니다.
nasm -f elf file.asm gcc -m32 -nostdlib -o file file.oSECTION .DATA hello: db 'Hello world!',10 helloLen: equ $-hello SECTION .TEXT GLOBAL _start _start: ; Write 'Hello world!' to the screen mov eax,4 ; 'write' system call mov ebx,1 ; file descriptor 1 = screen mov ecx,hello ; string to write mov edx,helloLen ; length of string to write int 80h ; call the kernel ; Terminate program mov eax,1 ; 'exit' system call mov ebx,0 ; exit with error code 0 int 80h ; call the kernel
아래는 'Hello world!' 출력하는 예제입니다.
64비트 환경에서 리눅스 어셈블리어 연습해보려고 별짓을 다 해봤는데 어셈블하고 링크하는 방법을 모르겠더군요. 그래서 그냥 VM Ware에 32비트 우분투를 설치하고 nasm으로 연습했습니다.
더 공부해보고 싶으신 분은 링크의 튜토리얼을 확인하세요(튜토리얼 링크: http://www.tutorialspoint.com/assembly_programming/)
'노트정리 > 프로그래밍 언어' 카테고리의 다른 글
| JDBC 튜토리얼 사이트 소개와 예제 (0) | 2016.10.25 |
|---|---|
| 펄, 정규표현식 강의. perl, regular expression lecture (0) | 2016.10.14 |
| Code::Blocks에서 MinGW 컴파일러 세팅하는 방법. 이클립스로 C++하는 거 아닙니다. (0) | 2016.05.09 |
| 각종 소스 코드를 HTML로 된 Syntax Highlight 해주는 사이트를 소개합니다. (0) | 2015.12.09 |
| 이클립스에서 the selection cannot be launched 에러 해결법. (0) | 2015.09.30 |
| 자바의 배열에서 C, C++과 가장 다른 점 (0) | 2014.02.13 |
| 무료 컴파일러 DEV C++ (0) | 2013.12.17 |
| Visual Studio 2012 Express for Web tutorial 영상 (2) | 2013.12.14 |


