mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2024-11-04 18:05:06 +01:00
improved MAIN-SUB memory map mirroring in SCD mode (verified on real hardware by Charles McDonald)
This commit is contained in:
parent
7073e57546
commit
4a41ee1525
@ -1045,7 +1045,7 @@ void scd_init(void)
|
||||
{
|
||||
if (i & 2)
|
||||
{
|
||||
/* PRG-RAM (first 128KB bank, mirrored ?) */
|
||||
/* PRG-RAM (first 128KB bank, mirrored) */
|
||||
m68k.memory_map[i].base = scd.prg_ram + ((i & 1) << 16);
|
||||
m68k.memory_map[i].read8 = NULL;
|
||||
m68k.memory_map[i].read16 = NULL;
|
||||
@ -1068,7 +1068,7 @@ void scd_init(void)
|
||||
}
|
||||
}
|
||||
|
||||
/* $200000-$23FFFF (resp. $600000-$63FFFF): Word-RAM in 2M mode (256KB) */
|
||||
/* $200000-$3FFFFF (resp. $600000-$7FFFFF): Word-RAM in 2M mode (256KB mirrored) */
|
||||
for (i=base+0x20; i<base+0x24; i++)
|
||||
{
|
||||
m68k.memory_map[i].base = scd.word_ram_2M + ((i & 3) << 16);
|
||||
@ -1079,18 +1079,6 @@ void scd_init(void)
|
||||
zbank_memory_map[i].read = NULL;
|
||||
zbank_memory_map[i].write = NULL;
|
||||
}
|
||||
|
||||
/* $240000-$3FFFFF (resp. $400000-$7FFFFF): unused area (Word-RAM mirrored ?) */
|
||||
for (i=base+0x24; i<base+0x40; i++)
|
||||
{
|
||||
m68k.memory_map[i].base = scd.word_ram_2M + ((i & 3) << 16);
|
||||
m68k.memory_map[i].read8 = m68k_read_bus_8;
|
||||
m68k.memory_map[i].read16 = m68k_read_bus_16;
|
||||
m68k.memory_map[i].write8 = m68k_unused_8_w;
|
||||
m68k.memory_map[i].write16 = m68k_unused_16_w;
|
||||
zbank_memory_map[i].read = zbank_unused_r;
|
||||
zbank_memory_map[i].write = zbank_unused_w;
|
||||
}
|
||||
|
||||
/****************************************************************/
|
||||
/* SUB-CPU memory map ($000000-$FFFFFF) */
|
||||
|
@ -322,37 +322,40 @@ unsigned int ctrl_io_read_byte(unsigned int address)
|
||||
#endif
|
||||
if (system_hw == SYSTEM_MCD)
|
||||
{
|
||||
/* register index ($A12000-A1203F mirrored up to $A120FF) */
|
||||
uint8 index = address & 0x3f;
|
||||
|
||||
/* Memory Mode */
|
||||
if (address == 0xa12003)
|
||||
if (index == 0x03)
|
||||
{
|
||||
m68k_poll_detect(0x03);
|
||||
return scd.regs[0x03>>1].byte.l;
|
||||
}
|
||||
|
||||
/* SUB-CPU communication flags */
|
||||
if (address == 0xa1200f)
|
||||
if (index == 0x0f)
|
||||
{
|
||||
m68k_poll_detect(0x0f);
|
||||
return scd.regs[0x0f>>1].byte.l;
|
||||
}
|
||||
|
||||
/* default registers */
|
||||
if (address < 0xa12030)
|
||||
if (index < 0x30)
|
||||
{
|
||||
/* SUB-CPU communication words */
|
||||
if (address >= 0xa12020)
|
||||
if (index >= 0x20)
|
||||
{
|
||||
m68k_poll_detect((address - 0x10) & 0x1f);
|
||||
m68k_poll_detect(index - 0x10);
|
||||
}
|
||||
|
||||
/* register LSB */
|
||||
if (address & 1)
|
||||
{
|
||||
return scd.regs[(address >> 1) & 0xff].byte.l;
|
||||
return scd.regs[index >> 1].byte.l;
|
||||
}
|
||||
|
||||
/* register MSB */
|
||||
return scd.regs[(address >> 1) & 0xff].byte.h;
|
||||
return scd.regs[index >> 1].byte.h;
|
||||
}
|
||||
}
|
||||
|
||||
@ -441,35 +444,38 @@ unsigned int ctrl_io_read_word(unsigned int address)
|
||||
#endif
|
||||
if (system_hw == SYSTEM_MCD)
|
||||
{
|
||||
/* register index ($A12000-A1203F mirrored up to $A120FF) */
|
||||
uint8 index = address & 0x3f;
|
||||
|
||||
/* Memory Mode */
|
||||
if (address == 0xa12002)
|
||||
if (index == 0x02)
|
||||
{
|
||||
m68k_poll_detect(0x03);
|
||||
return scd.regs[0x03>>1].w;
|
||||
}
|
||||
|
||||
/* CDC host data (word access only ?) */
|
||||
if (address == 0xa12008)
|
||||
if (index == 0x08)
|
||||
{
|
||||
return cdc_host_r();
|
||||
}
|
||||
|
||||
/* H-INT vector (word access only ?) */
|
||||
if (address == 0xa12006)
|
||||
if (index == 0x06)
|
||||
{
|
||||
return *(uint16 *)(m68k.memory_map[0].base + 0x72);
|
||||
}
|
||||
|
||||
/* default registers */
|
||||
if (address < 0xa12030)
|
||||
if (index < 0x30)
|
||||
{
|
||||
/* SUB-CPU communication words */
|
||||
if (address >= 0xa12020)
|
||||
if (index >= 0x20)
|
||||
{
|
||||
m68k_poll_detect((address - 0x10) & 0x1e);
|
||||
m68k_poll_detect(index - 0x10);
|
||||
}
|
||||
|
||||
return scd.regs[(address >> 1) & 0xff].w;
|
||||
return scd.regs[index >> 1].w;
|
||||
}
|
||||
}
|
||||
|
||||
@ -565,7 +571,8 @@ void ctrl_io_write_byte(unsigned int address, unsigned int data)
|
||||
#endif
|
||||
if (system_hw == SYSTEM_MCD)
|
||||
{
|
||||
switch (address & 0xff)
|
||||
/* register index ($A12000-A1203F mirrored up to $A120FF) */
|
||||
switch (address & 0x3f)
|
||||
{
|
||||
case 0x00: /* SUB-CPU interrupt */
|
||||
{
|
||||
@ -795,7 +802,8 @@ void ctrl_io_write_word(unsigned int address, unsigned int data)
|
||||
#endif
|
||||
if (system_hw == SYSTEM_MCD)
|
||||
{
|
||||
switch (address & 0xfe)
|
||||
/* register index ($A12000-A1203F mirrored up to $A120FF) */
|
||||
switch (address & 0x3e)
|
||||
{
|
||||
case 0x00: /* SUB-CPU interrupt & control */
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user