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

USING ASSEMPLY LANGUAGE. Write a program (starting at address $4000) to find the

ID: 3550739 • Letter: U

Question

USING ASSEMPLY LANGUAGE. Write a program (starting at address $4000) to find the average of four 16-bit

unsigned integers stored at locations $5000, $5002, $5004 and $5006 and store

the 16-bit result at location $5010. Round your result to the nearest integer. (You

can assume that the sum of the four integers is not greater than 64K). Initialize

your four numbers to be 302, 420, 1000 and 1529 (decimal). Enter your program

into the MiniIDE and assemble it. Load your assembled code into the simulator

and check that it operates correctly. In your report, show your code and show a

screen shot of the simulator after your program has completed with the memory

display window set to show addresses starting at $5000

Explanation / Answer

CODE SEGMENT

START:

fninit

MOV AX,[5000]

MOV CL,10

MOV BX,[5002]

ADD AX,BX

MOV BX,[5004]

ADD AX,BX

MOV BX,[5006]

ADD AX,BX

MOV [5010],AX

INT 21

CODE ENDS

END START