到目前为止,我已经写出了大多数代码,但是最大的困难是用户带来的输入输出。似乎从每个字符串中收集所有数据,然后输出它们。我希望他们分别输出它们,并显示减去已完成的学分和所需的学分的最终结果。希望你们能提供任何帮助,并引导我朝我的代码的编写方向发展。
.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
不能弄清楚我要输出的数字实际上并没有减去。这个数字要么高要么低。