From 0f164f496f2e5c681712c60c3a95fc3b2ebcbb0d Mon Sep 17 00:00:00 2001 From: 0kmg <9137159+0kmg@users.noreply.github.com> Date: Wed, 14 Dec 2022 09:26:04 -0800 Subject: bus/a7800/rom.cpp: Use proper bank order for Activision 128K cartridges. (#10686) --- hash/a7800.xml | 20 ++++++++++---------- src/devices/bus/a7800/rom.cpp | 38 ++++++++++++-------------------------- 2 files changed, 22 insertions(+), 36 deletions(-) diff --git a/hash/a7800.xml b/hash/a7800.xml index cfeadf03bcb..e4af4a23c2e 100644 --- a/hash/a7800.xml +++ b/hash/a7800.xml @@ -863,8 +863,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume - - + + @@ -877,8 +877,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume - - + + @@ -891,8 +891,8 @@ type of rom dumps. Effort will be made at a later date to split them and docume - - + + @@ -1633,8 +1633,8 @@ Saarna for debugging the problem) - - + + @@ -2019,8 +2019,8 @@ almost nothing like the prototype. - - + + diff --git a/src/devices/bus/a7800/rom.cpp b/src/devices/bus/a7800/rom.cpp index 1a088294f4d..45293f4260f 100644 --- a/src/devices/bus/a7800/rom.cpp +++ b/src/devices/bus/a7800/rom.cpp @@ -444,13 +444,12 @@ void a78_rom_abs_device::write_40xx(offs_t offset, uint8_t data) Carts with Activision bankswitch: 128K games. 8 x 16K banks (0-7) to be mapped at - 0xa000-0xdfff. Bank is selected depending on the - address written in 0xff80-0xff87. + 0xa000-0xdfff. Bank is selected by writing above + 0xe000 and depends on A2-A0. The rest of the memory is as follows: - 0x4000-0x5fff second 8kb of bank 6 - 0x6000-0x7fff first 8kb of bank 6 - 0x8000-0x9fff second 8kb of bank 7 - 0xe000-0xffff first 8kb of bank 7 + 0x4000-0x7fff bank 6 + 0x8000-0x9fff first 8K of bank 7 + 0xe000-0xffff second 8K of bank 7 GAMES: Double Dragon, Rampage. @@ -458,38 +457,25 @@ void a78_rom_abs_device::write_40xx(offs_t offset, uint8_t data) uint8_t a78_rom_act_device::read_40xx(offs_t offset) { - uint8_t data = 0xff; - uint16_t addr = offset & 0x1fff; - - // offset goes from 0 to 0xc000 + // offset goes from 0 to 0xbfff switch (offset & 0xe000) { + default: // unreachable: appease compiler case 0x0000: - data = m_rom[addr + 0x1a000]; - break; case 0x2000: - data = m_rom[addr + 0x18000]; - break; - case 0x4000: - data = m_rom[addr + 0x1e000]; - break; + return m_rom[offset | 0x18000]; case 0x6000: - data = m_rom[addr + (m_bank * 0x4000)]; - break; case 0x8000: - data = m_rom[addr + (m_bank * 0x4000) + 0x2000]; - break; + return m_rom[(offset & 0x3fff) | (m_bank * 0x4000)]; + case 0x4000: case 0xa000: - data = m_rom[addr + 0x1c000]; - break; + return m_rom[offset | 0x1c000]; } - - return data; } void a78_rom_act_device::write_40xx(offs_t offset, uint8_t data) { - if (offset >= 0xbf80 && offset <= 0xbf8f) + if (offset >= 0xa000) m_bank = offset & 7; } -- cgit v1.2.3