[Coco] Creating and loading big machine code files into RSDOS

William Astle lost at l-w.ca
Mon Feb 13 23:39:13 EST 2017

On 2017-02-13 08:04 PM, Mark McDougall wrote:
> On 14/02/2017 1:44 PM, William Astle wrote:
>> You really do want to avoid loading over Extended Basic. Depending how
>> far over it you go, it will crash. If you're careful, you can get away
>> with a small amount of overlap but it gets fiddly doing that.
> You also need to be careful which pages you load into even outside the
> (currently mapped) 64KB address space whilst BASIC is still running. I
> found I couldn't use pages $34-35, for example, as simply returning to
> BASIC to execute the program corrupted a few bytes on those pages.
> Regards,

It is true that you do need to be a bit careful. In particular:

Block $34 is used for the HGET/HPUT buffers and isn't messed with except 
on reset or by HBUFF, HGET, and HPUT. Part of it is clobbered during the 
hardware RESET (or cold start) handler. It's unfortunate they did that 
since it means that HGET/HPUT buffers cannot survive RESET (even if you 
intercept the RESET vector at $72). These are NOT touched by simply 
returning to the OK prompt.

Block $35 is used for stack space during the H* graphics commands. This 
one won't be modified unless you're doing H* graphics commands. It is 
definitely not touched by simply returning to the OK prompt.

Block $36 is the high res text screen memory. It will only be clobbered 
if you're using the 40/80 column screen.

Other than the above, there is no mechanism in the ROM that would cause 
either of blocks $34 or $35 to be modified so they should stay exactly 
as you put them. Unless you end up leaving them mapped in the logical 
address space and the stack or something other runtime data structure 
runs into them.

More information about the Coco mailing list