We now enter a short piece of code into memory by hand, set up the machine for running the code, and run the code.
Open the memory viewer:
Window Memory Viewersee Figure 44.
By default, the memory viewer shows memory locations begining at $0000. We will enter the following code, begining at memory location $2000:
00002000 303C 2468 move.w #$2468,d0 00002004 31C0 1FF0 move.w d0,$1ff0 00002008 4848 BREAKTo do this:
View From AddressEnter 2000
002000: 30 3c 24 68 31 c0 1f f0 48 48 00 00 00 00 00 00 002010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Before running the code, set the program counter to $2000 by clicking on it and entering the value $2000
Run the code by clicking the RUN button. You will notice that register D0 now contains the data $2468. Check that this data appears in memory (use the up arrow button).
Set PC to $2000, and run the code again using the SINGLE STEP button. Notice the instructions appear in the trace window and are reverse assembled, i.e. the simulator interprets the machine code and tells you the assembly code.
Exercises:
move.w #$2468,d0 addq.w #1,d0 BREAK
ANU Engineering - ENGN3213