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

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

ID: 3588223 • Letter: W

Question

Write a program in assemble 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

DATA SEGMENT

NUM1 DB 9H

NUM2 DB 7H

RESULT DB

ENDS

CODE SEGMENT

ASSUME DS:DATA CS:CODE

START:

MOV AX,DATA

MOV DS,AX

MOV AL,NUM1

ADD AL,NUM2

MOV RESULT,AL

MOV AH,.4CH

INT 21H

ENDS

END START

CODE SEGMENT

CODE SEGMENT is the starting point of the Code Segment in a Program and CODE is the name SEGMENT is the keyword for defining Segments, Where we can write the code of the program.

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