[Coco] Intercepting commands like POKE?

William Astle lost at l-w.ca
Thu Jan 4 12:55:57 EST 2024


> I have a project where I’d like to intercept things like PRINT@ and POKE. Does anyone here know anything about that? I don’t even know where to begin, outside of using a 64K machine and going in to ROM-to-RAM mode and just patching BASIC.

You'll want to be looking at the "COMVEC" stuff and "RVEC20" as they're 
named in Unravelled. In particular, you'll want to look at how Extended 
Basic intercepts CLOAD and CSAVE. To really understand what's going on, 
you'll want to trace what happens in the interpretation loop at $AD9E. 
You do have to be careful with RVEC20 since both Extended Basic and Disk 
Basic 1.1 intercept it. You'll have to re-implement a part of the 
interpretation loop to intercept commands properly but you can see 
what's needed by looking at Extended Basic's RVEC20 handler. (Disk Basic 
1.1 doesn't actually add anything to the interpretation loop. It only 
does so to work around a bug in Extended Basic 1.0.)

You definitely do *NOT* want to try intercepting commands via the 
"GETNCH" ($9F) routine as suggested by others. You could do it, but you 
*really* don't want to. Doing so will slow everything down some amount 
instead of just command processing and you don't actually have the full 
context when that routine is called since it's called from all over the 
place.



More information about the Coco mailing list