assembly - x86 汇编语言中的减法语法问题
问题描述
到目前为止,我已经写出了大部分代码,但我遇到的最大困难是用户输入的输出。它似乎从每个字符串中收集所有数据,然后输出它们。我希望他们单独输出它们并显示减去已完成学分和所需学分的最终结果。感谢你们提供的任何帮助,并引导我编写代码。
.586
.MODEL FLAT
INCLUDE io.h ; header file for input/output
.STACK 4096
.DATA
studentName DWORD ?
degreeName DWORD ?
creditsCompleted DWORD ?
creditsNeeded DWORD ?
prompt1 BYTE "Enter your Name:", 0
prompt2 BYTE "Enter your Degree Name:", 0
prompt3 BYTE "Enter the number of Credits Completed:", 0
prompt4 BYTE "Enter the number of Credits Required:", 0
string BYTE 40 DUP (?)
resultLbl BYTE "The Credits left to complete are:", 0
sum BYTE 40 DUP (?), 0
.CODE
_MainProc PROC
input prompt1, string, 40 ; read ASCII characters
atod string ; convert to integer
mov studentName, ebx ; store in memory
input prompt2, string, 40 ; repeat for second number
atod string
mov degreeName, ecx
input prompt3, string, 40
atod string
mov creditsCompleted,edx
input prompt4, string, 40
atod string
mov creditsNeeded,eax
mov eax, creditsNeeded
sub eax, creditsCompleted
dtoa sum, eax
output resultLbl, sum
_MainProc ENDP
END ; end of source code
无法弄清楚我输出的数字实际上是如何减去的。这个数字要么高要么低。
解决方案
推荐阅读
- swift - 快速处理 Twilio VoIP 呼叫代表
- php - symfony中ckeditor的默认模板
- android - Vimeo 视频全屏按钮未在 android webview 中显示。你能帮我么?
- bash - 如何通过 dockerfile 升级 bash?
- php - CentOS 7 无法安装 php-imap 扩展
- ios - 致命错误:在展开 Optional 值时意外发现 nil。iOS 天气警报应用
- node.js - Cheerio 等不及节点获取
- r - 如何包含响应式输出文本 Shiny
- excel-formula - 想要 Table2 中的所有值针对 Table1 中的每个条目
- docker - Docker无法重新启动Windows 10