我正在编写一个接受输入的程序,然后将其从一个长度单位转换为另一个指定的长度单位。问题是我的代码是在命令提示符的同一行上一次打印每个字符串,一旦输入值和转换,它就会退出而不是显示值。这是代码(我是ASM的新手,准备好你的眼睛):
include Irvine32.inc
.data
len Dword ?
InL Dword ?
str5 Byte "Enter the value of your length"
str6 Byte "1 for Yards to feet, 2 for feet to inches, 3 for yards to inches"
str7 Byte "Your converted output is:"
.code
main proc
lea edx, str5
call WriteString
call ReadDec ;prompts for a value and stores it as len
mov len, eax
lea edx, str6
call WriteString
call ReadDec
mov InL, eax
cmp InL, 2 ;prompts your conversion and compares it to send you to the right converter.
jl YardsFeet
je FeetInches
jg YardsInches
YardsFeet:
mov eax, 3
MUL len
jmp LenOut
FeetInches:
mov eax, 12
MUL len
jmp LenOut
YardsInches:
mov eax, 36
Mul len
jmp LenOut
LenOut:
mov eax, len
lea edx, str7
call WriteString
Call WriteDec
call crlf
exit
main endp
end main
我觉得这可能是一件很简单的事情我可以忽视,但最近大部分都是这样的。