[Coco] CoCo 128-column text mode
William Astle
lost at l-w.ca
Wed Jan 7 23:10:34 EST 2015
On 15-01-07 05:12 PM, Allen Huffman wrote:
> I did not realize reset copied ROM->RAM each time. Does that mean that items I had that kept working were patching in to the reset-vector to re-run? (I’m thinking things like POKEs for 6ms step rate and the like.)
Yeah. I think the theory behind it is if something goes rogue and
scribbles all over the "ROM", RESET will be often be able to recover
without doing a cold start if the ROMs are recopied.
The ROM/RAM copy can be inhibited by installing a RESET vector handler
that lives in somewhere between $0000 and $3FFF, or $6000-$7FFF. That
handler would need to switch to RAM mode, and then transfer control to
the original reset vector.
What happens is the boot firmware in the coco3 (located in the internal
ROM from $C000 to $DFFF) examines RSTFLG ($71) and RSTVEC ($72). If they
appear valid (same rules as the usual Color Basic ROM check), the
ROM/RAM copy is skipped. Now, because this check is done while the
system is in 32K internal ROM mode, any reset vector installed by Disk
Basic won't be valid (not present in memory at the time). If Disk Basic
isn't installed, the internal Extended Basic ROM has "NOP" instruction
at the start of the RESET hander set to $FF instead. (One of the
"patches" changes that to a "NOP").
Once it finishes the ROM/RAM copy, it goes ahead and transfers control
to the "Color Basic" initialization code with the machine in RAM mode.
(If there was a valid RESET vector, it does the same but with the
machine in 32K internal ROM mode). Then the old boot process begins with
some hardware initialization and then a check for a valid RESET vector,
which will now be valid (either DECB copied to RAM or the Extended Basic
routine now starting with NOP) so the warm start process happens.
In case you're wondering why the $4000-$5FFF range is excluded as a
valid place for the RESET vector, it's because the boot firmware
occupies that space in the logical memory map while it does its stuff.
More information about the Coco
mailing list