Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program in assembler to add two 4-byte numbers. The numbers are stored a

ID: 2248843 • Letter: W

Question

Write a program in assembler to add two 4-byte numbers.

The numbers are stored at data memory location from 0x0200~0x0207. The sum of the numbers will be stored at 0x0208~0x020B in data memory.

(HINT: num1 and num2 are only the place holder to assigning the values in the two separated sets of numbers. You do not need to worry about the names of the numbers. )


Data:
First number set, num1 = 78a81fa0
Second number set, num2 = 7192201f

For storing the number in the memory location you have to use “PUSH” and to get/read the number from memory location use “POP” instruction. You cannot use “LDS”
or “STS” to deal with memory location.

Explanation / Answer

ASSUME DS:DATA CS:CODE

DATA_HERE SEGMENT

DATA1:DW,0x0200H

RESULT DW,0x0208H

DATA_HERE ENDS

CODE_HERE SEGMENT

START:

MOV AX,DATA_HERE

MOV DS,AX

PUSH DATA1

ADD DATA2

POP AX

MOV RESULT,AX

INT 03H

CODE_HERE ENDS

END START

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote