Next: , Previous: , Up: Debugging   [Contents][Index]


5.5 Single Stepping the CPU

To execute a single instruction use the command step. This will execute the instruction pointed to by the current value of the program counter register.

In the example of Figure 5.3, prior to the step command the program counter is pointing the instruction at address 0x1703 which is a ‘tfr’ instruction. This causes the contents of register Y to be copied into register D6. In addition, program counter will be advanced to the next instruction. The new contents of the registers can be seen in the second call to read-all-regs.

> disassemble 0x1700 0x24
00001700 <.data>:
    1700:       bc 06 cc        clr.b 1740
    1703:       9e 96           tfr y, d6
    1705:       5e 00 ff ff     and d6, #16777208
    1709:       f8
    170a:       9e 90           tfr y, d2
    170c:       58 00 07        and d2, #7
    170f:       dd b8           neg.w d2
    1711:       9e 01           tfr d2, d3
    1713:       9e 69           tfr d6, y
    1715:       0b 11 80 0b     tbeq d3, *+11
    1719:       1c 99 89        mov.b (d3,y), (d3,x)
    171c:       31              inc d3
    171d:       20 ff f8        bra *-8
    1720:       08 88           lea x, (d2,x)
    1722:       67 be           add d7, d6
> read-all-regs
 D0: 00
 D1: 00
 D2: FFFF
 D3: 0000
 D4: 0000
 D5: 0000
 D6: 00A8207E
 D7: 00000000
  X: 000000
  Y: FE0091
 SP: 003000
 PC: 001703
CCW: u----000SX-Inzvc
> step
> read-all-regs
 D0: 00
 D1: 00
 D2: FFFF
 D3: 0000
 D4: 0000
 D5: 0000
 D6: 00FE0091
 D7: 00000000
  X: 000000
  Y: FE0091
 SP: 003000
 PC: 001705
CCW: u----000SX-Inzvc

Figure 5.3: Using the step command to execute an instruction. This instruction causes the PC and D6 register be updated.


Next: , Previous: , Up: Debugging   [Contents][Index]