Write an MC68000 assembly language program that will add three numbers: one numb
ID: 3890664 • Letter: W
Question
Write an MC68000 assembly language program that will add three numbers: one number in register D3, second one in memory locations specified by A4, and the third is an immediate value of 49. Store the sum in memory location specified in register A6
Include comments relating to the entire program (“global” comments)
Place the first instruction of the program at memory at address $2000. Use the ORG and END assembler directives where appropriate.
Start the simulator, load the program, initialize the PC register , and put representative addresses in A4 and A6. Also, put representative data in D3 and the memory location specified by A4,
Explanation / Answer
Assembly code to add three numbers:
ORG $2000
MOVE D3,D0 // Move value of first operand stored in D3 to D0
MOVE A4,D1 // Move value of second operand stored in A4 to D1
ORG $2100
MOVE D0, A6 // Load D0 into A6
ADD D1, A6 // Add value stored in D1 to A6 => NUM1 + NUM2
AADI #49, A6 // AADI is used to add immediate value
END $2100
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.