问题是我正在尝试编写简单的数字比较脚本,但cmp无法正常运行,这是我的代码 - 谢谢!
global _start
section .bss
number1:resb 3
number2:resb 3
section .data
da db "hello"
ll equ $-da
label1 db "enter the first number >>>"
len equ $-label1
label2 db "enter the second number >>>"
len2 equ $-label2
mess1 db "number 1 less than number 2",0ah
l1 equ $-mess1
mess2 db "number2 less than number 1",0ah
l2 equ $-mess2
section .text
_start:
mov eax,4
mov ebx,1
mov ecx,label1
mov edx,len
int 80h
mov eax,3
mov ebx,2
mov ecx,number1
mov edx,3
int 80h
mov eax,4
mov ebx,1
mov ecx,label2
mov edx,len2
int 80h
mov eax,3
mov ebx,2
mov ecx,number2
mov edx,3
int 80h
mov eax,4
mov ebx,1
mov ecx,number1
mov edx,3
int 80h
mov ax,number1
mov bx,number2
cmp ax,bx
jl _ss1
_ss1:
int 80h
mov eax,4
mov ebx,1
mov ecx,da
mov edx,ll
int 80h
mov eax,1
mov ebx,0
int 80h
答案 0 :(得分:-1)
您需要在代码底部使用jmp,这将跳过标签_ss1。这将在jl _ss1之后。