Monitor Reference

A.C. Wright 6502 BIOS
Monitor v1.1 · BIOS v1.5
Getting in and out
Three ways in. ESC at the boot splash; the BRK statement in BASIC; any BRK opcode in user code. The prompt is a single ..
One way out. Type X. BASIC comes back warm — your program and variables are still there.
EntryAddressUsed by
MonitorEntry$EE00Cold entry from the boot menu, or X back from BASIC
MonitorBrkEntry$EE03BRK entry with the register display
Every command
CmdSyntaxWhat it does
XXExit to BASIC
RRDisplay CPU registers
MM [addr] [addr]Memory dump (hex + ASCII, 8 bytes/row) Default: 8 lines (64 bytes). Remembers position for continuation.
DD [addr] [addr]Disassemble 65C02 instructions Default: 20 lines. Remembers position for continuation.
>> ADDR XX [XX XX ...]Deposit (write) bytes to memory
FF ADDR1 ADDR2 XXFill memory range with a byte value
TT SRC_START SRC_END DESTCopy memory block (handles overlapping regions)
HH ADDR1 ADDR2 XX [XX XX ...]Search for byte pattern in memory range Prints address of each match on its own line.
CC ADDR1 ADDR2 ADDR3Compare two memory regions Compares [addr1,addr2] with block at addr3, prints differing addresses.
GG [addr]Go (JMP to address with full register restore via RTI) If addr given, sets BRK_PCL/PCH. Restores A, X, Y, P, SP via RTI. Program runs until BRK returns to monitor or forever.
JJ [addr]Call subroutine and return to monitor on RTS Pushes monitor return address, restores A/X/Y, JMPs to target. When target does RTS, saves registers and re-enters monitor.
;; PC xxxx A xx X xx Y xx SP xx P xxModify saved CPU registers Any subset, any order. Labels: PC, A, X, Y, SP, P
LL ["FILE"] [ADDR]Load from CF (with quoted filename) or XModem (without) CF path: L "FILENAME" [ADDR] — load file to addr (default $0800) Serial path: L [ADDR] — receive via XModem to addr (default $0800)
SS ["FILE"] ADDR1 ADDR2Save to CF (with quoted filename) or XModem (without) CF path: S "FILENAME" ADDR1 ADDR2 — save [addr1,addr2) to file Serial path: S ADDR1 ADDR2 — send [addr1,addr2) via XModem
@@Display CF directory listing
NN $XXXX | +DDDDD | %BBBBNumber base conversion Output: $XXXX +DDDDD %BBBBBBBBBBBBBBBB
## [NN]Select / report the current CF disk bank
Reading the register line
PC=E9D3 A=00 X=FF Y=68 SP=FA NV-BDIZC
The flag legend printed above the P byte by R and the BRK entry. A flag letter shown means the bit is set; a dash means it is clear. ; writes the same fields back.
Numbers
Addresses are typed as bare hex — M 0800, not M $0800. The N command is the exception and wants a prefix: $ hex, + decimal, % binary. It answers in all three.
. N $FF00 $FF00 +65280 %1111111100000000
Go versus Jump
Use J. J FF00 calls the code at an address and comes back to the monitor when it hits RTS. G hands the machine over for good — and it turns interrupts off on the way, so anything that waits for a keypress will sit there for ever.
The Wozmon easter egg. J FF00 from here, or SYS 65280 from BASIC, lands you in a copy of the original Apple I monitor. Its prompt is a backslash. FF00.FF07 reads eight bytes; 0800: A9 41 writes two.
The messages it prints
MessageWhen
6502 MONITOR v1.1On the way in, whichever route you came by
BRK AT $A BRK was hit — the address that follows is where
FILE NOT FOUNDL "NAME" and there is no such file on the current disk
DIRECTORY FULLS "NAME" on a disk that already holds sixteen files
LOADEDA load finished — the byte count and address follow
SAVEDA save finished
BYTES AT $Tail of the load and save reports
BYTESTail of a report that has no address to give
I/O ERRORThe CompactFlash card did not answer