diff options
author | 2018-03-13 07:36:43 +0100 | |
---|---|---|
committer | 2018-03-14 14:07:14 +0100 | |
commit | 115bb9936c5cd3faf955d7eb1e251a94e4744b7b (patch) | |
tree | f0230f547f6c750f9974c61479eef28cbe4ad571 /src/mame/drivers/polepos.cpp | |
parent | f155992daab88ad024cec995428a67108218b51d (diff) |
Address maps macros removal, pass 1 [O. Galibert]
Diffstat (limited to 'src/mame/drivers/polepos.cpp')
-rw-r--r-- | src/mame/drivers/polepos.cpp | 134 |
1 files changed, 71 insertions, 63 deletions
diff --git a/src/mame/drivers/polepos.cpp b/src/mame/drivers/polepos.cpp index beff2b2c65c..fd5eed82c11 100644 --- a/src/mame/drivers/polepos.cpp +++ b/src/mame/drivers/polepos.cpp @@ -422,52 +422,57 @@ MACHINE_RESET_MEMBER(polepos_state,polepos) * CPU memory structures *********************************************************************/ -ADDRESS_MAP_START(polepos_state::z80_map) - AM_RANGE(0x0000, 0x2fff) AM_ROM - AM_RANGE(0x3000, 0x37ff) AM_MIRROR(0x0800) AM_RAM AM_SHARE("nvram") /* Battery Backup */ - AM_RANGE(0x4000, 0x47ff) AM_READWRITE(polepos_sprite_r, polepos_sprite_w) /* Motion Object */ - AM_RANGE(0x4800, 0x4bff) AM_READWRITE(polepos_road_r, polepos_road_w) /* Road Memory */ - AM_RANGE(0x4c00, 0x4fff) AM_READWRITE(polepos_alpha_r, polepos_alpha_w) /* Alphanumeric (char ram) */ - AM_RANGE(0x5000, 0x57ff) AM_READWRITE(polepos_view_r, polepos_view_w) /* Background Memory */ - - AM_RANGE(0x8000, 0x83bf) AM_MIRROR(0x0c00) AM_RAM /* Sound Memory */ - AM_RANGE(0x83c0, 0x83ff) AM_MIRROR(0x0c00) AM_DEVREADWRITE("namco", namco_device, polepos_sound_r, polepos_sound_w) /* Sound data */ - - AM_RANGE(0x9000, 0x9000) AM_MIRROR(0x0eff) AM_DEVREADWRITE("06xx", namco_06xx_device, data_r, data_w) - AM_RANGE(0x9100, 0x9100) AM_MIRROR(0x0eff) AM_DEVREADWRITE("06xx", namco_06xx_device, ctrl_r, ctrl_w) - AM_RANGE(0xa000, 0xa000) AM_MIRROR(0x0cff) AM_READ(polepos_ready_r) /* READY */ - AM_RANGE(0xa000, 0xa007) AM_MIRROR(0x0cf8) AM_DEVWRITE("latch", ls259_device, write_d0) - AM_RANGE(0xa100, 0xa100) AM_MIRROR(0x0cff) AM_DEVWRITE("watchdog", watchdog_timer_device, reset_w) - AM_RANGE(0xa200, 0xa200) AM_MIRROR(0x0cff) AM_DEVWRITE("polepos", polepos_sound_device, polepos_engine_sound_lsb_w) /* Car Sound ( Lower Nibble ) */ - AM_RANGE(0xa300, 0xa300) AM_MIRROR(0x0cff) AM_DEVWRITE("polepos", polepos_sound_device, polepos_engine_sound_msb_w) /* Car Sound ( Upper Nibble ) */ -ADDRESS_MAP_END - -ADDRESS_MAP_START(polepos_state::z80_io) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_READ(polepos_adc_r) AM_WRITENOP -ADDRESS_MAP_END +void polepos_state::z80_map(address_map &map) +{ + map(0x0000, 0x2fff).rom(); + map(0x3000, 0x37ff).mirror(0x0800).ram().share("nvram"); /* Battery Backup */ + map(0x4000, 0x47ff).rw(this, FUNC(polepos_state::polepos_sprite_r), FUNC(polepos_state::polepos_sprite_w)); /* Motion Object */ + map(0x4800, 0x4bff).rw(this, FUNC(polepos_state::polepos_road_r), FUNC(polepos_state::polepos_road_w)); /* Road Memory */ + map(0x4c00, 0x4fff).rw(this, FUNC(polepos_state::polepos_alpha_r), FUNC(polepos_state::polepos_alpha_w)); /* Alphanumeric (char ram) */ + map(0x5000, 0x57ff).rw(this, FUNC(polepos_state::polepos_view_r), FUNC(polepos_state::polepos_view_w)); /* Background Memory */ + + map(0x8000, 0x83bf).mirror(0x0c00).ram(); /* Sound Memory */ + map(0x83c0, 0x83ff).mirror(0x0c00).rw(m_namco_sound, FUNC(namco_device::polepos_sound_r), FUNC(namco_device::polepos_sound_w)); /* Sound data */ + + map(0x9000, 0x9000).mirror(0x0eff).rw("06xx", FUNC(namco_06xx_device::data_r), FUNC(namco_06xx_device::data_w)); + map(0x9100, 0x9100).mirror(0x0eff).rw("06xx", FUNC(namco_06xx_device::ctrl_r), FUNC(namco_06xx_device::ctrl_w)); + map(0xa000, 0xa000).mirror(0x0cff).r(this, FUNC(polepos_state::polepos_ready_r)); /* READY */ + map(0xa000, 0xa007).mirror(0x0cf8).w(m_latch, FUNC(ls259_device::write_d0)); + map(0xa100, 0xa100).mirror(0x0cff).w("watchdog", FUNC(watchdog_timer_device::reset_w)); + map(0xa200, 0xa200).mirror(0x0cff).w("polepos", FUNC(polepos_sound_device::polepos_engine_sound_lsb_w)); /* Car Sound ( Lower Nibble ) */ + map(0xa300, 0xa300).mirror(0x0cff).w("polepos", FUNC(polepos_sound_device::polepos_engine_sound_msb_w)); /* Car Sound ( Upper Nibble ) */ +} + +void polepos_state::z80_io(address_map &map) +{ + map.global_mask(0xff); + map(0x00, 0x00).r(this, FUNC(polepos_state::polepos_adc_r)).nopw(); +} /* the same memory map is used by both Z8002 CPUs; all RAM areas are shared */ -ADDRESS_MAP_START(polepos_state::z8002_map) - AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0x8fff) AM_READWRITE(polepos_sprite16_r, polepos_sprite16_w) AM_SHARE("sprite16_memory") /* Motion Object */ - AM_RANGE(0x9000, 0x97ff) AM_READWRITE(polepos_road16_r, polepos_road16_w) AM_SHARE("road16_memory") /* Road Memory */ - AM_RANGE(0x9800, 0x9fff) AM_READWRITE(polepos_alpha16_r, polepos_alpha16_w) AM_SHARE("alpha16_memory") /* Alphanumeric (char ram) */ - AM_RANGE(0xa000, 0xafff) AM_READWRITE(polepos_view16_r, polepos_view16_w) AM_SHARE("view16_memory") /* Background memory */ - AM_RANGE(0xc000, 0xc001) AM_MIRROR(0x38fe) AM_WRITE(polepos_view16_hscroll_w) /* Background horz scroll position */ - AM_RANGE(0xc100, 0xc101) AM_MIRROR(0x38fe) AM_WRITE(polepos_road16_vscroll_w) /* Road vertical position */ -ADDRESS_MAP_END - -ADDRESS_MAP_START(polepos_state::z8002_map_1) - AM_IMPORT_FROM(z8002_map) - AM_RANGE(0x6000, 0x6001) AM_MIRROR(0x0ffe) AM_WRITE(polepos_z8002_nvi_enable_w<true>) /* NVI enable - *NOT* shared by the two CPUs */ -ADDRESS_MAP_END - -ADDRESS_MAP_START(polepos_state::z8002_map_2) - AM_IMPORT_FROM(z8002_map) - AM_RANGE(0x6000, 0x6001) AM_MIRROR(0x0ffe) AM_WRITE(polepos_z8002_nvi_enable_w<false>) /* NVI enable - *NOT* shared by the two CPUs */ -ADDRESS_MAP_END +void polepos_state::z8002_map(address_map &map) +{ + map(0x0000, 0x7fff).rom(); + map(0x8000, 0x8fff).rw(this, FUNC(polepos_state::polepos_sprite16_r), FUNC(polepos_state::polepos_sprite16_w)).share("sprite16_memory"); /* Motion Object */ + map(0x9000, 0x97ff).rw(this, FUNC(polepos_state::polepos_road16_r), FUNC(polepos_state::polepos_road16_w)).share("road16_memory"); /* Road Memory */ + map(0x9800, 0x9fff).rw(this, FUNC(polepos_state::polepos_alpha16_r), FUNC(polepos_state::polepos_alpha16_w)).share("alpha16_memory"); /* Alphanumeric (char ram) */ + map(0xa000, 0xafff).rw(this, FUNC(polepos_state::polepos_view16_r), FUNC(polepos_state::polepos_view16_w)).share("view16_memory"); /* Background memory */ + map(0xc000, 0xc001).mirror(0x38fe).w(this, FUNC(polepos_state::polepos_view16_hscroll_w)); /* Background horz scroll position */ + map(0xc100, 0xc101).mirror(0x38fe).w(this, FUNC(polepos_state::polepos_road16_vscroll_w)); /* Road vertical position */ +} + +void polepos_state::z8002_map_1(address_map &map) +{ + z8002_map(map); + map(0x6000, 0x6001).mirror(0x0ffe).w(this, FUNC(polepos_state::polepos_z8002_nvi_enable_w<true>)); /* NVI enable - *NOT* shared by the two CPUs */ +} + +void polepos_state::z8002_map_2(address_map &map) +{ + z8002_map(map); + map(0x6000, 0x6001).mirror(0x0ffe).w(this, FUNC(polepos_state::polepos_z8002_nvi_enable_w<false>)); /* NVI enable - *NOT* shared by the two CPUs */ +} /********************************************************************* @@ -958,27 +963,30 @@ WRITE8_MEMBER(polepos_state::bootleg_soundlatch_w) m_soundlatch->write(space, 0, data | 0xfc); } -ADDRESS_MAP_START(polepos_state::topracern_io) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_IMPORT_FROM(z80_io) +void polepos_state::topracern_io(address_map &map) +{ + map.global_mask(0xff); + z80_io(map); // extra direct mapped inputs read - AM_RANGE(0x02, 0x02) AM_READ_PORT("STEER") AM_WRITENOP - AM_RANGE(0x03, 0x03) AM_READ_PORT("IN0") AM_DEVWRITE("dac", dac_byte_interface, write) - AM_RANGE(0x04, 0x04) AM_READ_PORT("DSWA") AM_WRITENOP // explosion sound trigger - AM_RANGE(0x05, 0x05) AM_READ_PORT("DSWB") AM_WRITE(bootleg_soundlatch_w) -ADDRESS_MAP_END - -ADDRESS_MAP_START(polepos_state::sound_z80_bootleg_map) - AM_RANGE(0x0000, 0x1fff) AM_ROM - AM_RANGE(0x2700, 0x27ff) AM_RAM - AM_RANGE(0x4000, 0x4000) AM_DEVREAD("soundlatch", generic_latch_8_device, read) - AM_RANGE(0x6000, 0x6000) AM_DEVREAD("soundlatch", generic_latch_8_device, acknowledge_r) -ADDRESS_MAP_END - -ADDRESS_MAP_START(polepos_state::sound_z80_bootleg_iomap) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_DEVREADWRITE("tms", tms5220_device, status_r, data_w) -ADDRESS_MAP_END + map(0x02, 0x02).portr("STEER").nopw(); + map(0x03, 0x03).portr("IN0").w("dac", FUNC(dac_byte_interface::write)); + map(0x04, 0x04).portr("DSWA").nopw(); // explosion sound trigger + map(0x05, 0x05).portr("DSWB").w(this, FUNC(polepos_state::bootleg_soundlatch_w)); +} + +void polepos_state::sound_z80_bootleg_map(address_map &map) +{ + map(0x0000, 0x1fff).rom(); + map(0x2700, 0x27ff).ram(); + map(0x4000, 0x4000).r(m_soundlatch, FUNC(generic_latch_8_device::read)); + map(0x6000, 0x6000).r(m_soundlatch, FUNC(generic_latch_8_device::acknowledge_r)); +} + +void polepos_state::sound_z80_bootleg_iomap(address_map &map) +{ + map.global_mask(0xff); + map(0x00, 0x00).rw("tms", FUNC(tms5220_device::status_r), FUNC(tms5220_device::data_w)); +} MACHINE_CONFIG_START(polepos_state::topracern) |