[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Does anyone understand this...
gdesroch@slate.mines.colorado.edu (DESROCHERS GARY FREDERIC) writes:
> I need to know what a
>BIT $CFFF
>does. I don't need breif answers like 'It clears all I/O ROMS'
>or 'It switches out C8 ROMS.". I can get these out of the IIc rom listing
>and II plus listing that I have. What does it do?!? The best answer would
>be as technical as you can give me or where I can get the answers.
Here goes:
On an Apple // the 64k memory map is divided into 3 sections RAM, I/O and ROM.
RAM is from $0000 to $BFFF, I/O from $C000 to $CFFF, and the ROM from $D000 to
$FFFF. This ignores such complications as Aux RAM on //e & //c and Language
cards.
The I/O space is divided into the following portions:
On board I/O: $C000..$C07F 128 bytes
Slot 0 I/O: $C080..$C08F 16 bytes
Slot 1 I/O: $C090..$C09F 16 bytes
..........
Slot 7 I/O: $C0F0..$C0FF 16 bytes
Slot 1 ROM: $C100..$C1FF 256 bytes
..........
Slot 7 ROM: $C700..$C7FF 256 bytes
Expansion ROM: $C800..$CFFF 2048 bytes
----------
4096 bytes
----------
Thus, each slot (except slot 0) has allocated to it 16 bytes (usually used
for I/O devices) plus 256 bytes (usually ROM or RAM) plus 2048 bytes
(usually ROM or RAM). The only trick with this scheme is that all 7 slots
share the same 2048 byte space and so a method of selecting which slot has
this space was devised.
Rule 1: Any access to $Cnxx (n=1..7) will turn on the expansion
ROM (if any) on the card in slot n.
Rule 2: Any access to $CFFF will turn off the expansion ROMs in ALL
slots.
Rule 3: Before using an expansion ROM, save $Cn in MSLOT ($7F8).
This is so that an interrupt handler can put things back
the way they were (if for instance your serial card interrupted
while you were in the middle of the 80 column card firmware).
This means that before the code in the Slot ROM can jump to the code in the
expansion ROM it must do the following (more or less).
LDA #$C1 ; assuming slot 1
STA MSLOT
BIT $CFFF ; turn off all expansion ROMs including mine
JSR $C800 ; fetch of JSR turns my expansion ROM back on
; so I can now use it.
Hope this explains things to your satisfaction.
--
David Wilson +61 42 213802 voice, +61 42 213262 fax
Dept Comp Sci, Uni of Wollongong david@cs.uow.edu.au