[Coco] Superboard discussion: Serial EEPROM

William Astle lost at l-w.net
Mon Apr 26 12:11:12 EDT 2004


Boisy G. Pitre wrote:

> I'm proposing an assembly language routine that will be in unused 
> portions of the BASIC ROM.  One call will write a byte to a location, 
> another call will read a byte from a location.  I wanted to use the 
> DEFUSR/USRX calls, but in the case of writing, two parameters need to 
> be passed (the location and the byte) and I don't believe the USRX 
> calls take more than one parameter.  Anybody know?

With a little bit of clever programming, you can actually make the 
routines called by USRX parse the stuff immediately following it. You 
can do the same with EXEC. So you can do weird stuff like:

A=USR0(P1),P2,P3

This will, obviously, cause a syntax error if you don't parse the stuff 
after the ) in the USR routine. However, this syntax error is triggered 
AFTER the execution of the USR routine so you can use the "GETNCH" (JSR 
<$9F) and so on infrastructure that BASIC itself uses.

I've also used EXEC for similar tricks, for example:

EXEC&H7000:P1,P2,P3

It's all a matter of coding the routine correctly.

The really neat thing about both of these tricks is they require 
absolutely no patching in the ROM.

For the record, I got the idea about the USR0(P1),P2,P3,P4... thing from 
a program in an old Rainbow that added a "command" for doing sprites, or 
something like that. (That one hooked the command interpretation 
routines so the listing would read ANIM rather than USR0 but it 
basically was a USR routine IIRC).




More information about the Coco mailing list