Design goals

This emulator is designed for people who just want to get stuck into learning assembly language programming without the hassle of installing software. Simple text and graphics screen emulation is included because seeing an immediate result of ones work as pictures is much more rewarding than letters and figures.

The 6809 was chosen because it's simple enough to be easy to learn, but not so primitive that the programmer is continually bogged down with trivial implementation problems rather than the logic of the task in hand. The emulation is not intended to mimic any one machine, but text and graphics are similar to the Dragon 32 and Tandy CoCo micros, making it easy to move on to full emulators for those particular machines when ready.

Screen layout

Machine state

The panel at the top left shows the state of the 6809 CPU registers, plus some control buttons.

Registers are labelled in blue. Numbers are all hexadecimal, except for the CC which is binary (A and B also have a handy binary readout below). You can change the registers interactively. The CC can have its bits toggled by clicking on them. To change the other registers, just click on a digit then type the new value; the cursor will move right so you can keep typing until you reach the end of the register, or click the cursor to finish editing.

Below the registers are the interrupt buttons; click one to send an interrupt to the CPU. Leave them alone at first, except perhaps for RESET which reboots the CPU without clearing RAM.

The slider controls the speed of the emulation. Minimum is one instruction per second, maximum roughly half a million (it's not supposed to be a cycle-perfect emulation). Refreshing the machine state takes up most of the work for your real computer. For higher speeds you'll probably want to uncheck the Refresh box; now the register, disassembly, and watch displays will only refresh when the CPU halts.

The buttons at the bottom simply Run, Halt and Step (one instruction per click) the CPU emulation.

Disassembly

The disassembly table is a window on memory viewed as a machine language program. The left column is the memory address (in hex), the next column lists the bytes (up to 5) of the machine code instruction, the third column is the human-readable mnemonic form of the instruction.

The next instruction due to be executed is highlighted in green; click on a line to select it (notice how the value of PC changes to match). Breakpoints are shown with the address highlighted in red; right-click to set and reset them. When the CPU reaches a breakpoint it stops here without executing the instruction.

You can edit an instruction in situ by right-clicking and re-typing. But make sure you know exactly what you're doing.

Labels

Once you've assembled a program its code labels will be available in this list. Click on a label to set the origin of the Disassembly window.

Assembly language input

This is where you enter and edit your assembly language program. By default this will be a simple 'Hello World' program; simply click the Assemble button, then click Run in the Machine State panel to see what it does. More sample programs are available on the Examples menu. Or Click the Clear button and copy/paste from an external editor.

This assembler is designed to be compatible with most common 6809 formats, as well as adding features of its own (more on assembler syntax). Beware that it is buggy and it's advisable not to attempt anything too complex with it.

Memory watch windows

A watch window shows 16 bytes of any area of RAM (with start address in steps of 16) in hex values. Use the buttons to open a new one beginning at the value of the X register, or at the last effective address used for reading or writing (this includes the stack). Click the cross to close a window. New values in the RAM can be set using the values of the A and B registers, by left and right clicking respectively.

Text screen

The text screen is a memory-mapped display of the contents of 512 bytes of RAM beginning at address $0400. One byte represents one character. Values of 64..95 are the corresponding ASCII characters; 96..127 are ASCII characters 32..63. Values of 0..63 mirror those of 64+ but in inverse video.

Columns and rows are zero-based with (0, 0) at the (left, top). Addresses increase left to right, then top to bottom, for a 32 wide and 16 high display. So column 7, row 3 is at address $400+(3*32)+(7).

Graphics screen

The graphics screen is a memory-mapped display of 6144 bytes of RAM beginning at address $0600. There are 3 graphics colour modes, in which either 1, 2, or 4 bits represent a single pixel in 2, 4, or 16 colours respectively. Addresses increase left to right, top to bottom as for the text screen.

Columns and rows are zero-base with (0, 0) at the (left, top). Sequences of bits (1, 2, or 4) from high to low represent pixels from left to right. The 2 colour mode has 256 pixels by 192, the 4 colour 128 by 192, each line being 32 bytes. The 16 colour mode has 128 pixels by 96, each line being 64 bytes.

Example: in 4 colour (2 bit) mode pixel (93, 38) would be in byte $0600+(38*32)+trunc (93/4), because there are 4 pixels in a byte. The colour value (0..3) would be stored in bits 5 & 4, ie. shifted left ((4-1)*2)-((93 mod 4)*2 times).

Keyboard input

Click the text screen panel then start typing for the emulator to receive keyboard input. Remember that (due to limitations of the emulated hardware) when lower case characters are printed to the screen they will appear in inverse video.