diff --git a/src/emu/addrmap.h b/src/emu/addrmap.h index 8d82166a4ef..c56c9257d47 100644 --- a/src/emu/addrmap.h +++ b/src/emu/addrmap.h @@ -350,35 +350,35 @@ void _class :: _name(::address_map &map) \ #define AM_DEVREADWRITE32(_tag, _class, _rhandler, _whandler, _unitmask) \ .set_handler(read32_delegate(&_class::_rhandler, #_class "::" #_rhandler, _tag, (_class *)nullptr), write32_delegate(&_class::_whandler, #_class "::" #_whandler, _tag, (_class *)nullptr), _unitmask) -// device reads with address shift -#define AM_DEVREAD_RSHIFT(_tag, _class, _handler, _rshift) \ - .set_handler(read_delegate([](_class &device, address_space &space, offs_t offset, native_type mem_mask)->native_type { return device._handler(space, offset >> _rshift, mem_mask); }, #_class "::" #_handler, _tag, (_class *)nullptr)) -#define AM_DEVREAD8_RSHIFT(_tag, _class, _handler, _unitmask, _rshift) \ - .set_handler(read8_delegate([](_class &device, address_space &space, offs_t offset, u8 mem_mask)->u8 { return device._handler(space, offset >> _rshift, mem_mask); }, #_class "::" #_handler, _tag, (_class *)nullptr), _unitmask) -#define AM_DEVREAD16_RSHIFT(_tag, _class, _handler, _unitmask, _rshift) \ - .set_handler(read16_delegate([](_class &device, address_space &space, offs_t offset, u16 mem_mask)->u16 { return device._handler(space, offset >> _rshift, mem_mask); }, #_class "::" #_handler, _tag, (_class *)nullptr), _unitmask) -#define AM_DEVREAD32_RSHIFT(_tag, _class, _handler, _unitmask, _rshift) \ - .set_handler(read32_delegate([](_class &device, address_space &space, offs_t offset, u32 mem_mask)->u32 { return device._handler(space, offset >> _rshift, mem_mask); }, #_class "::" #_handler, _tag, (_class *)nullptr), _unitmask) +// device reads with modified offset +#define AM_DEVREAD_MOD(_tag, _class, _handler, _modfn) \ + .set_handler(read_delegate([](_class &device, address_space &space, offs_t offset, native_type mem_mask)->native_type { return device._handler(space, emu::detail::offset_##_modfn(offset), mem_mask); }, #_class "::" #_handler, _tag, (_class *)nullptr)) +#define AM_DEVREAD8_MOD(_tag, _class, _handler, _modfn, _unitmask) \ + .set_handler(read8_delegate([](_class &device, address_space &space, offs_t offset, u8 mem_mask)->u8 { return device._handler(space, emu::detail::offset_##_modfn(offset), mem_mask); }, #_class "::" #_handler, _tag, (_class *)nullptr), _unitmask) +#define AM_DEVREAD16_MOD(_tag, _class, _handler, _modfn, _unitmask) \ + .set_handler(read16_delegate([](_class &device, address_space &space, offs_t offset, u16 mem_mask)->u16 { return device._handler(space, emu::detail::offset_##_modfn(offset), mem_mask); }, #_class "::" #_handler, _tag, (_class *)nullptr), _unitmask) +#define AM_DEVREAD32_MOD(_tag, _class, _handler, _modfn, _unitmask) \ + .set_handler(read32_delegate([](_class &device, address_space &space, offs_t offset, u32 mem_mask)->u32 { return device._handler(space, emu::detail::offset_##_modfn(offset), mem_mask); }, #_class "::" #_handler, _tag, (_class *)nullptr), _unitmask) -// device writes with address shift -#define AM_DEVWRITE_RSHIFT(_tag, _class, _handler, _rshift) \ - .set_handler(write_delegate([](_class &device, address_space &space, offs_t offset, native_type data, native_type mem_mask) { device._handler(space, offset >> _rshift, data, mem_mask); }, #_class "::" #_handler, _tag, (_class *)nullptr)) -#define AM_DEVWRITE8_RSHIFT(_tag, _class, _handler, _unitmask, _rshift) \ - .set_handler(write8_delegate([](_class &device, address_space &space, offs_t offset, u8 data, u8 mem_mask) { device._handler(space, offset >> _rshift, data, mem_mask); }, #_class "::" #_handler, _tag, (_class *)nullptr), _unitmask) -#define AM_DEVWRITE16_RSHIFT(_tag, _class, _handler, _unitmask, _rshift) \ - .set_handler(write16_delegate([](_class &device, address_space &space, offs_t offset, u16 data, u16 mem_mask) { device._handler(space, offset >> _rshift, data, mem_mask); }, #_class "::" #_handler, _tag, (_class *)nullptr), _unitmask) -#define AM_DEVWRITE32_RSHIFT(_tag, _class, _handler, _unitmask, _rshift) \ - .set_handler(write32_delegate([](_class &device, address_space &space, offs_t offset, u32 data, u32 mem_mask) { device._handler(space, offset >> _rshift, data, mem_mask); }, #_class "::" #_handler, _tag, (_class *)nullptr), _unitmask) +// device writes with modified offset +#define AM_DEVWRITE_MOD(_tag, _class, _handler, _modfn) \ + .set_handler(write_delegate([](_class &device, address_space &space, offs_t offset, native_type data, native_type mem_mask) { device._handler(space, emu::detail::offset_##_modfn(offset), data, mem_mask); }, #_class "::" #_handler, _tag, (_class *)nullptr)) +#define AM_DEVWRITE8_MOD(_tag, _class, _handler, _modfn, _unitmask) \ + .set_handler(write8_delegate([](_class &device, address_space &space, offs_t offset, u8 data, u8 mem_mask) { device._handler(space, emu::detail::offset_##_modfn(offset), data, mem_mask); }, #_class "::" #_handler, _tag, (_class *)nullptr), _unitmask) +#define AM_DEVWRITE16_MOD(_tag, _class, _handler, _modfn, _unitmask) \ + .set_handler(write16_delegate([](_class &device, address_space &space, offs_t offset, u16 data, u16 mem_mask) { device._handler(space, emu::detail::offset_##_modfn(offset), data, mem_mask); }, #_class "::" #_handler, _tag, (_class *)nullptr), _unitmask) +#define AM_DEVWRITE32_MOD(_tag, _class, _handler, _modfn, _unitmask) \ + .set_handler(write32_delegate([](_class &device, address_space &space, offs_t offset, u32 data, u32 mem_mask) { device._handler(space, emu::detail::offset_##_modfn(offset), data, mem_mask); }, #_class "::" #_handler, _tag, (_class *)nullptr), _unitmask) -// device reads/writes with address shift -#define AM_DEVREADWRITE_RSHIFT(_tag, _class, _rhandler, _whandler, _rshift) \ - .set_handler(read_delegate([](_class &device, address_space &space, offs_t offset, native_type mem_mask)->native_type { return device._rhandler(space, offset >> _rshift, mem_mask); }, #_class "::" #_rhandler, _tag, (_class *)nullptr), write_delegate([](_class &device, address_space &space, offs_t offset, native_type data, native_type mem_mask) { device._whandler(space, offset >> _rshift, data, mem_mask); }, #_class "::" #_whandler, _tag, (_class *)nullptr)) -#define AM_DEVREADWRITE8_RSHIFT(_tag, _class, _rhandler, _whandler, _unitmask, _rshift) \ - .set_handler(read8_delegate([](_class &device, address_space &space, offs_t offset, u8 mem_mask)->u8 { return device._rhandler(space, offset >> _rshift, mem_mask); }, #_class "::" #_rhandler, _tag, (_class *)nullptr), write8_delegate([](_class &device, address_space &space, offs_t offset, u8 data, u8 mem_mask) { device._whandler(space, offset >> _rshift, data, mem_mask); }, #_class "::" #_whandler, _tag, (_class *)nullptr), _unitmask) -#define AM_DEVREADWRITE16_RSHIFT(_tag, _class, _rhandler, _whandler, _unitmask, _rshift) \ - .set_handler(read16_delegate([](_class &device, address_space &space, offs_t offset, u16 mem_mask)->u16 { return device._rhandler(space, offset >> _rshift, mem_mask); }, #_class "::" #_rhandler, _tag, (_class *)nullptr), write16_delegate([](_class &device, address_space &space, offs_t offset, u16 data, u16 mem_mask) { device._whandler(space, offset >> _rshift, data, mem_mask); }, #_class "::" #_whandler, _tag, (_class *)nullptr), _unitmask) -#define AM_DEVREADWRITE32_RSHIFT(_tag, _class, _rhandler, _whandler, _unitmask, _rshift) \ - .set_handler(read32_delegate([](_class &device, address_space &space, offs_t offset, u32 mem_mask)->u32 { return device._rhandler(space, offset >> _rshift, mem_mask); }, #_class "::" #_rhandler, _tag, (_class *)nullptr), write32_delegate([](_class &device, address_space &space, offs_t offset, u32 data, u32 mem_mask) { device._whandler(space, offset >> _rshift, data, mem_mask); }, #_class "::" #_whandler, _tag, (_class *)nullptr), _unitmask) +// device reads/writes with modified offset +#define AM_DEVREADWRITE_MOD(_tag, _class, _rhandler, _whandler, _modfn) \ + .set_handler(read_delegate([](_class &device, address_space &space, offs_t offset, native_type mem_mask)->native_type { return device._rhandler(space, emu::detail::offset_##_modfn(offset), mem_mask); }, #_class "::" #_rhandler, _tag, (_class *)nullptr), write_delegate([](_class &device, address_space &space, offs_t offset, native_type data, native_type mem_mask) { device._whandler(space, emu::detail::offset_##_modfn(offset), data, mem_mask); }, #_class "::" #_whandler, _tag, (_class *)nullptr)) +#define AM_DEVREADWRITE8_MOD(_tag, _class, _rhandler, _whandler, _modfn, _unitmask) \ + .set_handler(read8_delegate([](_class &device, address_space &space, offs_t offset, u8 mem_mask)->u8 { return device._rhandler(space, emu::detail::offset_##_modfn(offset), mem_mask); }, #_class "::" #_rhandler, _tag, (_class *)nullptr), write8_delegate([](_class &device, address_space &space, offs_t offset, u8 data, u8 mem_mask) { device._whandler(space, emu::detail::offset_##_modfn(offset), data, mem_mask); }, #_class "::" #_whandler, _tag, (_class *)nullptr), _unitmask) +#define AM_DEVREADWRITE16_MOD(_tag, _class, _rhandler, _whandler, _modfn, _unitmask) \ + .set_handler(read16_delegate([](_class &device, address_space &space, offs_t offset, u16 mem_mask)->u16 { return device._rhandler(space, emu::detail::offset_##_modfn(offset), mem_mask); }, #_class "::" #_rhandler, _tag, (_class *)nullptr), write16_delegate([](_class &device, address_space &space, offs_t offset, u16 data, u16 mem_mask) { device._whandler(space, emu::detail::offset_##_modfn(offset), data, mem_mask); }, #_class "::" #_whandler, _tag, (_class *)nullptr), _unitmask) +#define AM_DEVREADWRITE32_MOD(_tag, _class, _rhandler, _whandler, _modfn, _unitmask) \ + .set_handler(read32_delegate([](_class &device, address_space &space, offs_t offset, u32 mem_mask)->u32 { return device._rhandler(space, emu::detail::offset_##_modfn(offset), mem_mask); }, #_class "::" #_rhandler, _tag, (_class *)nullptr), write32_delegate([](_class &device, address_space &space, offs_t offset, u32 data, u32 mem_mask) { device._whandler(space, emu::detail::offset_##_modfn(offset), data, mem_mask); }, #_class "::" #_whandler, _tag, (_class *)nullptr), _unitmask) // device set offset #define AM_DEVSETOFFSET(_tag, _class, _handler) \ @@ -448,4 +448,25 @@ void _class :: _name(::address_map &map) \ #define AM_RAM_DEVWRITE(_tag, _class, _write) AM_READONLY AM_DEVWRITE(_tag, _class, _write) +// templated functions for modified offset +namespace emu { namespace detail { + +template offs_t offset_rshift(offs_t offset) +{ + return offset >> shift; +} + +template offs_t offset_xor(offs_t offset) +{ + return offset ^ xorval; +} + +template offs_t offset_xorshift(offs_t offset) +{ + return (offset ^ xorval) >> shift; +} + +} } + + #endif /* __ADDRMAP_H__ */ diff --git a/src/mame/drivers/bbcbc.cpp b/src/mame/drivers/bbcbc.cpp index 77163c1eb23..e5b8a07fa64 100644 --- a/src/mame/drivers/bbcbc.cpp +++ b/src/mame/drivers/bbcbc.cpp @@ -69,7 +69,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( bbcbc_io, AS_IO, 8, bbcbc_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x7f) AM_DEVREADWRITE_RSHIFT("z80pio", z80pio_device, read, write, 5) + AM_RANGE(0x00, 0x7f) AM_DEVREADWRITE_MOD("z80pio", z80pio_device, read, write, rshift<5>) AM_RANGE(0x80, 0x80) AM_DEVREADWRITE("tms9129", tms9129_device, vram_read, vram_write) AM_RANGE(0x81, 0x81) AM_DEVREADWRITE("tms9129", tms9129_device, register_read, register_write) ADDRESS_MAP_END diff --git a/src/mame/drivers/equites.cpp b/src/mame/drivers/equites.cpp index c1aa962ce14..ff9d5f98c16 100644 --- a/src/mame/drivers/equites.cpp +++ b/src/mame/drivers/equites.cpp @@ -652,7 +652,7 @@ static ADDRESS_MAP_START( equites_map, AS_PROGRAM, 16, equites_state ) AM_RANGE(0x100000, 0x1001ff) AM_RAM AM_SHARE("spriteram") AM_RANGE(0x140000, 0x1407ff) AM_READWRITE8(mcu_ram_r, mcu_ram_w, 0x00ff) AM_RANGE(0x180000, 0x180001) AM_READ_PORT("IN1") AM_DEVWRITE8("soundlatch", generic_latch_8_device, write, 0x00ff) - AM_RANGE(0x180000, 0x180001) AM_SELECT(0x03c000) AM_DEVWRITE8_RSHIFT("mainlatch", ls259_device, write_a3, 0xff00, 13) + AM_RANGE(0x180000, 0x180001) AM_SELECT(0x03c000) AM_DEVWRITE8_MOD("mainlatch", ls259_device, write_a3, rshift<13>, 0xff00) AM_RANGE(0x1c0000, 0x1c0001) AM_READ_PORT("IN0") AM_WRITE(equites_scrollreg_w) AM_RANGE(0x380000, 0x380001) AM_WRITE8(equites_bgcolor_w, 0xff00) AM_RANGE(0x780000, 0x780001) AM_DEVWRITE("watchdog", watchdog_timer_device, reset16_w) @@ -672,7 +672,7 @@ static ADDRESS_MAP_START( splndrbt_map, AS_PROGRAM, 16, equites_state ) AM_RANGE(0x080000, 0x080001) AM_READ_PORT("IN0") AM_RANGE(0x0c0000, 0x0c0001) AM_READ_PORT("IN1") AM_RANGE(0x0c0000, 0x0c0001) AM_SELECT(0x020000) AM_WRITE8(equites_bgcolor_w, 0xff00) - AM_RANGE(0x0c0000, 0x0c0001) AM_SELECT(0x03c000) AM_DEVWRITE8_RSHIFT("mainlatch", ls259_device, write_a3, 0x00ff, 13) + AM_RANGE(0x0c0000, 0x0c0001) AM_SELECT(0x03c000) AM_DEVWRITE8_MOD("mainlatch", ls259_device, write_a3, rshift<13>, 0x00ff) AM_RANGE(0x100000, 0x100001) AM_WRITE(splndrbt_bg_scrollx_w) AM_RANGE(0x140000, 0x140001) AM_DEVWRITE8("soundlatch", generic_latch_8_device, write, 0x00ff) AM_RANGE(0x1c0000, 0x1c0001) AM_WRITE(splndrbt_bg_scrolly_w) diff --git a/src/mame/drivers/gaelco.cpp b/src/mame/drivers/gaelco.cpp index eb3ba81c23e..beb71c477b1 100644 --- a/src/mame/drivers/gaelco.cpp +++ b/src/mame/drivers/gaelco.cpp @@ -126,7 +126,7 @@ static ADDRESS_MAP_START( bigkarnk_map, AS_PROGRAM, 16, gaelco_state ) AM_RANGE(0x700004, 0x700005) AM_READ_PORT("P1") AM_RANGE(0x700006, 0x700007) AM_READ_PORT("P2") AM_RANGE(0x700008, 0x700009) AM_READ_PORT("SERVICE") - AM_RANGE(0x70000a, 0x70000b) AM_SELECT(0x000070) AM_DEVWRITE8_RSHIFT("outlatch", ls259_device, write_d0, 0x00ff, 3) + AM_RANGE(0x70000a, 0x70000b) AM_SELECT(0x000070) AM_DEVWRITE8_MOD("outlatch", ls259_device, write_d0, rshift<3>, 0x00ff) AM_RANGE(0x70000e, 0x70000f) AM_WRITE8(bigkarnk_sound_command_w, 0x00ff) /* Triggers a FIRQ on the sound CPU */ AM_RANGE(0xff8000, 0xffffff) AM_RAM /* Work RAM */ ADDRESS_MAP_END @@ -169,7 +169,7 @@ static ADDRESS_MAP_START( squash_map, AS_PROGRAM, 16, gaelco_state ) AM_RANGE(0x700002, 0x700003) AM_READ_PORT("DSW1") AM_RANGE(0x700004, 0x700005) AM_READ_PORT("P1") AM_RANGE(0x700006, 0x700007) AM_READ_PORT("P2") - AM_RANGE(0x70000a, 0x70000b) AM_SELECT(0x000070) AM_DEVWRITE8_RSHIFT("outlatch", ls259_device, write_d0, 0x00ff, 3) + AM_RANGE(0x70000a, 0x70000b) AM_SELECT(0x000070) AM_DEVWRITE8_MOD("outlatch", ls259_device, write_d0, rshift<3>, 0x00ff) AM_RANGE(0x70000c, 0x70000d) AM_WRITE8(OKIM6295_bankswitch_w, 0x00ff) AM_RANGE(0x70000e, 0x70000f) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff) /* OKI6295 status register */ AM_RANGE(0xff0000, 0xffffff) AM_RAM /* Work RAM */ @@ -187,7 +187,7 @@ static ADDRESS_MAP_START( thoop_map, AS_PROGRAM, 16, gaelco_state ) AM_RANGE(0x700002, 0x700003) AM_READ_PORT("DSW1") AM_RANGE(0x700004, 0x700005) AM_READ_PORT("P1") AM_RANGE(0x700006, 0x700007) AM_READ_PORT("P2") - AM_RANGE(0x70000a, 0x70000b) AM_SELECT(0x000070) AM_DEVWRITE8_RSHIFT("outlatch", ls259_device, write_d0, 0x00ff, 3) + AM_RANGE(0x70000a, 0x70000b) AM_SELECT(0x000070) AM_DEVWRITE8_MOD("outlatch", ls259_device, write_d0, rshift<3>, 0x00ff) AM_RANGE(0x70000c, 0x70000d) AM_WRITE8(OKIM6295_bankswitch_w, 0x00ff) AM_RANGE(0x70000e, 0x70000f) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff) /* OKI6295 status register */ AM_RANGE(0xff0000, 0xffffff) AM_RAM /* Work RAM */ diff --git a/src/mame/drivers/gaelco3d.cpp b/src/mame/drivers/gaelco3d.cpp index 4041ef3a2ff..75a503405c4 100644 --- a/src/mame/drivers/gaelco3d.cpp +++ b/src/mame/drivers/gaelco3d.cpp @@ -708,9 +708,9 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, gaelco3d_state ) AM_RANGE(0x510042, 0x510043) AM_READ(sound_status_r) AM_RANGE(0x510100, 0x510101) AM_READWRITE(eeprom_data_r, irq_ack_w) AM_RANGE(0x510102, 0x510103) AM_DEVREAD8("serial", gaelco_serial_device, data_r, 0x00ff) - AM_RANGE(0x510102, 0x510103) AM_SELECT(0x000038) AM_DEVWRITE8_RSHIFT("mainlatch", ls259_device, write_d0, 0x00ff, 2) + AM_RANGE(0x510102, 0x510103) AM_SELECT(0x000038) AM_DEVWRITE8_MOD("mainlatch", ls259_device, write_d0, rshift<2>, 0x00ff) AM_RANGE(0x510104, 0x510105) AM_DEVWRITE8("serial", gaelco_serial_device, data_w, 0x00ff) - AM_RANGE(0x510106, 0x510107) AM_SELECT(0x000070) AM_DEVWRITE8_RSHIFT("outlatch", ls259_device, write_d0, 0x00ff, 3) + AM_RANGE(0x510106, 0x510107) AM_SELECT(0x000070) AM_DEVWRITE8_MOD("outlatch", ls259_device, write_d0, rshift<3>, 0x00ff) AM_RANGE(0xfe7f80, 0xfe7fff) AM_WRITE(tms_comm_w) AM_SHARE("tms_comm_base") AM_RANGE(0xfe0000, 0xfeffff) AM_RAM AM_SHARE("m68k_ram_base") ADDRESS_MAP_END @@ -727,9 +727,9 @@ static ADDRESS_MAP_START( main020_map, AS_PROGRAM, 32, gaelco3d_state ) AM_RANGE(0x510040, 0x510043) AM_WRITE16(sound_data_w, 0xffff0000) AM_RANGE(0x510100, 0x510103) AM_READWRITE16(eeprom_data_r, irq_ack_w, 0xffff0000) AM_RANGE(0x510100, 0x510103) AM_DEVREAD8("serial", gaelco_serial_device, data_r, 0x000000ff) - AM_RANGE(0x510100, 0x510103) AM_SELECT(0x000038) AM_DEVWRITE8_RSHIFT("mainlatch", ls259_device, write_d0, 0x000000ff, 1) + AM_RANGE(0x510100, 0x510103) AM_SELECT(0x000038) AM_DEVWRITE8_MOD("mainlatch", ls259_device, write_d0, rshift<1>, 0x000000ff) AM_RANGE(0x510104, 0x510107) AM_DEVWRITE8("serial", gaelco_serial_device, data_w, 0x00ff0000) - AM_RANGE(0x510104, 0x510107) AM_SELECT(0x000070) AM_DEVWRITE8_RSHIFT("outlatch", ls259_device, write_d0, 0x000000ff, 2) + AM_RANGE(0x510104, 0x510107) AM_SELECT(0x000070) AM_DEVWRITE8_MOD("outlatch", ls259_device, write_d0, rshift<2>, 0x000000ff) AM_RANGE(0xfe7f80, 0xfe7fff) AM_WRITE16(tms_comm_w, 0xffffffff) AM_SHARE("tms_comm_base") AM_RANGE(0xfe0000, 0xfeffff) AM_RAM AM_SHARE("m68k_ram_base") ADDRESS_MAP_END diff --git a/src/mame/drivers/goodejan.cpp b/src/mame/drivers/goodejan.cpp index 30c334a8a31..80050f60155 100644 --- a/src/mame/drivers/goodejan.cpp +++ b/src/mame/drivers/goodejan.cpp @@ -459,7 +459,7 @@ static ADDRESS_MAP_START( totmejan_io_map, AS_IO, 16, goodejan_state ) ADDRESS_MAP_END static ADDRESS_MAP_START( goodejan_io_map, AS_IO, 16, goodejan_state ) - AM_RANGE(0x8000, 0x807f) AM_DEVREADWRITE("crtc", seibu_crtc_device, read_xor, write_xor) + AM_RANGE(0x8000, 0x807f) AM_DEVREADWRITE_MOD("crtc", seibu_crtc_device, read, write, xor<0x20>) AM_IMPORT_FROM(common_io_map) ADDRESS_MAP_END diff --git a/src/mame/drivers/gridlee.cpp b/src/mame/drivers/gridlee.cpp index 3ff622d3a38..f3551566f5a 100644 --- a/src/mame/drivers/gridlee.cpp +++ b/src/mame/drivers/gridlee.cpp @@ -303,7 +303,7 @@ WRITE_LINE_MEMBER(gridlee_state::coin_counter_w) static ADDRESS_MAP_START( cpu1_map, AS_PROGRAM, 8, gridlee_state ) AM_RANGE(0x0000, 0x07ff) AM_RAM AM_SHARE("spriteram") AM_RANGE(0x0800, 0x7fff) AM_RAM_WRITE(gridlee_videoram_w) AM_SHARE("videoram") - AM_RANGE(0x9000, 0x9000) AM_SELECT(0x0070) AM_DEVWRITE_RSHIFT("latch", ls259_device, write_d0, 4) + AM_RANGE(0x9000, 0x9000) AM_SELECT(0x0070) AM_DEVWRITE_MOD("latch", ls259_device, write_d0, rshift<4>) AM_RANGE(0x9200, 0x9200) AM_WRITE(gridlee_palette_select_w) AM_RANGE(0x9380, 0x9380) AM_DEVWRITE("watchdog", watchdog_timer_device, reset_w) AM_RANGE(0x9500, 0x9501) AM_READ(analog_port_r) diff --git a/src/mame/drivers/legionna.cpp b/src/mame/drivers/legionna.cpp index 68ea99d0acf..2ed11d1e1e2 100644 --- a/src/mame/drivers/legionna.cpp +++ b/src/mame/drivers/legionna.cpp @@ -187,7 +187,7 @@ static ADDRESS_MAP_START( legionna_map, AS_PROGRAM, 16, legionna_state ) AM_RANGE(0x100470, 0x100471) AM_WRITENOP // toggles 0x2000 / 0x0000, tile bank on some games AM_RANGE(0x100600, 0x10064f) AM_DEVREADWRITE("crtc", seibu_crtc_device, read, write) AM_RANGE(0x100680, 0x100681) AM_WRITENOP // irq ack? - AM_RANGE(0x100700, 0x10071f) AM_DEVREADWRITE8_RSHIFT("seibu_sound", seibu_sound_device, main_r, main_w, 0x00ff, 1) + AM_RANGE(0x100700, 0x10071f) AM_DEVREADWRITE8_MOD("seibu_sound", seibu_sound_device, main_r, main_w, rshift<1>, 0x00ff) AM_RANGE(0x100740, 0x100741) AM_READ_PORT("DSW1") AM_RANGE(0x100744, 0x100745) AM_READ_PORT("PLAYERS12") AM_RANGE(0x100748, 0x100749) AM_READ_PORT("PLAYERS34") @@ -214,7 +214,7 @@ static ADDRESS_MAP_START( heatbrl_map, AS_PROGRAM, 16, legionna_state ) AM_RANGE(0x100744, 0x100745) AM_READ_PORT("PLAYERS12") AM_RANGE(0x100748, 0x100749) AM_READ_PORT("PLAYERS34") AM_RANGE(0x10074c, 0x10074d) AM_READ_PORT("SYSTEM") - AM_RANGE(0x1007c0, 0x1007df) AM_DEVREADWRITE8_RSHIFT("seibu_sound", seibu_sound_device, main_r, main_w, 0x00ff, 1) + AM_RANGE(0x1007c0, 0x1007df) AM_DEVREADWRITE8_MOD("seibu_sound", seibu_sound_device, main_r, main_w, rshift<1>, 0x00ff) AM_RANGE(0x100800, 0x100fff) AM_RAM // _WRITE(legionna_background_w) AM_SHARE("back_data") AM_RANGE(0x101000, 0x1017ff) AM_RAM // _WRITE(legionna_foreground_w) AM_SHARE("fore_data") AM_RANGE(0x101800, 0x101fff) AM_RAM // _WRITE(legionna_midground_w) AM_SHARE("mid_data") @@ -231,7 +231,7 @@ static ADDRESS_MAP_START( godzilla_map, AS_PROGRAM, 16, legionna_state ) AM_RANGE(0x100470, 0x100471) AM_WRITE(denjinmk_setgfxbank) AM_RANGE(0x100600, 0x10064f) AM_DEVREADWRITE("crtc", seibu_crtc_device, read, write) AM_RANGE(0x100680, 0x100681) AM_WRITENOP // irq ack? - AM_RANGE(0x100700, 0x10071f) AM_DEVREADWRITE8_RSHIFT("seibu_sound", seibu_sound_device, main_r, main_w, 0x00ff, 1) + AM_RANGE(0x100700, 0x10071f) AM_DEVREADWRITE8_MOD("seibu_sound", seibu_sound_device, main_r, main_w, rshift<1>, 0x00ff) AM_RANGE(0x100740, 0x100741) AM_READ_PORT("DSW1") AM_RANGE(0x100744, 0x100745) AM_READ_PORT("PLAYERS12") AM_RANGE(0x100748, 0x100749) AM_READ_PORT("PLAYERS34") @@ -258,7 +258,7 @@ static ADDRESS_MAP_START( denjinmk_map, AS_PROGRAM, 16, legionna_state ) AM_RANGE(0x100470, 0x100471) AM_WRITE(denjinmk_setgfxbank) AM_RANGE(0x100600, 0x10064f) AM_DEVREADWRITE("crtc", seibu_crtc_device, read, write) AM_RANGE(0x100680, 0x100681) AM_WRITENOP // irq ack? - AM_RANGE(0x100700, 0x10071f) AM_READ8(denjinmk_sound_comms_r, 0xff) AM_DEVWRITE8_RSHIFT("seibu_sound", seibu_sound_device, main_w, 0x00ff, 1) + AM_RANGE(0x100700, 0x10071f) AM_READ8(denjinmk_sound_comms_r, 0xff) AM_DEVWRITE8_MOD("seibu_sound", seibu_sound_device, main_w, rshift<1>, 0x00ff) AM_RANGE(0x100740, 0x100741) AM_READ_PORT("DSW1") AM_RANGE(0x100744, 0x100745) AM_READ_PORT("PLAYERS12") AM_RANGE(0x100748, 0x100749) AM_READ_PORT("PLAYERS34") @@ -284,7 +284,7 @@ static ADDRESS_MAP_START( grainbow_map, AS_PROGRAM, 16, legionna_state ) AM_RANGE(0x100480, 0x100487) AM_WRITE(grainbow_layer_config_w) // probably a COP feature AM_RANGE(0x100600, 0x10064f) AM_DEVREADWRITE("crtc", seibu_crtc_device, read, write) AM_RANGE(0x100680, 0x100681) AM_WRITENOP // irq ack? - AM_RANGE(0x100700, 0x10071f) AM_DEVREADWRITE8_RSHIFT("seibu_sound", seibu_sound_device, main_r, main_w, 0x00ff, 1) + AM_RANGE(0x100700, 0x10071f) AM_DEVREADWRITE8_MOD("seibu_sound", seibu_sound_device, main_r, main_w, rshift<1>, 0x00ff) AM_RANGE(0x100740, 0x100741) AM_READ_PORT("DSW1") AM_RANGE(0x100744, 0x100745) AM_READ_PORT("PLAYERS12") AM_RANGE(0x100748, 0x100749) AM_READ_PORT("PLAYERS34") @@ -308,7 +308,7 @@ static ADDRESS_MAP_START( cupsoc_mem, AS_PROGRAM, 16, legionna_state ) AM_RANGE(0x100000, 0x1003ff) AM_RAM AM_RANGE(0x100600, 0x10064f) AM_DEVREADWRITE("crtc", seibu_crtc_device, read, write) AM_RANGE(0x100680, 0x100681) AM_WRITENOP // irq ack? - AM_RANGE(0x100700, 0x10071f) AM_DEVREADWRITE8_RSHIFT("seibu_sound", seibu_sound_device, main_r, main_w, 0x00ff, 1) + AM_RANGE(0x100700, 0x10071f) AM_DEVREADWRITE8_MOD("seibu_sound", seibu_sound_device, main_r, main_w, rshift<1>, 0x00ff) AM_RANGE(0x100740, 0x100741) AM_READ_PORT("DSW1") AM_RANGE(0x100744, 0x100745) AM_READ_PORT("PLAYERS12") AM_RANGE(0x100748, 0x100749) AM_READ_PORT("PLAYERS34") @@ -333,14 +333,14 @@ static ADDRESS_MAP_START( cupsocs_mem, AS_PROGRAM, 16, legionna_state ) AM_IMPORT_FROM( legionna_cop_mem ) AM_RANGE(0x000000, 0x0fffff) AM_ROM AM_RANGE(0x100000, 0x1003ff) AM_RAM - AM_RANGE(0x100600, 0x10067f) AM_DEVREADWRITE("crtc", seibu_crtc_device, read_xor, write_xor) + AM_RANGE(0x100600, 0x10067f) AM_DEVREADWRITE_MOD("crtc", seibu_crtc_device, read, write, xor<0x20>) AM_RANGE(0x100680, 0x100681) AM_WRITENOP // irq ack? AM_RANGE(0x100700, 0x100701) AM_READ_PORT("DSW1") AM_RANGE(0x100704, 0x100705) AM_READ_PORT("PLAYERS12") AM_RANGE(0x100708, 0x100709) AM_READ_PORT("PLAYERS34") AM_RANGE(0x10070c, 0x10070d) AM_READ_PORT("SYSTEM") AM_RANGE(0x10071c, 0x10071d) AM_READ_PORT("DSW2") - AM_RANGE(0x100740, 0x10075f) AM_DEVREADWRITE8_RSHIFT("seibu_sound", seibu_sound_device, main_r, main_w, 0x00ff, 1) + AM_RANGE(0x100740, 0x10075f) AM_DEVREADWRITE8_MOD("seibu_sound", seibu_sound_device, main_r, main_w, rshift<1>, 0x00ff) AM_RANGE(0x100800, 0x100fff) AM_RAM // _WRITE(legionna_background_w) AM_SHARE("back_data") AM_RANGE(0x101000, 0x1017ff) AM_RAM // _WRITE(legionna_foreground_w) AM_SHARE("fore_data") AM_RANGE(0x101800, 0x101fff) AM_RAM // _WRITE(legionna_midground_w) AM_SHARE("mid_data") diff --git a/src/mame/drivers/r2dx_v33.cpp b/src/mame/drivers/r2dx_v33.cpp index b31b03ee6e8..4c22095739c 100644 --- a/src/mame/drivers/r2dx_v33.cpp +++ b/src/mame/drivers/r2dx_v33.cpp @@ -478,7 +478,7 @@ static ADDRESS_MAP_START( nzeroteam_base_map, AS_PROGRAM, 16, r2dx_v33_state ) // AM_RANGE(0x00762, 0x00763) AM_READ(nzerotea_unknown_r) - AM_RANGE(0x00780, 0x0079f) AM_DEVREADWRITE8_RSHIFT("seibu_sound", seibu_sound_device, main_r, main_w, 0x00ff, 1) + AM_RANGE(0x00780, 0x0079f) AM_DEVREADWRITE8_MOD("seibu_sound", seibu_sound_device, main_r, main_w, rshift<1>, 0x00ff) AM_RANGE(0x00800, 0x00fff) AM_RAM AM_RANGE(0x01000, 0x0bfff) AM_RAM diff --git a/src/mame/drivers/raiden2.cpp b/src/mame/drivers/raiden2.cpp index a1cfa100254..efb99396e8d 100644 --- a/src/mame/drivers/raiden2.cpp +++ b/src/mame/drivers/raiden2.cpp @@ -967,7 +967,7 @@ static ADDRESS_MAP_START( raiden2_mem, AS_PROGRAM, 16, raiden2_state ) AM_IMPORT_FROM( raiden2_cop_mem ) - AM_RANGE(0x00700, 0x0071f) AM_DEVREADWRITE8_RSHIFT("seibu_sound", seibu_sound_device, main_r, main_w, 0x00ff, 1) + AM_RANGE(0x00700, 0x0071f) AM_DEVREADWRITE8_MOD("seibu_sound", seibu_sound_device, main_r, main_w, rshift<1>, 0x00ff) AM_RANGE(0x00740, 0x00741) AM_READ_PORT("DSW") AM_RANGE(0x00744, 0x00745) AM_READ_PORT("P1_P2") @@ -1008,7 +1008,7 @@ static ADDRESS_MAP_START( zeroteam_mem, AS_PROGRAM, 16, raiden2_state ) AM_IMPORT_FROM( raiden2_cop_mem ) - AM_RANGE(0x00700, 0x0071f) AM_DEVREADWRITE8_RSHIFT("seibu_sound", seibu_sound_device, main_r, main_w, 0x00ff, 1) + AM_RANGE(0x00700, 0x0071f) AM_DEVREADWRITE8_MOD("seibu_sound", seibu_sound_device, main_r, main_w, rshift<1>, 0x00ff) AM_RANGE(0x00740, 0x00741) AM_READ_PORT("DSW") AM_RANGE(0x00744, 0x00745) AM_READ_PORT("P1_P2") @@ -1039,7 +1039,7 @@ static ADDRESS_MAP_START( xsedae_mem, AS_PROGRAM, 16, raiden2_state ) AM_IMPORT_FROM( raiden2_cop_mem ) - AM_RANGE(0x00700, 0x0071f) AM_DEVREADWRITE8_RSHIFT("seibu_sound", seibu_sound_device, main_r, main_w, 0x00ff, 1) + AM_RANGE(0x00700, 0x0071f) AM_DEVREADWRITE8_MOD("seibu_sound", seibu_sound_device, main_r, main_w, rshift<1>, 0x00ff) AM_RANGE(0x00740, 0x00741) AM_READ_PORT("DSW") AM_RANGE(0x00744, 0x00745) AM_READ_PORT("P1_P2") diff --git a/src/mame/drivers/splash.cpp b/src/mame/drivers/splash.cpp index 31ae4dbab39..d57d6456213 100644 --- a/src/mame/drivers/splash.cpp +++ b/src/mame/drivers/splash.cpp @@ -102,7 +102,7 @@ static ADDRESS_MAP_START( splash_map, AS_PROGRAM, 16, splash_state ) AM_RANGE(0x840002, 0x840003) AM_READ_PORT("DSW2") AM_RANGE(0x840004, 0x840005) AM_READ_PORT("P1") AM_RANGE(0x840006, 0x840007) AM_READ_PORT("P2") - AM_RANGE(0x84000a, 0x84000b) AM_SELECT(0x000070) AM_DEVWRITE8_RSHIFT("outlatch", ls259_device, write_d0, 0xff00, 3) + AM_RANGE(0x84000a, 0x84000b) AM_SELECT(0x000070) AM_DEVWRITE8_MOD("outlatch", ls259_device, write_d0, rshift<3>, 0xff00) AM_RANGE(0x84000e, 0x84000f) AM_WRITE(splash_sh_irqtrigger_w) /* Sound command */ AM_RANGE(0x880000, 0x8817ff) AM_RAM_WRITE(vram_w) AM_SHARE("videoram") /* Video RAM */ AM_RANGE(0x881800, 0x881803) AM_RAM AM_SHARE("vregs") /* Scroll registers */ @@ -175,7 +175,7 @@ static ADDRESS_MAP_START( roldfrog_map, AS_PROGRAM, 16, splash_state ) AM_RANGE(0x840002, 0x840003) AM_READ_PORT("DSW2") AM_RANGE(0x840004, 0x840005) AM_READ_PORT("P1") AM_RANGE(0x840006, 0x840007) AM_READ_PORT("P2") - AM_RANGE(0x84000a, 0x84000b) AM_SELECT(0x000070) AM_DEVWRITE8_RSHIFT("outlatch", ls259_device, write_d0, 0xff00, 3) + AM_RANGE(0x84000a, 0x84000b) AM_SELECT(0x000070) AM_DEVWRITE8_MOD("outlatch", ls259_device, write_d0, rshift<3>, 0xff00) AM_RANGE(0x84000e, 0x84000f) AM_WRITE(roldf_sh_irqtrigger_w) /* Sound command */ AM_RANGE(0x880000, 0x8817ff) AM_RAM_WRITE(vram_w) AM_SHARE("videoram") /* Video RAM */ AM_RANGE(0x881800, 0x881803) AM_RAM AM_SHARE("vregs") /* Scroll registers */ diff --git a/src/mame/drivers/taito_l.cpp b/src/mame/drivers/taito_l.cpp index 368ff0b64a1..294e759a429 100644 --- a/src/mame/drivers/taito_l.cpp +++ b/src/mame/drivers/taito_l.cpp @@ -657,7 +657,7 @@ static ADDRESS_MAP_START( horshoes_map, AS_PROGRAM, 8, horshoes_state ) AM_IMPORT_FROM(common_banks_map) AM_RANGE(0x8000, 0x9fff) AM_RAM AM_RANGE(0xa000, 0xa003) AM_READ(extport_select_and_ym2203_r) AM_DEVWRITE("ymsnd", ym2203_device, write) - AM_RANGE(0xa800, 0xa800) AM_SELECT(0x000c) AM_DEVREAD_RSHIFT("upd4701", upd4701_device, read_xy, 2) + AM_RANGE(0xa800, 0xa800) AM_SELECT(0x000c) AM_DEVREAD_MOD("upd4701", upd4701_device, read_xy, rshift<2>) AM_RANGE(0xa802, 0xa802) AM_DEVREAD("upd4701", upd4701_device, reset_x) AM_RANGE(0xa803, 0xa803) AM_DEVREAD("upd4701", upd4701_device, reset_y) AM_RANGE(0xb801, 0xb801) AM_READNOP // Watchdog or interrupt ack diff --git a/src/mame/drivers/thoop2.cpp b/src/mame/drivers/thoop2.cpp index 3695f358170..427afb9315b 100644 --- a/src/mame/drivers/thoop2.cpp +++ b/src/mame/drivers/thoop2.cpp @@ -127,7 +127,7 @@ static ADDRESS_MAP_START( thoop2_map, AS_PROGRAM, 16, thoop2_state ) AM_RANGE(0x700004, 0x700005) AM_READ_PORT("P1") AM_RANGE(0x700006, 0x700007) AM_READ_PORT("P2") AM_RANGE(0x700008, 0x700009) AM_READ_PORT("SYSTEM") - AM_RANGE(0x70000a, 0x70000b) AM_SELECT(0x000070) AM_DEVWRITE8_RSHIFT("outlatch", ls259_device, write_d0, 0x00ff, 3) + AM_RANGE(0x70000a, 0x70000b) AM_SELECT(0x000070) AM_DEVWRITE8_MOD("outlatch", ls259_device, write_d0, rshift<3>, 0x00ff) AM_RANGE(0x70000c, 0x70000d) AM_WRITE8(OKIM6295_bankswitch_w, 0x00ff) /* OKI6295 bankswitch */ AM_RANGE(0x70000e, 0x70000f) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff) /* OKI6295 data register */ AM_RANGE(0xfe0000, 0xfe7fff) AM_RAM /* Work RAM */ diff --git a/src/mame/drivers/timeplt.cpp b/src/mame/drivers/timeplt.cpp index 47539003377..79673d94d59 100644 --- a/src/mame/drivers/timeplt.cpp +++ b/src/mame/drivers/timeplt.cpp @@ -142,7 +142,7 @@ static ADDRESS_MAP_START( timeplt_main_map, AS_PROGRAM, 8, timeplt_state ) AM_RANGE(0xc000, 0xc000) AM_MIRROR(0x0cff) AM_READ(scanline_r) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) AM_RANGE(0xc200, 0xc200) AM_MIRROR(0x0cff) AM_READ_PORT("DSW1") AM_DEVWRITE("watchdog", watchdog_timer_device, reset_w) AM_RANGE(0xc300, 0xc300) AM_MIRROR(0x0c9f) AM_READ_PORT("IN0") - AM_RANGE(0xc300, 0xc30f) AM_MIRROR(0x0cf0) AM_DEVWRITE_RSHIFT("mainlatch", ls259_device, write_d0, 1) + AM_RANGE(0xc300, 0xc30f) AM_MIRROR(0x0cf0) AM_DEVWRITE_MOD("mainlatch", ls259_device, write_d0, rshift<1>) AM_RANGE(0xc320, 0xc320) AM_MIRROR(0x0c9f) AM_READ_PORT("IN1") AM_RANGE(0xc340, 0xc340) AM_MIRROR(0x0c9f) AM_READ_PORT("IN2") AM_RANGE(0xc360, 0xc360) AM_MIRROR(0x0c9f) AM_READ_PORT("DSW0") diff --git a/src/mame/drivers/wrally.cpp b/src/mame/drivers/wrally.cpp index d9199197baa..78eb2a94eb9 100644 --- a/src/mame/drivers/wrally.cpp +++ b/src/mame/drivers/wrally.cpp @@ -154,7 +154,7 @@ static ADDRESS_MAP_START( wrally_map, AS_PROGRAM, 16, wrally_state ) AM_RANGE(0x700002, 0x700003) AM_READ_PORT("P1_P2") AM_RANGE(0x700004, 0x700005) AM_READ_PORT("WHEEL") AM_RANGE(0x700008, 0x700009) AM_READ_PORT("SYSTEM") - AM_RANGE(0x70000a, 0x70000b) AM_SELECT(0x000070) AM_DEVWRITE8_RSHIFT("outlatch", ls259_device, write_d0, 0x00ff, 3) + AM_RANGE(0x70000a, 0x70000b) AM_SELECT(0x000070) AM_DEVWRITE8_MOD("outlatch", ls259_device, write_d0, rshift<3>, 0x00ff) AM_RANGE(0x70000c, 0x70000d) AM_WRITE(okim6295_bankswitch_w) /* OKI6295 bankswitch */ AM_RANGE(0x70000e, 0x70000f) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff) /* OKI6295 status/data register */ AM_RANGE(0xfec000, 0xfeffff) AM_RAM AM_SHARE("shareram") /* Work RAM (shared with DS5002FP) */ diff --git a/src/mame/video/seibu_crtc.cpp b/src/mame/video/seibu_crtc.cpp index 194b1bebdeb..24a9dcc7f41 100644 --- a/src/mame/video/seibu_crtc.cpp +++ b/src/mame/video/seibu_crtc.cpp @@ -377,14 +377,3 @@ WRITE16_MEMBER( seibu_crtc_device::write_alt ) { write_word(BITSWAP16(offset,15,14,13,12,11,10,9,8,7,6,5,3,4,2,1,0),data); } - -/* Good E Jang / Seibu Cup Soccer Selection XOR bit 6 of the address bus */ -READ16_MEMBER( seibu_crtc_device::read_xor ) -{ - return read_word(offset ^ 0x20); -} - -WRITE16_MEMBER( seibu_crtc_device::write_xor ) -{ - write_word(offset ^ 0x20,data); -} diff --git a/src/mame/video/seibu_crtc.h b/src/mame/video/seibu_crtc.h index 072ad553155..985dea8f184 100644 --- a/src/mame/video/seibu_crtc.h +++ b/src/mame/video/seibu_crtc.h @@ -55,10 +55,8 @@ public: // I/O operations DECLARE_WRITE16_MEMBER( write ); DECLARE_WRITE16_MEMBER( write_alt ); - DECLARE_WRITE16_MEMBER( write_xor ); DECLARE_READ16_MEMBER( read ); DECLARE_READ16_MEMBER( read_alt ); - DECLARE_READ16_MEMBER( read_xor ); DECLARE_WRITE16_MEMBER(decrypt_key_w); DECLARE_WRITE16_MEMBER(layer_en_w); DECLARE_READ16_MEMBER(reg_1a_r);