[Coco] Color BASIC BREAK CHECK RAM hook ($17c)

Allen Huffman alsplace at pobox.com
Sat Jun 18 20:34:49 EDT 2022


Continuing … a simple test program on JSR and using LEAS $02,S to skip back.

* lwasm jsrtest.asm -fbasic -ojsrtest.bas --map

    org $3f00

init
    ldx #startmsg
    jsr print

    jsr breakcheck

    ldx #endmsg
    jsr print
    rts

breakcheck jsr newcode
    ldx #breakmsg
    jsr print
    rts

newcode ldx #newcodemsg
    bsr print
    leas $02,s  **HERE***
    rts

print lda ,x+
    beq printdone
    jsr [$a002]
    bra print
printdone
    rts

startmsg fcc "START"
    fcb 13,0

breakmsg fcc "BREAK CHECK"
    fcb 13,0

newcodemsg fcc "NEW CODE"
    fcb 13,0

endmsg fcc "END"
    fcb 13,0


If I start with the LEAS $02,S commented out, it runs like the BASIC ROMs do with the RAM hooks:

START
NEW CODE
BREAK CHECK
END

If I have the LEAS $02, S in NEWCODE, I see what I am trying to get:

START
NEW CODE
END


But in my “new code” using the RAM Hook, I see it execute mine, and I do the LEAS $02,S, and it still returns to complete the BREAK CHECK code.

I don’t see anything else getting put on the stack — just a few instructions from there to here — but maybe it’s there and I just don’t see it.

		— Allen





More information about the Coco mailing list