我有一个问题,我的循环,它包含的代码很长,它给了我错误jump destination too far : by 3 byte(s)
。当删除:跳转目的地太远:通过3个字节
mov edx,offset str1
call writestring
这部分低于主PROC,它没有给出错误。但是我需要这个字符串用户输入一个负数来给出一条消息。我怎么能够?
INCLUDE Irvine32.inc
.data
money dword 200,100,50,20,10,5,1
str1 byte "Enter the amounts for each value of money : ",0
str2 byte "The sum of your moneys are:",0
total dword 0
buffer dword 1000 dup(0),0
str3 byte "Do not enter neg number ",0
.code
main PROC
mov edx,offset str1
call writestring
call crlf
mov ecx,lengthof money
mov esi,0
mov edi,0
start1:
jmp continue
don:
push ecx
mov edx,ecx
mov edx,0
mov edx,7
sub edx,ecx
mov ecx,edx
mov edi,0
mov esi,0
start2:
mov eax,money[esi]
call writedec
mov ebx,eax
mov al,'x'
call writechar
mov eax,buffer[edi]
call writedec
call crlf
add esi,4
add edi,4
loop start2
pop ecx
continue:
;**************************************************
mov edx,0
mov eax,money[esi]
call writedec
mov ebx,eax
mov al,'x'
call writechar
call readint
;***************************************************
sub eax,0
js don
mov buffer[edi],eax
;*************************
mul ebx
add total,eax ;we add each the multiplication to total.
add esi,4 ;increases the index by 4.(because of dword type)
add edi,4
loop start1
mov edx,offset str2
call writestring
mov eax, total
call writedec
exit
main ENDP
END main
该错误指的是什么指令? – duskwuff
mov edx,offset str1 call writestring – zahit
你的代码是你永远不应该使用LOOP指令的一个很好的例子。 –