From ac3bf44b2ddb7796d3a70db6bd47837254840df2 Mon Sep 17 00:00:00 2001 From: Robbbert Date: Thu, 12 Apr 2018 01:23:58 +1000 Subject: (nw) more address map modernisation --- src/mame/drivers/a2600.cpp | 2 +- src/mame/drivers/asst128.cpp | 2 +- src/mame/drivers/de_2.cpp | 23 ++++++++++++----------- src/mame/drivers/galaga.cpp | 11 ++++++----- src/mame/drivers/qtsbc.cpp | 6 +++--- src/mame/drivers/rz1.cpp | 21 +++++++++++---------- src/mame/drivers/s11c.cpp | 36 +++++++++++++++++++----------------- src/mame/drivers/segapico.cpp | 15 +++++++-------- src/mame/drivers/sg1000.cpp | 34 ++++++++++++++++++---------------- src/mame/drivers/tv912.cpp | 2 +- 10 files changed, 79 insertions(+), 73 deletions(-) diff --git a/src/mame/drivers/a2600.cpp b/src/mame/drivers/a2600.cpp index dda836baec3..15f75b2a03f 100644 --- a/src/mame/drivers/a2600.cpp +++ b/src/mame/drivers/a2600.cpp @@ -39,7 +39,7 @@ void a2600_base_state::a2600_mem(address_map &map) // 6507 has 13-bit address sp map(0x0280, 0x029f).mirror(0x0d00).rw("riot", FUNC(riot6532_device::read), FUNC(riot6532_device::write)); #endif // map(0x1000, 0x1fff) is cart data and it is configured at reset time, depending on the mounted cart! -ADDRESS_MAP_END +} READ8_MEMBER(a2600_state::cart_over_all_r) diff --git a/src/mame/drivers/asst128.cpp b/src/mame/drivers/asst128.cpp index 7ef75c25160..2f57c589324 100644 --- a/src/mame/drivers/asst128.cpp +++ b/src/mame/drivers/asst128.cpp @@ -32,7 +32,7 @@ void asst128_mb_device::map(address_map &map) map(0x0060, 0x006f).rw("ppi8255", FUNC(i8255_device::read), FUNC(i8255_device::write)); map(0x0080, 0x008f).w(this, FUNC(asst128_mb_device::pc_page_w)); map(0x00a0, 0x00a1).w(this, FUNC(asst128_mb_device::nmi_enable_w)); -ADDRESS_MAP_END +} DEFINE_DEVICE_TYPE(ASST128_MOTHERBOARD, asst128_mb_device, "asst128_mb", "ASST128_MOTHERBOARD") diff --git a/src/mame/drivers/de_2.cpp b/src/mame/drivers/de_2.cpp index 8e52c445642..c58ca6f62f0 100644 --- a/src/mame/drivers/de_2.cpp +++ b/src/mame/drivers/de_2.cpp @@ -118,17 +118,18 @@ private: }; -ADDRESS_MAP_START(de_2_state::de_2_map) - AM_RANGE(0x0000, 0x1fff) AM_RAM AM_SHARE("nvram") - AM_RANGE(0x2100, 0x2103) AM_DEVREADWRITE("pia21", pia6821_device, read, write) // sound+solenoids - AM_RANGE(0x2200, 0x2200) AM_WRITE(sol3_w) // solenoids - AM_RANGE(0x2400, 0x2403) AM_DEVREADWRITE("pia24", pia6821_device, read, write) // lamps - AM_RANGE(0x2800, 0x2803) AM_DEVREADWRITE("pia28", pia6821_device, read, write) // display - AM_RANGE(0x2c00, 0x2c03) AM_DEVREADWRITE("pia2c", pia6821_device, read, write) // alphanumeric display - AM_RANGE(0x3000, 0x3003) AM_DEVREADWRITE("pia30", pia6821_device, read, write) // inputs - AM_RANGE(0x3400, 0x3403) AM_DEVREADWRITE("pia34", pia6821_device, read, write) // widget - AM_RANGE(0x4000, 0xffff) AM_ROM -ADDRESS_MAP_END +void de_2_state::de_2_map(address_map &map) +{ + map(0x0000, 0x1fff).ram().share("nvram"); + map(0x2100, 0x2103).rw("pia21", FUNC(pia6821_device::read), FUNC(pia6821_device::write)); // sound+solenoids + map(0x2200, 0x2200).w(this, FUNC(de_2_state::sol3_w)); // solenoids + map(0x2400, 0x2403).rw("pia24", FUNC(pia6821_device::read), FUNC(pia6821_device::write)); // lamps + map(0x2800, 0x2803).rw("pia28", FUNC(pia6821_device::read), FUNC(pia6821_device::write)); // display + map(0x2c00, 0x2c03).rw("pia2c", FUNC(pia6821_device::read), FUNC(pia6821_device::write)); // alphanumeric display + map(0x3000, 0x3003).rw("pia30", FUNC(pia6821_device::read), FUNC(pia6821_device::write)); // inputs + map(0x3400, 0x3403).rw("pia34", FUNC(pia6821_device::read), FUNC(pia6821_device::write)); // widget + map(0x4000, 0xffff).rom(); +} void de_2_state::de_2_audio_map(address_map &map) { diff --git a/src/mame/drivers/galaga.cpp b/src/mame/drivers/galaga.cpp index a2f3e96259d..6765f9caa3c 100644 --- a/src/mame/drivers/galaga.cpp +++ b/src/mame/drivers/galaga.cpp @@ -937,11 +937,12 @@ void xevious_state::battles_mem4(address_map &map) map(0x8000, 0x80ff).ram(); } -ADDRESS_MAP_START(galaga_state::dzigzag_mem4) - AM_RANGE(0x0000, 0x0fff) AM_ROM - AM_RANGE(0x1000, 0x107f) AM_RAM - AM_RANGE(0x4000, 0x4007) AM_READONLY // dip switches? bits 0 & 1 used -ADDRESS_MAP_END +void galaga_state::dzigzag_mem4(address_map &map) +{ + map(0x0000, 0x0fff).rom(); + map(0x1000, 0x107f).ram(); + map(0x4000, 0x4007).readonly(); // dip switches? bits 0 & 1 used +} static INPUT_PORTS_START( bosco ) diff --git a/src/mame/drivers/qtsbc.cpp b/src/mame/drivers/qtsbc.cpp index d149b7ff195..98bd1d493a0 100644 --- a/src/mame/drivers/qtsbc.cpp +++ b/src/mame/drivers/qtsbc.cpp @@ -204,14 +204,14 @@ void qtsbc_state::mem_map(address_map &map) { map.unmap_value_high(); map(0x0000, 0xffff).ram().share("ram"); - map(0x0000, 0xffff).r(this, FUNC(qtsbc_state::memory_r)).w(this, FUNC(qtsbc_state::memory_w)); + map(0x0000, 0xffff).rw(this, FUNC(qtsbc_state::memory_r), FUNC(qtsbc_state::memory_w)); } void qtsbc_state::io_map(address_map &map) { map.unmap_value_high(); - map(0x0000, 0xffff).r(this, FUNC(qtsbc_state::io_r)).w(this, FUNC(qtsbc_state::io_w)); -ADDRESS_MAP_END + map(0x0000, 0xffff).rw(this, FUNC(qtsbc_state::io_r), FUNC(qtsbc_state::io_w)); +} /* Input ports */ static INPUT_PORTS_START( qtsbc ) diff --git a/src/mame/drivers/rz1.cpp b/src/mame/drivers/rz1.cpp index 96e289b552b..a0431eeed1d 100644 --- a/src/mame/drivers/rz1.cpp +++ b/src/mame/drivers/rz1.cpp @@ -94,16 +94,17 @@ private: // ADDRESS MAPS //************************************************************************** -ADDRESS_MAP_START( rz1_state::map ) -// AM_RANGE(0x0000, 0x0fff) AM_ROM AM_REGION("maincpu", 0) - AM_RANGE(0x2000, 0x3fff) AM_RAM - AM_RANGE(0x4000, 0x7fff) AM_ROM AM_REGION("program", 0) - AM_RANGE(0x8000, 0x8fff) AM_WRITE(upd934g_c_w) - AM_RANGE(0x9000, 0x9fff) AM_READWRITE(key_r, upd934g_b_w) - AM_RANGE(0xa000, 0xbfff) AM_RAM // sample ram 1 - AM_RANGE(0xc000, 0xdfff) AM_RAM // sample ram 2 - AM_RANGE(0xe000, 0xe001) AM_WRITE(leds_w) -ADDRESS_MAP_END +void rz1_state::map(address_map &map) +{ +// map(0x0000, 0x0fff).rom().region("maincpu", 0); + map(0x2000, 0x3fff).ram(); + map(0x4000, 0x7fff).rom().region("program", 0); + map(0x8000, 0x8fff).w(this, FUNC(rz1_state::upd934g_c_w)); + map(0x9000, 0x9fff).rw(this, FUNC(rz1_state::key_r), FUNC(rz1_state::upd934g_b_w)); + map(0xa000, 0xbfff).ram(); // sample ram 1 + map(0xc000, 0xdfff).ram(); // sample ram 2 + map(0xe000, 0xe001).w(this, FUNC(rz1_state::leds_w)); +} //************************************************************************** diff --git a/src/mame/drivers/s11c.cpp b/src/mame/drivers/s11c.cpp index 51fd06beff0..128af7ea3ec 100644 --- a/src/mame/drivers/s11c.cpp +++ b/src/mame/drivers/s11c.cpp @@ -27,23 +27,25 @@ void s11c_state::s11c_main_map(address_map &map) map(0x4000, 0xffff).rom(); } -ADDRESS_MAP_START(s11c_state::s11c_audio_map) - AM_RANGE(0x0000, 0x07ff) AM_MIRROR(0x0800) AM_RAM - AM_RANGE(0x1000, 0x1fff) AM_WRITE(bank_w) - AM_RANGE(0x2000, 0x2003) AM_MIRROR(0x0ffc) AM_DEVREADWRITE("pias", pia6821_device, read, write) - AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank0") - AM_RANGE(0xc000, 0xffff) AM_ROMBANK("bank1") -ADDRESS_MAP_END - -ADDRESS_MAP_START(s11c_state::s11c_bg_map) - AM_RANGE(0x0000, 0x07ff) AM_RAM - AM_RANGE(0x2000, 0x2001) AM_MIRROR(0x1ffe) AM_DEVREADWRITE("ym2151", ym2151_device, read, write) - AM_RANGE(0x4000, 0x4003) AM_MIRROR(0x1ffc) AM_DEVREADWRITE("pia40", pia6821_device, read, write) - AM_RANGE(0x6000, 0x67ff) AM_WRITE(bg_speech_digit_w) - AM_RANGE(0x6800, 0x6fff) AM_WRITE(bg_speech_clock_w) - AM_RANGE(0x7800, 0x7fff) AM_WRITE(bgbank_w) - AM_RANGE(0x8000, 0xffff) AM_ROMBANK("bgbank") -ADDRESS_MAP_END +void s11c_state::s11c_audio_map(address_map &map) +{ + map(0x0000, 0x07ff).mirror(0x0800).ram(); + map(0x1000, 0x1fff).w(this, FUNC(s11c_state::bank_w)); + map(0x2000, 0x2003).mirror(0x0ffc).rw("pias", FUNC(pia6821_device::read), FUNC(pia6821_device::write)); + map(0x8000, 0xbfff).bankr("bank0"); + map(0xc000, 0xffff).bankr("bank1"); +} + +void s11c_state::s11c_bg_map(address_map &map) +{ + map(0x0000, 0x07ff).ram(); + map(0x2000, 0x2001).mirror(0x1ffe).rw("ym2151", FUNC(ym2151_device::read), FUNC(ym2151_device::write)); + map(0x4000, 0x4003).mirror(0x1ffc).rw("pia40", FUNC(pia6821_device::read), FUNC(pia6821_device::write)); + map(0x6000, 0x67ff).w(this, FUNC(s11c_state::bg_speech_digit_w)); + map(0x6800, 0x6fff).w(this, FUNC(s11c_state::bg_speech_clock_w)); + map(0x7800, 0x7fff).w(this, FUNC(s11c_state::bgbank_w)); + map(0x8000, 0xffff).bankr("bgbank"); +} static INPUT_PORTS_START( s11c ) PORT_START("X0") diff --git a/src/mame/drivers/segapico.cpp b/src/mame/drivers/segapico.cpp index 7e5a5c2d2ab..6f7280ab75c 100644 --- a/src/mame/drivers/segapico.cpp +++ b/src/mame/drivers/segapico.cpp @@ -341,14 +341,13 @@ WRITE16_MEMBER(pico_base_state::pico_68k_io_write ) } } -ADDRESS_MAP_START(pico_base_state::pico_mem) - AM_RANGE(0x000000, 0x3fffff) AM_ROM - - AM_RANGE(0x800000, 0x80001f) AM_READWRITE(pico_68k_io_read, pico_68k_io_write) - - AM_RANGE(0xc00000, 0xc0001f) AM_DEVREADWRITE("gen_vdp", sega315_5313_device, vdp_r, vdp_w) - AM_RANGE(0xe00000, 0xe0ffff) AM_RAM AM_MIRROR(0x1f0000) -ADDRESS_MAP_END +void pico_base_state::pico_mem(address_map &map) +{ + map(0x000000, 0x3fffff).rom(); + map(0x800000, 0x80001f).rw(this, FUNC(pico_base_state::pico_68k_io_read), FUNC(pico_base_state::pico_68k_io_write)); + map(0xc00000, 0xc0001f).rw("gen_vdp", FUNC(sega315_5313_device::vdp_r), FUNC(sega315_5313_device::vdp_w)); + map(0xe00000, 0xe0ffff).ram().mirror(0x1f0000); +} static INPUT_PORTS_START( pico ) diff --git a/src/mame/drivers/sg1000.cpp b/src/mame/drivers/sg1000.cpp index b4624a0666c..c9ce4f770fc 100644 --- a/src/mame/drivers/sg1000.cpp +++ b/src/mame/drivers/sg1000.cpp @@ -174,31 +174,33 @@ void sg1000_state::omv_io_map(address_map &map) ADDRESS_MAP( sc3000_map ) -------------------------------------------------*/ -ADDRESS_MAP_START(sg1000_state::sc3000_map) - AM_RANGE(0x0000, 0xbfff) AM_DEVREADWRITE(CARTSLOT_TAG, sega8_cart_slot_device, read_cart, write_cart) - AM_RANGE(0xc000, 0xc7ff) AM_MIRROR(0x3800) AM_RAM -ADDRESS_MAP_END +void sg1000_state::sc3000_map(address_map &map) +{ + map(0x0000, 0xbfff).rw(CARTSLOT_TAG, FUNC(sega8_cart_slot_device::read_cart), FUNC(sega8_cart_slot_device::write_cart)); + map(0xc000, 0xc7ff).mirror(0x3800).ram(); +} /*------------------------------------------------- ADDRESS_MAP( sc3000_io_map ) -------------------------------------------------*/ -ADDRESS_MAP_START(sg1000_state::sc3000_io_map) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x7f, 0x7f) AM_DEVWRITE(SN76489AN_TAG, sn76489a_device, write) - AM_RANGE(0xbe, 0xbe) AM_DEVREADWRITE(TMS9918A_TAG, tms9918a_device, vram_read, vram_write) - AM_RANGE(0xbf, 0xbf) AM_DEVREADWRITE(TMS9918A_TAG, tms9918a_device, register_read, register_write) - AM_RANGE(0xdc, 0xdf) AM_READWRITE(peripheral_r, peripheral_w) -ADDRESS_MAP_END +void sg1000_state::sc3000_io_map(address_map &map) +{ + map.global_mask(0xff); + map(0x7f, 0x7f).w(SN76489AN_TAG, FUNC(sn76489a_device::write)); + map(0xbe, 0xbe).rw(TMS9918A_TAG, FUNC(tms9918a_device::vram_read), FUNC(tms9918a_device::vram_write)); + map(0xbf, 0xbf).rw(TMS9918A_TAG, FUNC(tms9918a_device::register_read), FUNC(tms9918a_device::register_write)); + map(0xdc, 0xdf).rw(this, FUNC(sg1000_state::peripheral_r), FUNC(sg1000_state::peripheral_w)); +} /* This is how the I/O ports are really mapped, but MAME does not support overlapping ranges ADDRESS_MAP_START(sg1000_state::sc3000_io_map) ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_MIRROR(0xdf) AM_DEVREADWRITE(UPD9255_TAG, i8255_device, read, write) - AM_RANGE(0x00, 0x00) AM_MIRROR(0x7f) AM_DEVWRITE(SN76489AN_TAG, sn76489a_device, write) - AM_RANGE(0x00, 0x00) AM_MIRROR(0xae) AM_DEVREADWRITE(TMS9918A_TAG, tms9918a_device, vram_read, vram_write) - AM_RANGE(0x01, 0x01) AM_MIRROR(0xae) AM_DEVREADWRITE(TMS9918A_TAG, tms9918a_device, register_read, register_write) - AM_RANGE(0x60, 0x60) AM_MIRROR(0x9f) AM_READ(sc3000_r_r) + map(0x00, 0x00) AM_MIRROR(0xdf) AM_DEVREADWRITE(UPD9255_TAG, i8255_device, read, write) + map(0x00, 0x00) AM_MIRROR(0x7f) AM_DEVWRITE(SN76489AN_TAG, sn76489a_device, write) + map(0x00, 0x00) AM_MIRROR(0xae) AM_DEVREADWRITE(TMS9918A_TAG, tms9918a_device, vram_read, vram_write) + map(0x01, 0x01) AM_MIRROR(0xae) AM_DEVREADWRITE(TMS9918A_TAG, tms9918a_device, register_read, register_write) + map(0x60, 0x60) AM_MIRROR(0x9f) AM_READ(sc3000_r_r) ADDRESS_MAP_END */ diff --git a/src/mame/drivers/tv912.cpp b/src/mame/drivers/tv912.cpp index e8c14e85bfa..0987f4689f0 100644 --- a/src/mame/drivers/tv912.cpp +++ b/src/mame/drivers/tv912.cpp @@ -476,7 +476,7 @@ static INPUT_PORTS_START( switches ) PORT_DIPNAME(0x03, 0x02, "DTR (RS232)") PORT_DIPLOCATION("S5:3,4") PORT_DIPSETTING(0x02, "Tied to RTS") PORT_DIPSETTING(0x01, "Pulled to +12V") -ADDRESS_MAP_END +INPUT_PORTS_END static INPUT_PORTS_START( tv912b ) PORT_INCLUDE(switches) -- cgit v1.2.3