Write a program that will generate the following output. Using (Assembly languag
ID: 3865502 • Letter: W
Question
Write a program that will generate the following output. Using (Assembly language)
X is CA
Y is EB
X+Y is ?? with c-flag(?) and o-flag(?)
X-Y is ?? with c-flag(?) and o-flag(?)
where the "??" are replaced with the appropriate values.
Repeat the output with X=46 and Y=74, and X=CB and Y=37.
Use the irvine procedures WriteString, WriteChar and Calf to produce the output. (You actually only need WriteString.)
HINT: You can replace characters by simply adding the displacement. For example, if you want to print out, "Cat number 57", you can use the following code:
.data
catnum BYTE "Cat number ??",0Dh, 0Ah, 0
.code
mov catnum+11, "5"
mov catnum+12, "7"
mov edx, catnum
call WriteString
Explanation / Answer
ANSWER::
x+y
x-y
.MODEL SMALL
.STACK 100H
.DATA
MSG DB "===SUBTRACTION OF TWO NUMBERS=== $"
PROMPT1 DB 0AH," ENTER A FIRST NUMBER: $"
PROMPT2 DB 0AH,"ENTER A SECOND NUMBER: $"
PROMPT3 DB 0AH," ANSWER: $"
NUM1 DB ?,'$'
NUM2 DB ?,'$'
.CODE
START:
MOV AX,@DATA
MOV DS,AX
INT 21H
MOV AH,9
LEA DX,MSG
INT 21H
MOV AH,9
LEA DX,PROMPT1
INT 21H
MOV AH,1
INT 21H
SUB AL,30H
MOV NUM1,AL
MOV AH,9
LEA DX,PROMPT2
INT 21H
MOV AH,1
INT 21H
SUB AL,30H
MOV NUM2,AL
MOV AH,9
LEA DX,PROMPT3
INT 21H
MOV AL,NUM1
SUB AL,NUM2
ADD AL,30H
MOV AH,2
MOV DL,AL
INT 21H
MOV AH,4CH
INT 21H
END START
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.