Question: ASSEMBLY LANGUAGE Write a program to print the sum of two digits Example run: Enter first digit: 1 Enter second digit: 2 Sum = 3
ASSEMBLY LANGUAGE
Write a program to print the sum of two digits
Example run:
Enter first digit: 1
Enter second digit: 2
Sum = 3
I have the answer but it gets a bunch of errors! CAN SOMEONE CORRECT THIS CODE FOR ME?
.model small .stack 100h .data Message1 db "Enter First Digit : $" Message2 db, 0dh,0ah, "Enter Second Digit : $" Message3 db , 0dh,0ah, "SUM of Entered Numbers = $" No1 db ? ; No2 db ?, ; ans db ?, "$" .code main PROC mov ax, @data ;initiaize ds mov ds, ax mov dx, OFFSET Message1 ;load and display msg1 mov ah, 09 int 21h mov ah, 1h ;read first initial int 21h sub al, 30h mov No1, al mov dx,offset Message2 ;load and display msg2 mov ah, 9 int 21h ;read second initial mov ah , 1h int 21h sub al, 30h mov No2, al mov dx,offset Message3 mov ah 9 ;load and display msg3 int 21h mov al, No1 ;add No1 and No1 add al, No2 add al, 30h ;moves value into ans mov ans, al mov dx,offset ans ;load and display msg3 mov ah, 9 int 21h ;returns control to dos mov ah, 4ch int 21h
main endp end main
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
