1
0
mirror of https://github.com/pevans/erc-c.git synced 2024-11-27 20:51:17 +00:00

Memory is determined solely by BANK_ALTZP.

Previously, we just used whatever the segment was that got passed in.
But aside from switching the stack and zero page, ALTZP also changes
where bank-switchable memory is read from and written to; it's either
always aux memory (ALTZP is on) or always main memory (ALTZP is off).
This commit is contained in:
Peter Evans 2018-01-12 21:21:08 -06:00
parent c953616a71
commit 208c909fc2

View File

@ -16,6 +16,12 @@ SEGMENT_READER(apple2_mem_read_bank)
mach = (apple2 *)_mach;
// In the case of bank-switchable memory, BANK_ALTZP is the ultimate
// arbitrator; if it's on, we have to use aux, and if not, we have
// to use main. Whatever the segment was that was passed in will
// turn out to be immaterial.
segment = (mach->bank_switch & BANK_ALTZP) ? mach->aux : mach->main;
if (~mach->bank_switch & BANK_RAM) {
// We need to account for the difference in address location
// before we can successfully get any data from ROM.
@ -52,6 +58,9 @@ SEGMENT_WRITER(apple2_mem_write_bank)
return;
}
// See my spiel in the read bank mapper; the same applies here.
segment = (mach->bank_switch & BANK_ALTZP) ? mach->aux : mach->main;
// You will note, if we've gotten here, that it's possible to write
// to the bank-switch addresses even if the ROM flag is 1. It's
// true! Except that writes never go to ROM. That is to say, it's