I want to create a program that adds two hex values together using ADD.B, ADD.W, and ADD.L and see what the differences are. I'm new to assembly programming, so I can't seem to get it quite right. There are no errors, but when I run the program, no result is displayed. There also doesn't seem to be any value stored in register D3. Can anyone tell me what I am doing wrong? Thanks a lot for any help.
START ORG $1000 Program starts at loc $1000
MOVE $374D1FC4,D2 [D0] <- $374D1FC4
MOVE $F22C4663,D3 [D1] <- $F22C4663
ADD.B D2,D3 [D1] <- [D0] + [D1]
* ADD.W D2,D3 [D1] <- [D0] + [D1]
* ADD.L D2,D3 [D1] <- [D0] + [D1]
MOVE D3,R
* The following three instructions will display [R] to Output Window
* Task number 3 of trap #15 is to display D1.L as a signed decimal
MOVE R,D1 [D1] <- R
EXT.L D1 Extend sign bit to presreve the sign
MOVE #3,D0 Assign task number to [D0]
TRAP #15 Ask "OS" to perform the task
STOP #$2700 Stop execution
* Data section
R DS.W 1 int R;
END START
Easy68K gives you a hint about what the problem is when you try to run the program: "Address Error: Instruction at 1006 accessing address f22c4663".
These lines:
MOVE $374D1FC4,D2 [D0] <- $374D1FC4
MOVE $F22C4663,D3 [D1] <- $F22C4663
should be changed to:
MOVE #$374D1FC4,D2 [D0] <- $374D1FC4
MOVE #$F22C4663,D3 [D1] <- $F22C4663
assuming that you wanted to load the immediate values $374D1FC4
and $F22C4663
.