Download the assembly program clab52s.s:
* clab52s.s
ORG $0
DC.L $8000 Stack pointer value after a reset
DC.L START Program counter value after a reset
ORG $2000 Start at location 2000 Hex
START CLR.W SUM Clear variable SUM
MOVE.W COUNT,D0 Load COUNT value
LOOP ADD.W D0,SUM ADD D0 to SUM
SUB.W #1,D0 Decrement counter
BNE LOOP Loop if counter not zero
MOVE.W SUM,D7 copy sum to D7
BREAK Tell the simulator to BREAK if we're running
SUM DS.W 1 Reserve one word for SUM
COUNT DC.W 25 Initial value for COUNT
This file contains a mixture of assembly language code and assembler directives. The assembly language is standard Motorola 68000, as described in Motorola documentation and in the text (Clements, Chapter 2). Assembler directives and syntax vary from assembler to assembler, and the ones used here are similar to the textbook (Clements, pp 15).
Exercises:
ANU Engineering - ENGN3213