* Assemble - Assembles (compiles) the source code in the text box into
6502 object code at address $0600. Also performs a Reset. Any error
messages appear in the info box at the bottom of the page.
* Run/Stop - Runs (executes) or stops execution of the 6502 code. This
button will be disabled when unassembled code exists in the text box
(for example, if you add code, or if the code doesn't assemble correctly).
Code stops executing when a BRK instruction is hit (which is the default
instruction following your assembled code).
* Reset - Rests registers, sets the PC to $0600, and clears the zero page,
stack, and displays.
* Hexdump - Displays memory contents from $0600 to the end of the assembled
code, in hexadecimal format.
* Disasseble - Display a hexdump plus a disassembly of the memory contents
from $0600 to the end of the assembled code. Note: if the disassembled
code does not match your source code after a Run, then your code has
probably overwritten memory page $06 (and later) -- which is easy to do
since this page immediately follows the bitmapped display.
* Notes - Displays this information text in the info box at the bottom
of the page.
* Speed - Sets the speed of execution in instructions per display frame.
Set to the left, the speed will be approximately 1% of a 1MHz 6502; on the
right, it will be about 100% (or just over).
* Save - Downloads the source code in the text box to your local machine.
This is an easy way to make backup copies of evolving code, or to place
the code in a file under version control.
* Load - Loads the specified file from the local machine into the text box.
This is an alternative to cutting and pasting code into the emulator.
* Monitor - Displays the memory region starting at "Start" and running
for "Length" bytes.
* Text screen - Enables and disables the text display (on the right hand
* Debugger - Turns on single-stepping controls.
* Step - Executes a single instruction.
* Jump to... - Jumps to the specified address or label.
All 64K ($0000-$ffff) is populated with RAM and available. This is the
system memory map:
Page $00: 6502 zero page, used for variables and pointers
Two locations in the zero page are connected to devices:
* Memory location $fe contains a new random byte on every read.
* Memory location $ff contains the ascii code of the last key pressed.
Values written to $ff will remain unchanged until next key press.
Printable keys have their ASCII value; BackSpace is $08; Enter is $0d;
Cursor controls are $80=up, $81=right, $82=down, $83=left
Page $01: 6502 stack (downward)
Pages $02-05: bitmapped display
Pages $06-$ef: your code and data
Pages $f0-$f7: character display
Pages $f8-$fd: reserved for future ROM expansion
Pages $fe-$ff: ROM code (see below)
Available Assembler Directives:
dcb value[,value [...]] - (define constant byte) used to create
constants in memory. Multiple bytes are separated by commas. Values
may be in decimal, hexadecimal, or single characters in double quotes
(except spaces - use 32 or $20 to represent a space).
define macro value - defines a macro expression. value must be an
*=address - changes assembler pointer to given address
label: - defines an address label. Reference the label in your
code without the colon. Labels can be used with the "Jump To" button in the
The bitmapped display is 32x32 pixels, and memory locations $200 to
$5ff map to the screen pixels. The lowest four bits of each byte set the
colour of the corresponding pixel. The colours are:
$a: Light red
$b: Dark grey
$d: Light green
$e: Light blue
$f: Light grey
The character display is 80x25 characters in size, and memory locations
$f000-$f7cf contains the ASCII characters on the display (row-major).
Bit 7, if set, make a character appear in reverse video. Codes $21-$7e
(and corresponding codes with bit 7 set, $a1-$fe) display; all other codes
show up as blanks.
These routines are defined in ROM:
* SCINIT $ff81 - Initialize and clear the character display
* CHRIN $ffcf - Input one character from keyboard (returns A)
* CHROUT $ffdw - Outputs one character (A) to the screen at the current cursor
position. Screen will wrap/scroll appropriately. Printable characters
and cursor codes ($80/$81/$82/$83 for up/right/left/down) as well as
RETURN ($0d) are accepted. Printable ASCII codes with the high bit set
will be printed in reverse video.
* SCREEN $ffed - Returns the character screen size in the X and Y registers.
* PLOT $fff0 - gets (CARRY=1) or sets (CARRY=0) the cursor position
If C=0: X,Y registers set the cursor position
Y:X is returned as a pointer to the current screen position
If C=1: X,Y registers return the current cursor position
A contains the character at the current cursor location
To use these routines, these define directives may be pasted into your code:
; ROM routines
define SCINIT $ff81 ; initialize/clear screen
define CHRIN $ffcf ; input character from keyboard
define CHROUT $ffd2 ; output character to screen
define SCREEN $ffed ; get screen size
define PLOT $fff0 ; get/set cursor coordinates
The Speed slider controls the number of opcodes executed per display frame.
When set fully left, the emulator operates at about 1% of the speed of an
actual 6502 chip; when set rully right, the emulator operates close to
the actual speed of a 1MHz 6502 chip (depending on the code). It is
recommended that the higher speeds be used with the ROM routines.
A reference for the 6502 opcodes is available at
Another reference with flag information:
Example code which will run in this emulator:
More examples, plus the ROM source code:
Source code for this emulator: