[Coco] Color BASIC BREAK CHECK RAM hook ($17c)
Walter ZAMBOTTI
zambotti at iinet.net.au
Sun Jun 19 20:32:49 EDT 2022
Allen
sounds technical.
You could have provided a short explanation of what the console out hook
is or what it does.
I assume console means display so this is where the the bits finally hit
the video ram memory and are displayed on screen?!?!?
Walter
On 16/6/22 23:20, Allen Huffman via Coco 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
>
More information about the Coco
mailing list