I\'m having trouble making another code to display my project 1 and my name just
ID: 3732187 • Letter: I
Question
I'm having trouble making another code to display my project 1 and my name just how the assignment is show to do if anyone can help me thank you. And they gave me the program already but they want us to add more to it which I dont know what to use.
; Example assembly language program -- adds two numbers
; Author: R. Detmer
; Date: 1/2008
.586
.MODEL FLAT
INCLUDE io.h ; header file for input/output
.STACK 4096
.DATA
number1 DWORD ?
number2 DWORD ?
prompt1 BYTE "Enter first number", 0
prompt2 BYTE "Enter second number", 0
string BYTE 40 DUP (?)
resultLbl BYTE "The sum is", 0
sum BYTE 11 DUP (?), 0
.CODE
_MainProc PROC
input prompt1, string, 40 ; read ASCII characters
atod string ; convert to integer
mov number1, eax ; store in memory
input prompt2, string, 40 ; repeat for second number
atod string
mov number2, eax
mov eax, number1 ; first number to EAX
add eax, number2 ; add second number
dtoa sum, eax ; convert to ASCII characters
output resultLbl, sum ; output label and sum
mov eax, 0 ; exit with return code 0
ret
_MainProc ENDP
END ; end of source code
Explanation / Answer
Please add the extra lines that are underlined and execute the program.
; Example assembly language program -- adds two numbers
; Author: R. Detmer
; Date: 1/2008
.586
.MODEL FLAT
INCLUDE io.h ; header file for input/output
.STACK 4096
.DATA
number1 DWORD ?
number2 DWORD ?
resultLbl0 STRING “Project1”,0
output resultLbl0, yourname ;REPLACE YOUR NAME HERE
prompt1 BYTE "Enter first number", 0
prompt2 BYTE "Enter second number", 0
string BYTE 40 DUP (?)
resultLbl1 BYTE "The sum is", 0
resultLbl2 STRING “End of Project1”,0
sum BYTE 11 DUP (?), 0
.CODE
_MainProc PROC
input prompt1, string, 40 ; read ASCII characters
atod string ; convert to integer
mov number1, eax ; store in memory
input prompt2, string, 40 ; repeat for second number
atod string
mov number2, eax
mov eax, number1 ; first number to EAX
add eax, number2 ; add second number
dtoa sum, eax ; convert to ASCII characters
output resultLbl1, sum ; output label and sum
output resultLbl2, yourname ; REPLACE YOUR NAME HERE
mov eax, 0 ; exit with return code 0
ret
_MainProc ENDP
END ; end of source code
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.