[Coco] Color BASIC BREAK CHECK RAM hook ($17c)
Arthur Flexser
flexser at fiu.edu
Fri Jun 17 01:00:45 EDT 2022
Did you change RVEC from $167 to the break key hook? Your listing shows it
as $167 still.
Art
On Thu, Jun 16, 2022 at 11:20 AM Allen Huffman via Coco <
coco at maltedmedia.com> wrote:
> Hi, 6809 ROM folks… I started looking at the RAM hooks in Color BASIC to
> see what they did. I wrote a simple program that hijacks the CONSOLE OUT
> hook so it jumps to my routine, then returns to handle the normal stuff. I
> will be posting an article about this soon.
>
> consoleout.asm:
> ————
> * lwasm consout.asm -fbasic -oconsout.bas --map
>
> RVEC equ $167 console out RAM hook
>
> org $3f00
>
> init
> lda RVEC get op code
> sta savedrvec save it
> ldx RVEC+1 get address
> stx savedrvec save it
>
> lda #$7e op code for JMP
> sta RVEC store it in RAM hook
> ldx #newcode address of newcodee
> stx RVEC+1 store it in RAM hook
>
> rts done
>
> newcode
> inc $400 inc top left byte of 32-col screen
> savedrvec rmb 3 3 bytes to save original RVEC entry
>
>
> I then looked at the BREAK CHECK hook. It is similar, but it processes the
> break check after calling the RAM hooks. I thought it would be easy to make
> it skip that check by doing something like Disk BASIC does when if it
> doesn’t want to break (disk file I/O). It manipulates the stack pointer so
> when it returns, it returns to the original jsr caller and does not finish
> the rest of the Color BASIC code:
>
> Disk BASIC RAM hook code:
> ————
> * BREAK CHECK RAM HOOK
> DEVC11 TST DEVNUM
> BLE LC8AF * IF NOT A DISK FILE
> LEAS $02,S * PURGE RETURN ADDRESS OFF THE STACK
> LC8AF RTS
>
> In my code, I save whatever RAM hook is there, then point it to my new
> code. For the break check, I call the saved vector routine first, and then
> do this stack trick. It still ends up running the code, so I don’t quite
> grasp what I am doing with the stack.
>
> Any clue what I should be looking at?
>
> nobreak.asm
> ————
> * lwasm consout.asm -fbasic -oconsout.bas --map
>
> RVEC equ $167 console out RAM hook
>
> org $3f00
>
> init
> lda RVEC get op code
> sta savedrvec save it
> ldx RVEC+1 get address
> stx savedrvec save it
>
> lda #$7e op code for JMP
> sta RVEC store it in RAM hook
> ldx #newcode address of newcodee
> stx RVEC+1 store it in RAM hook
>
> rts done
>
> newcode
> inc $400 inc top left byte of 32-col screen
> savedrvec rmb 3 3 bytes to save original RVEC entry
>
> Thanks, much. I sure wish I had these Unravelled books back then.
>
> --
> Allen Huffman - PO Box 7634 - Urbandale IA 50323 - 515-999-0227 (vmail/TXT
> only)
> http://www.subethasoftware.com - https://www.facebook.com/subethasoftware
> http://www.PayPal.me/AllenHuffman.
> http://swagbucks.com/refer/allenhuffman
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> https://pairlist5.pair.net/mailman/listinfo/coco
>
More information about the Coco
mailing list