[Coco] Color BASIC BREAK CHECK RAM hook ($17c)
Allen Huffman
alsplace at pobox.com
Sat Jun 18 20:10:32 EDT 2022
Thanks Art and Chris. Still no go...
> On Jun 18, 2022, at 3:21 PM, Christopher R. Hawks <chawks at dls.net> wrote:
>
> I have to differ, Art. If the saved vector starts with JMP, the
> code will NOT come back to the LEAS 2,s. JMP does not save a return
> address on the stack. So the code will RTS back to the code that called
> JSR $017f (and placed a return address on the stack).
>
> Allen's code needs to change the JMP to a JSR. (And do the right
> thing if DECB is missing, $17f contains an RTS.)
Color BASIC ROM:
LA549 JSR RVEC11 (HOOK INTO RAM)
LDA DEVNUM (GET DEVICE NUMBER)
INCA (CHECK FOR TAPE)
BEQ LA5A1 (RETURN IF TAPE)
…
LA5A1 RTS
First it jumps out to the 3 RAM hook bytes, which is code expected to do something and then RTS back.
Then it sees if device is not -1 (if inc devnum makes 0) and branches to an RTS if so, skipping break check.
If RVEC11 is:
JMP NEWCODE
and NEWCODE is:
NEWCODE RTS
…that would just return back and finish the break check code.
The other ROMs add checking for DLOAD (#-3), Disk Devices, etc. and then want to bypass the break check. I see that they do it like this:
DVEC11 TST DEVNUM
BLE LC85F
LEAS $02, S
LC85 RTS
If the device number is negative (? I guess ?) it pops a JSR return value off the stack, then does an RTS. This makes it return to whatever did the JSR LA549 to the Color BASIC check code, rather than returning to the check code.
That is what I was trying to do, but no luck yet.
For normal RAM hooks, I’d want to still service the regular stuff, but for this one, I don’t really need to, and it “should” just work like this:
* lwasm nobreak.asm -fbasic -onobreak.bas --map
RVEC11 equ $17f break check RAM hook
org $3f00
init
lda #$7e op code for JMP
sta RVEC11 store it in RAM hook
ldx #newcode address of new code
stx RVEC11+1 store it in RAM hook
rts done
newcode
inc $400 inc top left byte of 32-col screen
leas $02,s
rts
I thought that would be the same as what I see in the Disk BASIC ROM, just without the TST DEVNUM being in the mix.
somewhere in BASIC:
JSR LA549 *Go to a break check
…gets to...
LA549 JSR RVEC11
—> JMP NEWCODE
——> inc $400
——> leas $02,s
——> rts (should go back to the “somewhere in BASIC” JSR, yes?)
…this never executes:
LDA DEVNUM
INCA
BEQ LA5A1
…
I feel like I’m missing something very simple I just do not understand.
--
Allen Huffman - PO Box 7634 - Urbandale IA 50323 - 515-999-0227 (vmail/TXT only)
http://www.subethasoftware.com - https://www.facebook.com/subethasoftware
More information about the Coco
mailing list