The Acorn 6502 Microcomputer Kit Emulator Mini-Debugger
Introduction

More pictures

Timeline & people

Documentation

Firmware

Schematics

Specifications

Emulator Overview
Using the Monitor
Emulator Menus
Mini-Debugger

The Emulator includes a mini-debugger. This is a simple debug aid whose display is shown at the bottom of the window once Debug has been checked in the View menu selection.

When the processor is halted, the mini-debugger lets you inspect the state of the 6502 processor, view and modify memory, single-step, set the Program Counter and run, and set ‘hard’ breakpoints.

When the processor is running, the debugger does not attempt to show state which may be changing too rapidly to see, but does continue to show the static settings.

When halted, the mini-debugger display contains two lines of information, which might look like this:

PC:fe32 A:d1 X:04 Y:3e N-1BDI-C SP:fd
 M:fe00.a0 G:0000 P:0000 F:fe30

In this display, the top line shows the contents of the 6502 processor registers in the order: Program Counter, A, X, Y, P (status), Stack Pointer. Each is shown in hexadecimal except for the P register; for the P register each status bit is shown as a separate character (with ‘-’ indicating the bit is 0). The eight bits are:

NNegative DDecimal mode
VOverflow IIRQ interrupt mask
1[Reserved, always 1] ZZero
BBRK executed CCarry

The second line of the display shows the mini-debugger addresses and status. These are controlled by debugger commands which are used in the same way as the Acorn Monitor commands; when the emulator is halted, hexadecimal and command keystrokes (or button clicks) are handled by the debugger rather than by the Acorn Monitor (which, being halted, could not process them).

The debugger commands act as follows:

m Modify. The modify address is shown after the M:. When the m key is pressed it is highlighted in red (as shown in the example above) to indicate that the address can be altered. The address can then be changed either by typing in hexadecimal characters or by using the up/down cursor keys (or ^, v, or Enter), just as when using the Acorn monitor.

As the modify address is changed, the byte at that address is displayed after the dot. This byte is displayed whenever the processor is halted.

To change the byte at the modify address, press m again; now the data byte is shown in red and (if it is a writeable address) it can be changed by typing in hexadecimal digits.

While data is being modified, the modify address may be incremented or decremented using the up/down keys, as before. Pressing m or another command letter leaves the modify data state.

g Go. Again, this is used just as in the Acorn monitor. The go address is shown after the G:, and when g is pressed, it is highlighted in red and can be altered by typing in hexadecimal characters. Pressing g a second time starts the processor running from the entered address. Pressing any other command key carries out the new command instead of branching to the go address.
p Sets a point address (hard breakpoint). The point address is shown after the P:, and when p is pressed, it is highlighted in red and can be altered by typing in hexadecimal characters. When the processor is next started (by using the Go or Run commands or using the Run or Reset menu options, etc.) it will be halted automatically when the instruction at the point address is about to be executed.

The point address will not cause the processor to halt unless the mini-debugger is displayed.

r Run. The processor is started, running from the current Program Counter address.
step Pressing the Space bar causes the Emulator to run for a single instruction; it is then halted and the 6502 registers, etc. are redisplayed.
s Save to file. This lets you select a range of addresses to be saved to a file (the same as selecting Save As in the File menu).
l Load from file. This lets you load data from a file (the same as selecting Load in the File menu).

The fourth field on the second line of the mini-debugger display shows the from address (if there is one). This the address of the last executed instruction, and is shown after the F:. It cannot be altered by a command, but is useful when the processor halts after a branch to a location with an invalid opcode; the from address then shows where the processor branched from.

Note that the debugger modify, go, and point addresses are independent of the similar Acorn Monitor addresses (which are held in the emulated RAM). The debugger addresses are saved from session to session in the as1.ini file.


Photographs and HTML text © Mike Cowlishaw 2001, 2002.