diff options
author | 2019-03-09 01:55:11 -0500 | |
---|---|---|
committer | 2019-03-09 01:55:11 -0500 | |
commit | f7ff691bd25b95d1af1a2dbbaf2f20f6b3d49334 (patch) | |
tree | 85e23a984cdbf33b1a53b4f7826d2d7a97b545b9 /src/devices/bus/snes/rom.cpp | |
parent | 107fff092eb5c0f87adb09c0bdf42280ee94a95d (diff) |
bus/gameboy, bus/snes: Simplify read/write handlers (nw)
bus/snes: Add callback for fetching open bus (nw)
Diffstat (limited to 'src/devices/bus/snes/rom.cpp')
-rw-r--r-- | src/devices/bus/snes/rom.cpp | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/src/devices/bus/snes/rom.cpp b/src/devices/bus/snes/rom.cpp index bae27f21fad..3308808a008 100644 --- a/src/devices/bus/snes/rom.cpp +++ b/src/devices/bus/snes/rom.cpp @@ -174,12 +174,12 @@ void sns_rom_20col_device::device_start() mapper specific handlers -------------------------------------------------*/ -READ8_MEMBER(sns_rom_device::read_l) +uint8_t sns_rom_device::read_l(offs_t offset) { - return read_h(space, offset); + return read_h(offset); } -READ8_MEMBER(sns_rom_device::read_h) +uint8_t sns_rom_device::read_h(offs_t offset) { int bank = offset / 0x10000; return m_rom[rom_bank_map[bank] * 0x8000 + (offset & 0x7fff)]; @@ -200,7 +200,7 @@ READ8_MEMBER(sns_rom_device::read_h) ***********************************************************************************************************/ -READ8_MEMBER( sns_rom_obc1_device::chip_read ) +uint8_t sns_rom_obc1_device::chip_read(offs_t offset) { uint16_t address = offset & 0x1fff; uint8_t value; @@ -236,7 +236,7 @@ READ8_MEMBER( sns_rom_obc1_device::chip_read ) } -WRITE8_MEMBER( sns_rom_obc1_device::chip_write ) +void sns_rom_obc1_device::chip_write(offs_t offset, uint8_t data) { uint16_t address = offset & 0x1fff; uint8_t temp; @@ -289,12 +289,12 @@ WRITE8_MEMBER( sns_rom_obc1_device::chip_write ) // Pokemon (and many others): a byte is written and a permutation of its bits must be returned. // Address range for read/write depends on the game (check snes.xml) -READ8_MEMBER( sns_rom_pokemon_device::chip_read ) +uint8_t sns_rom_pokemon_device::chip_read(offs_t offset) { return bitswap<8>(m_latch,0,6,7,1,2,3,4,5); } -WRITE8_MEMBER( sns_rom_pokemon_device::chip_write ) +void sns_rom_pokemon_device::chip_write(offs_t offset, uint8_t data) { m_latch = data; } @@ -340,7 +340,7 @@ void sns_rom_tekken2_device::update_prot(uint32_t offset) } } -READ8_MEMBER( sns_rom_tekken2_device::chip_read ) +uint8_t sns_rom_tekken2_device::chip_read(offs_t offset) { update_prot(offset); @@ -362,10 +362,10 @@ READ8_MEMBER( sns_rom_tekken2_device::chip_read ) } } - return 0xff; // should be open_bus + return read_open_bus(); } -WRITE8_MEMBER( sns_rom_tekken2_device::chip_write ) +void sns_rom_tekken2_device::chip_write(offs_t offset, uint8_t data) { update_prot(offset); } @@ -373,7 +373,7 @@ WRITE8_MEMBER( sns_rom_tekken2_device::chip_write ) // Soul Blade: Adresses $xxx0-$xxx3 in banks $80-$bf always read $55, $0f, $aa, $f0. // Banks $c0-$ff return open bus. -READ8_MEMBER( sns_rom_soulblad_device::chip_read ) +uint8_t sns_rom_soulblad_device::chip_read(offs_t offset) { uint8_t value; offset &= 3; @@ -401,36 +401,36 @@ READ8_MEMBER( sns_rom_soulblad_device::chip_read ) // The actual banks depends on the last 8bits of the address accessed. // Type 1: bits0-4 of the address are used as base bank (256KB chunks) -READ8_MEMBER(sns_rom_mcpirate1_device::read_l) +uint8_t sns_rom_mcpirate1_device::read_l(offs_t offset) { - return read_h(space, offset); + return read_h(offset); } -READ8_MEMBER(sns_rom_mcpirate1_device::read_h) +uint8_t sns_rom_mcpirate1_device::read_h(offs_t offset) { int bank = (offset / 0x10000) + (m_base_bank * 8); return m_rom[rom_bank_map[bank] * 0x8000 + (offset & 0x7fff)]; } -WRITE8_MEMBER( sns_rom_mcpirate1_device::chip_write ) +void sns_rom_mcpirate1_device::chip_write(offs_t offset, uint8_t data) { m_base_bank = offset & 0x1f; // printf("offset %X data %X bank %X\n", offset, data, m_base_bank); } // Type 2: bits0-3 & bit5 of the address are used as base bank (256KB chunks) -READ8_MEMBER(sns_rom_mcpirate2_device::read_l) +uint8_t sns_rom_mcpirate2_device::read_l(offs_t offset) { - return read_h(space, offset); + return read_h(offset); } -READ8_MEMBER(sns_rom_mcpirate2_device::read_h) +uint8_t sns_rom_mcpirate2_device::read_h(offs_t offset) { int bank = (offset / 0x10000) + (m_base_bank * 8); return m_rom[rom_bank_map[bank] * 0x8000 + (offset & 0x7fff)]; } -WRITE8_MEMBER( sns_rom_mcpirate2_device::chip_write ) +void sns_rom_mcpirate2_device::chip_write(offs_t offset, uint8_t data) { m_base_bank = (offset & 0x0f) | ((offset & 0x20) >> 1); // printf("offset %X data %X bank %X\n", offset, data, m_base_bank); @@ -443,19 +443,19 @@ WRITE8_MEMBER( sns_rom_mcpirate2_device::chip_write ) // accesses in [01-3f] don't go to the only 32KB bank) // - bit 5 is always 0 // it's worth to notice that for FC games size of bank is twice the size of original FC PRG -READ8_MEMBER(sns_rom_20col_device::read_l) +uint8_t sns_rom_20col_device::read_l(offs_t offset) { - return read_h(space, offset); + return read_h(offset); } -READ8_MEMBER(sns_rom_20col_device::read_h) +uint8_t sns_rom_20col_device::read_h(offs_t offset) { int prg32k = (!BIT(m_base_bank, 6) && BIT(m_base_bank, 7)); int bank = prg32k ? 0 : (offset / 0x10000); return m_rom[((m_base_bank & 0x1f) + bank) * 0x8000 + (offset & 0x7fff)]; } -WRITE8_MEMBER( sns_rom_20col_device::chip_write ) +void sns_rom_20col_device::chip_write(offs_t offset, uint8_t data) { // [#] game - written bank value // [01] spartan x - c6 @@ -486,23 +486,23 @@ WRITE8_MEMBER( sns_rom_20col_device::chip_write ) // Work in progress (probably very wrong) -READ8_MEMBER( sns_rom_banana_device::chip_read ) +uint8_t sns_rom_banana_device::chip_read(offs_t offset) { return bitswap<8>(m_latch[0xf],0,6,7,1,2,3,4,5); } -WRITE8_MEMBER( sns_rom_banana_device::chip_write ) +void sns_rom_banana_device::chip_write(offs_t offset, uint8_t data) { // printf("write addr %X data %X\n", offset, data); m_latch[0xf] = data; } -READ8_MEMBER( sns_rom_bugs_device::chip_read ) +uint8_t sns_rom_bugs_device::chip_read(offs_t offset) { return bitswap<8>(m_latch[offset & 0xff],0,6,7,1,2,3,4,5); } -WRITE8_MEMBER( sns_rom_bugs_device::chip_write ) +void sns_rom_bugs_device::chip_write(offs_t offset, uint8_t data) { m_latch[offset & 0xff] = data; } |