mirror of
https://github.com/pevans/erc-c.git
synced 2024-12-21 23:29:16 +00:00
Account for changes to rom segment structure
This commit is contained in:
parent
caea83f9c6
commit
bcf6b213a6
@ -56,7 +56,12 @@
|
||||
#define APPLE2_AUX_SIZE 0x10000
|
||||
|
||||
/*
|
||||
* This is the base address (or offset) for all bank-switched memory
|
||||
* This is the base address for system / internal ROM.
|
||||
*/
|
||||
#define APPLE2_SYSROM_OFFSET 0xC000
|
||||
|
||||
/*
|
||||
* This defines the base address for bank-switchable memory
|
||||
*/
|
||||
#define APPLE2_BANK_OFFSET 0xD000
|
||||
|
||||
|
@ -52,7 +52,7 @@ SEGMENT_READER(apple2_bank_read)
|
||||
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.
|
||||
return vm_segment_get(mach->rom, addr - APPLE2_BANK_OFFSET);
|
||||
return vm_segment_get(mach->rom, addr - APPLE2_SYSROM_OFFSET);
|
||||
}
|
||||
|
||||
// Each memory bank (main or auxiliary) have an additional 4k of RAM
|
||||
|
@ -65,8 +65,8 @@ Test(apple2_bank, read)
|
||||
// when addressing from main memory
|
||||
apple2_set_bank_switch(mach, BANK_WRITE);
|
||||
val = 123;
|
||||
vm_segment_set(mach->rom, 0x77, val);
|
||||
val = vm_segment_get(mach->rom, 0x77);
|
||||
vm_segment_set(mach->rom, 0x1077, val);
|
||||
val = vm_segment_get(mach->rom, 0x1077);
|
||||
cr_assert_eq(vm_segment_get(mach->main, 0xD077), val);
|
||||
|
||||
// In RAM1 bank mode, setting a value in memory should return thaty
|
||||
@ -104,9 +104,9 @@ Test(apple2_bank, write)
|
||||
// were).
|
||||
right = 123;
|
||||
wrong = 222;
|
||||
vm_segment_set(mach->rom, 0x77, right);
|
||||
vm_segment_set(mach->rom, 0x1077, right);
|
||||
vm_segment_set(mach->main, 0xD077, wrong);
|
||||
cr_assert_eq(vm_segment_get(mach->rom, 0x77), right);
|
||||
cr_assert_eq(vm_segment_get(mach->rom, 0x1077), right);
|
||||
cr_assert_eq(vm_segment_get(mach->main, 0xD077), right);
|
||||
|
||||
// RAM1 is the main bank; it's all 64k RAM in one chunk.
|
||||
|
@ -141,8 +141,8 @@ Test(apple2, set_bank_switch)
|
||||
|
||||
Test(apple2, reset)
|
||||
{
|
||||
vm_segment_set(mach->rom, 0x2FFC, 0x34);
|
||||
vm_segment_set(mach->rom, 0x2FFD, 0x12);
|
||||
vm_segment_set(mach->rom, 0x3FFC, 0x34);
|
||||
vm_segment_set(mach->rom, 0x3FFD, 0x12);
|
||||
apple2_reset(mach);
|
||||
|
||||
cr_assert_eq(mach->cpu->PC, 0x1234);
|
||||
|
Loading…
Reference in New Issue
Block a user