diff --git a/src/mame/drivers/irobot.cpp b/src/mame/drivers/irobot.cpp index 78c98bf00ea..454d24e9a86 100644 --- a/src/mame/drivers/irobot.cpp +++ b/src/mame/drivers/irobot.cpp @@ -82,12 +82,12 @@ #include "emu.h" #include "includes/irobot.h" #include "cpu/m6809/m6809.h" -#include "sound/pokey.h" +#include "machine/adc0808.h" #include "machine/nvram.h" #include "speaker.h" -#define MAIN_CLOCK XTAL(12'096'000) -#define VIDEO_CLOCK XTAL(20'000'000) +#define MAIN_CLOCK 12.096_MHz_XTAL +#define VIDEO_CLOCK 20_MHz_XTAL /************************************* * @@ -122,24 +122,20 @@ WRITE8_MEMBER(irobot_state::irobot_clearfirq_w) READ8_MEMBER(irobot_state::quad_pokeyn_r) { - static const char *const devname[4] = { "pokey1", "pokey2", "pokey3", "pokey4" }; int pokey_num = (offset >> 3) & ~0x04; int control = (offset & 0x20) >> 2; int pokey_reg = (offset % 8) | control; - pokey_device *pokey = machine().device(devname[pokey_num]); - return pokey->read(pokey_reg); + return m_pokey[pokey_num]->read(pokey_reg); } WRITE8_MEMBER(irobot_state::quad_pokeyn_w) { - static const char *const devname[4] = { "pokey1", "pokey2", "pokey3", "pokey4" }; int pokey_num = (offset >> 3) & ~0x04; int control = (offset & 0x20) >> 2; int pokey_reg = (offset % 8) | control; - pokey_device *pokey = machine().device(devname[pokey_num]); - pokey->write(pokey_reg, data); + m_pokey[pokey_num]->write(pokey_reg, data); } @@ -162,12 +158,12 @@ void irobot_state::irobot_map(address_map &map) map(0x1180, 0x1180).w(this, FUNC(irobot_state::irobot_out0_w)); map(0x11c0, 0x11c0).w(this, FUNC(irobot_state::irobot_rom_banksel_w)); map(0x1200, 0x12ff).ram().w(this, FUNC(irobot_state::irobot_nvram_w)).share("nvram"); - map(0x1300, 0x13ff).r(this, FUNC(irobot_state::irobot_control_r)); + map(0x1300, 0x13ff).mirror(0xff).r("adc", FUNC(adc0809_device::data_r)); map(0x1400, 0x143f).rw(this, FUNC(irobot_state::quad_pokeyn_r), FUNC(irobot_state::quad_pokeyn_w)); map(0x1800, 0x18ff).w(this, FUNC(irobot_state::irobot_paletteram_w)); map(0x1900, 0x19ff).writeonly(); /* Watchdog reset */ map(0x1a00, 0x1a00).w(this, FUNC(irobot_state::irobot_clearfirq_w)); - map(0x1b00, 0x1bff).w(this, FUNC(irobot_state::irobot_control_w)); + map(0x1b00, 0x1b03).mirror(0xfc).w("adc", FUNC(adc0809_device::address_offset_start_w)); map(0x1c00, 0x1fff).ram().share("videoram"); map(0x2000, 0x3fff).rw(this, FUNC(irobot_state::irobot_sharedmem_r), FUNC(irobot_state::irobot_sharedmem_w)); map(0x4000, 0x5fff).bankr("bank1"); @@ -302,9 +298,13 @@ GFXDECODE_END MACHINE_CONFIG_START(irobot_state::irobot) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", MC6809E, MAIN_CLOCK/8) + MCFG_CPU_ADD("maincpu", MC6809E, MAIN_CLOCK / 8) MCFG_CPU_PROGRAM_MAP(irobot_map) + MCFG_DEVICE_ADD("adc", ADC0809, MAIN_CLOCK / 16) + MCFG_ADC0808_IN0_CB(IOPORT("AN0")) + MCFG_ADC0808_IN1_CB(IOPORT("AN1")) + MCFG_NVRAM_ADD_0FILL("nvram") /* video hardware */ @@ -329,17 +329,17 @@ MACHINE_CONFIG_START(irobot_state::irobot) /* FIXME: I-Robot has all channels of the quad-pokey tied together * This needs to be taken into account in the design. */ - MCFG_SOUND_ADD("pokey1", POKEY, MAIN_CLOCK/8) + MCFG_SOUND_ADD("pokey1", POKEY, MAIN_CLOCK / 8) MCFG_POKEY_ALLPOT_R_CB(IOPORT("DSW2")) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("pokey2", POKEY, MAIN_CLOCK/8) + MCFG_SOUND_ADD("pokey2", POKEY, MAIN_CLOCK / 8) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("pokey3", POKEY, MAIN_CLOCK/8) + MCFG_SOUND_ADD("pokey3", POKEY, MAIN_CLOCK / 8) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("pokey4", POKEY, MAIN_CLOCK/8) + MCFG_SOUND_ADD("pokey4", POKEY, MAIN_CLOCK / 8) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) MACHINE_CONFIG_END diff --git a/src/mame/includes/irobot.h b/src/mame/includes/irobot.h index a4560f42dc7..67e2e3ab918 100644 --- a/src/mame/includes/irobot.h +++ b/src/mame/includes/irobot.h @@ -11,6 +11,7 @@ #pragma once #include "machine/timer.h" +#include "sound/pokey.h" #include "screen.h" #define IR_TIMING 1 /* try to emulate MB and VG running time */ @@ -39,7 +40,8 @@ public: m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), - m_palette(*this, "palette") + m_palette(*this, "palette"), + m_pokey(*this, "pokey%u", 1U) { } DECLARE_DRIVER_INIT(irobot); @@ -59,8 +61,6 @@ protected: DECLARE_WRITE8_MEMBER(irobot_statwr_w); DECLARE_WRITE8_MEMBER(irobot_out0_w); DECLARE_WRITE8_MEMBER(irobot_rom_banksel_w); - DECLARE_WRITE8_MEMBER(irobot_control_w); - DECLARE_READ8_MEMBER(irobot_control_r); DECLARE_READ8_MEMBER(irobot_status_r); DECLARE_WRITE8_MEMBER(irobot_paletteram_w); DECLARE_READ8_MEMBER(quad_pokeyn_r); @@ -96,7 +96,6 @@ private: uint8_t *m_comRAM[2]; uint8_t *m_mbRAM; uint8_t *m_mbROM; - uint8_t m_control_num; uint8_t m_statwr; uint8_t m_out0; uint8_t m_outx; @@ -117,6 +116,7 @@ private: required_device m_gfxdecode; required_device m_screen; required_device m_palette; + required_device_array m_pokey; }; #endif // MAME_INCLUDES_IROBOT_H diff --git a/src/mame/includes/starwars.h b/src/mame/includes/starwars.h index 60e74cf4aa7..8b01b9c308c 100644 --- a/src/mame/includes/starwars.h +++ b/src/mame/includes/starwars.h @@ -39,7 +39,6 @@ public: uint8_t *m_slapstic_source; uint8_t *m_slapstic_base; uint8_t m_slapstic_current_bank; - uint8_t m_control_num; int m_MPA; int m_BIC; uint16_t m_dvd_shift; diff --git a/src/mame/machine/irobot.cpp b/src/mame/machine/irobot.cpp index 22ae2d49169..36851edc3c3 100644 --- a/src/mame/machine/irobot.cpp +++ b/src/mame/machine/irobot.cpp @@ -186,21 +186,6 @@ void irobot_state::machine_reset() m_outx = 0; } -WRITE8_MEMBER(irobot_state::irobot_control_w) -{ - m_control_num = offset & 0x03; -} - -READ8_MEMBER(irobot_state::irobot_control_r) -{ - if (m_control_num == 0) - return ioport("AN0")->read(); - else if (m_control_num == 1) - return ioport("AN1")->read(); - return 0; - -} - /* we allow irmb_running and irvg_running to appear running before clearing them to simulate the mathbox and vector generator running in real time */ READ8_MEMBER(irobot_state::irobot_status_r)