我正在尝试创建一个简单的函数来比较两个数字并打印消息,说明它们是否相等。 我将第二个数字传递给我的函数时遇到了麻烦,它根本不起作用。
这是我的代码:
org 0x7e00
jmp _start
dados:
ig: db "iguais", 0xa, 0xd, 0
dif: db "diferentes", 0xa, 0xd, 0
PrintString:
push bp
mov bp, sp
mov si, [bp + 4]
Imprimir:
lodsb
cmp al, 0 ;verificar se chegou no fim da string.
je strEnd
mov ah, 0xe ;interrupcao para escrever charactere
mov bh, 0 ;pagina
mov bl, 30 ;linha
mov cx, 3 ;colunas
int 10h
jmp Imprimir
strEnd:
pop bp
ret
;here's the part that doesn't work
comp:
push bp
mov bp, sp
mov cx, [bp + 4]
mov bx, [bp + 8]
cmp bx, cx
je equals
jne different
equals:
pop bp
push ig
call PrintString
ret
different:
pop bp
push dif
call PrintString
ret
_start:
mov ax, 3
push ax
mov ax, 12
push ax
call comp
jmp $