2007 CodeEngn Conference 01
Stack 의 기본적인 개념 설명과 NASM 어셈블러 사용법 설명, 다양한 Calling Convention에 대해 예제를 통해 설명한다.
http://codeengn.com/conference/01
49. http://www.CodeEngn.com
NASMNASM
L1 db 0 ; byte
L2 dw 1000 ; word
L3 db 110101b ; byte
L4 db 12h ; byte
L5 db 17o ; byte
L6 dd 1A92h ; double word
L7 resb 1 ; uninitialized byte
L8 db 'A' ; ascii code = 'A'
L9 db 0,1,2,3 ; 4 bytes
L10 db 'w', 'o','r','d',0 ;string
L11 db 'word', 0
L12 times 100 db 0 ; 100 bytes of zero
L13 resw 100 ; 100*2(word bytes
50. http://www.CodeEngn.com
NASMNASM
Mov al, [L1] ;copy byte at L1
Mov eax, L1 ;eax = address of byte at L1
Mov [L1], ah ; copy ah into byte at L1
Mov eax, [L6] ; copy double word
Add eax, [L6] ; eax = eax + double word at L6
Add [L6], eax ; double word at L6 += eax
Mov al, [L6]; copy first byte of double word at L6 into al
Mov [L6], 1 ; operation size is not specified
Mov dword [L6], 1 ; store a 1 at L6