C'mon, the Compact monitor, is a very small monitor program for the 65org16. You must supply the following routines:
Both routines should preserve the Y register and the D flag. OUTPUT should also preserve the accumulator. The OUTCR routine outputs a CR and an LF; modify it if your system uses a different sequence. The (case-insensitive) commands are:
croutput a CRLF (and a dash prompt)
0-9A-Faccumulate hex digit
,store 16-bit "byte" at address, increment address
Ggo (call routine)
Xhex/ASCII dump 128 16-bit "bytes"
All other characters are ignored (thus you can use spaces freely). Leading zeros can be omitted. Note that commands execute immediately, i.e. you will get a memory dump when you press X not when you press Enter.
Any routines you call with the G command should return with the D flag clear (they will be called with the D flag clear).
12345678 Xdump 128 bytes starting at address $12345678
12345678 Gcall the routine at address $12345678
AAAAAAAA @ 1111,2222,3333,store $1111, $2222, and $3333 at address $AAAAAAAA
To install the single step "plug-in" for C'mon, simply cut and paste the three sections of source code at the appropriate place in C'mon.
To single step, use the @ command to set the address, then use the $ (single step) command to single step that instruction. Use $ again to single step the next instruction. After each single step, the program counter (of the next instruction) and the A, S, X, Y, P (in hex), and P (again, but in binary) registers will be output.
If you set the break vector to BREAK, it will save the registers and set the address so that the next instruction (after the signature byte) can be single stepped. Example:
ORG $2000 CLC LDA #$1234 ADC #$5678 BRK .byte $0000 ; signature byte (its value is ignored) EOR #$ABCD
2000G can be used to execute up to the ADC instruction. A subsequent $ command will begin single stepping at the EOR instruction.
Since it isn't always convenient to use BRK, it is also possible to use JSR BRKPT instead of BRK (and its signature byte). Everything about the preceding example would be the same, except that the code would be:
ORG $2000 CLC LDA #$1234 ADC #$5678 JSR BRKPT EOR #$ABCD