[Coco] Intercepting commands like POKE?

William Astle lost at l-w.ca
Thu Jan 4 17:02:20 EST 2024


On 2024-01-04 14:26, Ciaran Anscomb via Coco wrote:
> So [$0123] (in stub 0) points to the dispatch table - in cb 1.3 that's
> $AB67.  There are 36 dispatch addresses, so 72 bytes - copy them somewhere
> and adjust $0123 to point there instead and I guess you can then intercept
> what you want?  PRINT is the 8th entry, POKE is the 19th.
> 
> I mean I've not tried any of this, but it should work.  In theory $120
> is supposed to hold the number of tokens in the dispatch table, but the
> value there seems way too high.  Maybe Dragon BASIC does this a little
> differently...

It holds the number of keywords in the keyword table. There are a number 
of keywords that get tokenized but which aren't commands that can be 
executed (operators, syntactic keywords like THEN or OFF). The 
interpretation loop checks for that and doesn't try to look up anything 
above "SKIPF" in that table.

Command dispatch is a bit odd in Color Basic. The jump table for Color 
Basic is stored in the COMVEC RAM area. However, for Extended Basic and 
Disk Basic, the address is a handler routine instead.

Basically, replacing the jump table only works for Color Basic commands 
(which POKE and PRINT are).



More information about the Coco mailing list