Write an MC68000 assembly language program that computes the average of fifteen
ID: 3600665 • Letter: W
Question
Write an MC68000 assembly language program that computes the average of fifteen data bytes in memory (use EASY68k software)
The program should expect to find the data bytes stored at memory locations $600 thru $60E.
All values are positive and their sum may require more than 8 bits
The program should store the result as follows:
Integer part of average at Byte $760
Fractional part (the remainder after division) at Byte $761
Use ORG directives to set the location counter to the proper place,
Use DS.B directives to define names for the data bytes, and Specify the data address by name in the instructions.
Example:
ORG $600
DATA1 DS.B 1
DATA2 DS.B 1
ORG $800
MOVE.B DATA1, D0
Explanation / Answer
ANSWER::
DATA SEGMENT
NUM1 DB 5
NUM2 DB 9
NUM3 DB 7
AVG DB ?
ENDS
CODE SEGMENT
ASSUME DS:DATA CS:CODE
START:
MOV AX,DATA
MOV DS,AX
MOV AL,NUM1
ADD AL,NUM2
ADD AL,NUM3
MOV AH,0
MOV DL,3
DIV DL
MOV AVG,AL
MOV AH,4CH
INT 21H
ENDS
END START
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.