[Coco] Coco3 warm start...
William Astle
lost at l-w.ca
Fri Nov 16 19:19:23 EST 2007
Robert Gault wrote:
> The first code a Coco3 will run after a reset is at $8C1B. That will
> force 32k internal ROM mode and jump to $C000. That is the Coco3
> initialization routine not the Disk ROM. That code runs until $C0C7
> (actually at $4088) where tests are made for cold or warm start.
>
> The first test is
> lda $feed
> cmpa #$55
> which will pass if there is no "run away code" and you just pushed the
> Reset button. The second test at $C0CE (actually at $408F) is
> lda $71
> cmpa #$55
> which will also pass if the MMU blocks have not been swapped around. The
> third test at $C0E7 (actually $4095) is
> ldx $72
> lda ,x
> cmpa #$12 or NOP
> which will also pass if the MMU blocks have not been changed. The fourth
> test at $C0F1 (actually $409F) is
> clr $ffa0
> lda $71
> cmpa #$55
> which will fail unless OS-9 is running or some program that uses MMU
> block-0 and sets the reset flag.
>
> Now the default MMU block $38 is restored, ROM copied to RAM, memory is
> left in RAM mode, and the code jumps to the normal reset vector at $72.
> The code has not yet seen the Extended Basic patch which "is set to have
> $FF at the reset point rather than $12".
>
> If you want, I can send you a trace (generated in MESS) of the code that
> gets run starting at $8C1B.
That's not necessary. When I said "disk basic is not present", I meant
that in 32K internal ROM mode, it doesn't see the disk ROM so it's not
relevent whether the vector address at $72 is valid or not since it's
pointing to an address in RAM or external ROM. My point was that
regardless whether disk basic is present in the system or not, the first
test is going to fail, either because the extended basic reset vector is
disabled in ROM or because the Disk basic code is not present because of
32K internal ROM mode. Which means ROM gets copied to RAM on a regular
reset when just using basic. And that, of course, leaves the system in
RAM mode.
Basically, what I have come to understand is that there are three
different tests made for warm/cold start as follows:
1. *in 32K internal ROM mode*, test the reset vector in block $38 and if
it succeeds, go on to step 3b (in ROM mode); this test will *always*
fail with vectors as set up by Extended Basic *or* Disk Basic.
2. *still in 32K internal ROM mode* the above fails, check the vectors
in block 0 and if valid, leave block 0 in place and go on to step 3b,
and leave ROM mode enabled
2.5 copy ROM to RAM and install the basic patches and go on to 3a.
3a. *in RAM mode* test the reset vectors for color basic and if valid,
turn control over to them, otherwise do a cold start. Even though step 1
above will have failed if we're here, the vectors may test as valid now
that we are in RAM mode.
3b. *in ROM mode* test the reset vectors in color basic and if valid
turn control over to them; this test should always succeed since we
don't get here unless it succeeded before. Note that this will leave the
system in 32K internal ROM mode.
(The code executed in 3a and 3b is identical except one is a copy in RAM
while the other is the original in ROM.)
Note that the init code at $C000 in the internal ROM sets the MMU
registers so it is known that block $38 will be at $0000 when the test
in "1" above is made.
--
William Astle
lost at l-w.ca
More information about the Coco
mailing list