[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Some questions
In article <1992Nov1.223132.28343@galileo.cc.rochester.edu> mh001b@uhura.cc.rochester.edu (Matthew W. Hacker) writes:
> Ok, here are some more questions:
>
> 1) I still don't know how the GS figures out how much memory
> is installed. Anybody?
I've managed to track down the routine that determines the size of the
IIgs's memory. In a ROM 03, it is at location $FC/0305. In a ROM 01,
it is at $FF/$02FC. The code in this routine is identical for both
ROMs.
As I expected, it is called during the first MMBootInit call after a
cold start. On Control-Apple-Reset, or power up, the reset code calls
TLBootInit, which calls MMBootInit and the other BootInit calls.
There is a flag which is set after the first call has been made, so
this routine won't be called again until the computer is turned off,
the RAM disk is resized (Resize after Reset option - ROM 03 only), or
the self test is invoked.
It uses a temporary pointer on the memory manager's direct page,
which is reserved from the stack in the usual manner by a routine that
is called earlier in MMBootInit.
This routine is only called on a cold start (i.e. power up, or after
a self-test).
The memory size routine writes a two byte value to locations $0000 and
$0001 in every bank, starting at bank $7F and working down to $02. The
value written starts at $FF80 and climbs to $FFFD as the bank decreases.
Note that the sum of the number written and the bank number is always
$FFFF.
After writing all these values, the memory manager scans through them
again, starting at the top and working down, until it finds an entry
that has the correct value. It uses this as the 'highest valid bank
number', which is stored in a couple of places in bank $E1 for future
reference.
Note that the 'echo' effect I mentioned in earlier messages is taken
care of, because if there was an echo, the last value written to the
RAM would be the number of the LOWER bank, and the higher bank's
number wouldn't match.
For example, if a 1 megabyte card was installed in a ROM 01, the value
written to $12/0000 would be $FFED, and the value written to $02/0000
would be $FFFD. When reading back from $12/0000, the memory manager
would see $FFFD (because of the memory echo) and would not regard bank
$12 as a valid part of memory.
The problem with certain memory cards not supporting three rows of RAM
chips arises because they leave 'holes' in the IIgs memory map - once
the memory manager finds something that looks like valid RAM, it assumes
everything below that point is available.
--
David Empson
Internet: David.Empson@bbs.actrix.gen.nz EMPSON_D@kosmos.wcc.govt.nz
Snail mail: P.O. Box 27-103, Wellington, New Zealand