Post by Thomas HartePost by Kent DickeyWhen $C035 bit 6 is 0, memory from $c000-$ffff in banks 0 and 1 work like
an Apple //e, with all the language card, ROM, and IO space soft switches
(built-in and peripherals) behaving as you would expect on a //e affecting
accessing to banks 0 and 1.
When $C035 bit 6 is 1, memory from $c000-$ffff in bank 0 is the DRAM from
$c000-$ffff--there is no LC bank switching, no ROM, and no IO space soft
switches. And similarly in bank 1 (but it points to bank 1 DRAM).
[snip]
Post by Thomas HartePost by Kent DickeyStandard Apple //e memory mapping is complex, and I think that is your
actual question. What is it you're trying to do?
Just research; writing emulators is one of my hobbies and reading up as
though I were going to write one even more so. But this feels like a day
one-type question â the documentation didn't feel particularly
explicit as to how the reset vector ends up being sourced from ROM and
therefore how the system even starts up.
The IIgs documentation is not as complete as the previous generation.
That's partly because they basically don't document things that don't
affect people writing normal software. I'm not sure where the vector
pull always coming from ROM is documented.
Post by Thomas HarteAs well as the Hardware Reference and the Firmware Guide, I also checked
the Fischer book; I'm grateful for your answer indicating that bit 6
does affect the entire range from $c000 to the end of each bank, which
both explains how appropriate vectors are visible straight from the
power-on reset and how they can point to useful code.
https://github.com/TomHarte/CLK/wiki/Apple-IIe-Memory-Paging to
summarise it for myself back when I wrote an emulator of that. I hope
it's accurate (and, indeed, comprehensible). So if I've fully understood
then I guess the main difference on a IIgs with bit 6 = 0 versus a IIe
is that VPB also factors in? I can't imagine that they changed the rules
for regular memory accesses.
There are other differences around shadowing. The actual video buffers
are not in banks $00 or $01, but rather in $e0 and $e1, and writes to
banks $00 and $01 are shadowed to also be done to banks $e0 and $e1.
Note that the shadowing is done at the true bank level--so if RAMWRT is
set so that writes to address $1000 really go to bank 1, then those writes
are shadowed to bank $e1.
Post by Thomas HarteI'm also taking it from the documentation and your commentary that with
bit 6 = 0, banks $00 and $01 have exactly the same contents. Presumably
that's a safeguard against those addressing modes, like abs, x, that can
now cross bank boundaries?
Banks $00 and $01 combine to make 128KB of memory that look like an Apple
//e's 128KB of memory (except these are not the actual video buffers). The
way to think of it is generating accesses to bank $00 addresses may actually
reference bank $00 or bank $01, and may shadow writes to bank $e0 (or $e1),
depending on the //e softswitches. But, directly access bank $01 using the
65816 long addressing modes will always access bank $01 (although again,
writes can be shadowed to bank $e1). Accessing other banks just accesses the
indicated bank, and there's no shadowing.
Banks $e0 and $e1 have the actual video memory (main and aux), which you can
directly access if you want. This memory is all running at 1MHz. It's not
that useful, so the ROM uses most of bank $e0 and $e1 that are not video
memory as storage for things like the Memory Manager, etc.
All of my knowledge about IIgs addressing is in my emulator, KEGS,
at http://kegs.sourceforge.net/ (Old version from 15 years ago), with an
alpha update at: https://sourceforge.net/projects/kegs/ which is cleaned up
a bit. KEGS 1.00+ is intended for Mac OS X and Linux. The memory mapping is
handled in moremem.c. KEGS has a table of 65536 remap entries for
every page of $100 bytes (so it covers the entire 16MB of addressing), so
KEGS just has to fiddle with these pointers when the softswitches are
touched. moremem.c has "fixup" routines which handle each softswitch.
Actual emulation is basically a lookup of this pointer, then add the offset
onto the page, and then access that location.
I will look into your emulator, I'm interested in using Metal on Mac OS X
in KEGS. I'm pretty disappointed in the Mac programming documentation.
Kent