Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Assembly 重写您的程序,并询问其中一个用户是否要继续汇编中的计算(是/否)_Assembly_X86 - Fatal编程技术网

Assembly 重写您的程序,并询问其中一个用户是否要继续汇编中的计算(是/否)

Assembly 重写您的程序,并询问其中一个用户是否要继续汇编中的计算(是/否),assembly,x86,Assembly,X86,我已经完成了MUL计算,但真正的问题是我需要重写程序并执行此任务“重写您的程序,并询问任何一个用户是否要继续计算。” 计算(是/否)。如果是,用户可以选择执行MUL或DIV。如果不是,请打印“谢谢”并退出程序。“有人能告诉我如何执行此操作的代码吗?” INCLUDE Irvine32.inc .data str1 BYTE "Please enter a multiplicand (n) <1...9>: ",0 str2 BYTE "Please en

我已经完成了MUL计算,但真正的问题是我需要重写程序并执行此任务“重写您的程序,并询问任何一个用户是否要继续计算。” 计算(是/否)。如果是,用户可以选择执行MUL或DIV。如果不是,请打印“谢谢”并退出程序。“有人能告诉我如何执行此操作的代码吗?”

INCLUDE Irvine32.inc
.data
str1 BYTE "Please enter a multiplicand (n) <1...9>: ",0
str2 BYTE "Please enter a multiplier (m) <1...9>: ",0
str3 BYTE "Multiplication of: ",0
str4 BYTE "The product is: ",0
str5 BYTE " x ",0
str6 BYTE "Do you want to continue ? [Yes/No] : "
multiplicand dword ?
multiplier dword ?
product dword 0
answer dword ?

.code 

main PROC

call clrscr ; clear the console and locates the cursor at the upperleft corner.

mov edx, offset str1 ; move the address of str1 to edx
call WriteString ; display the string "str1"
call ReadDec ; read a 32bit unsigned number input from user
mov multiplicand, eax ; move the input from user into "multiplicand"

mov edx, offset str2 ; move the address of str2 to edx
call WriteString ; display the string "str1"
call ReadDec ; read a 32bit unsigned number input from user
mov multiplier, eax ; move the input from user into "multiplier"

call crlf ; add newline
mov edx, offset str3 ; move the address of str3 to edx
call WriteString ; display the string "str3"

mov eax, multiplicand ; move multiplicand into eax
call WriteDec ;  display the value eax from multiplicand
mov edx, offset str5 ; move the address of str5 to edx
call WriteString ; display str5

mov eax, multiplier ; move multiplier into ebx
call WriteDec ; display value eax from multiplier

mul multiplicand ; eax*multiplicand value
mov product, eax ; mov eax value into product

call crlf
mov edx, offset str4
call crlf
call WriteString ; display the string of str4
call WriteDec
call crlf

mov edx, offset str6
call crlf
call WriteString
call ReadString



exit 

main ENDP

END main
包括Irvine32.inc
.数据
str1字节“请输入被乘数(n):”,0
str2字节“请输入乘数(m):”,0
str3字节“的乘法:”,0
str4字节“产品为:”,0
str5字节“x”,0
str6字节“是否继续?[是/否]:”
德沃德?
德沃德?
乘积dword 0
回答德沃德?
.代码
主进程
调用CLRSC;清除控制台并将光标定位在左上角。
mov edx,偏移str1;将str1的地址移到edx
通话记录;显示字符串“str1”
调用ReadDec;读取用户输入的32位无符号数字
mov被乘数,eax;将输入从用户移动到“被乘数”
mov edx,偏移量str2;将str2的地址移到edx
通话记录;显示字符串“str1”
调用ReadDec;读取用户输入的32位无符号数字
mov乘数,eax;将用户输入移动到“乘数”中
调用crlf;添加换行符
移动edx,偏移str3;将str3的地址移到edx
通话记录;显示字符串“str3”
mov-eax,被乘数;将被乘数移到eax中
调用WriteDec;显示被乘数的值eax
mov edx,偏移量str5;将str5的地址移到edx
通话记录;显示str5
mov-eax,乘数;将乘数移到ebx
调用WriteDec;显示乘法器中的值eax
多重乘子;eax*被乘数值
mov产品,eax;将eax值移动到产品中
呼叫crlf
移动edx,偏移str4
呼叫crlf
通话记录;显示str4的字符串
通话记录
呼叫crlf
移动edx,偏移str6
呼叫crlf
通话记录
调用读取字符串
出口
主端
端干管

在教科书中查找
cmp
和条件跳转。基本上我没有任何教科书可供参考,这就是为什么我在这里提问。因为在我的课堂上,我还没有学会如何进行条件跳转。条件跳转是实现“如果”的唯一方法。在这个网站上提问并不是第一次被教东西的好方法。看看周围的其他教程、书籍等。网站上有一些参考资料。当你有一个更具体的问题和该领域的一些背景时,再回来询问。