I'm trying to write the M68K ASM for the following piece of java code :
And have come up with :
Is this correct, and does anyone know of a better approach ?
Code:
((a + b) + (c + d)) + ((e + f) + (g + h))
And have come up with :
Code:
ORG $2000
A DC.L $DEADBEEF
B DC.L $DEADBEEF
C DC.L $DEADBEEF
D DC.L $DEADBEEF
E DC.L $DEADBEEF
F DC.L $DEADBEEF
G DC.L $DEADBEEF
H DC.L $DEADBEEF
PART1 DC.L 0
PART2 DC.L 0
PART3 DC.L 0
PART4 DC.L 0
ORG $400
MOVE.L A,D0
MOVE.L B,D1
ADD.L D0,D1
MOVE.L D0,PART1
MOVE.L C,D0
MOVE.L D,D1
ADD.L D0,D1
MOVE.L D0,PART2
MOVE.L E,D0
MOVE.L F,D1
ADD.L D0,D1
MOVE.L D0,PART3
MOVE.L G,D0
MOVE.L H,D1
ADD.L D0,D1
MOVE.L D0,PART4
MOVE.L PART1,D0
MOVE.L PART2,D1
MOVE.L PART3,D2
MOVE.L PART4,D3
ADD.L D0,D1
ADD.L D0,D2
ADD.L D0,D3
END
Is this correct, and does anyone know of a better approach ?