Source code

Description

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:

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).

Examples

Single step "plug-in"

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