[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: memory switches
In article <1995Nov7.155913.3304@freenet.victoria.bc.ca>
ur448@freenet.Victoria.BC.CA (John Edward Flanders) writes:
>Could anyone please explain the locations and functions of the memory bank
>switches on an Apple //e with 128k memory?
Have patience...this gets rather complicated.
The bank-switching controls are as follows:
$C002: Select main memory for reading in $0200...$BFFF
$C003: Select aux memory for reading in $0200...$BFFF
$C004: Select main memory for writing in $0200...$BFFF
$C005: Select aux memory for reading in $0200...$BFFF
$C008: Select main memory for reading & writing in $0000...$01FF & $D000...$FFFF
$C009: Select aux memory for reading & writing in $0000...$01FF & $D000...$FFFF
To activate any switch, write a value at the I/O location. It doesn't matter
what you write; the act of writing is what triggers the switch. (You *must*
access the switch by writing--reading a switch just gets you the ASCII code
of the most recent keypress, and doesn't do any bank switching.)
Don't ever try to POKE these switches from BASIC--you'll bank-switch yourself
out of existence.
Note that these switches divide memory into four ranges:
$0000...$01FF: Switched by $C008, $C009.
$0200...$BFFF: Switched by $C002...$C005.
$C000...$CFFF: Not switchable.
$D000...$FFFF: Switched by $C008, $C009. This is the "language card"
area...the switch only controls which of the two
"language cards" (main or aux) is active...if you
have ROM mapped into this area, it never switches (i.e.
there's only one ROM, and it shows up in both the main
and aux banks).
Note that for memory in $0200...$BFFF, reading and writing are separately
selectable...you can read from main memory and write to aux memory, for
example. However, for memory in $0000...$01FF and $D000...$FFFF, reading
and writing are not separately selectable...you either read and write in
the main bank, or you read and write in the aux bank.
Looks simple enough, doesn't it? Well, here comes the complicated part.
There is another switch that affects bank switching:
$C000: Turn off 80-column bank switching
$C001: Turn on 80-column bank switching
(As above, these switches must be accessed by writing.)
If 80-column bank switching is off, bank switching works exactly as
described above. But if 80-column bank switching is on, the text screen
($0400...$07FF) becomes immune to the normal bank-switching controls. In
this mode, the text screen is bank-switched by the following controls
instead:
$C054: Map the main text page into $0400...$07FF
$C055: Map the aux text page into $0400...$07FF
(These switches can be triggered by ANY access, not just a write.)
Note that this is the PAGE1/PAGE2 switch. When 80-colunn bank switching
is on, text page 2 (and graphics page 2) cannot be displayed.
As if that weren't confusing enough, turning on the HIRES switch (by
accessing $C057) causes hires page 1 ($2000...$3FFF) to behave just like
the text screen--it too becomes immune to the normal bank-switching
controls, and is switched instead by $C054, $C055.
Actually, I lied when I wrote above that the I/O area ($C000...$CFFF)
doesn't bank-switch. The following switches control portions of this
memory area:
$C006: Map slot card ROMs into $C100...$CFFF
$C007: Map internal ROM into $C100...$CFFF
$C00A: Map built-in 80-column firmware into $C300...$C3FF
$C00B: Map slot card ROM into $C300...$C3FF
(These are write-only switches.)
- Neil Parker
--
Neil Parker, nparker@{cie-2,cie}.uoregon.edu, http://cie-2.uoregon.edu/~nparker
"Bad move, Neil!" -- The Tick