%include "asm_io.inc"
segment .data
;
; Output strings
;
prompt db "entre 2 numeros", 0
maior db "o primeiro é maior que o segundo", 0
menor db "o primeiro é menor que o segundo",0
igual db "igual",0
segment .bss
input resd 1
input1 resd 1
segment .text
global _asm_main
_asm_main:
enter 0,0 ; setup routine
pusha
mov eax,prompt
call print_string
call read_int
mov ,eax
call print_nl
call read_int
mov ,eax
mov eax,
mov ebx,
cmp ebx,eax
je zero
jl lower
jg great
zero:
mov eax,igual
call print_string
lower:
mov eax,menor
call print_string
great:
mov eax,maior
call print_string
next:
popa
mov eax, 0 ; return back to C
leave
ret
when eax is equals a ebx the prograll calls zero,lower and great. Anyone could help me?
It smells a bit of homework, so I'll not give you the full solution, just a hint.
Which is: what does call do? What happens after call print_string?
Which is: what does call do? What happens after call print_string?
%include "asm_io.inc"
segment .data
;
; Output strings
;
prompt db "entre 2 numeros", 0
maior db "o primeiro é maior que o segundo", 0
menor db "o primeiro é menor que o segundo",0
igual db "igual",0
segment .bss
input resd 1
input1 resd 1
segment .text
global _asm_main
_asm_main:
enter 0,0 ; setup routine
pusha
mov eax,prompt
call print_string
call read_int
mov ,eax
call print_nl
call read_int
mov ,eax
mov eax,
mov ebx,
cmp ebx,eax
je zero
jl lower
jg great
zero:
mov eax,igual
call print_string
jmp next
lower:
mov eax,menor
call print_string
jmp next
great:
mov eax,maior
call print_string
jmp next
next:
popa
mov eax, 0 ; return back to C
leave
ret
i got it, thanx. I'm trying learning asm by myself.