[Coco] 64K Coco mode and the MC6883

Sean Conner sean at conman.org
Tue Mar 28 15:46:40 EDT 2023


It was thus said that the Great Dave Philipsen via Coco once stated:
> So I'm not really familiar with using VARPTR because I don't program 
> much in BASIC. But from what is being stated here and on the Sub-Etha 
> site, VARPTR(P$) is actually a pointer that points to a string 
> descriptor, not the string itself. So if indeed the 3rd and 4th bytes of 
> that descriptor are actually the real starting address of the string, 
> P=VARPTR(P$)+2 : EXEC P will not work. EXEC P will transfer program 
> execution to the 3rd and 4th byte of the descriptor. These two bytes 
> contain an address, they don't contain executable code. Thus, this is 
> why the original instruction was to set P=VARPTR(P$)+1 : POKE P, 126 : 
> EXEC P. Now you are executing code which is the JMP instruction followed 
> by its operand which is the start address of the string.
> 
> Just thinking out loud here. I haven't tested this but that's the way 
> I'm seeing it.

  That's it exactly.  

  Some of the details of BASIC programming on the Coco have escaped me (it's
been 33 years since I did any), and I'm leary of just poking the code
randomly into memory, so when I saw the method of using a string to store
the code, it seemed like a perfectly good way of doing this for a one-off
type of operation.  I would not do this for a longer running program.

  -spc


More information about the Coco mailing list