SECTION .data
x: dd 32
y: dd 56
msg1: db "X is greater thean Y",10,0
msg2: db "Y is greater thean X",10,0
SECTION .bss
SECTION .text
extern printf ;from c standard libray
global main ;
main:
;create stack frame
push ebp
mov ebp, esp
;if( x > y) {
; msg1
;} else{
; msg2
;}
mov eax, DWORD [x]
mov ebx, DWORD [y]
cmp eax, ebx ; cmp x, y
jg .xGreatThany
push DWORD msg2
call printf
jmp .done
.xGreatThany:
push DWORD msg1
call printf
jmp .done
.done:
;destory the stack frame
mov esp, ebp
pop ebp
ret
댓글 없음:
댓글 쓰기