From fcb4f01dfb424d4871f52a0b069ce9cc3856eaa3 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Sat, 4 Mar 2023 12:34:11 +1100 Subject: [PATCH] Various cleanups: Isolated the speedup code in the Eolith base state, so eolith16 and vegaeo aren't inheriting a pile of stuff they don't need. nichibutsu/jangou.cpp: Split into derived classes so all object finders are required and device_remove isn't necessary. Also use the data pending callback on latches as it's there. taito/taito_l.cpp: Use normal start/reset handlers rather than an elaborate maze of indirection. vsystem/aerofgt.cpp: Split the driver class up a little. It's still a mess. Got rid of a few of the remaining MCFG macros. --- src/mame/eolith/eolith.cpp | 353 ++++++++-------- src/mame/eolith/eolith.h | 102 ----- src/mame/eolith/eolith16.cpp | 20 +- src/mame/eolith/eolith_speedup.cpp | 126 ++++++ src/mame/eolith/eolith_speedup.h | 46 ++ src/mame/eolith/eolith_v.cpp | 44 -- src/mame/eolith/ghosteo.cpp | 20 +- src/mame/eolith/vegaeo.cpp | 19 +- src/mame/konami/moo.cpp | 10 +- src/mame/konami/moo.h | 12 +- src/mame/nichibutsu/jangou.cpp | 641 ++++++++++++++-------------- src/mame/taito/taito_l.cpp | 72 +--- src/mame/taito/taito_l.h | 98 ++--- src/mame/ti/tm990189.cpp | 337 +++++---------- src/mame/upl/ninjakd2.cpp | 3 - src/mame/upl/ninjakd2.h | 1 - src/mame/vsystem/aerofgt.cpp | 657 +++++++++++++++-------------- src/mame/vsystem/aerofgt.h | 227 ++++++---- src/mame/vsystem/aerofgt_v.cpp | 139 +++--- 19 files changed, 1425 insertions(+), 1502 deletions(-) delete mode 100644 src/mame/eolith/eolith.h create mode 100644 src/mame/eolith/eolith_speedup.cpp create mode 100644 src/mame/eolith/eolith_speedup.h delete mode 100644 src/mame/eolith/eolith_v.cpp diff --git a/src/mame/eolith/eolith.cpp b/src/mame/eolith/eolith.cpp index 6723f890ff1..468dd049ee0 100644 --- a/src/mame/eolith/eolith.cpp +++ b/src/mame/eolith/eolith.cpp @@ -101,16 +101,148 @@ *********************************************************************/ #include "emu.h" -#include "eolith.h" +#include "eolith_speedup.h" #include "cpu/e132xs/e132xs.h" #include "cpu/mcs51/mcs51.h" +#include "cpu/mcs51/mcs51.h" #include "machine/eepromser.h" #include "machine/gen_latch.h" +#include "sound/qs1000.h" #include "speaker.h" +namespace { + +class eolith_state : public eolith_state_base +{ +public: + eolith_state(const machine_config &mconfig, device_type type, const char *tag) + : eolith_state_base(mconfig, type, tag) + , m_soundcpu(*this, "soundcpu") + , m_qs1000(*this, "qs1000") + , m_eepromoutport(*this, "EEPROMOUT") + , m_in0(*this, "IN0") + , m_led(*this, "led0") + , m_sndbank(*this, "sound_bank") + { + } + + void eolith45(machine_config &config) ATTR_COLD; + void eolith50(machine_config &config) ATTR_COLD; + void ironfort(machine_config &config) ATTR_COLD; + + void init_eolith() ATTR_COLD; + void init_landbrk() ATTR_COLD; + void init_hidctch2() ATTR_COLD; + void init_hidnc2k() ATTR_COLD; + void init_landbrka() ATTR_COLD; + void init_landbrkb() ATTR_COLD; + +protected: + virtual void machine_start() override ATTR_COLD; + virtual void machine_reset() override ATTR_COLD; + virtual void video_start() override ATTR_COLD; + + void eolith_map(address_map &map) ATTR_COLD; + +private: + uint32_t eolith_custom_r(); + void systemcontrol_w(uint32_t data); + void eolith_vram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + uint16_t eolith_vram_r(offs_t offset); + void sound_p1_w(uint8_t data); + uint8_t qs1000_p1_r(); + void qs1000_p1_w(uint8_t data); + void soundcpu_to_qs1000(uint8_t data); + + uint32_t screen_update_eolith(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + void sound_io_map(address_map &map) ATTR_COLD; + void sound_prg_map(address_map &map) ATTR_COLD; + + void patch_mcu_protection(uint32_t address) ATTR_COLD; + + required_device m_soundcpu; + required_device m_qs1000; + + required_ioport m_eepromoutport; + required_ioport m_in0; + output_finder<> m_led; + + required_memory_bank m_sndbank; + + int m_coin_counter_bit = 0; + std::unique_ptr m_vram; + int m_buffer = 0; +}; + + +class hidctch3_state : public eolith_state +{ +public: + hidctch3_state(const machine_config &mconfig, device_type type, const char *tag) + : eolith_state(mconfig, type, tag) + , m_penxport(*this, "PEN_X_P%u", 1) + , m_penyport(*this, "PEN_Y_P%u", 1) + { + } + + void hidctch3(machine_config &config) ATTR_COLD; + +private: + template uint32_t hidctch3_pen_r(); + + void hidctch3_map(address_map &map) ATTR_COLD; + + required_ioport_array<2> m_penxport; + required_ioport_array<2> m_penyport; +}; + + +void eolith_state::eolith_vram_w(offs_t offset, uint16_t data, uint16_t mem_mask) +{ + if ((mem_mask == 0xffff) && (~data & 0x8000)) + { + // candy needs this to always write to RAM (verified that certain glitches, for example the high score table, don't occur on real hw) + // other games clearly don't. + // is there a cpu bug, or is there more to this logic / a flag which disables it? + COMBINE_DATA(&m_vram[offset+(0x40000/2)*m_buffer]); + } +} + + +uint16_t eolith_state::eolith_vram_r(offs_t offset) +{ + return m_vram[offset+(0x40000/2)*m_buffer]; +} + +void eolith_state::video_start() +{ + eolith_state_base::video_start(); + + m_vram = std::make_unique(0x40000); + save_pointer(NAME(m_vram), 0x40000); + save_item(NAME(m_buffer)); + + m_buffer = 0; +} + +uint32_t eolith_state::screen_update_eolith(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + for (int y = 0; y < 240; y++) + { + for (int x = 0; x < 320; x++) + { + bitmap.pix(y, x) = m_vram[(0x40000/2) * (m_buffer ^ 1) + (y * 336) + x] & 0x7fff; + } + } + + return 0; +} + + /************************************* * * Control @@ -119,7 +251,19 @@ void eolith_state::machine_start() { + eolith_state_base::machine_start(); + m_led.resolve(); + + // Configure the sound ROM banking + m_sndbank->configure_entries(0, 16, memregion("sounddata")->base(), 0x8000); +} + +void eolith_state::machine_reset() +{ + eolith_state_base::machine_reset(); + + m_soundcpu->set_input_line(MCS51_INT1_LINE, ASSERT_LINE); } uint32_t eolith_state::eolith_custom_r() @@ -148,8 +292,8 @@ void eolith_state::systemcontrol_w(uint32_t data) // bit 0x100 and 0x040 ? } -template -uint32_t eolith_state::hidctch3_pen_r() +template +uint32_t hidctch3_state::hidctch3_pen_r() { //320 x 240 int xpos = m_penxport[Player]->read(); @@ -236,13 +380,14 @@ void eolith_state::eolith_map(address_map &map) map(0xfff80000, 0xffffffff).rom().region("maincpu", 0); } -void eolith_state::hidctch3_map(address_map &map) +void hidctch3_state::hidctch3_map(address_map &map) { eolith_map(map); + map(0xfc200000, 0xfc200003).nopw(); // this generates pens vibration // It is not clear why the first reads are needed too - map(0xfce00000, 0xfce00003).mirror(0x00080000).r(FUNC(eolith_state::hidctch3_pen_r<0>)); - map(0xfcf00000, 0xfcf00003).mirror(0x00080000).r(FUNC(eolith_state::hidctch3_pen_r<1>)); + map(0xfce00000, 0xfce00003).mirror(0x00080000).r(FUNC(hidctch3_state::hidctch3_pen_r<0>)); + map(0xfcf00000, 0xfcf00003).mirror(0x00080000).r(FUNC(hidctch3_state::hidctch3_pen_r<1>)); } @@ -551,8 +696,6 @@ void eolith_state::eolith45(machine_config &config) m_soundcpu->port_out_cb<1>().set(FUNC(eolith_state::sound_p1_w)); m_soundcpu->serial_tx_cb().set(FUNC(eolith_state::soundcpu_to_qs1000)); // Sound CPU -> QS1000 CPU serial link - MCFG_MACHINE_RESET_OVERRIDE(eolith_state,eolith) - EEPROM_93C66_8BIT(config, "eeprom") .erase_time(attotime::from_usec(250)) .write_time(attotime::from_usec(250)); @@ -578,12 +721,12 @@ void eolith_state::eolith45(machine_config &config) GENERIC_LATCH_8(config, "soundlatch").data_pending_callback().set_inputline(m_soundcpu, MCS51_INT0_LINE); - qs1000_device &qs1000(QS1000(config, "qs1000", XTAL(24'000'000))); - qs1000.set_external_rom(true); - qs1000.p1_in().set(FUNC(eolith_state::qs1000_p1_r)); - qs1000.p1_out().set(FUNC(eolith_state::qs1000_p1_w)); - qs1000.add_route(0, "lspeaker", 1.0); - qs1000.add_route(1, "rspeaker", 1.0); + QS1000(config, m_qs1000, XTAL(24'000'000)); + m_qs1000->set_external_rom(true); + m_qs1000->p1_in().set(FUNC(eolith_state::qs1000_p1_r)); + m_qs1000->p1_out().set(FUNC(eolith_state::qs1000_p1_w)); + m_qs1000->add_route(0, "lspeaker", 1.0); + m_qs1000->add_route(1, "rspeaker", 1.0); } void eolith_state::eolith50(machine_config &config) @@ -598,10 +741,10 @@ void eolith_state::ironfort(machine_config &config) m_maincpu->set_clock(44900000); /* Normally 45MHz??? but PCB actually had a 44.9MHz OSC, so it's value is used */ } -void eolith_state::hidctch3(machine_config &config) +void hidctch3_state::hidctch3(machine_config &config) { eolith50(config); - m_maincpu->set_addrmap(AS_PROGRAM, &eolith_state::hidctch3_map); + m_maincpu->set_addrmap(AS_PROGRAM, &hidctch3_state::hidctch3_map); } @@ -1551,17 +1694,9 @@ ROM_START( hidctch3 ) ROM_END -MACHINE_RESET_MEMBER(eolith_state,eolith) -{ - m_soundcpu->set_input_line(MCS51_INT1_LINE, ASSERT_LINE); -} - void eolith_state::init_eolith() { init_speedup(); - - // Configure the sound ROM banking - m_sndbank->configure_entries(0, 16, memregion("sounddata")->base(), 0x8000); } void eolith_state::init_landbrk() @@ -1617,133 +1752,7 @@ void eolith_state::init_hidnc2k() init_eolith(); } -/* Eolith Speedup Handling */ - -/* - This uses triggers and a scanline counter to speed up the eolith games a bit - in some cases this results in a 100% speedup - e.g hidden catch 25% -> 50% speed ingame - - this could probably be done a bit better using timers -*/ - -void eolith_state::speedup_read() -{ - /* for debug */ - //if ((m_maincpu->pc()!=m_speedup_address) && (m_speedup_vblank!=1) ) - // printf("%s:eolith speedup_read data %02x\n",machine().describe_context().c_str(), m_speedup_vblank); - - if (m_speedup_vblank==0 && m_speedup_scanline < m_speedup_resume_scanline) - { - int pc = m_maincpu->pc(); - - if ((pc==m_speedup_address) || (pc==m_speedup_address2)) - { - m_maincpu->spin_until_trigger(1000); - } - } -} - -static const struct -{ - const char *s_name; - int speedup_address; - int speedup_address2; - int speedup_resume_scanline; - -} eolith_speedup_table[] = -{ - /* eolith.cpp */ - { "linkypip", 0x4000825c, -1,/*0x4000ABAE,*/ 240 }, // 2nd address is used on the planet cutscene between but idle skipping between levels, but seems too aggressive - { "ironfort", 0x40020854, -1, 240 }, - { "ironfortc",0x40020234, -1, 240 }, - { "hidnctch", 0x4000bba0, -1, 240 }, - { "hidnctcha",0x4000bba0, -1, 240 }, - { "raccoon", 0x40008204, -1, 240 }, - { "puzzlekg", 0x40029458, -1, 240 }, - { "hidctch2", 0x40009524, -1, 240 }, - { "hidctch2a",0x40029B58, -1, 240 }, - { "landbrk", 0x40023574, -1, 240 }, - { "landbrka", 0x4002446c, -1, 240 }, - { "landbrkb", 0x40023B28, -1, 240 }, - { "nhidctch", 0x40012778, -1, 240 }, - { "hidctch3", 0x4001f6a0, -1, 240 }, - { "fort2b", 0x000081e0, -1, 240 }, - { "fort2ba", 0x000081e0, -1, 240 }, - { "penfan", 0x4001FA66, -1, 240 }, - { "penfana", 0x4001FAb6, -1, 240 }, - { "candy", 0x4001990C, -1, 240 }, - { "hidnc2k", 0x40016824, -1, 240 }, - /* eolith16.cpp */ - { "klondkp", 0x0001a046, -1, 240 }, - /* vegaeo.cpp */ - { "crazywar", 0x00008cf8, -1, 240 }, - { nullptr, 0, 0 } -}; - - -void eolith_state::init_speedup() -{ - int n_game = 0; - m_speedup_address = 0; - m_speedup_address2 = 0; - m_speedup_resume_scanline = 0; - m_speedup_vblank = 0; - m_speedup_scanline = 0; - - while( eolith_speedup_table[ n_game ].s_name != nullptr ) - { - if( strcmp( machine().system().name, eolith_speedup_table[ n_game ].s_name ) == 0 ) - { - m_speedup_address = eolith_speedup_table[ n_game ].speedup_address; - m_speedup_address2 = eolith_speedup_table[ n_game ].speedup_address2; - m_speedup_resume_scanline = eolith_speedup_table[ n_game ].speedup_resume_scanline; - } - n_game++; - } - - save_item(NAME(m_speedup_vblank)); - save_item(NAME(m_speedup_scanline)); -} - -/* todo, use timers instead! */ -TIMER_DEVICE_CALLBACK_MEMBER(eolith_state::eolith_speedup) -{ - if (param==0) - { - m_speedup_vblank = 0; - } - - if (param==m_speedup_resume_scanline) - { - machine().scheduler().trigger(1000); - } - - if (param==240) - { - m_speedup_vblank = 1; - } -} - -READ_LINE_MEMBER(eolith_state::speedup_vblank_r) -{ -// printf("%s:eolith speedup_read data %02x\n",machine().describe_context().c_str(), m_speedup_vblank); - - - return (m_screen->vpos() >= 240); -} - -// StealSee doesn't use interrupts, just the vblank -READ_LINE_MEMBER(eolith_state::stealsee_speedup_vblank_r) -{ - int pc = m_maincpu->pc(); - - if (pc==0x400081ec) - if(!m_speedup_vblank) - m_maincpu->eat_cycles(500); - - return (m_screen->vpos() >= 240); -} +} // anonymous namespace /************************************* @@ -1752,24 +1761,24 @@ READ_LINE_MEMBER(eolith_state::stealsee_speedup_vblank_r) * *************************************/ -GAME( 1998, linkypip, 0, eolith45, linkypip, eolith_state, init_eolith, ROT0, "Eolith", "Linky Pipe", MACHINE_SUPPORTS_SAVE ) -GAME( 1998, ironfort, 0, ironfort, ironfort, eolith_state, init_eolith, ROT0, "Eolith", "Iron Fortress", MACHINE_SUPPORTS_SAVE ) -GAME( 1998, ironfortc, ironfort, ironfort, ironfortc, eolith_state, init_eolith, ROT0, "Eolith (Excellent Competence Ltd. license)", "Gongtit Jiucoi Iron Fortress (Hong Kong)", MACHINE_SUPPORTS_SAVE ) // Licensed/Distributed to Hong Kong company Excellent Competence Ltd. -GAME( 1998, hidnctch, 0, eolith45, hidnctch, eolith_state, init_eolith, ROT0, "Eolith", "Hidden Catch (World) / Tul Lin Gu Lim Chat Ki '98 (Korea) (pcb ver 3.03)", MACHINE_SUPPORTS_SAVE ) // or Teurrin Geurim Chajgi '98 -GAME( 1998, hidnctcha, hidnctch, eolith45, hidnctch, eolith_state, init_eolith, ROT0, "Eolith", "Hidden Catch (World) / Tul Lin Gu Lim Chat Ki '98 (Korea) (pcb ver 3.02)", MACHINE_SUPPORTS_SAVE ) // or Teurrin Geurim Chajgi '98 -GAME( 1998, raccoon, 0, eolith45, raccoon, eolith_state, init_eolith, ROT0, "Eolith", "Raccoon World", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) -GAME( 1998, puzzlekg, 0, eolith45, puzzlekg, eolith_state, init_eolith, ROT0, "Eolith", "Puzzle King (Dance & Puzzle)", MACHINE_SUPPORTS_SAVE ) -GAME( 1999, candy, 0, eolith50, candy, eolith_state, init_eolith, ROT0, "Eolith", "Candy Candy", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -GAME( 1999, hidctch2, 0, eolith50, hidctch2, eolith_state, init_hidctch2, ROT0, "Eolith", "Hidden Catch 2 (pcb ver 3.03) (Kor/Eng) (AT89c52 protected)", MACHINE_SUPPORTS_SAVE ) -GAME( 1999, hidctch2a, hidctch2, eolith50, hidctch2, eolith_state, init_eolith, ROT0, "Eolith", "Hidden Catch 2 (pcb ver 1.00) (Kor/Eng/Jpn/Chi)", MACHINE_SUPPORTS_SAVE ) -GAME( 1999, hidnc2k, 0, eolith50, hidctch2, eolith_state, init_hidnc2k, ROT0, "Eolith", "Hidden Catch 2000 (AT89c52 protected)", MACHINE_SUPPORTS_SAVE ) -GAME( 1999, landbrk, 0, eolith45, landbrk, eolith_state, init_landbrk, ROT0, "Eolith", "Land Breaker (World) / Miss Tang Ja Ru Gi (Korea) (pcb ver 3.02)", MACHINE_SUPPORTS_SAVE ) // or Miss Ttang Jjareugi -GAME( 1999, landbrka, landbrk, eolith45, landbrk, eolith_state, init_landbrka, ROT0, "Eolith", "Land Breaker (World) / Miss Tang Ja Ru Gi (Korea) (pcb ver 3.03) (AT89c52 protected)", MACHINE_SUPPORTS_SAVE ) // or Miss Ttang Jjareugi -GAME( 1999, landbrkb, landbrk, eolith45, landbrk, eolith_state, init_landbrkb, ROT0, "Eolith", "Land Breaker (World) / Miss Tang Ja Ru Gi (Korea) (pcb ver 1.0) (AT89c52 protected)", MACHINE_SUPPORTS_SAVE ) // or Miss Ttang Jjareugi -GAME( 1999, nhidctch, 0, eolith45, hidctch2, eolith_state, init_eolith, ROT0, "Eolith", "New Hidden Catch (World) / New Tul Lin Gu Lim Chat Ki '98 (Korea) (pcb ver 3.02)", MACHINE_SUPPORTS_SAVE ) // or New Teurrin Geurim Chajgi '98 -GAME( 1999, penfan, 0, eolith45, penfan, eolith_state, init_eolith, ROT0, "Eolith", "Penfan Girls - Step1. Mild Mind (set 1)", MACHINE_SUPPORTS_SAVE ) // alt title of Ribbon -GAME( 1999, penfana, penfan, eolith45, penfan, eolith_state, init_eolith, ROT0, "Eolith", "Penfan Girls - Step1. Mild Mind (set 2)", MACHINE_SUPPORTS_SAVE ) -GAME( 2000, stealsee, 0, eolith45, stealsee, eolith_state, init_eolith, ROT0, "Moov Generation / Eolith", "Steal See", MACHINE_SUPPORTS_SAVE ) -GAME( 2000, hidctch3, 0, hidctch3, hidctch3, eolith_state, init_eolith, ROT0, "Eolith", "Hidden Catch 3 (ver 1.00 / pcb ver 3.05)", MACHINE_SUPPORTS_SAVE ) -GAME( 2001, fort2b, 0, eolith50, common, eolith_state, init_eolith, ROT0, "Eolith", "Fortress 2 Blue Arcade (World) (ver 1.01 / pcb ver 3.05)", MACHINE_SUPPORTS_SAVE ) // Language selection is greyed out in Service Mode -GAME( 2001, fort2ba, fort2b, eolith50, common, eolith_state, init_eolith, ROT0, "Eolith", "Fortress 2 Blue Arcade (Korea) (ver 1.00 / pcb ver 3.05)", MACHINE_SUPPORTS_SAVE ) // ^^ +GAME( 1998, linkypip, 0, eolith45, linkypip, eolith_state, init_eolith, ROT0, "Eolith", "Linky Pipe", MACHINE_SUPPORTS_SAVE ) +GAME( 1998, ironfort, 0, ironfort, ironfort, eolith_state, init_eolith, ROT0, "Eolith", "Iron Fortress", MACHINE_SUPPORTS_SAVE ) +GAME( 1998, ironfortc, ironfort, ironfort, ironfortc, eolith_state, init_eolith, ROT0, "Eolith (Excellent Competence Ltd. license)", "Gongtit Jiucoi Iron Fortress (Hong Kong)", MACHINE_SUPPORTS_SAVE ) // Licensed/Distributed to Hong Kong company Excellent Competence Ltd. +GAME( 1998, hidnctch, 0, eolith45, hidnctch, eolith_state, init_eolith, ROT0, "Eolith", "Hidden Catch (World) / Tul Lin Gu Lim Chat Ki '98 (Korea) (pcb ver 3.03)", MACHINE_SUPPORTS_SAVE ) // or Teurrin Geurim Chajgi '98 +GAME( 1998, hidnctcha, hidnctch, eolith45, hidnctch, eolith_state, init_eolith, ROT0, "Eolith", "Hidden Catch (World) / Tul Lin Gu Lim Chat Ki '98 (Korea) (pcb ver 3.02)", MACHINE_SUPPORTS_SAVE ) // or Teurrin Geurim Chajgi '98 +GAME( 1998, raccoon, 0, eolith45, raccoon, eolith_state, init_eolith, ROT0, "Eolith", "Raccoon World", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) +GAME( 1998, puzzlekg, 0, eolith45, puzzlekg, eolith_state, init_eolith, ROT0, "Eolith", "Puzzle King (Dance & Puzzle)", MACHINE_SUPPORTS_SAVE ) +GAME( 1999, candy, 0, eolith50, candy, eolith_state, init_eolith, ROT0, "Eolith", "Candy Candy", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +GAME( 1999, hidctch2, 0, eolith50, hidctch2, eolith_state, init_hidctch2, ROT0, "Eolith", "Hidden Catch 2 (pcb ver 3.03) (Kor/Eng) (AT89c52 protected)", MACHINE_SUPPORTS_SAVE ) +GAME( 1999, hidctch2a, hidctch2, eolith50, hidctch2, eolith_state, init_eolith, ROT0, "Eolith", "Hidden Catch 2 (pcb ver 1.00) (Kor/Eng/Jpn/Chi)", MACHINE_SUPPORTS_SAVE ) +GAME( 1999, hidnc2k, 0, eolith50, hidctch2, eolith_state, init_hidnc2k, ROT0, "Eolith", "Hidden Catch 2000 (AT89c52 protected)", MACHINE_SUPPORTS_SAVE ) +GAME( 1999, landbrk, 0, eolith45, landbrk, eolith_state, init_landbrk, ROT0, "Eolith", "Land Breaker (World) / Miss Tang Ja Ru Gi (Korea) (pcb ver 3.02)", MACHINE_SUPPORTS_SAVE ) // or Miss Ttang Jjareugi +GAME( 1999, landbrka, landbrk, eolith45, landbrk, eolith_state, init_landbrka, ROT0, "Eolith", "Land Breaker (World) / Miss Tang Ja Ru Gi (Korea) (pcb ver 3.03) (AT89c52 protected)", MACHINE_SUPPORTS_SAVE ) // or Miss Ttang Jjareugi +GAME( 1999, landbrkb, landbrk, eolith45, landbrk, eolith_state, init_landbrkb, ROT0, "Eolith", "Land Breaker (World) / Miss Tang Ja Ru Gi (Korea) (pcb ver 1.0) (AT89c52 protected)", MACHINE_SUPPORTS_SAVE ) // or Miss Ttang Jjareugi +GAME( 1999, nhidctch, 0, eolith45, hidctch2, eolith_state, init_eolith, ROT0, "Eolith", "New Hidden Catch (World) / New Tul Lin Gu Lim Chat Ki '98 (Korea) (pcb ver 3.02)", MACHINE_SUPPORTS_SAVE ) // or New Teurrin Geurim Chajgi '98 +GAME( 1999, penfan, 0, eolith45, penfan, eolith_state, init_eolith, ROT0, "Eolith", "Penfan Girls - Step1. Mild Mind (set 1)", MACHINE_SUPPORTS_SAVE ) // alt title of Ribbon +GAME( 1999, penfana, penfan, eolith45, penfan, eolith_state, init_eolith, ROT0, "Eolith", "Penfan Girls - Step1. Mild Mind (set 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 2000, stealsee, 0, eolith45, stealsee, eolith_state, init_eolith, ROT0, "Moov Generation / Eolith", "Steal See", MACHINE_SUPPORTS_SAVE ) +GAME( 2000, hidctch3, 0, hidctch3, hidctch3, hidctch3_state, init_eolith, ROT0, "Eolith", "Hidden Catch 3 (ver 1.00 / pcb ver 3.05)", MACHINE_SUPPORTS_SAVE ) +GAME( 2001, fort2b, 0, eolith50, common, eolith_state, init_eolith, ROT0, "Eolith", "Fortress 2 Blue Arcade (World) (ver 1.01 / pcb ver 3.05)", MACHINE_SUPPORTS_SAVE ) // Language selection is greyed out in Service Mode +GAME( 2001, fort2ba, fort2b, eolith50, common, eolith_state, init_eolith, ROT0, "Eolith", "Fortress 2 Blue Arcade (Korea) (ver 1.00 / pcb ver 3.05)", MACHINE_SUPPORTS_SAVE ) // ^^ diff --git a/src/mame/eolith/eolith.h b/src/mame/eolith/eolith.h deleted file mode 100644 index 31ac20d65fa..00000000000 --- a/src/mame/eolith/eolith.h +++ /dev/null @@ -1,102 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Tomasz Slanina,Pierpaolo Prazzoli - -#include "cpu/mcs51/mcs51.h" -#include "machine/timer.h" -#include "sound/qs1000.h" -#include "emupal.h" -#include "screen.h" - -class eolith_state : public driver_device -{ -public: - eolith_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_screen(*this, "screen") - , m_palette(*this, "palette") - , m_qs1000(*this, "qs1000") - , m_eepromoutport(*this, "EEPROMOUT") - , m_soundcpu(*this, "soundcpu") - , m_in0(*this, "IN0") - , m_penxport(*this, "PEN_X_P%u", 1) - , m_penyport(*this, "PEN_Y_P%u", 1) - , m_led(*this, "led0") - , m_sndbank(*this, "sound_bank") - { - } - - void ironfort(machine_config &config); - void eolith50(machine_config &config); - void eolith45(machine_config &config); - void hidctch3(machine_config &config); - - void init_eolith(); - void init_landbrk(); - void init_hidctch2(); - void init_hidnc2k(); - void init_landbrka(); - void init_landbrkb(); - - DECLARE_READ_LINE_MEMBER(speedup_vblank_r); - DECLARE_READ_LINE_MEMBER(stealsee_speedup_vblank_r); - - void speedup_read(); - void init_speedup(); - -protected: - virtual void video_start() override; - - required_device m_maincpu; - required_device m_screen; - required_device m_palette; - optional_device m_qs1000; - optional_ioport m_eepromoutport; - TIMER_DEVICE_CALLBACK_MEMBER(eolith_speedup); - -private: - - uint32_t eolith_custom_r(); - void systemcontrol_w(uint32_t data); - template uint32_t hidctch3_pen_r(); - void eolith_vram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - uint16_t eolith_vram_r(offs_t offset); - void sound_p1_w(uint8_t data); - uint8_t qs1000_p1_r(); - void qs1000_p1_w(uint8_t data); - void soundcpu_to_qs1000(uint8_t data); - - DECLARE_MACHINE_RESET(eolith); - - uint32_t screen_update_eolith(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - void eolith_map(address_map &map); - void hidctch3_map(address_map &map); - void sound_io_map(address_map &map); - void sound_prg_map(address_map &map); - - virtual void machine_start() override; - // shared with eolith16.cpp, vegaeo.cpp - - void patch_mcu_protection(uint32_t address); - - optional_device m_soundcpu; - - optional_ioport m_in0; // klondkp doesn't have it - optional_ioport_array<2> m_penxport; - optional_ioport_array<2> m_penyport; - output_finder<> m_led; - - optional_memory_bank m_sndbank; - - int m_coin_counter_bit = 0; - std::unique_ptr m_vram; - int m_buffer = 0; - - // speedups - see machine/eolithsp.c - int m_speedup_address = 0; - int m_speedup_address2 = 0; - int m_speedup_resume_scanline = 0; - int m_speedup_vblank = 0; - int m_speedup_scanline = 0; -}; diff --git a/src/mame/eolith/eolith16.cpp b/src/mame/eolith/eolith16.cpp index 1828de8b4df..34c61c6f7af 100644 --- a/src/mame/eolith/eolith16.cpp +++ b/src/mame/eolith/eolith16.cpp @@ -12,7 +12,7 @@ **********************************************************************/ #include "emu.h" -#include "eolith.h" +#include "eolith_speedup.h" #include "cpu/e132xs/e132xs.h" #include "machine/eepromser.h" @@ -24,36 +24,38 @@ namespace { -class eolith16_state : public eolith_state +class eolith16_state : public eolith_state_base { public: eolith16_state(const machine_config &mconfig, device_type type, const char *tag) - : eolith_state(mconfig, type, tag) + : eolith_state_base(mconfig, type, tag) , m_special_io(*this, "SPECIAL") + , m_eepromoutport(*this, "EEPROMOUT") , m_vram(*this, "vram", 0x20000, ENDIANNESS_BIG) , m_vrambank(*this, "vrambank") { } - void eolith16(machine_config &config); + void eolith16(machine_config &config) ATTR_COLD; - void init_eolith16(); + void init_eolith16() ATTR_COLD; protected: - virtual void video_start() override; + virtual void video_start() override ATTR_COLD; private: required_ioport m_special_io; + required_ioport m_eepromoutport; memory_share_creator m_vram; required_memory_bank m_vrambank; void eeprom_w(uint16_t data); uint16_t eolith16_custom_r(); - void eolith16_palette(palette_device &palette) const; + void eolith16_palette(palette_device &palette) const ATTR_COLD; uint32_t screen_update_eolith16(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void eolith16_map(address_map &map); + void eolith16_map(address_map &map) ATTR_COLD; }; @@ -121,6 +123,8 @@ INPUT_PORTS_END void eolith16_state::video_start() { + eolith_state_base::video_start(); + m_vrambank->configure_entries(0, 2, memshare("vram")->ptr(), 0x10000); m_vrambank->set_entry(0); } diff --git a/src/mame/eolith/eolith_speedup.cpp b/src/mame/eolith/eolith_speedup.cpp new file mode 100644 index 00000000000..f13fafdacf6 --- /dev/null +++ b/src/mame/eolith/eolith_speedup.cpp @@ -0,0 +1,126 @@ +// license:BSD-3-Clause +// copyright-holders:Tomasz Slanina,Pierpaolo Prazzoli +#include "emu.h" +#include "eolith_speedup.h" + + +/* Eolith Speedup Handling */ + +/* + This uses triggers and a scanline counter to speed up the eolith games a bit + in some cases this results in a 100% speedup + e.g hidden catch 25% -> 50% speed ingame + + this could probably be done a bit better using timers +*/ + +void eolith_state_base::speedup_read() +{ + /* for debug */ + //if ((m_maincpu->pc()!=m_speedup_address) && (m_speedup_vblank!=1) ) + // printf("%s:eolith speedup_read data %02x\n",machine().describe_context().c_str(), m_speedup_vblank); + + if (m_speedup_vblank==0 && m_speedup_scanline < m_speedup_resume_scanline) + { + int pc = m_maincpu->pc(); + + if ((pc==m_speedup_address) || (pc==m_speedup_address2)) + { + m_maincpu->spin_until_trigger(1000); + } + } +} + +static const struct +{ + const char *s_name; + int speedup_address; + int speedup_address2; + int speedup_resume_scanline; + +} eolith_speedup_table[] = +{ + /* eolith.cpp */ + { "linkypip", 0x4000825c, -1,/*0x4000ABAE,*/ 240 }, // 2nd address is used on the planet cutscene between but idle skipping between levels, but seems too aggressive + { "ironfort", 0x40020854, -1, 240 }, + { "ironfortc",0x40020234, -1, 240 }, + { "hidnctch", 0x4000bba0, -1, 240 }, + { "hidnctcha",0x4000bba0, -1, 240 }, + { "raccoon", 0x40008204, -1, 240 }, + { "puzzlekg", 0x40029458, -1, 240 }, + { "hidctch2", 0x40009524, -1, 240 }, + { "hidctch2a",0x40029B58, -1, 240 }, + { "landbrk", 0x40023574, -1, 240 }, + { "landbrka", 0x4002446c, -1, 240 }, + { "landbrkb", 0x40023B28, -1, 240 }, + { "nhidctch", 0x40012778, -1, 240 }, + { "hidctch3", 0x4001f6a0, -1, 240 }, + { "fort2b", 0x000081e0, -1, 240 }, + { "fort2ba", 0x000081e0, -1, 240 }, + { "penfan", 0x4001FA66, -1, 240 }, + { "penfana", 0x4001FAb6, -1, 240 }, + { "candy", 0x4001990C, -1, 240 }, + { "hidnc2k", 0x40016824, -1, 240 }, + /* eolith16.cpp */ + { "klondkp", 0x0001a046, -1, 240 }, + /* vegaeo.cpp */ + { "crazywar", 0x00008cf8, -1, 240 }, + { nullptr, 0, 0 } +}; + + +void eolith_state_base::init_speedup() +{ + m_speedup_address = 0; + m_speedup_address2 = 0; + m_speedup_resume_scanline = 0; + m_speedup_vblank = 0; + m_speedup_scanline = 0; + + for (const auto &speedups : eolith_speedup_table) + { + if (strcmp(machine().system().name, speedups.s_name) == 0) + { + m_speedup_address = speedups.speedup_address; + m_speedup_address2 = speedups.speedup_address2; + m_speedup_resume_scanline = speedups.speedup_resume_scanline; + break; + } + } + + save_item(NAME(m_speedup_vblank)); + save_item(NAME(m_speedup_scanline)); +} + +/* todo, use timers instead! */ +TIMER_DEVICE_CALLBACK_MEMBER(eolith_state_base::eolith_speedup) +{ + if (param == 0) + m_speedup_vblank = 0; + + if (param == m_speedup_resume_scanline) + machine().scheduler().trigger(1000); + + if (param == 240) + m_speedup_vblank = 1; +} + +READ_LINE_MEMBER(eolith_state_base::speedup_vblank_r) +{ +// printf("%s:eolith speedup_read data %02x\n",machine().describe_context().c_str(), m_speedup_vblank); + + + return (m_screen->vpos() >= 240); +} + +// StealSee doesn't use interrupts, just the vblank +READ_LINE_MEMBER(eolith_state_base::stealsee_speedup_vblank_r) +{ + int pc = m_maincpu->pc(); + + if (pc == 0x400081ec) + if (!m_speedup_vblank) + m_maincpu->eat_cycles(500); + + return (m_screen->vpos() >= 240); +} diff --git a/src/mame/eolith/eolith_speedup.h b/src/mame/eolith/eolith_speedup.h new file mode 100644 index 00000000000..9db61e20d42 --- /dev/null +++ b/src/mame/eolith/eolith_speedup.h @@ -0,0 +1,46 @@ +// license:BSD-3-Clause +// copyright-holders:Tomasz Slanina,Pierpaolo Prazzoli +#ifndef MAME_EOLITH_EOLITH_SPEEDUP_H +#define MAME_EOLITH_EOLITH_SPEEDUP_H + +#pragma once + +#include "machine/timer.h" + +#include "emupal.h" +#include "screen.h" + +class eolith_state_base : public driver_device +{ +public: + eolith_state_base(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_screen(*this, "screen") + , m_palette(*this, "palette") + { + } + + DECLARE_READ_LINE_MEMBER(speedup_vblank_r); + DECLARE_READ_LINE_MEMBER(stealsee_speedup_vblank_r); + +protected: + void speedup_read(); + void init_speedup() ATTR_COLD; + + TIMER_DEVICE_CALLBACK_MEMBER(eolith_speedup); + + required_device m_maincpu; + required_device m_screen; + required_device m_palette; + +private: + // speedups - see eolith/eolith_speedup.cpp + int m_speedup_address = 0; + int m_speedup_address2 = 0; + int m_speedup_resume_scanline = 0; + int m_speedup_vblank = 0; + int m_speedup_scanline = 0; +}; + +#endif // MAME_EOLITH_EOLITH_SPEEDUP_H diff --git a/src/mame/eolith/eolith_v.cpp b/src/mame/eolith/eolith_v.cpp deleted file mode 100644 index 82d06470f22..00000000000 --- a/src/mame/eolith/eolith_v.cpp +++ /dev/null @@ -1,44 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Tomasz Slanina,Pierpaolo Prazzoli -#include "emu.h" -#include "eolith.h" - - -void eolith_state::eolith_vram_w(offs_t offset, uint16_t data, uint16_t mem_mask) -{ - if ((mem_mask == 0xffff) && (~data & 0x8000)) - { - // candy needs this to always write to RAM (verified that certain glitches, for example the high score table, don't occur on real hw) - // other games clearly don't. - // is there a cpu bug, or is there more to this logic / a flag which disables it? - COMBINE_DATA(&m_vram[offset+(0x40000/2)*m_buffer]); - } -} - - -uint16_t eolith_state::eolith_vram_r(offs_t offset) -{ - return m_vram[offset+(0x40000/2)*m_buffer]; -} - -void eolith_state::video_start() -{ - m_vram = std::make_unique(0x40000); - save_pointer(NAME(m_vram), 0x40000); - save_item(NAME(m_buffer)); - - m_buffer = 0; -} - -uint32_t eolith_state::screen_update_eolith(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - for (int y = 0; y < 240; y++) - { - for (int x = 0; x < 320; x++) - { - bitmap.pix(y, x) = m_vram[(0x40000/2) * (m_buffer ^ 1) + (y * 336) + x] & 0x7fff; - } - } - - return 0; -} diff --git a/src/mame/eolith/ghosteo.cpp b/src/mame/eolith/ghosteo.cpp index 4875b160fc0..f8dc3a7fcd4 100644 --- a/src/mame/eolith/ghosteo.cpp +++ b/src/mame/eolith/ghosteo.cpp @@ -57,6 +57,7 @@ ToDo: verify QS1000 hook-up */ #include "emu.h" + #include "cpu/arm7/arm7.h" #include "cpu/arm7/arm7core.h" #include "machine/gen_latch.h" @@ -64,6 +65,7 @@ ToDo: verify QS1000 hook-up //#include "machine/smartmed.h" #include "machine/i2cmem.h" #include "sound/qs1000.h" + #include "emupal.h" #include "screen.h" #include "speaker.h" @@ -104,16 +106,16 @@ public: { } - void ghosteo(machine_config &config); - void touryuu(machine_config &config); - void bballoon(machine_config &config); + void ghosteo(machine_config &config) ATTR_COLD; + void touryuu(machine_config &config) ATTR_COLD; + void bballoon(machine_config &config) ATTR_COLD; - void init_touryuu(); - void init_bballoon(); + void init_touryuu() ATTR_COLD; + void init_bballoon() ATTR_COLD; protected: - virtual void machine_start() override; - virtual void machine_reset() override; + virtual void machine_start() override ATTR_COLD; + virtual void machine_reset() override ATTR_COLD; private: required_device m_maincpu; @@ -146,8 +148,8 @@ private: DECLARE_WRITE_LINE_MEMBER(s3c2410_i2c_scl_w ); DECLARE_READ_LINE_MEMBER(s3c2410_i2c_sda_r ); DECLARE_WRITE_LINE_MEMBER(s3c2410_i2c_sda_w ); - void bballoon_map(address_map &map); - void touryuu_map(address_map &map); + void bballoon_map(address_map &map) ATTR_COLD; + void touryuu_map(address_map &map) ATTR_COLD; }; diff --git a/src/mame/eolith/vegaeo.cpp b/src/mame/eolith/vegaeo.cpp index a2f308f4411..ab72397844c 100644 --- a/src/mame/eolith/vegaeo.cpp +++ b/src/mame/eolith/vegaeo.cpp @@ -14,37 +14,40 @@ *********************************************************************/ #include "emu.h" -#include "eolith.h" +#include "eolith_speedup.h" #include "cpu/e132xs/e132xs.h" #include "machine/at28c16.h" #include "machine/gen_latch.h" #include "sound/qs1000.h" + #include "speaker.h" namespace { -class vegaeo_state : public eolith_state +class vegaeo_state : public eolith_state_base { public: vegaeo_state(const machine_config &mconfig, device_type type, const char *tag) - : eolith_state(mconfig, type, tag) + : eolith_state_base(mconfig, type, tag) , m_soundlatch(*this, "soundlatch") + , m_qs1000(*this, "qs1000") , m_system_io(*this, "SYSTEM") , m_qs1000_bank(*this, "qs1000_bank") { } - void vega(machine_config &config); + void vega(machine_config &config) ATTR_COLD; - void init_vegaeo(); + void init_vegaeo() ATTR_COLD; protected: - virtual void video_start() override; + virtual void video_start() override ATTR_COLD; private: required_device m_soundlatch; + required_device m_qs1000; required_ioport m_system_io; memory_bank_creator m_qs1000_bank; @@ -60,7 +63,7 @@ private: void qs1000_p3_w(uint8_t data); uint32_t screen_update_vega(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void vega_map(address_map &map); + void vega_map(address_map &map) ATTR_COLD; }; void vegaeo_state::qs1000_p1_w(uint8_t data) @@ -160,6 +163,8 @@ INPUT_PORTS_END void vegaeo_state::video_start() { + eolith_state_base::video_start(); + m_vram = std::make_unique(0x14000*2); save_pointer(NAME(m_vram), 0x14000*2); save_item(NAME(m_vbuffer)); diff --git a/src/mame/konami/moo.cpp b/src/mame/konami/moo.cpp index 84795e75c26..98726f8d300 100644 --- a/src/mame/konami/moo.cpp +++ b/src/mame/konami/moo.cpp @@ -464,7 +464,7 @@ static INPUT_PORTS_START( bucky ) INPUT_PORTS_END -MACHINE_START_MEMBER(moo_state,moo) +void moo_state::machine_start() { save_item(NAME(m_cur_control2)); save_item(NAME(m_alpha_enabled)); @@ -476,7 +476,7 @@ MACHINE_START_MEMBER(moo_state,moo) m_dmaend_timer = timer_alloc(FUNC(moo_state::dmaend_callback), this); } -MACHINE_RESET_MEMBER(moo_state,moo) +void moo_state::machine_reset() { int i; @@ -504,9 +504,6 @@ void moo_state::moo(machine_config &config) Z80(config, m_soundcpu, XTAL(32'000'000)/4); // 8MHz verified m_soundcpu->set_addrmap(AS_PROGRAM, &moo_state::sound_map); - MCFG_MACHINE_START_OVERRIDE(moo_state,moo) - MCFG_MACHINE_RESET_OVERRIDE(moo_state,moo) - EEPROM_ER5911_8BIT(config, "eeprom"); K053252(config, m_k053252, XTAL(32'000'000)/4); // 8MHz @@ -561,9 +558,6 @@ void moo_state::moobl(machine_config &config) m_maincpu->set_addrmap(AS_PROGRAM, &moo_state::moobl_map); m_maincpu->set_vblank_int("screen", FUNC(moo_state::moobl_interrupt)); - MCFG_MACHINE_START_OVERRIDE(moo_state,moo) - MCFG_MACHINE_RESET_OVERRIDE(moo_state,moo) - EEPROM_ER5911_8BIT(config, "eeprom"); /* video hardware */ diff --git a/src/mame/konami/moo.h b/src/mame/konami/moo.h index 91dff8ad55d..cef3b9becf1 100644 --- a/src/mame/konami/moo.h +++ b/src/mame/konami/moo.h @@ -44,9 +44,13 @@ public: m_k054321(*this, "k054321") { } - void bucky(machine_config &config); - void moo(machine_config &config); - void moobl(machine_config &config); + void bucky(machine_config &config) ATTR_COLD; + void moo(machine_config &config) ATTR_COLD; + void moobl(machine_config &config) ATTR_COLD; + +protected: + virtual void machine_start() override ATTR_COLD; + virtual void machine_reset() override ATTR_COLD; private: /* memory pointers */ @@ -85,8 +89,6 @@ private: void sound_bankswitch_w(uint8_t data); void moo_prot_w(address_space &space, offs_t offset, uint16_t data, uint16_t mem_mask = ~0); void moobl_oki_bank_w(uint16_t data); - DECLARE_MACHINE_START(moo); - DECLARE_MACHINE_RESET(moo); DECLARE_VIDEO_START(moo); DECLARE_VIDEO_START(bucky); uint32_t screen_update_moo(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); diff --git a/src/mame/nichibutsu/jangou.cpp b/src/mame/nichibutsu/jangou.cpp index a0e0dee348a..843ffaa1ae6 100644 --- a/src/mame/nichibutsu/jangou.cpp +++ b/src/mame/nichibutsu/jangou.cpp @@ -47,99 +47,147 @@ namespace { #define MASTER_CLOCK XTAL(19'968'000) -class jangou_state : public driver_device +class cntrygrl_state : public driver_device { public: - jangou_state(const machine_config &mconfig, device_type type, const char *tag) + cntrygrl_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) , m_cpu_0(*this, "cpu0") - , m_cpu_1(*this, "cpu1") - , m_nsc(*this, "nsc") - , m_msm(*this, "msm") - , m_cvsd(*this, "cvsd") - , m_palette(*this, "palette") , m_blitter(*this, "blitter") + , m_palette(*this, "palette") + , m_keymatrix(*this, { "PL1_1", "PL1_2", "PL2_1", "PL2_2", "PL1_3", "PL2_3" }) + { + } + + void cntrygrl(machine_config &config) ATTR_COLD; + void roylcrdn(machine_config &config) ATTR_COLD; + void luckygrl(machine_config &config) ATTR_COLD; + +protected: + required_device m_cpu_0; + required_device m_blitter; + + virtual void machine_start() override ATTR_COLD; + virtual void machine_reset() override ATTR_COLD; + + void mux_w(uint8_t data); + void output_w(uint8_t data); + +private: + required_device m_palette; + required_ioport_array<6> m_keymatrix; + + std::unique_ptr m_tmp_bitmap; + + /* misc */ + uint8_t m_mux_data = 0; + + uint8_t input_mux_r(); + + void init_palette(palette_device &palette) const ATTR_COLD; + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + void cntrygrl_cpu0_map(address_map &map) ATTR_COLD; + void cntrygrl_cpu0_io(address_map &map) ATTR_COLD; + void roylcrdn_cpu0_map(address_map &map) ATTR_COLD; + void roylcrdn_cpu0_io(address_map &map) ATTR_COLD; + void luckygrl_cpu0_map(address_map &map) ATTR_COLD; + void decrypted_opcodes_map(address_map &map) ATTR_COLD; +}; + +class jangou_state_base : public cntrygrl_state +{ +protected: + jangou_state_base(const machine_config &mconfig, device_type type, const char *tag) + : cntrygrl_state(mconfig, type, tag) + , m_cpu_1(*this, "cpu1") , m_soundlatch(*this, "soundlatch") { } - void jngolady(machine_config &config); - void roylcrdn(machine_config &config); - void cntrygrl(machine_config &config); - void jangou(machine_config &config); - void luckygrl(machine_config &config); - - void init_jngolady(); - protected: - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; + required_device m_cpu_1; + required_device m_soundlatch; + + void jangou_base(machine_config &config) ATTR_COLD; private: + void jangou_cpu0_io(address_map &map) ATTR_COLD; +}; + +class jangou_state : public jangou_state_base +{ +public: + jangou_state(const machine_config &mconfig, device_type type, const char *tag) + : jangou_state_base(mconfig, type, tag) + , m_cvsd(*this, "cvsd") + { + } + + void jangou(machine_config &config) ATTR_COLD; + +protected: + virtual void machine_start() override ATTR_COLD; + virtual void machine_reset() override ATTR_COLD; + +private: + required_device m_cvsd; + /* sound-related */ - // Jangou CVSD Sound - emu_timer *m_cvsd_bit_timer = nullptr; - uint8_t m_cvsd_shiftreg = 0; - int m_cvsd_shift_cnt = 0; - // Jangou Lady ADPCM Sound - uint8_t m_adpcm_byte = 0; - int m_msm5205_vclk_toggle = 0; + emu_timer *m_cvsd_bit_timer = nullptr; + uint8_t m_cvsd_shiftreg = 0; + int m_cvsd_shift_cnt = 0; + + void cvsd_w(uint8_t data); + TIMER_CALLBACK_MEMBER(cvsd_bit_timer_callback); + + void jangou_cpu0_map(address_map &map) ATTR_COLD; + void jangou_cpu1_map(address_map &map) ATTR_COLD; + void jangou_cpu1_io(address_map &map) ATTR_COLD; +}; + +class jngolady_state : public jangou_state_base +{ +public: + jngolady_state(const machine_config &mconfig, device_type type, const char *tag) + : jangou_state_base(mconfig, type, tag) + , m_nsc(*this, "nsc") + , m_nsclatch(*this, "nsclatch") + , m_msm(*this, "msm") + { + } + + void jngolady(machine_config &config) ATTR_COLD; + + void init_jngolady() ATTR_COLD; + +protected: + virtual void machine_start() override ATTR_COLD; + virtual void machine_reset() override ATTR_COLD; + +private: + required_device m_nsc; + required_device m_nsclatch; + required_device m_msm; + + /* sound-related */ + uint8_t m_adpcm_byte = 0; + int m_msm5205_vclk_toggle = 0; /* misc */ - uint8_t m_mux_data = 0; - uint8_t m_nsc_latch = 0; - uint8_t m_z80_latch = 0; + uint8_t m_z80_latch = 0; - std::unique_ptr m_tmp_bitmap; - - /* devices */ - required_device m_cpu_0; - optional_device m_cpu_1; - optional_device m_nsc; - optional_device m_msm; - optional_device m_cvsd; - required_device m_palette; - required_device m_blitter; - optional_device m_soundlatch; - - /* video-related */ - void mux_w(uint8_t data); - void output_w(uint8_t data); - void sound_latch_w(uint8_t data); - uint8_t sound_latch_r(); - void cvsd_w(uint8_t data); void adpcm_w(uint8_t data); uint8_t master_com_r(); - void master_com_w(uint8_t data); - uint8_t slave_com_r(); void slave_com_w(uint8_t data); - uint8_t jngolady_rng_r(); - uint8_t input_mux_r(); + uint8_t rng_r(); - void jangou_palette(palette_device &palette) const; - DECLARE_MACHINE_START(jngolady); - DECLARE_MACHINE_RESET(jngolady); - DECLARE_MACHINE_START(common); - DECLARE_MACHINE_RESET(common); - uint32_t screen_update_jangou(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_CALLBACK_MEMBER(cvsd_bit_timer_callback); - DECLARE_WRITE_LINE_MEMBER(jngolady_vclk_cb); + DECLARE_WRITE_LINE_MEMBER(vclk_cb); - void cntrygrl_cpu0_io(address_map &map); - void cntrygrl_cpu0_map(address_map &map); - void cpu0_io(address_map &map); - void cpu0_map(address_map &map); - void cpu1_io(address_map &map); - void cpu1_map(address_map &map); void jngolady_cpu0_map(address_map &map); void jngolady_cpu1_io(address_map &map); void jngolady_cpu1_map(address_map &map); void nsc_map(address_map &map); - void roylcrdn_cpu0_io(address_map &map); - void roylcrdn_cpu0_map(address_map &map); - void luckygrl_cpu0_map(address_map &map); - void decrypted_opcodes_map(address_map &map); }; @@ -150,7 +198,7 @@ private: *************************************/ // guess: use the same resistor values as Crazy Climber (needs checking on the real hardware) -void jangou_state::jangou_palette(palette_device &palette) const +void cntrygrl_state::init_palette(palette_device &palette) const { uint8_t const *const color_prom = memregion("proms")->base(); static constexpr int resistances_rg[3] = { 1000, 470, 220 }; @@ -188,12 +236,7 @@ void jangou_state::jangou_palette(palette_device &palette) const } } -void jangou_state::video_start() -{ - m_tmp_bitmap = std::make_unique(256, 256); -} - -uint32_t jangou_state::screen_update_jangou(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +uint32_t cntrygrl_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { for (int y = cliprect.min_y; y <= cliprect.max_y; ++y) { @@ -220,12 +263,12 @@ uint32_t jangou_state::screen_update_jangou(screen_device &screen, bitmap_ind16 * *************************************/ -void jangou_state::mux_w(uint8_t data) +void cntrygrl_state::mux_w(uint8_t data) { - m_mux_data = ~data; + m_mux_data = data; } -void jangou_state::output_w(uint8_t data) +void cntrygrl_state::output_w(uint8_t data) { /* --x- ---- ? (polls between high and low in irq routine, most likely irq mask) @@ -238,19 +281,15 @@ void jangou_state::output_w(uint8_t data) // machine().bookkeeping().coin_lockout_w(0, ~data & 0x20); } -uint8_t jangou_state::input_mux_r() +uint8_t cntrygrl_state::input_mux_r() { - switch(m_mux_data) + uint8_t result = 0xff; + for (unsigned i = 0; m_keymatrix.size() > i; ++i) { - case 0x01: return ioport("PL1_1")->read(); - case 0x02: return ioport("PL1_2")->read(); - case 0x04: return ioport("PL2_1")->read(); - case 0x08: return ioport("PL2_2")->read(); - case 0x10: return ioport("PL1_3")->read(); - case 0x20: return ioport("PL2_3")->read(); + if (!BIT(m_mux_data, i)) + result &= m_keymatrix[i]->read(); } - - return ioport("IN_NOMUX")->read(); + return result; } @@ -260,18 +299,6 @@ uint8_t jangou_state::input_mux_r() * *************************************/ -void jangou_state::sound_latch_w(uint8_t data) -{ - m_soundlatch->write(data & 0xff); - m_cpu_1->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); -} - -uint8_t jangou_state::sound_latch_r() -{ - m_cpu_1->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); - return m_soundlatch->read(); -} - /* Jangou HC-55516 CVSD */ void jangou_state::cvsd_w(uint8_t data) { @@ -281,7 +308,7 @@ void jangou_state::cvsd_w(uint8_t data) TIMER_CALLBACK_MEMBER(jangou_state::cvsd_bit_timer_callback) { /* Data is shifted out at the MSB */ - m_cvsd->digit_w((m_cvsd_shiftreg >> 7) & 1); + m_cvsd->digit_w(BIT(m_cvsd_shiftreg, 7)); m_cvsd_shiftreg <<= 1; /* Trigger an IRQ for every 8 shifted bits */ @@ -291,15 +318,17 @@ TIMER_CALLBACK_MEMBER(jangou_state::cvsd_bit_timer_callback) /* Jangou Lady MSM5218 (MSM5205-compatible) ADPCM */ -void jangou_state::adpcm_w(uint8_t data) +void jngolady_state::adpcm_w(uint8_t data) { m_adpcm_byte = data; } -WRITE_LINE_MEMBER(jangou_state::jngolady_vclk_cb) +WRITE_LINE_MEMBER(jngolady_state::vclk_cb) { - if (m_msm5205_vclk_toggle == 0) + if (!m_msm5205_vclk_toggle) + { m_msm->data_w(m_adpcm_byte >> 4); + } else { m_msm->data_w(m_adpcm_byte & 0xf); @@ -316,63 +345,120 @@ WRITE_LINE_MEMBER(jangou_state::jngolady_vclk_cb) * *************************************/ -uint8_t jangou_state::master_com_r() +uint8_t jngolady_state::master_com_r() { return m_z80_latch; } -void jangou_state::master_com_w(uint8_t data) -{ - m_nsc->set_input_line(0, ASSERT_LINE); - m_nsc_latch = data; -} - -uint8_t jangou_state::slave_com_r() -{ - m_nsc->set_input_line(0, CLEAR_LINE); - return m_nsc_latch; -} - -void jangou_state::slave_com_w(uint8_t data) +void jngolady_state::slave_com_w(uint8_t data) { m_z80_latch = data; } +/************************************* + * + * Country Girl Memory Map + * + *************************************/ + +void cntrygrl_state::cntrygrl_cpu0_map(address_map &map) +{ + map(0x0000, 0x3fff).rom(); +// map(0xc000, 0xc7ff).ram(); + map(0xe000, 0xefff).ram(); +} + +void cntrygrl_state::cntrygrl_cpu0_io(address_map &map) +{ + map.global_mask(0xff); + map(0x01, 0x01).r("aysnd", FUNC(ay8910_device::data_r)); + map(0x02, 0x03).w("aysnd", FUNC(ay8910_device::data_address_w)); + map(0x10, 0x10).portr("DSW"); //dsw + blitter busy flag + map(0x10, 0x10).w(FUNC(cntrygrl_state::output_w)); + map(0x11, 0x11).w(FUNC(cntrygrl_state::mux_w)); + map(0x12, 0x17).m(m_blitter, FUNC(jangou_blitter_device::blit_v1_regs)); + map(0x20, 0x2f).w(m_blitter, FUNC(jangou_blitter_device::vregs_w)); + map(0x30, 0x30).nopw(); //? polls 0x03 continuously +} + +/************************************* + * + * Royal Card Memory Map + * + *************************************/ + +void cntrygrl_state::roylcrdn_cpu0_map(address_map &map) +{ + map(0x0000, 0x2fff).rom(); + map(0x7000, 0x77ff).ram().share("nvram"); /* MK48Z02B-15 ZEROPOWER RAM */ +} + +void cntrygrl_state::roylcrdn_cpu0_io(address_map &map) +{ + map.global_mask(0xff); + map(0x01, 0x01).r("aysnd", FUNC(ay8910_device::data_r)); + map(0x02, 0x03).w("aysnd", FUNC(ay8910_device::data_address_w)); + map(0x10, 0x10).portr("DSW"); /* DSW + blitter busy flag */ + map(0x10, 0x10).nopw(); /* Writes continuosly 0's in attract mode, and 1's in game */ + map(0x11, 0x11).w(FUNC(cntrygrl_state::mux_w)); + map(0x12, 0x17).m(m_blitter, FUNC(jangou_blitter_device::blit_v1_regs)); + map(0x13, 0x13).nopr(); /* Often reads bit7 with unknown purposes */ + map(0x20, 0x2f).w(m_blitter, FUNC(jangou_blitter_device::vregs_w)); + map(0x30, 0x30).nopw(); /* Seems to write 0x10 on each sound event */ +} + +/************************************* + * + * Lucky Girl Memory Map + * + *************************************/ + +void cntrygrl_state::luckygrl_cpu0_map(address_map &map) +{ + map(0x0000, 0x4fff).rom(); + map(0xc000, 0xc7ff).ram(); +} + +void cntrygrl_state::decrypted_opcodes_map(address_map &map) +{ + map(0x0000, 0x4fff).rom().share("decrypted_opcodes"); +} + /************************************* * * Jangou Memory Map * *************************************/ -void jangou_state::cpu0_map(address_map &map) +void jangou_state::jangou_cpu0_map(address_map &map) { map(0x0000, 0x9fff).rom(); map(0xc000, 0xc7ff).ram(); } -void jangou_state::cpu0_io(address_map &map) +void jangou_state_base::jangou_cpu0_io(address_map &map) { map.global_mask(0xff); map(0x01, 0x01).r("aysnd", FUNC(ay8910_device::data_r)); map(0x02, 0x03).w("aysnd", FUNC(ay8910_device::data_address_w)); - map(0x10, 0x10).portr("DSW").w(FUNC(jangou_state::output_w)); //dsw + blitter busy flag - map(0x11, 0x11).w(FUNC(jangou_state::mux_w)); + map(0x10, 0x10).portr("DSW").w(FUNC(jangou_state_base::output_w)); //dsw + blitter busy flag + map(0x11, 0x11).w(FUNC(jangou_state_base::mux_w)); map(0x12, 0x17).m(m_blitter, FUNC(jangou_blitter_device::blit_v1_regs)); map(0x20, 0x2f).w(m_blitter, FUNC(jangou_blitter_device::vregs_w)); map(0x30, 0x30).nopw(); //? polls 0x03 continuously - map(0x31, 0x31).w(FUNC(jangou_state::sound_latch_w)); + map(0x31, 0x31).w(m_soundlatch, FUNC(generic_latch_8_device::write)); } -void jangou_state::cpu1_map(address_map &map) +void jangou_state::jangou_cpu1_map(address_map &map) { map(0x0000, 0x7fff).rom().nopw(); } -void jangou_state::cpu1_io(address_map &map) +void jangou_state::jangou_cpu1_io(address_map &map) { map.global_mask(0xff); - map(0x00, 0x00).r(FUNC(jangou_state::sound_latch_r)); + map(0x00, 0x00).r(m_soundlatch, FUNC(generic_latch_8_device::read)); map(0x01, 0x01).w(FUNC(jangou_state::cvsd_w)); map(0x02, 0x02).nopw(); // Echoes sound command - acknowledge? } @@ -384,106 +470,36 @@ void jangou_state::cpu1_io(address_map &map) * *************************************/ -void jangou_state::jngolady_cpu0_map(address_map &map) +void jngolady_state::jngolady_cpu0_map(address_map &map) { map(0x0000, 0x9fff).rom(); map(0xc000, 0xc7ff).ram().share("share1"); - map(0xe000, 0xe000).rw(FUNC(jangou_state::master_com_r), FUNC(jangou_state::master_com_w)); + map(0xe000, 0xe000).r(FUNC(jngolady_state::master_com_r)).w(m_nsclatch, FUNC(generic_latch_8_device::write)); } -void jangou_state::jngolady_cpu1_map(address_map &map) +void jngolady_state::jngolady_cpu1_map(address_map &map) { map(0x0000, 0x7fff).rom().nopw(); } -void jangou_state::jngolady_cpu1_io(address_map &map) +void jngolady_state::jngolady_cpu1_io(address_map &map) { map.global_mask(0xff); - map(0x00, 0x00).r(FUNC(jangou_state::sound_latch_r)); - map(0x01, 0x01).w(FUNC(jangou_state::adpcm_w)); + map(0x00, 0x00).r(m_soundlatch, FUNC(generic_latch_8_device::read)); + map(0x01, 0x01).w(FUNC(jngolady_state::adpcm_w)); map(0x02, 0x02).nopw(); } -void jangou_state::nsc_map(address_map &map) +void jngolady_state::nsc_map(address_map &map) { - map(0x8000, 0x8000).nopw(); //write-only,irq related? - map(0x9000, 0x9000).rw(FUNC(jangou_state::slave_com_r), FUNC(jangou_state::slave_com_w)); + map(0x8000, 0x8000).nopw(); //write-only, IRQ-related? + map(0x9000, 0x9000).r(m_nsclatch, FUNC(generic_latch_8_device::read)).w(FUNC(jngolady_state::slave_com_w)); map(0xc000, 0xc7ff).ram().share("share1"); map(0xf000, 0xffff).rom(); } -/************************************* - * - * Country Girl Memory Map - * - *************************************/ - -void jangou_state::cntrygrl_cpu0_map(address_map &map) -{ - map(0x0000, 0x3fff).rom(); -// map(0xc000, 0xc7ff).ram(); - map(0xe000, 0xefff).ram(); -} - -void jangou_state::cntrygrl_cpu0_io(address_map &map) -{ - map.global_mask(0xff); - map(0x01, 0x01).r("aysnd", FUNC(ay8910_device::data_r)); - map(0x02, 0x03).w("aysnd", FUNC(ay8910_device::data_address_w)); - map(0x10, 0x10).portr("DSW"); //dsw + blitter busy flag - map(0x10, 0x10).w(FUNC(jangou_state::output_w)); - map(0x11, 0x11).w(FUNC(jangou_state::mux_w)); - map(0x12, 0x17).m(m_blitter, FUNC(jangou_blitter_device::blit_v1_regs)); - map(0x20, 0x2f).w(m_blitter, FUNC(jangou_blitter_device::vregs_w)); - map(0x30, 0x30).nopw(); //? polls 0x03 continuously -// map(0x31, 0x31).w(FUNC(jangou_state::sound_latch_w)); -} - -/************************************* - * - * Lucky Girl Memory Map - * - *************************************/ - -void jangou_state::luckygrl_cpu0_map(address_map &map) -{ - map(0x0000, 0x4fff).rom(); - map(0xc000, 0xc7ff).ram(); -} - -void jangou_state::decrypted_opcodes_map(address_map &map) -{ - map(0x0000, 0x4fff).rom().share("decrypted_opcodes"); -} - -/************************************* - * - * Royal Card Memory Map - * - *************************************/ - -void jangou_state::roylcrdn_cpu0_map(address_map &map) -{ - map(0x0000, 0x2fff).rom(); - map(0x7000, 0x77ff).ram().share("nvram"); /* MK48Z02B-15 ZEROPOWER RAM */ -} - -void jangou_state::roylcrdn_cpu0_io(address_map &map) -{ - map.global_mask(0xff); - map(0x01, 0x01).r("aysnd", FUNC(ay8910_device::data_r)); - map(0x02, 0x03).w("aysnd", FUNC(ay8910_device::data_address_w)); - map(0x10, 0x10).portr("DSW"); /* DSW + blitter busy flag */ - map(0x10, 0x10).nopw(); /* Writes continuosly 0's in attract mode, and 1's in game */ - map(0x11, 0x11).w(FUNC(jangou_state::mux_w)); - map(0x12, 0x17).m(m_blitter, FUNC(jangou_blitter_device::blit_v1_regs)); - map(0x13, 0x13).nopr(); /* Often reads bit7 with unknown purposes */ - map(0x20, 0x2f).w(m_blitter, FUNC(jangou_blitter_device::vregs_w)); - map(0x30, 0x30).nopw(); /* Seems to write 0x10 on each sound event */ -} - /************************************* * @@ -555,9 +571,6 @@ static INPUT_PORTS_START( jangou ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_START("IN_NOMUX") - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - /* there's a bank of 6 dip-switches in there*/ PORT_START("DSW") PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:1,2") @@ -583,7 +596,11 @@ INPUT_PORTS_END static INPUT_PORTS_START( macha ) PORT_START("PL1_1") - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("1P A") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("1P B") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("1P C") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 ) + PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("PL1_2") PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) @@ -600,13 +617,6 @@ static INPUT_PORTS_START( macha ) PORT_START("PL2_3") PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("IN_NOMUX") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("1P A") PORT_CODE(KEYCODE_Z) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("1P B") PORT_CODE(KEYCODE_X) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("1P C") PORT_CODE(KEYCODE_C) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 ) - PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) - /*The "unknown" bits for this port might be actually unused*/ PORT_START("SYSTEM") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) @@ -725,9 +735,6 @@ static INPUT_PORTS_START( cntrygrl ) PORT_DIPSETTING( 0x40, DEF_STR( 1C_5C ) ) PORT_DIPSETTING( 0x00, "1 Coin / 10 Credits" ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("blitter", jangou_blitter_device, status_r) - - PORT_START("IN_NOMUX") - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) INPUT_PORTS_END static INPUT_PORTS_START( jngolady ) @@ -739,7 +746,7 @@ static INPUT_PORTS_START( jngolady ) PORT_MODIFY("PL2_3") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START2 ) PORT_NAME("P2 Start / P2 Mahjong Flip Flop") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_FLIP_FLOP ) PORT_NAME("P2 Ready") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_FLIP_FLOP ) PORT_PLAYER(2) PORT_NAME("P2 Ready") PORT_MODIFY("SYSTEM") PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) // no service switch @@ -825,9 +832,6 @@ static INPUT_PORTS_START( roylcrdn ) PORT_START("DSW") PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("blitter", jangou_blitter_device, status_r) - - PORT_START("IN_NOMUX") - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) INPUT_PORTS_END static INPUT_PORTS_START( luckygrl ) @@ -894,9 +898,6 @@ static INPUT_PORTS_START( luckygrl ) PORT_DIPUNKNOWN_DIPLOC(0x20, 0x20, "SW1:6") PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("blitter", jangou_blitter_device, status_r) - - PORT_START("IN_NOMUX") - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) INPUT_PORTS_END @@ -906,169 +907,158 @@ INPUT_PORTS_END * *************************************/ -MACHINE_START_MEMBER(jangou_state,common) +void cntrygrl_state::machine_start() { save_item(NAME(m_mux_data)); + + m_tmp_bitmap = std::make_unique(256, 256); } void jangou_state::machine_start() { - MACHINE_START_CALL_MEMBER(common); + jangou_state_base::machine_start(); save_item(NAME(m_cvsd_shiftreg)); save_item(NAME(m_cvsd_shift_cnt)); - /* Create a timer to feed the CVSD DAC with sample bits */ + // Create a timer to feed the CVSD DAC with sample bits m_cvsd_bit_timer = timer_alloc(FUNC(jangou_state::cvsd_bit_timer_callback), this); m_cvsd_bit_timer->adjust(attotime::from_hz(MASTER_CLOCK / 1024), 0, attotime::from_hz(MASTER_CLOCK / 1024)); } -MACHINE_START_MEMBER(jangou_state,jngolady) +void jngolady_state::machine_start() { - MACHINE_START_CALL_MEMBER(common); + jangou_state_base::machine_start(); save_item(NAME(m_adpcm_byte)); save_item(NAME(m_msm5205_vclk_toggle)); - save_item(NAME(m_nsc_latch)); save_item(NAME(m_z80_latch)); } -MACHINE_RESET_MEMBER(jangou_state,common) +void cntrygrl_state::machine_reset() { - m_mux_data = 0; + m_mux_data = 0xff; } void jangou_state::machine_reset() { - MACHINE_RESET_CALL_MEMBER(common); + jangou_state_base::machine_reset(); m_cvsd_shiftreg = 0; m_cvsd_shift_cnt = 0; } -MACHINE_RESET_MEMBER(jangou_state,jngolady) +void jngolady_state::machine_reset() { - MACHINE_RESET_CALL_MEMBER(common); + jangou_state_base::machine_reset(); m_adpcm_byte = 0; m_msm5205_vclk_toggle = 0; - m_nsc_latch = 0; m_z80_latch = 0; } /* Note: All frequencies and dividers are unverified */ -void jangou_state::jangou(machine_config &config) +void cntrygrl_state::cntrygrl(machine_config &config) { /* basic machine hardware */ Z80(config, m_cpu_0, MASTER_CLOCK / 8); - m_cpu_0->set_addrmap(AS_PROGRAM, &jangou_state::cpu0_map); - m_cpu_0->set_addrmap(AS_IO, &jangou_state::cpu0_io); + m_cpu_0->set_addrmap(AS_PROGRAM, &cntrygrl_state::cntrygrl_cpu0_map); + m_cpu_0->set_addrmap(AS_IO, &cntrygrl_state::cntrygrl_cpu0_io); m_cpu_0->set_vblank_int("screen", FUNC(jangou_state::irq0_line_hold)); - Z80(config, m_cpu_1, MASTER_CLOCK / 8); - m_cpu_1->set_addrmap(AS_PROGRAM, &jangou_state::cpu1_map); - m_cpu_1->set_addrmap(AS_IO, &jangou_state::cpu1_io); - JANGOU_BLITTER(config, "blitter", MASTER_CLOCK/4); /* video hardware */ screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_raw(MASTER_CLOCK/4,320,0,256,264,16,240); // assume same as nightgal.cpp - screen.set_screen_update(FUNC(jangou_state::screen_update_jangou)); + screen.set_screen_update(FUNC(cntrygrl_state::screen_update)); screen.set_palette(m_palette); - PALETTE(config, m_palette, FUNC(jangou_state::jangou_palette), 32); + PALETTE(config, m_palette, FUNC(cntrygrl_state::init_palette), 32); /* sound hardware */ SPEAKER(config, "mono").front_center(); - GENERIC_LATCH_8(config, m_soundlatch); - ay8910_device &aysnd(AY8910(config, "aysnd", MASTER_CLOCK / 16)); aysnd.port_a_read_callback().set(FUNC(jangou_state::input_mux_r)); aysnd.port_b_read_callback().set_ioport("SYSTEM"); aysnd.add_route(ALL_OUTPUTS, "mono", 0.40); +} + +void cntrygrl_state::roylcrdn(machine_config &config) +{ + cntrygrl(config); + + /* basic machine hardware */ + m_cpu_0->set_addrmap(AS_PROGRAM, &cntrygrl_state::roylcrdn_cpu0_map); + m_cpu_0->set_addrmap(AS_IO, &cntrygrl_state::roylcrdn_cpu0_io); + + NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); +} + +void cntrygrl_state::luckygrl(machine_config &config) +{ + cntrygrl(config); + + sega_315_spat_device &maincpu(SEGA_315_SPAT(config.replace(), m_cpu_0, MASTER_CLOCK / 8)); // actually Falcon 03155096 encrypted Z80 + maincpu.set_addrmap(AS_PROGRAM, &cntrygrl_state::luckygrl_cpu0_map); + maincpu.set_addrmap(AS_IO, &cntrygrl_state::cntrygrl_cpu0_io); + maincpu.set_addrmap(AS_OPCODES, &cntrygrl_state::decrypted_opcodes_map); + maincpu.set_decrypted_tag(":decrypted_opcodes"); + maincpu.set_size(0x5000); + maincpu.set_vblank_int("screen", FUNC(cntrygrl_state::irq0_line_hold)); +} + +void jangou_state_base::jangou_base(machine_config &config) +{ + cntrygrl(config); + + /* basic machine hardware */ + m_cpu_0->set_addrmap(AS_IO, &jangou_state::jangou_cpu0_io); + + Z80(config, m_cpu_1, MASTER_CLOCK / 8); + + GENERIC_LATCH_8(config, m_soundlatch); + m_soundlatch->data_pending_callback().set_inputline(m_cpu_1, INPUT_LINE_NMI); +} + +void jangou_state::jangou(machine_config &config) +{ + jangou_base(config); + + /* basic machine hardware */ + m_cpu_0->set_addrmap(AS_PROGRAM, &jangou_state::jangou_cpu0_map); + + m_cpu_1->set_addrmap(AS_PROGRAM, &jangou_state::jangou_cpu1_map); + m_cpu_1->set_addrmap(AS_IO, &jangou_state::jangou_cpu1_io); HC55516(config, m_cvsd, MASTER_CLOCK / 1024); m_cvsd->add_route(ALL_OUTPUTS, "mono", 0.60); } -void jangou_state::jngolady(machine_config &config) +void jngolady_state::jngolady(machine_config &config) { - jangou(config); + jangou_base(config); /* basic machine hardware */ - m_cpu_0->set_addrmap(AS_PROGRAM, &jangou_state::jngolady_cpu0_map); + m_cpu_0->set_addrmap(AS_PROGRAM, &jngolady_state::jngolady_cpu0_map); - m_cpu_1->set_addrmap(AS_PROGRAM, &jangou_state::jngolady_cpu1_map); - m_cpu_1->set_addrmap(AS_IO, &jangou_state::jngolady_cpu1_io); + m_cpu_1->set_addrmap(AS_PROGRAM, &jngolady_state::jngolady_cpu1_map); + m_cpu_1->set_addrmap(AS_IO, &jngolady_state::jngolady_cpu1_io); NSC8105(config, m_nsc, MASTER_CLOCK / 8); - m_nsc->set_addrmap(AS_PROGRAM, &jangou_state::nsc_map); + m_nsc->set_addrmap(AS_PROGRAM, &jngolady_state::nsc_map); - MCFG_MACHINE_START_OVERRIDE(jangou_state,jngolady) - MCFG_MACHINE_RESET_OVERRIDE(jangou_state,jngolady) + GENERIC_LATCH_8(config, m_nsclatch); + m_nsclatch->data_pending_callback().set_inputline(m_nsc, 0); /* sound hardware */ - config.device_remove("cvsd"); - MSM5205(config, m_msm, XTAL(400'000)); - m_msm->vck_legacy_callback().set(FUNC(jangou_state::jngolady_vclk_cb)); + m_msm->vck_legacy_callback().set(FUNC(jngolady_state::vclk_cb)); m_msm->set_prescaler_selector(msm5205_device::S96_4B); m_msm->add_route(ALL_OUTPUTS, "mono", 0.80); } -void jangou_state::cntrygrl(machine_config &config) -{ - jangou(config); - - /* basic machine hardware */ - m_cpu_0->set_addrmap(AS_PROGRAM, &jangou_state::cntrygrl_cpu0_map); - m_cpu_0->set_addrmap(AS_IO, &jangou_state::cntrygrl_cpu0_io); - - config.device_remove("cpu1"); - - MCFG_MACHINE_START_OVERRIDE(jangou_state,common) - MCFG_MACHINE_RESET_OVERRIDE(jangou_state,common) - - /* sound hardware */ - config.device_remove("cvsd"); - config.device_remove("soundlatch"); -} - -void jangou_state::roylcrdn(machine_config &config) -{ - jangou(config); - - /* basic machine hardware */ - m_cpu_0->set_addrmap(AS_PROGRAM, &jangou_state::roylcrdn_cpu0_map); - m_cpu_0->set_addrmap(AS_IO, &jangou_state::roylcrdn_cpu0_io); - - config.device_remove("cpu1"); - - NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); - - MCFG_MACHINE_START_OVERRIDE(jangou_state,common) - MCFG_MACHINE_RESET_OVERRIDE(jangou_state,common) - - /* sound hardware */ - config.device_remove("cvsd"); - config.device_remove("soundlatch"); -} - -void jangou_state::luckygrl(machine_config &config) -{ - cntrygrl(config); - - sega_315_spat_device &maincpu(SEGA_315_SPAT(config.replace(), m_cpu_0, MASTER_CLOCK / 8)); // actually Falcon 03155096 encrypted Z80 - maincpu.set_addrmap(AS_PROGRAM, &jangou_state::luckygrl_cpu0_map); - maincpu.set_addrmap(AS_IO, &jangou_state::cntrygrl_cpu0_io); - maincpu.set_addrmap(AS_OPCODES, &jangou_state::decrypted_opcodes_map); - maincpu.set_decrypted_tag(":decrypted_opcodes"); - maincpu.set_size(0x5000); - maincpu.set_vblank_int("screen", FUNC(jangou_state::irq0_line_hold)); -} - /************************************* * @@ -1364,15 +1354,10 @@ ROM_END * *************************************/ -/*Temporary kludge to make the RNG work*/ -uint8_t jangou_state::jngolady_rng_r() +// Temporary kludge to make the RNG work +void jngolady_state::init_jngolady() { - return machine().rand(); -} - -void jangou_state::init_jngolady() -{ - m_nsc->space(AS_PROGRAM).install_read_handler(0x08, 0x08, read8smo_delegate(*this, FUNC(jangou_state::jngolady_rng_r))); + m_nsc->space(AS_PROGRAM).install_read_handler(0x08, 0x08, read8smo_delegate(*this, NAME([this] () { return u8(machine().rand()); }))); } } // anonymous namespace @@ -1384,15 +1369,15 @@ void jangou_state::init_jngolady() * *************************************/ -GAME( 1983, jangou, 0, jangou, jangou, jangou_state, empty_init, ROT0, "Nichibutsu", "Jangou [BET] (Japan)", MACHINE_SUPPORTS_SAVE ) -GAME( 1983, macha, 0, jangou, macha, jangou_state, empty_init, ROT0, "Logitec", "Monoshiri Quiz Osyaberi Macha (Japan)", MACHINE_SUPPORTS_SAVE ) -GAME( 1984, jngolady, 0, jngolady, jngolady, jangou_state, init_jngolady, ROT0, "Nichibutsu", "Jangou Lady (Japan)", MACHINE_SUPPORTS_SAVE ) -GAME( 1984, cntrygrl, 0, cntrygrl, cntrygrl, jangou_state, empty_init, ROT0, "Royal Denshi", "Country Girl (Japan set 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1984, cntrygrla, cntrygrl, cntrygrl, cntrygrl, jangou_state, empty_init, ROT0, "Nichibutsu", "Country Girl (Japan set 2)", MACHINE_SUPPORTS_SAVE ) -GAME( 1984, fruitbun, cntrygrl, cntrygrl, cntrygrl, jangou_state, empty_init, ROT0, "Nichibutsu", "Fruits & Bunny (World?)", MACHINE_SUPPORTS_SAVE ) -GAME( 1985, roylcrdn, 0, roylcrdn, roylcrdn, jangou_state, empty_init, ROT0, "Amusement", "Royal Card (Nichibutsu HW)", MACHINE_SUPPORTS_SAVE ) -GAME( 1982, roylcrdna, roylcrdn, roylcrdn, roylcrdn, jangou_state, empty_init, ROT0, "Miki Corp.", "Royal Card Part-Two (Nichibutsu HW, Ver. 1.02)", MACHINE_SUPPORTS_SAVE ) -GAME( 1985, luckygrl, 0, luckygrl, luckygrl, jangou_state, empty_init, ROT0, "Wing Co., Ltd.", "Lucky Girl (Wing)", MACHINE_SUPPORTS_SAVE ) +GAME( 1983, jangou, 0, jangou, jangou, jangou_state, empty_init, ROT0, "Nichibutsu", "Jangou [BET] (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1983, macha, 0, jangou, macha, jangou_state, empty_init, ROT0, "Logitec", "Monoshiri Quiz Oshaberi Macha (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, jngolady, 0, jngolady, jngolady, jngolady_state, init_jngolady, ROT0, "Nichibutsu", "Jangou Lady (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, cntrygrl, 0, cntrygrl, cntrygrl, cntrygrl_state, empty_init, ROT0, "Royal Denshi", "Country Girl (Japan set 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, cntrygrla, cntrygrl, cntrygrl, cntrygrl, cntrygrl_state, empty_init, ROT0, "Nichibutsu", "Country Girl (Japan set 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, fruitbun, cntrygrl, cntrygrl, cntrygrl, cntrygrl_state, empty_init, ROT0, "Nichibutsu", "Fruits & Bunny (World?)", MACHINE_SUPPORTS_SAVE ) +GAME( 1985, roylcrdn, 0, roylcrdn, roylcrdn, cntrygrl_state, empty_init, ROT0, "Amusement", "Royal Card (Nichibutsu HW)", MACHINE_SUPPORTS_SAVE ) +GAME( 1982, roylcrdna, roylcrdn, roylcrdn, roylcrdn, cntrygrl_state, empty_init, ROT0, "Miki Corp.", "Royal Card Part-Two (Nichibutsu HW, Ver. 1.02)", MACHINE_SUPPORTS_SAVE ) +GAME( 1985, luckygrl, 0, luckygrl, luckygrl, cntrygrl_state, empty_init, ROT0, "Wing Co., Ltd.", "Lucky Girl (Wing)", MACHINE_SUPPORTS_SAVE ) /* Some other games that might run on this HW: diff --git a/src/mame/taito/taito_l.cpp b/src/mame/taito/taito_l.cpp index 034d947956b..48593b8ac52 100644 --- a/src/mame/taito/taito_l.cpp +++ b/src/mame/taito/taito_l.cpp @@ -72,59 +72,45 @@ puzznici note #include "speaker.h" -void taitol_state::state_register() +void taitol_state::machine_start() { save_item(NAME(m_last_irq_level)); } -void taitol_2cpu_state::state_register() +void taitol_2cpu_state::machine_start() { + taitol_state::machine_start(); + if (m_audio_bnk.found()) m_audio_bnk->configure_entries(0, m_audio_prg->bytes()/0x4000, m_audio_prg->base(), 0x4000); - - taitol_state::state_register(); } -void fhawk_state::state_register() +void fhawk_state::machine_start() { + taitol_2cpu_state::machine_start(); + m_slave_bnk->configure_entries(0, m_slave_prg->bytes()/0x4000, m_slave_prg->base(), 0x4000); - taitol_2cpu_state::state_register(); save_item(NAME(m_slave_rombank)); } -void champwr_state::state_register() +void champwr_state::machine_start() { - fhawk_state::state_register(); + fhawk_state::machine_start(); save_item(NAME(m_adpcm_pos)); save_item(NAME(m_adpcm_data)); } -void taitol_1cpu_state::state_register() -{ - taitol_state::state_register(); -} - -MACHINE_START_MEMBER(taitol_state, taito_l) -{ - state_register(); -} - -void taitol_state::taito_machine_reset() +void taitol_state::machine_reset() { m_last_irq_level = 0; } -void taitol_2cpu_state::taito_machine_reset() +void fhawk_state::machine_reset() { - taitol_state::taito_machine_reset(); -} - -void fhawk_state::taito_machine_reset() -{ - taitol_2cpu_state::taito_machine_reset(); + taitol_2cpu_state::machine_reset(); m_slave_rombank = 0; m_slave_bnk->set_entry(m_slave_rombank); @@ -132,25 +118,14 @@ void fhawk_state::taito_machine_reset() m_audio_bnk->set_entry(1); } -void champwr_state::taito_machine_reset() +void champwr_state::machine_reset() { - fhawk_state::taito_machine_reset(); + fhawk_state::machine_reset(); m_adpcm_pos = 0; m_adpcm_data = -1; } -void taitol_1cpu_state::taito_machine_reset() -{ - taitol_state::taito_machine_reset(); -} - - -MACHINE_RESET_MEMBER(taitol_state, taito_l) -{ - taito_machine_reset(); -} - IRQ_CALLBACK_MEMBER(taitol_state::irq_callback) { @@ -1309,9 +1284,6 @@ void fhawk_state::fhawk(machine_config &config) tc0220ioc.write_4_callback().set(FUNC(taitol_state::coin_control_w)); tc0220ioc.read_7_callback().set_ioport("IN2"); - MCFG_MACHINE_START_OVERRIDE(taitol_state, taito_l) - MCFG_MACHINE_RESET_OVERRIDE(taitol_state, taito_l) - /* video hardware */ l_system_video(config); @@ -1376,9 +1348,6 @@ void taitol_2cpu_state::raimais(machine_config &config) MB8421(config, "dpram"); - MCFG_MACHINE_START_OVERRIDE(taitol_state, taito_l) - MCFG_MACHINE_RESET_OVERRIDE(taitol_state, taito_l) - /* video hardware */ l_system_video(config); @@ -1419,9 +1388,6 @@ void taitol_2cpu_state::kurikint(machine_config &config) MB8421(config, "dpram"); - MCFG_MACHINE_START_OVERRIDE(taitol_state, taito_l) - MCFG_MACHINE_RESET_OVERRIDE(taitol_state, taito_l) - /* video hardware */ l_system_video(config); @@ -1453,9 +1419,6 @@ void taitol_1cpu_state::base(machine_config &config) m_main_cpu->set_addrmap(AS_PROGRAM, &taitol_1cpu_state::plotting_map); m_main_cpu->set_irq_acknowledge_callback(FUNC(taitol_state::irq_callback)); - MCFG_MACHINE_START_OVERRIDE(taitol_state, taito_l) - MCFG_MACHINE_RESET_OVERRIDE(taitol_state, taito_l) - /* video hardware */ l_system_video(config); @@ -1495,11 +1458,15 @@ void taitol_1cpu_state::puzznici(machine_config &config) void horshoes_state::machine_start() { + taitol_1cpu_state::machine_start(); + save_item(NAME(m_horshoes_gfxbank)); } void horshoes_state::machine_reset() { + taitol_1cpu_state::machine_reset(); + m_horshoes_gfxbank = 0; } @@ -1565,9 +1532,6 @@ void taitol_2cpu_state::evilston(machine_config &config) mb8421_device &dpram(MB8421(config, "dpram")); dpram.intl_callback().set_inputline("audiocpu", INPUT_LINE_NMI); - MCFG_MACHINE_START_OVERRIDE(taitol_state, taito_l) - MCFG_MACHINE_RESET_OVERRIDE(taitol_state, taito_l) - /* video hardware */ l_system_video(config); diff --git a/src/mame/taito/taito_l.h b/src/mame/taito/taito_l.h index fe22b1c2c0c..4ad14acc53b 100644 --- a/src/mame/taito/taito_l.h +++ b/src/mame/taito/taito_l.h @@ -26,15 +26,15 @@ public: { } - DECLARE_MACHINE_START(taito_l); - DECLARE_MACHINE_RESET(taito_l); IRQ_CALLBACK_MEMBER(irq_callback); void coin_control_w(u8 data); protected: + virtual void machine_start() override ATTR_COLD; + virtual void machine_reset() override ATTR_COLD; + /* misc */ - int m_last_irq_level; void irq_enable_w(u8 data); void mcu_control_w(u8 data); @@ -42,12 +42,11 @@ protected: DECLARE_WRITE_LINE_MEMBER(screen_vblank_taitol); TIMER_DEVICE_CALLBACK_MEMBER(vbl_interrupt); - void l_system_video(machine_config &config); + void l_system_video(machine_config &config) ATTR_COLD; - void common_banks_map(address_map &map); + void common_banks_map(address_map &map) ATTR_COLD; - virtual void state_register(); - virtual void taito_machine_reset(); + int m_last_irq_level; required_device m_main_cpu; optional_device m_upd4701; @@ -68,21 +67,20 @@ public: void sound_bankswitch_w(u8 data); - void kurikint(machine_config &config); - void evilston(machine_config &config); - void raimais(machine_config &config); + void kurikint(machine_config &config) ATTR_COLD; + void evilston(machine_config &config) ATTR_COLD; + void raimais(machine_config &config) ATTR_COLD; protected: - virtual void state_register() override; - virtual void taito_machine_reset() override; + virtual void machine_start() override ATTR_COLD; - void evilston_2_map(address_map &map); - void evilston_map(address_map &map); - void kurikint_2_map(address_map &map); - void kurikint_map(address_map &map); - void raimais_2_map(address_map &map); - void raimais_3_map(address_map &map); - void raimais_map(address_map &map); + void evilston_2_map(address_map &map) ATTR_COLD; + void evilston_map(address_map &map) ATTR_COLD; + void kurikint_2_map(address_map &map) ATTR_COLD; + void kurikint_map(address_map &map) ATTR_COLD; + void raimais_2_map(address_map &map) ATTR_COLD; + void raimais_3_map(address_map &map) ATTR_COLD; + void raimais_map(address_map &map) ATTR_COLD; required_device m_audio_cpu; required_memory_region m_audio_prg; @@ -105,15 +103,15 @@ public: u8 slave_rombank_r(); void portA_w(u8 data); - void fhawk(machine_config &config); + void fhawk(machine_config &config) ATTR_COLD; protected: - virtual void state_register() override; - virtual void taito_machine_reset() override; + virtual void machine_start() override ATTR_COLD; + virtual void machine_reset() override ATTR_COLD; - void fhawk_2_map(address_map &map); - void fhawk_3_map(address_map &map); - void fhawk_map(address_map &map); + void fhawk_2_map(address_map &map) ATTR_COLD; + void fhawk_3_map(address_map &map) ATTR_COLD; + void fhawk_map(address_map &map) ATTR_COLD; required_memory_region m_slave_prg; required_memory_bank m_slave_bnk; @@ -142,15 +140,15 @@ public: void msm5205_stop_w(u8 data); void msm5205_volume_w(u8 data); - void champwr(machine_config &config); + void champwr(machine_config &config) ATTR_COLD; protected: - virtual void state_register() override; - virtual void taito_machine_reset() override; + virtual void machine_start() override ATTR_COLD; + virtual void machine_reset() override ATTR_COLD; - void champwr_2_map(address_map &map); - void champwr_3_map(address_map &map); - void champwr_map(address_map &map); + void champwr_2_map(address_map &map) ATTR_COLD; + void champwr_3_map(address_map &map) ATTR_COLD; + void champwr_map(address_map &map) ATTR_COLD; required_device m_msm; required_region_ptr m_adpcm_rgn; @@ -172,29 +170,21 @@ public: u8 extport_select_and_ym2203_r(offs_t offset); - void init_plottinga(); + void init_plottinga() ATTR_COLD; - DECLARE_MACHINE_RESET(plotting); - DECLARE_MACHINE_RESET(puzznic); - DECLARE_MACHINE_RESET(palamed); - DECLARE_MACHINE_RESET(cachat); - - void base(machine_config &config); - void add_muxes(machine_config &config); - void palamed(machine_config &config); - void plotting(machine_config &config); - void puzznici(machine_config &config); - void cachat(machine_config &config); - void puzznic(machine_config &config); + void base(machine_config &config) ATTR_COLD; + void add_muxes(machine_config &config) ATTR_COLD; + void palamed(machine_config &config) ATTR_COLD; + void plotting(machine_config &config) ATTR_COLD; + void puzznici(machine_config &config) ATTR_COLD; + void cachat(machine_config &config) ATTR_COLD; + void puzznic(machine_config &config) ATTR_COLD; protected: - virtual void state_register() override; - virtual void taito_machine_reset() override; - - void palamed_map(address_map &map); - void plotting_map(address_map &map); - void puzznic_map(address_map &map); - void puzznici_map(address_map &map); + void palamed_map(address_map &map) ATTR_COLD; + void plotting_map(address_map &map) ATTR_COLD; + void puzznic_map(address_map &map) ATTR_COLD; + void puzznici_map(address_map &map) ATTR_COLD; required_device m_ymsnd; optional_device_array m_mux; @@ -209,11 +199,11 @@ public: { } - void horshoes(machine_config &config); + void horshoes(machine_config &config) ATTR_COLD; protected: - virtual void machine_start() override; - virtual void machine_reset() override; + virtual void machine_start() override ATTR_COLD; + virtual void machine_reset() override ATTR_COLD; private: void horshoes_tile_cb(u32 &code); diff --git a/src/mame/ti/tm990189.cpp b/src/mame/ti/tm990189.cpp index e725dc252f8..f00984d158e 100644 --- a/src/mame/ti/tm990189.cpp +++ b/src/mame/ti/tm990189.cpp @@ -88,50 +88,35 @@ public: , m_tms9980a(*this, "maincpu") , m_speaker(*this, "speaker") , m_cass(*this, "cassette") - , m_tms9918(*this, "tms9918") , m_tms9901_usr(*this, TMS9901_0_TAG) , m_tms9901_sys(*this, TMS9901_1_TAG) , m_tms9902(*this, "tms9902") , m_digits(*this, "digit%u", 0U) , m_leds(*this, "led%u", 0U) - { } + { + } - void tm990_189_v(machine_config &config); - void tm990_189(machine_config &config); + void tm990_189(machine_config &config) ATTR_COLD; DECLARE_INPUT_CHANGED_MEMBER( load_interrupt ); +protected: + virtual void machine_start() override ATTR_COLD; + virtual void machine_reset() override ATTR_COLD; + + required_device m_tms9980a; + private: - virtual void machine_reset() override; - - uint8_t video_vdp_r(offs_t offset); - void video_vdp_w(offs_t offset, uint8_t data); - uint8_t video_joy_r(); - void video_joy_w(uint8_t data); - void external_operation(offs_t offset, uint8_t data); - DECLARE_WRITE_LINE_MEMBER(usr9901_led0_w); - DECLARE_WRITE_LINE_MEMBER(usr9901_led1_w); - DECLARE_WRITE_LINE_MEMBER(usr9901_led2_w); - DECLARE_WRITE_LINE_MEMBER(usr9901_led3_w); + template DECLARE_WRITE_LINE_MEMBER(usr9901_led_w) { led_set(N, state); } DECLARE_WRITE_LINE_MEMBER(usr9901_interrupt_callback); DECLARE_WRITE_LINE_MEMBER(sys9901_interrupt_callback); uint8_t sys9901_r(offs_t offset); - DECLARE_WRITE_LINE_MEMBER(sys9901_digitsel0_w); - DECLARE_WRITE_LINE_MEMBER(sys9901_digitsel1_w); - DECLARE_WRITE_LINE_MEMBER(sys9901_digitsel2_w); - DECLARE_WRITE_LINE_MEMBER(sys9901_digitsel3_w); - DECLARE_WRITE_LINE_MEMBER(sys9901_segment0_w); - DECLARE_WRITE_LINE_MEMBER(sys9901_segment1_w); - DECLARE_WRITE_LINE_MEMBER(sys9901_segment2_w); - DECLARE_WRITE_LINE_MEMBER(sys9901_segment3_w); - DECLARE_WRITE_LINE_MEMBER(sys9901_segment4_w); - DECLARE_WRITE_LINE_MEMBER(sys9901_segment5_w); - DECLARE_WRITE_LINE_MEMBER(sys9901_segment6_w); - DECLARE_WRITE_LINE_MEMBER(sys9901_segment7_w); + template DECLARE_WRITE_LINE_MEMBER(sys9901_digitsel_w) { digitsel(N, state); } + template DECLARE_WRITE_LINE_MEMBER(sys9901_segment_w) { segment_set(N, state); } DECLARE_WRITE_LINE_MEMBER(sys9901_dsplytrgr_w); DECLARE_WRITE_LINE_MEMBER(sys9901_shiftlight_w); @@ -139,14 +124,11 @@ private: DECLARE_WRITE_LINE_MEMBER(sys9901_tapewdata_w); void xmit_callback(uint8_t data); - DECLARE_MACHINE_START(tm990_189); - DECLARE_MACHINE_START(tm990_189_v); emu_timer *m_load_timer = nullptr; - void tm990_189_cru_map(address_map &map); - void tm990_189_memmap(address_map &map); - void tm990_189_v_memmap(address_map &map); + void tm990_189_cru_map(address_map &map) ATTR_COLD; + void tm990_189_memmap(address_map &map) ATTR_COLD; void draw_digit(void); void led_set(int number, bool state); @@ -157,10 +139,8 @@ private: TIMER_CALLBACK_MEMBER(clear_load); void hold_load(); - required_device m_tms9980a; required_device m_speaker; required_device m_cass; - optional_device m_tms9918; required_device m_tms9901_usr; required_device m_tms9901_sys; @@ -176,19 +156,50 @@ private: uint8_t m_segment_state[10]{}; uint8_t m_old_segment_state[10]{}; uint8_t m_LED_state = 0U; - emu_timer *m_joy1x_timer = 0; - emu_timer *m_joy1y_timer = 0; - emu_timer *m_joy2x_timer = 0; - emu_timer *m_joy2y_timer = 0; device_image_interface *m_rs232_fp = 0; //uint8_t m_rs232_rts; +}; + + +class tm990189_v_state : public tm990189_state +{ +public: + tm990189_v_state(const machine_config &mconfig, device_type type, const char *tag) + : tm990189_state(mconfig, type, tag) + , m_tms9918(*this, "tms9918") + , m_buttons(*this, "BUTTONS") + , m_axes(*this, { "JOY1_X", "JOY1_Y", "JOY2_X", "JOY2_Y" }) + { + } + + void tm990_189_v(machine_config &config) ATTR_COLD; + +protected: + virtual void machine_start() override ATTR_COLD; + + uint8_t video_vdp_r(offs_t offset); + void video_vdp_w(offs_t offset, uint8_t data); + uint8_t video_joy_r(); + void video_joy_w(uint8_t data); + + void tm990_189_v_memmap(address_map &map) ATTR_COLD; + + required_device m_tms9918; + required_ioport m_buttons; + required_ioport_array<4> m_axes; + + emu_timer *m_joy1x_timer = nullptr; + emu_timer *m_joy1y_timer = nullptr; + emu_timer *m_joy2x_timer = nullptr; + emu_timer *m_joy2y_timer = nullptr; + uint8_t m_bogus_read_save = 0U; }; #define displayena_duration attotime::from_usec(4500) /* Can anyone confirm this? 74LS123 connected to C=0.1uF and R=100kOhm */ -MACHINE_START_MEMBER(tm990189_state,tm990_189) +void tm990189_state::machine_start() { m_digits.resolve(); m_leds.resolve(); @@ -200,9 +211,9 @@ MACHINE_START_MEMBER(tm990189_state,tm990_189) m_load_timer = timer_alloc(FUNC(tm990189_state::clear_load), this); } -MACHINE_START_MEMBER(tm990189_state,tm990_189_v) +void tm990189_v_state::machine_start() { - MACHINE_START_CALL_MEMBER(tm990_189); + tm990189_state::machine_start(); m_joy1x_timer = machine().scheduler().timer_alloc(timer_expired_delegate()); m_joy1y_timer = machine().scheduler().timer_alloc(timer_expired_delegate()); @@ -295,26 +306,6 @@ void tm990189_state::led_set(int offset, bool state) m_LED_state &= ~(1 << offset); } -WRITE_LINE_MEMBER( tm990189_state::usr9901_led0_w ) -{ - led_set(0, state); -} - -WRITE_LINE_MEMBER( tm990189_state::usr9901_led1_w ) -{ - led_set(1, state); -} - -WRITE_LINE_MEMBER( tm990189_state::usr9901_led2_w ) -{ - led_set(2, state); -} - -WRITE_LINE_MEMBER( tm990189_state::usr9901_led3_w ) -{ - led_set(3, state); -} - WRITE_LINE_MEMBER( tm990189_state::sys9901_interrupt_callback ) { // TODO: Check this @@ -368,23 +359,6 @@ void tm990189_state::digitsel(int offset, bool state) m_digitsel &= ~ (1 << offset); } -WRITE_LINE_MEMBER( tm990189_state::sys9901_digitsel0_w ) -{ - digitsel(0, state); -} -WRITE_LINE_MEMBER( tm990189_state::sys9901_digitsel1_w ) -{ - digitsel(1, state); -} -WRITE_LINE_MEMBER( tm990189_state::sys9901_digitsel2_w ) -{ - digitsel(2, state); -} -WRITE_LINE_MEMBER( tm990189_state::sys9901_digitsel3_w ) -{ - digitsel(3, state); -} - void tm990189_state::segment_set(int offset, bool state) { @@ -398,38 +372,6 @@ void tm990189_state::segment_set(int offset, bool state) } } -WRITE_LINE_MEMBER( tm990189_state::sys9901_segment0_w ) -{ - segment_set(0, state); -} -WRITE_LINE_MEMBER( tm990189_state::sys9901_segment1_w ) -{ - segment_set(1, state); -} -WRITE_LINE_MEMBER( tm990189_state::sys9901_segment2_w ) -{ - segment_set(2, state); -} -WRITE_LINE_MEMBER( tm990189_state::sys9901_segment3_w ) -{ - segment_set(3, state); -} -WRITE_LINE_MEMBER( tm990189_state::sys9901_segment4_w ) -{ - segment_set(4, state); -} -WRITE_LINE_MEMBER( tm990189_state::sys9901_segment5_w ) -{ - segment_set(5, state); -} -WRITE_LINE_MEMBER( tm990189_state::sys9901_segment6_w ) -{ - segment_set(6, state); -} -WRITE_LINE_MEMBER( tm990189_state::sys9901_segment7_w ) -{ - segment_set(7, state); -} WRITE_LINE_MEMBER( tm990189_state::sys9901_dsplytrgr_w ) { @@ -581,7 +523,7 @@ void tm990189_state::external_operation(offs_t offset, uint8_t data) Video Board handling */ -uint8_t tm990189_state::video_vdp_r(offs_t offset) +uint8_t tm990189_v_state::video_vdp_r(offs_t offset) { int reply = 0; @@ -612,7 +554,7 @@ uint8_t tm990189_state::video_vdp_r(offs_t offset) return reply; } -void tm990189_state::video_vdp_w(offs_t offset, uint8_t data) +void tm990189_v_state::video_vdp_w(offs_t offset, uint8_t data) { if (offset & 1) { @@ -623,9 +565,9 @@ void tm990189_state::video_vdp_w(offs_t offset, uint8_t data) } } -uint8_t tm990189_state::video_joy_r() +uint8_t tm990189_v_state::video_joy_r() { - uint8_t data = ioport("BUTTONS")->read(); + uint8_t data = m_buttons->read(); if (m_joy1x_timer->remaining() < attotime::zero) data |= 0x01; @@ -642,12 +584,12 @@ uint8_t tm990189_state::video_joy_r() return data; } -void tm990189_state::video_joy_w(uint8_t data) +void tm990189_v_state::video_joy_w(uint8_t data) { - m_joy1x_timer->reset(attotime::from_usec(ioport("JOY1_X")->read()*28+28)); - m_joy1y_timer->reset(attotime::from_usec(ioport("JOY1_Y")->read()*28+28)); - m_joy2x_timer->reset(attotime::from_usec(ioport("JOY2_X")->read()*28+28)); - m_joy2y_timer->reset(attotime::from_usec(ioport("JOY2_Y")->read()*28+28)); + m_joy1x_timer->reset(attotime::from_usec(m_axes[0]->read()*28+28)); + m_joy1y_timer->reset(attotime::from_usec(m_axes[1]->read()*28+28)); + m_joy2x_timer->reset(attotime::from_usec(m_axes[2]->read()*28+28)); + m_joy2y_timer->reset(attotime::from_usec(m_axes[3]->read()*28+28)); } /* @@ -661,10 +603,10 @@ static const tms9901_interface usr9901reset_param = // write handlers { - DEVCB_DRIVER_LINE_MEMBER(tm990189_state, usr9901_led0_w), - DEVCB_DRIVER_LINE_MEMBER(tm990189_state, usr9901_led1_w), - DEVCB_DRIVER_LINE_MEMBER(tm990189_state, usr9901_led2_w), - DEVCB_DRIVER_LINE_MEMBER(tm990189_state, usr9901_led3_w), + DEVCB_DRIVER_LINE_MEMBER(tm990189_state, usr9901_led_w<0>), + DEVCB_DRIVER_LINE_MEMBER(tm990189_state, usr9901_led_w<1>), + DEVCB_DRIVER_LINE_MEMBER(tm990189_state, usr9901_led_w<2>), + DEVCB_DRIVER_LINE_MEMBER(tm990189_state, usr9901_led_w<3>), DEVCB_NOOP, DEVCB_NOOP, DEVCB_NOOP, @@ -695,18 +637,18 @@ static const tms9901_interface sys9901reset_param = // write handlers { - DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_digitsel0_w), - DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_digitsel1_w), - DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_digitsel2_w), - DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_digitsel3_w), - DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment0_w), - DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment1_w), - DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment2_w), - DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment3_w), - DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment4_w), - DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment5_w), - DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment6_w), - DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment7_w), + DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_digitsel_w<0>), + DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_digitsel_w<1>), + DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_digitsel_w<2>), + DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_digitsel_w<3>), + DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment_w<0>), + DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment_w<1>), + DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment_w<2>), + DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment_w<3>), + DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment_w<4>), + DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment_w<5>), + DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment_w<6>), + DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment_w<7>), DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_dsplytrgr_w), DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_shiftlight_w), DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_spkrdrive_w), @@ -748,23 +690,23 @@ static const tms9901_interface sys9901reset_param = void tm990189_state::tm990_189_memmap(address_map &map) { - map(0x0000, 0x07ff).ram(); /* RAM */ - map(0x0800, 0x0fff).rom(); /* extra ROM - application programs with unibug, remaining 2kb of program for university basic */ - map(0x1000, 0x2fff).noprw(); /* reserved for expansion (RAM and/or tms9918 video controller) */ - map(0x3000, 0x3fff).rom(); /* main ROM - unibug or university basic */ + map(0x0000, 0x07ff).ram(); // RAM + map(0x0800, 0x0fff).rom(); // extra ROM - application programs with unibug, remaining 2kb of program for university basic + map(0x1000, 0x2fff).noprw(); // reserved for expansion (RAM and/or tms9918 video controller) + map(0x3000, 0x3fff).rom(); // main ROM - unibug or university basic } -void tm990189_state::tm990_189_v_memmap(address_map &map) +void tm990189_v_state::tm990_189_v_memmap(address_map &map) { - map(0x0000, 0x07ff).ram(); /* RAM */ - map(0x0800, 0x0fff).rom(); /* extra ROM - application programs with unibug, remaining 2kb of program for university basic */ + map(0x0000, 0x07ff).ram(); // RAM + map(0x0800, 0x0fff).rom(); // extra ROM - application programs with unibug, remaining 2kb of program for university basic - map(0x1000, 0x17ff).rom().nopw(); /* video board ROM 1 */ - map(0x1800, 0x1fff).rom().w(FUNC(tm990189_state::video_joy_w)); /* video board ROM 2 and joystick write port*/ - map(0x2000, 0x27ff).r(FUNC(tm990189_state::video_vdp_r)).nopw(); /* video board tms9918 read ports (bogus) */ - map(0x2800, 0x2fff).rw(FUNC(tm990189_state::video_joy_r), FUNC(tm990189_state::video_vdp_w)); /* video board joystick read port and tms9918 write ports */ + map(0x1000, 0x17ff).rom().nopw(); // video board ROM 1 + map(0x1800, 0x1fff).rom().w(FUNC(tm990189_v_state::video_joy_w)); // video board ROM 2 and joystick write port + map(0x2000, 0x27ff).r(FUNC(tm990189_v_state::video_vdp_r)).nopw(); // video board TMS9918 read ports (bogus) + map(0x2800, 0x2fff).rw(FUNC(tm990189_v_state::video_joy_r), FUNC(tm990189_v_state::video_vdp_w)); // video board joystick read port and TMS9918 write ports - map(0x3000, 0x3fff).rom(); /* main ROM - unibug or university basic */ + map(0x3000, 0x3fff).rom(); // main ROM - unibug or university basic } /* @@ -838,8 +780,6 @@ void tm990189_state::tm990_189(machine_config &config) m_tms9980a->set_addrmap(AS_IO, &tm990189_state::tm990_189_cru_map); m_tms9980a->extop_cb().set(FUNC(tm990189_state::external_operation)); - MCFG_MACHINE_START_OVERRIDE(tm990189_state, tm990_189 ) - /* Video hardware */ config.set_default_layout(layout_tm990189); @@ -851,26 +791,26 @@ void tm990189_state::tm990_189(machine_config &config) CASSETTE(config, "cassette", 0).add_route(ALL_OUTPUTS, "mono", 0.25); TMS9901(config, m_tms9901_usr, 8_MHz_XTAL / 4); - m_tms9901_usr->p_out_cb(0).set(FUNC(tm990189_state::usr9901_led0_w)); - m_tms9901_usr->p_out_cb(1).set(FUNC(tm990189_state::usr9901_led1_w)); - m_tms9901_usr->p_out_cb(2).set(FUNC(tm990189_state::usr9901_led2_w)); - m_tms9901_usr->p_out_cb(3).set(FUNC(tm990189_state::usr9901_led3_w)); + m_tms9901_usr->p_out_cb(0).set(FUNC(tm990189_state::usr9901_led_w<0>)); + m_tms9901_usr->p_out_cb(1).set(FUNC(tm990189_state::usr9901_led_w<1>)); + m_tms9901_usr->p_out_cb(2).set(FUNC(tm990189_state::usr9901_led_w<2>)); + m_tms9901_usr->p_out_cb(3).set(FUNC(tm990189_state::usr9901_led_w<3>)); m_tms9901_usr->intreq_cb().set(FUNC(tm990189_state::usr9901_interrupt_callback)); TMS9901(config, m_tms9901_sys, 8_MHz_XTAL / 4); m_tms9901_sys->read_cb().set(FUNC(tm990189_state::sys9901_r)); - m_tms9901_sys->p_out_cb(0).set(FUNC(tm990189_state::sys9901_digitsel0_w)); - m_tms9901_sys->p_out_cb(1).set(FUNC(tm990189_state::sys9901_digitsel1_w)); - m_tms9901_sys->p_out_cb(2).set(FUNC(tm990189_state::sys9901_digitsel2_w)); - m_tms9901_sys->p_out_cb(3).set(FUNC(tm990189_state::sys9901_digitsel3_w)); - m_tms9901_sys->p_out_cb(4).set(FUNC(tm990189_state::sys9901_segment0_w)); - m_tms9901_sys->p_out_cb(5).set(FUNC(tm990189_state::sys9901_segment1_w)); - m_tms9901_sys->p_out_cb(6).set(FUNC(tm990189_state::sys9901_segment2_w)); - m_tms9901_sys->p_out_cb(7).set(FUNC(tm990189_state::sys9901_segment3_w)); - m_tms9901_sys->p_out_cb(8).set(FUNC(tm990189_state::sys9901_segment4_w)); - m_tms9901_sys->p_out_cb(9).set(FUNC(tm990189_state::sys9901_segment5_w)); - m_tms9901_sys->p_out_cb(10).set(FUNC(tm990189_state::sys9901_segment6_w)); - m_tms9901_sys->p_out_cb(11).set(FUNC(tm990189_state::sys9901_segment7_w)); + m_tms9901_sys->p_out_cb(0).set(FUNC(tm990189_state::sys9901_digitsel_w<0>)); + m_tms9901_sys->p_out_cb(1).set(FUNC(tm990189_state::sys9901_digitsel_w<1>)); + m_tms9901_sys->p_out_cb(2).set(FUNC(tm990189_state::sys9901_digitsel_w<2>)); + m_tms9901_sys->p_out_cb(3).set(FUNC(tm990189_state::sys9901_digitsel_w<3>)); + m_tms9901_sys->p_out_cb(4).set(FUNC(tm990189_state::sys9901_segment_w<0>)); + m_tms9901_sys->p_out_cb(5).set(FUNC(tm990189_state::sys9901_segment_w<1>)); + m_tms9901_sys->p_out_cb(6).set(FUNC(tm990189_state::sys9901_segment_w<2>)); + m_tms9901_sys->p_out_cb(7).set(FUNC(tm990189_state::sys9901_segment_w<3>)); + m_tms9901_sys->p_out_cb(8).set(FUNC(tm990189_state::sys9901_segment_w<4>)); + m_tms9901_sys->p_out_cb(9).set(FUNC(tm990189_state::sys9901_segment_w<5>)); + m_tms9901_sys->p_out_cb(10).set(FUNC(tm990189_state::sys9901_segment_w<6>)); + m_tms9901_sys->p_out_cb(11).set(FUNC(tm990189_state::sys9901_segment_w<7>)); m_tms9901_sys->p_out_cb(12).set(FUNC(tm990189_state::sys9901_dsplytrgr_w)); m_tms9901_sys->p_out_cb(13).set(FUNC(tm990189_state::sys9901_shiftlight_w)); m_tms9901_sys->p_out_cb(14).set(FUNC(tm990189_state::sys9901_spkrdrive_w)); @@ -888,65 +828,21 @@ void tm990189_state::tm990_189(machine_config &config) display_timer.set_start_delay(attotime::from_msec(150)); } -void tm990189_state::tm990_189_v(machine_config &config) +void tm990189_v_state::tm990_189_v(machine_config &config) { - /* basic machine hardware */ - TMS9980A(config, m_tms9980a, 8_MHz_XTAL); - m_tms9980a->set_addrmap(AS_PROGRAM, &tm990189_state::tm990_189_v_memmap); - m_tms9980a->set_addrmap(AS_IO, &tm990189_state::tm990_189_cru_map); - m_tms9980a->extop_cb().set(FUNC(tm990189_state::external_operation)); + tm990_189(config); - MCFG_MACHINE_START_OVERRIDE(tm990189_state, tm990_189_v ) + /* basic machine hardware */ + m_tms9980a->set_addrmap(AS_PROGRAM, &tm990189_v_state::tm990_189_v_memmap); /* video hardware */ - tms9918_device &vdp(TMS9918(config, "tms9918", XTAL(10'738'635))); - vdp.set_screen("screen"); - vdp.set_vram_size(0x4000); + TMS9918(config, m_tms9918, XTAL(10'738'635)); + m_tms9918->set_screen("screen"); + m_tms9918->set_vram_size(0x4000); + SCREEN(config, "screen", SCREEN_TYPE_RASTER); config.set_default_layout(layout_tm990189v); - - /* sound hardware */ - SPEAKER(config, "mono").front_center(); - SPEAKER_SOUND(config, "speaker").add_route(ALL_OUTPUTS, "mono", 0.50); /* one two-level buzzer */ - - /* Devices */ - CASSETTE(config, "cassette", 0).add_route(ALL_OUTPUTS, "mono", 0.25); - - TMS9901(config, m_tms9901_usr, 8_MHz_XTAL / 4); - m_tms9901_usr->p_out_cb(0).set(FUNC(tm990189_state::usr9901_led0_w)); - m_tms9901_usr->p_out_cb(1).set(FUNC(tm990189_state::usr9901_led1_w)); - m_tms9901_usr->p_out_cb(2).set(FUNC(tm990189_state::usr9901_led2_w)); - m_tms9901_usr->p_out_cb(3).set(FUNC(tm990189_state::usr9901_led3_w)); - m_tms9901_usr->intreq_cb().set(FUNC(tm990189_state::usr9901_interrupt_callback)); - - TMS9901(config, m_tms9901_sys, 8_MHz_XTAL / 4); - m_tms9901_sys->read_cb().set(FUNC(tm990189_state::sys9901_r)); - m_tms9901_sys->p_out_cb(0).set(FUNC(tm990189_state::sys9901_digitsel0_w)); - m_tms9901_sys->p_out_cb(1).set(FUNC(tm990189_state::sys9901_digitsel1_w)); - m_tms9901_sys->p_out_cb(2).set(FUNC(tm990189_state::sys9901_digitsel2_w)); - m_tms9901_sys->p_out_cb(3).set(FUNC(tm990189_state::sys9901_digitsel3_w)); - m_tms9901_sys->p_out_cb(4).set(FUNC(tm990189_state::sys9901_segment0_w)); - m_tms9901_sys->p_out_cb(5).set(FUNC(tm990189_state::sys9901_segment1_w)); - m_tms9901_sys->p_out_cb(6).set(FUNC(tm990189_state::sys9901_segment2_w)); - m_tms9901_sys->p_out_cb(7).set(FUNC(tm990189_state::sys9901_segment3_w)); - m_tms9901_sys->p_out_cb(8).set(FUNC(tm990189_state::sys9901_segment4_w)); - m_tms9901_sys->p_out_cb(9).set(FUNC(tm990189_state::sys9901_segment5_w)); - m_tms9901_sys->p_out_cb(10).set(FUNC(tm990189_state::sys9901_segment6_w)); - m_tms9901_sys->p_out_cb(11).set(FUNC(tm990189_state::sys9901_segment7_w)); - m_tms9901_sys->p_out_cb(12).set(FUNC(tm990189_state::sys9901_dsplytrgr_w)); - m_tms9901_sys->p_out_cb(13).set(FUNC(tm990189_state::sys9901_shiftlight_w)); - m_tms9901_sys->p_out_cb(14).set(FUNC(tm990189_state::sys9901_spkrdrive_w)); - m_tms9901_sys->p_out_cb(15).set(FUNC(tm990189_state::sys9901_tapewdata_w)); - m_tms9901_sys->intreq_cb().set(FUNC(tm990189_state::sys9901_interrupt_callback)); - - TMS9902(config, m_tms9902, 8_MHz_XTAL / 4); - m_tms9902->xmit_cb().set(FUNC(tm990189_state::xmit_callback)); // called when a character is transmitted; - TM990_189_RS232(config, "rs232", 0, m_tms9902); - - timer_device &display_timer(TIMER(config, "display_timer")); - display_timer.configure_periodic(FUNC(tm990189_state::display_callback), attotime::from_hz(30)); - display_timer.set_start_delay(attotime::from_msec(150)); } @@ -1073,6 +969,7 @@ static INPUT_PORTS_START(tm990_189) PORT_BIT( 0x3ff, 0x1aa, IPT_AD_STICK_Y) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0xd2,0x282 ) PORT_PLAYER(2) PORT_REVERSE INPUT_PORTS_END -// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS -COMP( 1978, 990189, 0, 0, tm990_189, tm990_189, tm990189_state, empty_init, "Texas Instruments", "TM 990/189 University Board microcomputer", 0 ) -COMP( 1980, 990189v, 990189, 0, tm990_189_v, tm990_189, tm990189_state, empty_init, "Texas Instruments", "TM 990/189 University Board microcomputer with Video Board Interface", 0 ) + +// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS +COMP( 1978, 990189, 0, 0, tm990_189, tm990_189, tm990189_state, empty_init, "Texas Instruments", "TM 990/189 University Board microcomputer", 0 ) +COMP( 1980, 990189v, 990189, 0, tm990_189_v, tm990_189, tm990189_v_state, empty_init, "Texas Instruments", "TM 990/189 University Board microcomputer with Video Board Interface", 0 ) diff --git a/src/mame/upl/ninjakd2.cpp b/src/mame/upl/ninjakd2.cpp index 4d9284bb8e1..597f31b84a6 100644 --- a/src/mame/upl/ninjakd2.cpp +++ b/src/mame/upl/ninjakd2.cpp @@ -1045,9 +1045,6 @@ void omegaf_state::omegaf(machine_config &config) m_soundcpu->set_addrmap(AS_PROGRAM, &omegaf_state::ninjakid_nopcm_sound_cpu); -// MCFG_MACHINE_START_OVERRIDE(ninjakd2_state,omegaf) -// MCFG_MACHINE_RESET_OVERRIDE(ninjakd2_state,omegaf) - /* video hardware */ MCFG_VIDEO_START_OVERRIDE(omegaf_state,omegaf) diff --git a/src/mame/upl/ninjakd2.h b/src/mame/upl/ninjakd2.h index 4dcf9d47884..fd2dba3ac0e 100644 --- a/src/mame/upl/ninjakd2.h +++ b/src/mame/upl/ninjakd2.h @@ -126,7 +126,6 @@ private: TILE_GET_INFO_MEMBER(mnight_get_bg_tile_info); DECLARE_VIDEO_START(mnight); DECLARE_VIDEO_START(arkarea); - }; class robokid_state : public mnight_state diff --git a/src/mame/vsystem/aerofgt.cpp b/src/mame/vsystem/aerofgt.cpp index 1e327880f51..9dc6d0ae205 100644 --- a/src/mame/vsystem/aerofgt.cpp +++ b/src/mame/vsystem/aerofgt.cpp @@ -63,39 +63,36 @@ Verification still needed for the other PCBs. #include "emu.h" #include "aerofgt.h" +#include "vs9209.h" +#include "vsystem_gga.h" + #include "cpu/m68000/m68000.h" #include "cpu/z80/z80.h" #include "machine/mb3773.h" -#include "vs9209.h" #include "sound/ymopm.h" #include "sound/ymopn.h" #include "sound/ymopl.h" -#include "vsystem_gga.h" + #include "screen.h" #include "speaker.h" -void aerofgt_state::karatblzbl_soundlatch_w(uint8_t data) +void aerofgt_sound_cpu_state::karatblzbl_soundlatch_w(uint8_t data) { m_soundlatch->write(data); m_audiocpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero); } -uint8_t aerofgt_state::pending_command_r() +uint8_t aerofgt_sound_cpu_state::pending_command_r() { return m_soundlatch->pending_r(); } -void aerofgt_state::aerofgt_sh_bankswitch_w(uint8_t data) +void aerofgt_banked_sound_state::sh_bankswitch_w(uint8_t data) { m_soundbank->set_entry(data & 0x03); } -void aerofgt_state::spinlbrk_sh_bankswitch_w(uint8_t data) -{ - m_soundbank->set_entry(data & 0x01); -} - void aerofgt_state::pspikesb_oki_banking_w(uint16_t data) { m_oki->set_rom_bank(data & 3); @@ -110,21 +107,21 @@ void aerofgt_state::aerfboo2_okim6295_banking_w(offs_t offset, uint16_t data, ui // } } -void aerofgt_state::aerfboot_okim6295_banking_w(uint8_t data) +void aerofgt_sound_cpu_state::aerfboot_okim6295_banking_w(uint8_t data) { /*bit 2 (0x4) set too?*/ if (data & 0x4) m_okibank->set_entry(data & 0x3); } -void aerofgt_state::karatblzbl_d7759_write_port_0_w(uint8_t data) +void aerofgt_sound_cpu_state::karatblzbl_d7759_write_port_0_w(uint8_t data) { m_upd7759->port_w(data); m_upd7759->start_w(0); m_upd7759->start_w(1); } -void aerofgt_state::karatblzbl_d7759_reset_w(uint8_t data) +void aerofgt_sound_cpu_state::karatblzbl_d7759_reset_w(uint8_t data) { m_upd7759->reset_w(BIT(data, 7)); } @@ -148,21 +145,21 @@ void aerofgt_state::scrolly_w(offs_t offset, uint16_t data, uint16_t mem_mask) COMBINE_DATA(&m_scrolly[Layer]); } -void aerofgt_state::pspikes_map(address_map &map) +void aerofgt_banked_sound_state::pspikes_map(address_map &map) { map(0x000000, 0x03ffff).rom(); map(0x100000, 0x10ffff).ram(); /* work RAM */ map(0x200000, 0x203fff).ram().share("sprlookupram1"); - map(0xff8000, 0xff8fff).ram().w(FUNC(aerofgt_state::vram_w<0>)).share("vram.0"); + map(0xff8000, 0xff8fff).ram().w(FUNC(aerofgt_banked_sound_state::vram_w<0>)).share("vram.0"); map(0xffc000, 0xffc3ff).writeonly().share("spriteram"); map(0xffd000, 0xffdfff).ram().share("rasterram"); /* bg1 scroll registers */ map(0xffe000, 0xffefff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); map(0xfff000, 0xfff001).portr("IN0"); - map(0xfff001, 0xfff001).w(FUNC(aerofgt_state::pspikes_palette_bank_w)); + map(0xfff001, 0xfff001).w(FUNC(aerofgt_banked_sound_state::pspikes_palette_bank_w)); map(0xfff002, 0xfff003).portr("IN1"); - map(0xfff003, 0xfff003).w(FUNC(aerofgt_state::pspikes_gfxbank_w)); - map(0xfff004, 0xfff005).portr("DSW").w(FUNC(aerofgt_state::scrolly_w<0>)); - map(0xfff007, 0xfff007).r(FUNC(aerofgt_state::pending_command_r)).w(m_soundlatch, FUNC(generic_latch_8_device::write)).umask16(0x00ff); + map(0xfff003, 0xfff003).w(FUNC(aerofgt_banked_sound_state::pspikes_gfxbank_w)); + map(0xfff004, 0xfff005).portr("DSW").w(FUNC(aerofgt_banked_sound_state::scrolly_w<0>)); + map(0xfff007, 0xfff007).r(FUNC(aerofgt_banked_sound_state::pending_command_r)).w(m_soundlatch, FUNC(generic_latch_8_device::write)).umask16(0x00ff); map(0xfff400, 0xfff403).w("gga", FUNC(vsystem_gga_device::write)).umask16(0x00ff); } @@ -185,26 +182,26 @@ void aerofgt_state::pspikesb_map(address_map &map) map(0xfff400, 0xfff403).nopw(); // GGA access } -void aerofgt_state::spikes91_map(address_map &map) +void aerofgt_sound_cpu_state::spikes91_map(address_map &map) { map(0x000000, 0x03ffff).rom(); map(0x100000, 0x10ffff).ram(); /* work RAM */ map(0x200000, 0x203fff).ram().share("sprlookupram1"); map(0xc04000, 0xc04001).nopw(); - map(0xff8000, 0xff8fff).ram().w(FUNC(aerofgt_state::vram_w<0>)).share("vram.0"); + map(0xff8000, 0xff8fff).ram().w(FUNC(aerofgt_sound_cpu_state::vram_w<0>)).share("vram.0"); map(0xffa000, 0xffbfff).ram().share("tx_tilemap_ram"); map(0xffc000, 0xffcfff).ram().share("spriteram"); - //map(0xffd200, 0xffd201).w(FUNC(aerofgt_state::pspikesb_gfxbank_w)); + //map(0xffd200, 0xffd201).w(FUNC(aerofgt_sound_cpu_state::pspikesb_gfxbank_w)); map(0xffd000, 0xffdfff).ram().share("rasterram"); /* bg1 scroll registers */ map(0xffe000, 0xffefff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); map(0xfff000, 0xfff001).portr("IN0"); map(0xfff002, 0xfff003).portr("IN1"); - map(0xfff003, 0xfff003).w(FUNC(aerofgt_state::pspikes_gfxbank_w)); - map(0xfff004, 0xfff005).portr("DSW").w(FUNC(aerofgt_state::scrolly_w<0>)); - map(0xfff007, 0xfff007).r(FUNC(aerofgt_state::pending_command_r)).w(m_soundlatch, FUNC(generic_latch_8_device::write)).umask16(0x00ff); - map(0xfff008, 0xfff009).w(FUNC(aerofgt_state::spikes91_lookup_w)); + map(0xfff003, 0xfff003).w(FUNC(aerofgt_sound_cpu_state::pspikes_gfxbank_w)); + map(0xfff004, 0xfff005).portr("DSW").w(FUNC(aerofgt_sound_cpu_state::scrolly_w<0>)); + map(0xfff007, 0xfff007).r(FUNC(aerofgt_sound_cpu_state::pending_command_r)).w(m_soundlatch, FUNC(generic_latch_8_device::write)).umask16(0x00ff); + map(0xfff008, 0xfff009).w(FUNC(aerofgt_sound_cpu_state::spikes91_lookup_w)); } void aerofgt_state::pspikesc_map(address_map &map) @@ -226,30 +223,30 @@ void aerofgt_state::pspikesc_map(address_map &map) map(0xfff400, 0xfff403).nopw(); // GGA access } -void aerofgt_state::kickball_map(address_map &map) +void aerofgt_sound_cpu_state::kickball_map(address_map &map) { map(0x000000, 0x07ffff).rom(); map(0x100000, 0x10ffff).ram(); /* work RAM */ map(0x200000, 0x20ffff).ram().share("sprlookupram1"); - map(0xff8000, 0xff8fff).ram().w(FUNC(aerofgt_state::vram_w<0>)).share("vram.0"); + map(0xff8000, 0xff8fff).ram().w(FUNC(aerofgt_sound_cpu_state::vram_w<0>)).share("vram.0"); map(0xffc000, 0xffc3ff).writeonly().share("spriteram"); map(0xffd000, 0xffdfff).ram().share("rasterram"); /* bg1 scroll registers */ map(0xffe000, 0xffefff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); map(0xfff000, 0xfff001).portr("IN0"); - map(0xfff001, 0xfff001).w(FUNC(aerofgt_state::pspikes_palette_bank_w)); + map(0xfff001, 0xfff001).w(FUNC(aerofgt_sound_cpu_state::pspikes_palette_bank_w)); map(0xfff002, 0xfff003).portr("IN1"); - map(0xfff003, 0xfff003).w(FUNC(aerofgt_state::kickball_gfxbank_w)); - map(0xfff004, 0xfff005).portr("DSW").w(FUNC(aerofgt_state::scrolly_w<0>)); - map(0xfff007, 0xfff007).r(FUNC(aerofgt_state::pending_command_r)).w(m_soundlatch, FUNC(generic_latch_8_device::write)).umask16(0x00ff); + map(0xfff003, 0xfff003).w(FUNC(aerofgt_sound_cpu_state::kickball_gfxbank_w)); + map(0xfff004, 0xfff005).portr("DSW").w(FUNC(aerofgt_sound_cpu_state::scrolly_w<0>)); + map(0xfff007, 0xfff007).r(FUNC(aerofgt_sound_cpu_state::pending_command_r)).w(m_soundlatch, FUNC(generic_latch_8_device::write)).umask16(0x00ff); map(0xfff400, 0xfff403).nopw(); // GGA access } -void aerofgt_state::karatblz_map(address_map &map) +void aerofgt_banked_sound_state::karatblz_map(address_map &map) { map.global_mask(0xfffff); map(0x000000, 0x07ffff).rom(); - map(0x080000, 0x081fff).ram().w(FUNC(aerofgt_state::vram_w<0>)).share("vram.0"); - map(0x082000, 0x083fff).ram().w(FUNC(aerofgt_state::vram_w<1>)).share("vram.1"); + map(0x080000, 0x081fff).ram().w(FUNC(aerofgt_banked_sound_state::vram_w<0>)).share("vram.0"); + map(0x082000, 0x083fff).ram().w(FUNC(aerofgt_banked_sound_state::vram_w<1>)).share("vram.1"); map(0x0a0000, 0x0affff).ram().share("sprlookupram1"); map(0x0b0000, 0x0bffff).ram().share("sprlookupram2"); map(0x0c0000, 0x0cffff).ram(); /* work RAM */ @@ -257,26 +254,26 @@ void aerofgt_state::karatblz_map(address_map &map) map(0x0fc000, 0x0fc7ff).ram().share("spriteram"); map(0x0fe000, 0x0fe7ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); map(0x0ff000, 0x0ff001).portr("IN0"); - map(0x0ff000, 0x0ff000).w(FUNC(aerofgt_state::spinlbrk_flip_screen_w)); + map(0x0ff000, 0x0ff000).w(FUNC(aerofgt_banked_sound_state::spinlbrk_flip_screen_w)); map(0x0ff002, 0x0ff003).portr("IN1"); - map(0x0ff002, 0x0ff002).w(FUNC(aerofgt_state::karatblz_gfxbank_w)); + map(0x0ff002, 0x0ff002).w(FUNC(aerofgt_banked_sound_state::karatblz_gfxbank_w)); map(0x0ff004, 0x0ff005).portr("IN2"); map(0x0ff006, 0x0ff007).portr("IN3"); map(0x0ff007, 0x0ff007).w(m_soundlatch, FUNC(generic_latch_8_device::write)); - map(0x0ff008, 0x0ff009).portr("DSW").w(FUNC(aerofgt_state::scrollx_w<0>)); - map(0x0ff00b, 0x0ff00b).r(FUNC(aerofgt_state::pending_command_r)); - map(0x0ff00a, 0x0ff00b).w(FUNC(aerofgt_state::scrolly_w<0>)); - map(0x0ff00c, 0x0ff00d).w(FUNC(aerofgt_state::scrollx_w<1>)); - map(0x0ff00e, 0x0ff00f).w(FUNC(aerofgt_state::scrolly_w<1>)); + map(0x0ff008, 0x0ff009).portr("DSW").w(FUNC(aerofgt_banked_sound_state::scrollx_w<0>)); + map(0x0ff00b, 0x0ff00b).r(FUNC(aerofgt_banked_sound_state::pending_command_r)); + map(0x0ff00a, 0x0ff00b).w(FUNC(aerofgt_banked_sound_state::scrolly_w<0>)); + map(0x0ff00c, 0x0ff00d).w(FUNC(aerofgt_banked_sound_state::scrollx_w<1>)); + map(0x0ff00e, 0x0ff00f).w(FUNC(aerofgt_banked_sound_state::scrolly_w<1>)); map(0x0ff400, 0x0ff403).w("gga", FUNC(vsystem_gga_device::write)).umask16(0x00ff); } -void aerofgt_state::karatblzbl_map(address_map &map) +void aerofgt_sound_cpu_state::karatblzbl_map(address_map &map) { map.global_mask(0xfffff); map(0x000000, 0x07ffff).rom(); - map(0x080000, 0x081fff).ram().w(FUNC(aerofgt_state::vram_w<0>)).share("vram.0"); - map(0x082000, 0x083fff).ram().w(FUNC(aerofgt_state::vram_w<1>)).share("vram.1"); + map(0x080000, 0x081fff).ram().w(FUNC(aerofgt_sound_cpu_state::vram_w<0>)).share("vram.0"); + map(0x082000, 0x083fff).ram().w(FUNC(aerofgt_sound_cpu_state::vram_w<1>)).share("vram.1"); map(0x0a0000, 0x0affff).ram().share("sprlookupram1"); map(0x0b0000, 0x0bffff).ram().share("sprlookupram2"); map(0x0c0000, 0x0cffff).ram(); /* work RAM */ @@ -284,33 +281,33 @@ void aerofgt_state::karatblzbl_map(address_map &map) map(0x0fc000, 0x0fc7ff).ram().share("spriteram"); map(0x0fe000, 0x0fe7ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); map(0x0ff000, 0x0ff001).portr("IN0"); - map(0x0ff000, 0x0ff000).w(FUNC(aerofgt_state::spinlbrk_flip_screen_w)); + map(0x0ff000, 0x0ff000).w(FUNC(aerofgt_sound_cpu_state::spinlbrk_flip_screen_w)); map(0x0ff002, 0x0ff003).portr("IN1"); - map(0x0ff002, 0x0ff002).w(FUNC(aerofgt_state::karatblz_gfxbank_w)); + map(0x0ff002, 0x0ff002).w(FUNC(aerofgt_sound_cpu_state::karatblz_gfxbank_w)); map(0x0ff004, 0x0ff005).portr("IN2"); map(0x0ff006, 0x0ff007).portr("IN3"); - map(0x0ff007, 0x0ff007).w(FUNC(aerofgt_state::karatblzbl_soundlatch_w)); - map(0x0ff008, 0x0ff009).portr("DSW").w(FUNC(aerofgt_state::scrollx_w<0>)); - map(0x0ff00b, 0x0ff00b).r(FUNC(aerofgt_state::pending_command_r)); - map(0x0ff00a, 0x0ff00b).w(FUNC(aerofgt_state::scrolly_w<0>)); - map(0x0ff00c, 0x0ff00d).w(FUNC(aerofgt_state::scrollx_w<1>)); - map(0x0ff00e, 0x0ff00f).w(FUNC(aerofgt_state::scrolly_w<1>)); + map(0x0ff007, 0x0ff007).w(FUNC(aerofgt_sound_cpu_state::karatblzbl_soundlatch_w)); + map(0x0ff008, 0x0ff009).portr("DSW").w(FUNC(aerofgt_sound_cpu_state::scrollx_w<0>)); + map(0x0ff00b, 0x0ff00b).r(FUNC(aerofgt_sound_cpu_state::pending_command_r)); + map(0x0ff00a, 0x0ff00b).w(FUNC(aerofgt_sound_cpu_state::scrolly_w<0>)); + map(0x0ff00c, 0x0ff00d).w(FUNC(aerofgt_sound_cpu_state::scrollx_w<1>)); + map(0x0ff00e, 0x0ff00f).w(FUNC(aerofgt_sound_cpu_state::scrolly_w<1>)); map(0x0ff400, 0x0ff403).nopw(); // GGA access } -void aerofgt_state::spinlbrk_map(address_map &map) +void aerofgt_banked_sound_state::spinlbrk_map(address_map &map) { map(0x000000, 0x03ffff).rom(); - map(0x080000, 0x080fff).ram().w(FUNC(aerofgt_state::vram_w<0>)).share("vram.0"); - map(0x082000, 0x082fff).ram().w(FUNC(aerofgt_state::vram_w<1>)).share("vram.1"); + map(0x080000, 0x080fff).ram().w(FUNC(aerofgt_banked_sound_state::vram_w<0>)).share("vram.0"); + map(0x082000, 0x082fff).ram().w(FUNC(aerofgt_banked_sound_state::vram_w<1>)).share("vram.1"); map(0xff8000, 0xffbfff).ram(); /* work RAM */ map(0xffc000, 0xffc7ff).ram().share("spriteram"); map(0xffd000, 0xffd1ff).ram().share("rasterram"); /* bg1 scroll registers */ map(0xffe000, 0xffe7ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); map(0xfff000, 0xfff001).portr("IN0"); - map(0xfff000, 0xfff000).w(FUNC(aerofgt_state::spinlbrk_flip_screen_w)); - map(0xfff001, 0xfff001).w(FUNC(aerofgt_state::spinlbrk_gfxbank_w)); - map(0xfff002, 0xfff003).portr("IN1").w(FUNC(aerofgt_state::scrollx_w<1>)); + map(0xfff000, 0xfff000).w(FUNC(aerofgt_banked_sound_state::spinlbrk_flip_screen_w)); + map(0xfff001, 0xfff001).w(FUNC(aerofgt_banked_sound_state::spinlbrk_gfxbank_w)); + map(0xfff002, 0xfff003).portr("IN1").w(FUNC(aerofgt_banked_sound_state::scrollx_w<1>)); map(0xfff004, 0xfff005).portr("DSW"); map(0xfff007, 0xfff007).w(m_soundlatch, FUNC(generic_latch_8_device::write)); // map(0xfff008, 0xfff009); - read when analog inputs are enabled @@ -318,13 +315,13 @@ void aerofgt_state::spinlbrk_map(address_map &map) map(0xfff400, 0xfff403).w("gga", FUNC(vsystem_gga_device::write)).umask16(0x00ff); } -void aerofgt_state::turbofrc_map(address_map &map) +void aerofgt_banked_sound_state::turbofrc_map(address_map &map) { map.global_mask(0xfffff); map(0x000000, 0x0bffff).rom(); map(0x0c0000, 0x0cffff).ram(); /* work RAM */ - map(0x0d0000, 0x0d1fff).ram().w(FUNC(aerofgt_state::vram_w<0>)).share("vram.0"); - map(0x0d2000, 0x0d3fff).ram().w(FUNC(aerofgt_state::vram_w<1>)).share("vram.1"); + map(0x0d0000, 0x0d1fff).ram().w(FUNC(aerofgt_banked_sound_state::vram_w<0>)).share("vram.0"); + map(0x0d2000, 0x0d3fff).ram().w(FUNC(aerofgt_banked_sound_state::vram_w<1>)).share("vram.1"); map(0x0e0000, 0x0e3fff).ram().share("sprlookupram1"); map(0x0e4000, 0x0e7fff).ram().share("sprlookupram2"); map(0x0f8000, 0x0fbfff).ram(); /* work RAM */ @@ -332,67 +329,67 @@ void aerofgt_state::turbofrc_map(address_map &map) map(0x0fd000, 0x0fdfff).ram().share("rasterram"); /* bg1 scroll registers */ map(0x0fe000, 0x0fe7ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); map(0x0ff000, 0x0ff001).portr("IN0"); - map(0x0ff001, 0x0ff001).w(FUNC(aerofgt_state::turbofrc_flip_screen_w)); - map(0x0ff002, 0x0ff003).portr("IN1").w(FUNC(aerofgt_state::scrolly_w<0>)); - map(0x0ff004, 0x0ff005).portr("DSW").w(FUNC(aerofgt_state::scrollx_w<1>)); - map(0x0ff007, 0x0ff007).r(FUNC(aerofgt_state::pending_command_r)); - map(0x0ff006, 0x0ff007).w(FUNC(aerofgt_state::scrolly_w<1>)); + map(0x0ff001, 0x0ff001).w(FUNC(aerofgt_banked_sound_state::turbofrc_flip_screen_w)); + map(0x0ff002, 0x0ff003).portr("IN1").w(FUNC(aerofgt_banked_sound_state::scrolly_w<0>)); + map(0x0ff004, 0x0ff005).portr("DSW").w(FUNC(aerofgt_banked_sound_state::scrollx_w<1>)); + map(0x0ff007, 0x0ff007).r(FUNC(aerofgt_banked_sound_state::pending_command_r)); + map(0x0ff006, 0x0ff007).w(FUNC(aerofgt_banked_sound_state::scrolly_w<1>)); map(0x0ff008, 0x0ff009).portr("IN2"); - map(0x0ff008, 0x0ff00b).w(FUNC(aerofgt_state::turbofrc_gfxbank_w)); + map(0x0ff008, 0x0ff00b).w(FUNC(aerofgt_banked_sound_state::turbofrc_gfxbank_w)); map(0x0ff00c, 0x0ff00d).nopw(); /* related to bg2 (written together with the scroll registers) */ map(0x0ff00e, 0x0ff00e).w(m_soundlatch, FUNC(generic_latch_8_device::write)); map(0x0ff400, 0x0ff403).w("gga", FUNC(vsystem_gga_device::write)).umask16(0x00ff); } -void aerofgt_state::aerofgtb_map(address_map &map) +void aerofgt_banked_sound_state::aerofgtb_map(address_map &map) { map(0x000000, 0x07ffff).rom(); map(0x0c0000, 0x0cffff).ram(); /* work RAM */ - map(0x0d0000, 0x0d1fff).ram().w(FUNC(aerofgt_state::vram_w<0>)).share("vram.0"); - map(0x0d2000, 0x0d3fff).ram().w(FUNC(aerofgt_state::vram_w<1>)).share("vram.1"); + map(0x0d0000, 0x0d1fff).ram().w(FUNC(aerofgt_banked_sound_state::vram_w<0>)).share("vram.0"); + map(0x0d2000, 0x0d3fff).ram().w(FUNC(aerofgt_banked_sound_state::vram_w<1>)).share("vram.1"); map(0x0e0000, 0x0e3fff).ram().share("sprlookupram1"); map(0x0e4000, 0x0e7fff).ram().share("sprlookupram2"); map(0x0f8000, 0x0fbfff).ram(); /* work RAM */ map(0x0fc000, 0x0fc7ff).ram().share("spriteram"); map(0x0fd000, 0x0fd7ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); map(0x0fe000, 0x0fe001).portr("IN0"); - map(0x0fe001, 0x0fe001).w(FUNC(aerofgt_state::turbofrc_flip_screen_w)); - map(0x0fe002, 0x0fe003).portr("IN1").w(FUNC(aerofgt_state::scrolly_w<0>)); - map(0x0fe004, 0x0fe005).portr("DSW1").w(FUNC(aerofgt_state::scrollx_w<1>)); - map(0x0fe007, 0x0fe007).r(FUNC(aerofgt_state::pending_command_r)); - map(0x0fe006, 0x0fe007).w(FUNC(aerofgt_state::scrolly_w<1>)); + map(0x0fe001, 0x0fe001).w(FUNC(aerofgt_banked_sound_state::turbofrc_flip_screen_w)); + map(0x0fe002, 0x0fe003).portr("IN1").w(FUNC(aerofgt_banked_sound_state::scrolly_w<0>)); + map(0x0fe004, 0x0fe005).portr("DSW1").w(FUNC(aerofgt_banked_sound_state::scrollx_w<1>)); + map(0x0fe007, 0x0fe007).r(FUNC(aerofgt_banked_sound_state::pending_command_r)); + map(0x0fe006, 0x0fe007).w(FUNC(aerofgt_banked_sound_state::scrolly_w<1>)); map(0x0fe008, 0x0fe009).portr("DSW2"); - map(0x0fe008, 0x0fe00b).w(FUNC(aerofgt_state::turbofrc_gfxbank_w)); + map(0x0fe008, 0x0fe00b).w(FUNC(aerofgt_banked_sound_state::turbofrc_gfxbank_w)); map(0x0fe00e, 0x0fe00e).w(m_soundlatch, FUNC(generic_latch_8_device::write)); map(0x0fe400, 0x0fe403).w("gga", FUNC(vsystem_gga_device::write)).umask16(0x00ff); map(0x0ff000, 0x0fffff).ram().share("rasterram"); /* used only for the scroll registers */ } -void aerofgt_state::aerofgt_map(address_map &map) +void aerofgt_banked_sound_state::aerofgt_map(address_map &map) { map(0x000000, 0x07ffff).rom(); map(0x1a0000, 0x1a07ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); map(0x1b0000, 0x1b07ff).ram().share("rasterram"); /* used only for the scroll registers */ map(0x1b0800, 0x1b0801).ram(); /* tracks watchdog state */ map(0x1b0ff0, 0x1b0fff).ram(); /* stack area during boot */ - map(0x1b2000, 0x1b3fff).ram().w(FUNC(aerofgt_state::vram_w<0>)).share("vram.0"); - map(0x1b4000, 0x1b5fff).ram().w(FUNC(aerofgt_state::vram_w<1>)).share("vram.1"); + map(0x1b2000, 0x1b3fff).ram().w(FUNC(aerofgt_banked_sound_state::vram_w<0>)).share("vram.0"); + map(0x1b4000, 0x1b5fff).ram().w(FUNC(aerofgt_banked_sound_state::vram_w<1>)).share("vram.1"); map(0x1c0000, 0x1c7fff).ram().share("sprlookupram1"); map(0x1d0000, 0x1d1fff).ram().share("spriteram"); map(0xfef000, 0xffefff).ram(); /* work RAM */ - map(0xffff80, 0xffff87).w(FUNC(aerofgt_state::aerofgt_gfxbank_w)); - map(0xffff88, 0xffff89).w(FUNC(aerofgt_state::scrolly_w<0>)); /* + something else in the top byte */ - map(0xffff90, 0xffff91).w(FUNC(aerofgt_state::scrolly_w<1>)); /* + something else in the top byte */ + map(0xffff80, 0xffff87).w(FUNC(aerofgt_banked_sound_state::aerofgt_gfxbank_w)); + map(0xffff88, 0xffff89).w(FUNC(aerofgt_banked_sound_state::scrolly_w<0>)); /* + something else in the top byte */ + map(0xffff90, 0xffff91).w(FUNC(aerofgt_banked_sound_state::scrolly_w<1>)); /* + something else in the top byte */ map(0xffffa0, 0xffffbf).rw("io", FUNC(vs9209_device::read), FUNC(vs9209_device::write)).umask16(0x00ff); map(0xffffc1, 0xffffc1).w(m_soundlatch, FUNC(generic_latch_8_device::write)); } -void aerofgt_state::aerfboot_map(address_map &map) +void aerofgt_sound_cpu_state::aerfboot_map(address_map &map) { map(0x000000, 0x07ffff).rom(); map(0x0c0000, 0x0cffff).ram(); /* work RAM */ - map(0x0d0000, 0x0d1fff).ram().w(FUNC(aerofgt_state::vram_w<0>)).share("vram.0"); - map(0x0d2000, 0x0d3fff).ram().w(FUNC(aerofgt_state::vram_w<1>)).share("vram.1"); + map(0x0d0000, 0x0d1fff).ram().w(FUNC(aerofgt_sound_cpu_state::vram_w<0>)).share("vram.0"); + map(0x0d2000, 0x0d3fff).ram().w(FUNC(aerofgt_sound_cpu_state::vram_w<1>)).share("vram.1"); map(0x0e0000, 0x0e3fff).ram().share("sprlookupram1"); map(0x0e4000, 0x0e7fff).ram().share("sprlookupram2"); map(0x0f8000, 0x0fbfff).ram(); /* work RAM */ @@ -402,10 +399,10 @@ void aerofgt_state::aerfboot_map(address_map &map) map(0x0fe002, 0x0fe003).portr("IN1"); map(0x0fe004, 0x0fe005).portr("DSW1"); map(0x0fe008, 0x0fe009).portr("DSW2"); - map(0x0fe002, 0x0fe003).w(FUNC(aerofgt_state::scrolly_w<0>)); - map(0x0fe004, 0x0fe005).w(FUNC(aerofgt_state::scrollx_w<1>)); - map(0x0fe006, 0x0fe007).w(FUNC(aerofgt_state::scrolly_w<1>)); - map(0x0fe008, 0x0fe00b).w(FUNC(aerofgt_state::turbofrc_gfxbank_w)); + map(0x0fe002, 0x0fe003).w(FUNC(aerofgt_sound_cpu_state::scrolly_w<0>)); + map(0x0fe004, 0x0fe005).w(FUNC(aerofgt_sound_cpu_state::scrollx_w<1>)); + map(0x0fe006, 0x0fe007).w(FUNC(aerofgt_sound_cpu_state::scrolly_w<1>)); + map(0x0fe008, 0x0fe00b).w(FUNC(aerofgt_sound_cpu_state::turbofrc_gfxbank_w)); map(0x0fe00e, 0x0fe00e).w(m_soundlatch, FUNC(generic_latch_8_device::write)); map(0x0fe010, 0x0fe011).nopw(); map(0x0fe012, 0x0fe013).nopw(); // MSB = watchdog? @@ -444,68 +441,68 @@ void aerofgt_state::aerfboo2_map(address_map &map) map(0x0ff000, 0x0fffff).ram().share("rasterram"); /* used only for the scroll registers */ } -void aerofgt_state::wbbc97_map(address_map &map) +void aerofgt_sound_cpu_state::wbbc97_map(address_map &map) { map(0x000000, 0x3fffff).rom(); map(0x500000, 0x50ffff).ram(); /* work RAM */ map(0x600000, 0x605fff).ram().share("sprlookupram1"); map(0xa00000, 0xa3ffff).ram().share("bitmapram"); - map(0xff8000, 0xff8fff).ram().w(FUNC(aerofgt_state::vram_w<0>)).share("vram.0"); + map(0xff8000, 0xff8fff).ram().w(FUNC(aerofgt_sound_cpu_state::vram_w<0>)).share("vram.0"); map(0xffc000, 0xffc3ff).writeonly().share("spriteram"); map(0xffd000, 0xffdfff).ram().share("rasterram"); /* bg1 scroll registers */ map(0xffe000, 0xffefff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); map(0xfff000, 0xfff001).portr("IN0"); - map(0xfff001, 0xfff001).w(FUNC(aerofgt_state::pspikes_palette_bank_w)); + map(0xfff001, 0xfff001).w(FUNC(aerofgt_sound_cpu_state::pspikes_palette_bank_w)); map(0xfff002, 0xfff003).portr("IN1"); - map(0xfff003, 0xfff003).w(FUNC(aerofgt_state::pspikes_gfxbank_w)); - map(0xfff004, 0xfff005).portr("DSW").w(FUNC(aerofgt_state::scrolly_w<0>)); - map(0xfff007, 0xfff007).r(FUNC(aerofgt_state::pending_command_r)).w(m_soundlatch, FUNC(generic_latch_8_device::write)).umask16(0x00ff); - map(0xfff00e, 0xfff00f).w(FUNC(aerofgt_state::wbbc97_bitmap_enable_w)); + map(0xfff003, 0xfff003).w(FUNC(aerofgt_sound_cpu_state::pspikes_gfxbank_w)); + map(0xfff004, 0xfff005).portr("DSW").w(FUNC(aerofgt_sound_cpu_state::scrolly_w<0>)); + map(0xfff007, 0xfff007).r(FUNC(aerofgt_sound_cpu_state::pending_command_r)).w(m_soundlatch, FUNC(generic_latch_8_device::write)).umask16(0x00ff); + map(0xfff00e, 0xfff00f).w(FUNC(aerofgt_sound_cpu_state::wbbc97_bitmap_enable_w)); map(0xfff400, 0xfff403).nopw(); // GGA access } -void aerofgt_state::sound_map(address_map &map) +void aerofgt_banked_sound_state::sound_map(address_map &map) { - map(0x0000, 0x77ff).rom(); + map(0x0000, 0x77ff).rom().region("audiocpu", 0); map(0x7800, 0x7fff).ram(); - map(0x8000, 0xffff).bankr("soundbank"); + map(0x8000, 0xffff).bankr(m_soundbank); } -void aerofgt_state::spinlbrk_sound_portmap(address_map &map) +void aerofgt_banked_sound_state::spinlbrk_sound_portmap(address_map &map) { map.global_mask(0xff); - map(0x00, 0x00).w(FUNC(aerofgt_state::spinlbrk_sh_bankswitch_w)); + map(0x00, 0x00).w(FUNC(aerofgt_banked_sound_state::sh_bankswitch_w)); map(0x14, 0x14).rw(m_soundlatch, FUNC(generic_latch_8_device::read), FUNC(generic_latch_8_device::acknowledge_w)); map(0x18, 0x1b).rw("ymsnd", FUNC(ym2610_device::read), FUNC(ym2610_device::write)); } -void aerofgt_state::turbofrc_sound_portmap(address_map &map) +void aerofgt_banked_sound_state::turbofrc_sound_portmap(address_map &map) { map.global_mask(0xff); - map(0x00, 0x00).w(FUNC(aerofgt_state::aerofgt_sh_bankswitch_w)); + map(0x00, 0x00).w(FUNC(aerofgt_banked_sound_state::sh_bankswitch_w)); map(0x14, 0x14).rw(m_soundlatch, FUNC(generic_latch_8_device::read), FUNC(generic_latch_8_device::acknowledge_w)); map(0x18, 0x1b).rw("ymsnd", FUNC(ym2610_device::read), FUNC(ym2610_device::write)); } -void aerofgt_state::aerofgt_sound_portmap(address_map &map) +void aerofgt_banked_sound_state::aerofgt_sound_portmap(address_map &map) { map.global_mask(0xff); map(0x00, 0x03).rw("ymsnd", FUNC(ym2610_device::read), FUNC(ym2610_device::write)); - map(0x04, 0x04).w(FUNC(aerofgt_state::aerofgt_sh_bankswitch_w)); + map(0x04, 0x04).w(FUNC(aerofgt_banked_sound_state::sh_bankswitch_w)); map(0x08, 0x08).w(m_soundlatch, FUNC(generic_latch_8_device::acknowledge_w)); map(0x0c, 0x0c).r(m_soundlatch, FUNC(generic_latch_8_device::read)); } -void aerofgt_state::aerfboot_sound_map(address_map &map) +void aerofgt_sound_cpu_state::aerfboot_sound_map(address_map &map) { map(0x0000, 0x7fff).rom(); map(0x8000, 0x87ff).ram(); - map(0x9000, 0x9000).w(FUNC(aerofgt_state::aerfboot_okim6295_banking_w)); + map(0x9000, 0x9000).w(FUNC(aerofgt_sound_cpu_state::aerfboot_okim6295_banking_w)); map(0x9800, 0x9800).rw(m_oki, FUNC(okim6295_device::read), FUNC(okim6295_device::write)); map(0xa000, 0xa000).r(m_soundlatch, FUNC(generic_latch_8_device::read)); } -void aerofgt_state::wbbc97_sound_map(address_map &map) +void aerofgt_sound_cpu_state::wbbc97_sound_map(address_map &map) { map(0x0000, 0xefff).rom(); map(0xf000, 0xf7ff).ram(); @@ -515,30 +512,30 @@ void aerofgt_state::wbbc97_sound_map(address_map &map) map(0xfc20, 0xfc20).r(m_soundlatch, FUNC(generic_latch_8_device::read)); } -void aerofgt_state::karatblzbl_sound_map(address_map &map) +void aerofgt_sound_cpu_state::karatblzbl_sound_map(address_map &map) { map(0x0000, 0xefff).rom(); map(0xf000, 0xf7ff).ram(); map(0xf800, 0xf800).r(m_soundlatch, FUNC(generic_latch_8_device::read)); //.w("soundlatch2", FUNC(generic_latch_8_device::write)); } -void aerofgt_state::karatblzbl_sound_portmap(address_map &map) +void aerofgt_sound_cpu_state::karatblzbl_sound_portmap(address_map &map) { map.global_mask(0xff); map(0x00, 0x00).rw("ymsnd", FUNC(ym3812_device::status_r), FUNC(ym3812_device::address_w)); map(0x20, 0x20).w("ymsnd", FUNC(ym3812_device::data_w)); - map(0x40, 0x40).w(FUNC(aerofgt_state::karatblzbl_d7759_write_port_0_w)); - map(0x80, 0x80).w(FUNC(aerofgt_state::karatblzbl_d7759_reset_w)); + map(0x40, 0x40).w(FUNC(aerofgt_sound_cpu_state::karatblzbl_d7759_write_port_0_w)); + map(0x80, 0x80).w(FUNC(aerofgt_sound_cpu_state::karatblzbl_d7759_reset_w)); } -void aerofgt_state::kickball_sound_map(address_map &map) +void aerofgt_sound_cpu_state::kickball_sound_map(address_map &map) { map(0x0000, 0xefff).rom(); map(0xf000, 0xf7ff).ram(); map(0xf800, 0xf800).r(m_soundlatch, FUNC(generic_latch_8_device::read)); } -void aerofgt_state::kickball_sound_portmap(address_map &map) +void aerofgt_sound_cpu_state::kickball_sound_portmap(address_map &map) { map.global_mask(0xff); map(0x00, 0x00).rw("ymsnd", FUNC(ym3812_device::status_r), FUNC(ym3812_device::address_w)); @@ -547,7 +544,7 @@ void aerofgt_state::kickball_sound_portmap(address_map &map) map(0xc0, 0xc0).w(m_soundlatch, FUNC(generic_latch_8_device::acknowledge_w)); } -void aerofgt_state::spikes91_sound_map(address_map &map) +void aerofgt_sound_cpu_state::spikes91_sound_map(address_map &map) { map(0x0000, 0xdfff).rom(); map(0xe000, 0xe001).rw("ymsnd", FUNC(ym2151_device::read), FUNC(ym2151_device::write)); @@ -557,10 +554,10 @@ void aerofgt_state::spikes91_sound_map(address_map &map) map(0xf800, 0xffff).ram(); } -void aerofgt_state::oki_map(address_map &map) +void aerofgt_sound_cpu_state::oki_map(address_map &map) { //only for aerfboot for now map(0x00000, 0x1ffff).rom(); - map(0x20000, 0x3ffff).bankr("okibank"); + map(0x20000, 0x3ffff).bankr(m_okibank); } static INPUT_PORTS_START( pspikes ) @@ -1419,70 +1416,61 @@ static GFXDECODE_START( gfx_wbbc97 ) GFXDECODE_END -MACHINE_START_MEMBER(aerofgt_state,common) +void aerofgt_sound_cpu_state::machine_start() { + aerofgt_state::machine_start(); + + m_spikes91_lookup = 0; + + save_item(NAME(m_spikes91_lookup)); } -MACHINE_START_MEMBER(aerofgt_state,aerofgt) +void aerofgt_banked_sound_state::machine_start() { - m_soundbank->configure_entries(0, 4, memregion("audiocpu")->base(), 0x8000); + aerofgt_sound_cpu_state::machine_start(); - MACHINE_START_CALL_MEMBER(common); + m_soundbank->configure_entries(0, 4, memregion("soundbank")->base(), 0x8000); } -MACHINE_START_MEMBER(aerofgt_state,spinlbrk) +void aerofgt_banked_sound_state::machine_reset() { - m_soundbank->configure_entries(0, 2, memregion("audiocpu")->base()+0x8000, 0x8000); - - MACHINE_START_CALL_MEMBER(common); -} - -MACHINE_RESET_MEMBER(aerofgt_state,common) -{ -} - -MACHINE_RESET_MEMBER(aerofgt_state,aerofgt) -{ - MACHINE_RESET_CALL_MEMBER(common); + aerofgt_sound_cpu_state::machine_reset(); m_soundbank->set_entry(0); /* needed by spinlbrk */ } -void aerofgt_state::pspikes(machine_config &config) +void aerofgt_banked_sound_state::pspikes(machine_config &config) { /* basic machine hardware */ M68000(config, m_maincpu, XTAL(20'000'000)/2); /* verified on pcb */ - m_maincpu->set_addrmap(AS_PROGRAM, &aerofgt_state::pspikes_map); - m_maincpu->set_vblank_int("screen", FUNC(aerofgt_state::irq1_line_hold)); /* all irq vectors are the same */ + m_maincpu->set_addrmap(AS_PROGRAM, &aerofgt_banked_sound_state::pspikes_map); + m_maincpu->set_vblank_int("screen", FUNC(aerofgt_banked_sound_state::irq1_line_hold)); /* all irq vectors are the same */ Z80(config, m_audiocpu, XTAL(20'000'000)/4); /* verified on pcb */ - m_audiocpu->set_addrmap(AS_PROGRAM, &aerofgt_state::sound_map); - m_audiocpu->set_addrmap(AS_IO, &aerofgt_state::turbofrc_sound_portmap); + m_audiocpu->set_addrmap(AS_PROGRAM, &aerofgt_banked_sound_state::sound_map); + m_audiocpu->set_addrmap(AS_IO, &aerofgt_banked_sound_state::turbofrc_sound_portmap); /* IRQs are triggered by the YM2610 */ - MCFG_MACHINE_START_OVERRIDE(aerofgt_state,aerofgt) - MCFG_MACHINE_RESET_OVERRIDE(aerofgt_state,aerofgt) - /* video hardware */ screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_refresh_hz(61.31); /* verified on pcb */ screen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); screen.set_size(64*8, 32*8); screen.set_visarea(0*8+4, 44*8+4-1, 0*8, 30*8-1); - screen.set_screen_update(FUNC(aerofgt_state::screen_update_pspikes)); + screen.set_screen_update(FUNC(aerofgt_banked_sound_state::screen_update_pspikes)); screen.set_palette(m_palette); GFXDECODE(config, m_gfxdecode, m_palette, gfx_pspikes); PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048); VSYSTEM_SPR2(config, m_spr_old[0], 0); - m_spr_old[0]->set_tile_indirect_cb(FUNC(aerofgt_state::aerofgt_old_tile_callback)); + m_spr_old[0]->set_tile_indirect_cb(FUNC(aerofgt_banked_sound_state::aerofgt_old_tile_callback)); m_spr_old[0]->set_gfx_region(1); m_spr_old[0]->set_gfxdecode_tag(m_gfxdecode); VSYSTEM_GGA(config, "gga", XTAL(14'318'181) / 2); // divider not verified - MCFG_VIDEO_START_OVERRIDE(aerofgt_state,pspikes) + MCFG_VIDEO_START_OVERRIDE(aerofgt_banked_sound_state,pspikes) /* sound hardware */ SPEAKER(config, "lspeaker").front_left(); @@ -1500,18 +1488,15 @@ void aerofgt_state::pspikes(machine_config &config) ymsnd.add_route(2, "rspeaker", 1.0); } -void aerofgt_state::spikes91(machine_config &config) +void aerofgt_sound_cpu_state::spikes91(machine_config &config) { /* basic machine hardware */ M68000(config, m_maincpu, 20000000/2); /* 10 MHz (?) */ - m_maincpu->set_addrmap(AS_PROGRAM, &aerofgt_state::spikes91_map); - m_maincpu->set_vblank_int("screen", FUNC(aerofgt_state::irq1_line_hold)); /* all irq vectors are the same */ + m_maincpu->set_addrmap(AS_PROGRAM, &aerofgt_sound_cpu_state::spikes91_map); + m_maincpu->set_vblank_int("screen", FUNC(aerofgt_sound_cpu_state::irq1_line_hold)); /* all irq vectors are the same */ Z80(config, m_audiocpu, 24000000/8); // ? - m_audiocpu->set_addrmap(AS_PROGRAM, &aerofgt_state::spikes91_sound_map); - - MCFG_MACHINE_START_OVERRIDE(aerofgt_state,common) - MCFG_MACHINE_RESET_OVERRIDE(aerofgt_state,common) + m_audiocpu->set_addrmap(AS_PROGRAM, &aerofgt_sound_cpu_state::spikes91_sound_map); GENERIC_LATCH_8(config, m_soundlatch); m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, 0); @@ -1522,7 +1507,7 @@ void aerofgt_state::spikes91(machine_config &config) screen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); screen.set_size(64*8, 32*8); screen.set_visarea(0*8, 320-1, 0*8+4, 224+4-1); - screen.set_screen_update(FUNC(aerofgt_state::screen_update_spikes91)); + screen.set_screen_update(FUNC(aerofgt_sound_cpu_state::screen_update_spikes91)); screen.set_palette(m_palette); GFXDECODE(config, m_gfxdecode, m_palette, gfx_spikes91); @@ -1530,7 +1515,7 @@ void aerofgt_state::spikes91(machine_config &config) //VSYSTEM_GGA(config, "gga", 0); - MCFG_VIDEO_START_OVERRIDE(aerofgt_state,pspikes) + MCFG_VIDEO_START_OVERRIDE(aerofgt_sound_cpu_state,pspikes) SPEAKER(config, "mono").front_center(); @@ -1547,9 +1532,6 @@ void aerofgt_state::pspikesb(machine_config &config) m_maincpu->set_addrmap(AS_PROGRAM, &aerofgt_state::pspikesb_map); m_maincpu->set_vblank_int("screen", FUNC(aerofgt_state::irq1_line_hold)); /* all irq vectors are the same */ - MCFG_MACHINE_START_OVERRIDE(aerofgt_state,common) - MCFG_MACHINE_RESET_OVERRIDE(aerofgt_state,common) - /* video hardware */ screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_refresh_hz(60); @@ -1580,19 +1562,16 @@ void aerofgt_state::pspikesb(machine_config &config) tile banking and sound system are different like many of the bootlegs */ -void aerofgt_state::kickball(machine_config &config) +void aerofgt_sound_cpu_state::kickball(machine_config &config) { /* basic machine hardware */ M68000(config, m_maincpu, XTAL(10'000'000)); // 10Mhz XTAL near 10Mhz rated CPU - m_maincpu->set_addrmap(AS_PROGRAM, &aerofgt_state::kickball_map); - m_maincpu->set_vblank_int("screen", FUNC(aerofgt_state::irq1_line_hold)); /* only IRQ1 is valid */ + m_maincpu->set_addrmap(AS_PROGRAM, &aerofgt_sound_cpu_state::kickball_map); + m_maincpu->set_vblank_int("screen", FUNC(aerofgt_sound_cpu_state::irq1_line_hold)); /* only IRQ1 is valid */ Z80(config, m_audiocpu, XTAL(4'000'000)); - m_audiocpu->set_addrmap(AS_PROGRAM, &aerofgt_state::kickball_sound_map); - m_audiocpu->set_addrmap(AS_IO, &aerofgt_state::kickball_sound_portmap); - - MCFG_MACHINE_START_OVERRIDE(aerofgt_state,common) - MCFG_MACHINE_RESET_OVERRIDE(aerofgt_state,common) + m_audiocpu->set_addrmap(AS_PROGRAM, &aerofgt_sound_cpu_state::kickball_sound_map); + m_audiocpu->set_addrmap(AS_IO, &aerofgt_sound_cpu_state::kickball_sound_portmap); /* video hardware */ screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); @@ -1600,20 +1579,20 @@ void aerofgt_state::kickball(machine_config &config) screen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); screen.set_size(64*8, 32*8); screen.set_visarea(0*8+4, 44*8+4-1, 0*8, 30*8-1); - screen.set_screen_update(FUNC(aerofgt_state::screen_update_pspikes)); + screen.set_screen_update(FUNC(aerofgt_sound_cpu_state::screen_update_pspikes)); screen.set_palette(m_palette); GFXDECODE(config, m_gfxdecode, m_palette, gfx_kickball); PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048); VSYSTEM_SPR2(config, m_spr_old[0], 0); - m_spr_old[0]->set_tile_indirect_cb(FUNC(aerofgt_state::aerofgt_old_tile_callback)); + m_spr_old[0]->set_tile_indirect_cb(FUNC(aerofgt_sound_cpu_state::aerofgt_old_tile_callback)); m_spr_old[0]->set_gfx_region(1); m_spr_old[0]->set_gfxdecode_tag(m_gfxdecode); //VSYSTEM_GGA(config, "gga", 0); // still accessed as if it exists, in clone hardware? - MCFG_VIDEO_START_OVERRIDE(aerofgt_state,pspikes) + MCFG_VIDEO_START_OVERRIDE(aerofgt_sound_cpu_state,pspikes) /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -1637,9 +1616,6 @@ void aerofgt_state::pspikesc(machine_config &config) m_maincpu->set_addrmap(AS_PROGRAM, &aerofgt_state::pspikesc_map); m_maincpu->set_vblank_int("screen", FUNC(aerofgt_state::irq1_line_hold)); /* all irq vectors are the same */ - MCFG_MACHINE_START_OVERRIDE(aerofgt_state,common) - MCFG_MACHINE_RESET_OVERRIDE(aerofgt_state,common) - /* video hardware */ screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_refresh_hz(60); @@ -1668,19 +1644,16 @@ void aerofgt_state::pspikesc(machine_config &config) m_oki->add_route(ALL_OUTPUTS, "mono", 1.0); } -void aerofgt_state::karatblz(machine_config &config) +void aerofgt_banked_sound_state::karatblz(machine_config &config) { /* basic machine hardware */ M68000(config, m_maincpu, 20000000/2); /* 10 MHz (?) */ - m_maincpu->set_addrmap(AS_PROGRAM, &aerofgt_state::karatblz_map); - m_maincpu->set_vblank_int("screen", FUNC(aerofgt_state::irq1_line_hold)); + m_maincpu->set_addrmap(AS_PROGRAM, &aerofgt_banked_sound_state::karatblz_map); + m_maincpu->set_vblank_int("screen", FUNC(aerofgt_banked_sound_state::irq1_line_hold)); Z80(config, m_audiocpu, 8000000/2); /* 4 MHz ??? */ - m_audiocpu->set_addrmap(AS_PROGRAM, &aerofgt_state::sound_map); - m_audiocpu->set_addrmap(AS_IO, &aerofgt_state::turbofrc_sound_portmap); /* IRQs are triggered by the YM2610 */ - - MCFG_MACHINE_START_OVERRIDE(aerofgt_state,aerofgt) - MCFG_MACHINE_RESET_OVERRIDE(aerofgt_state,aerofgt) + m_audiocpu->set_addrmap(AS_PROGRAM, &aerofgt_banked_sound_state::sound_map); + m_audiocpu->set_addrmap(AS_IO, &aerofgt_banked_sound_state::turbofrc_sound_portmap); /* IRQs are triggered by the YM2610 */ /* video hardware */ screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); @@ -1688,7 +1661,7 @@ void aerofgt_state::karatblz(machine_config &config) screen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); screen.set_size(64*8, 32*8); screen.set_visarea(1*8, 45*8-1, 0*8, 30*8-1); - screen.set_screen_update(FUNC(aerofgt_state::screen_update_karatblz)); + screen.set_screen_update(FUNC(aerofgt_banked_sound_state::screen_update_karatblz)); screen.set_palette(m_palette); GFXDECODE(config, m_gfxdecode, m_palette, gfx_turbofrc); @@ -1697,16 +1670,16 @@ void aerofgt_state::karatblz(machine_config &config) VSYSTEM_GGA(config, "gga", XTAL(14'318'181) / 2); // divider not verified VSYSTEM_SPR2(config, m_spr_old[0], 0); - m_spr_old[0]->set_tile_indirect_cb(FUNC(aerofgt_state::aerofgt_old_tile_callback)); + m_spr_old[0]->set_tile_indirect_cb(FUNC(aerofgt_banked_sound_state::aerofgt_old_tile_callback)); m_spr_old[0]->set_gfx_region(2); m_spr_old[0]->set_gfxdecode_tag(m_gfxdecode); VSYSTEM_SPR2(config, m_spr_old[1], 0); - m_spr_old[1]->set_tile_indirect_cb(FUNC(aerofgt_state::aerofgt_ol2_tile_callback)); + m_spr_old[1]->set_tile_indirect_cb(FUNC(aerofgt_banked_sound_state::aerofgt_ol2_tile_callback)); m_spr_old[1]->set_gfx_region(3); m_spr_old[1]->set_gfxdecode_tag(m_gfxdecode); - MCFG_VIDEO_START_OVERRIDE(aerofgt_state,karatblz) + MCFG_VIDEO_START_OVERRIDE(aerofgt_banked_sound_state,karatblz) /* sound hardware */ SPEAKER(config, "lspeaker").front_left(); @@ -1724,19 +1697,16 @@ void aerofgt_state::karatblz(machine_config &config) ymsnd.add_route(2, "rspeaker", 1.0); } -void aerofgt_state::karatblzbl(machine_config &config) +void aerofgt_sound_cpu_state::karatblzbl(machine_config &config) { /* basic machine hardware */ M68000(config, m_maincpu, 20000000/2); /* 10 MHz (?) */ - m_maincpu->set_addrmap(AS_PROGRAM, &aerofgt_state::karatblzbl_map); - m_maincpu->set_vblank_int("screen", FUNC(aerofgt_state::irq1_line_hold)); + m_maincpu->set_addrmap(AS_PROGRAM, &aerofgt_sound_cpu_state::karatblzbl_map); + m_maincpu->set_vblank_int("screen", FUNC(aerofgt_sound_cpu_state::irq1_line_hold)); Z80(config, m_audiocpu, 8000000/2); /* 4 MHz ??? */ - m_audiocpu->set_addrmap(AS_PROGRAM, &aerofgt_state::karatblzbl_sound_map); - m_audiocpu->set_addrmap(AS_IO, &aerofgt_state::karatblzbl_sound_portmap); - - MCFG_MACHINE_START_OVERRIDE(aerofgt_state,common) - MCFG_MACHINE_RESET_OVERRIDE(aerofgt_state,common) + m_audiocpu->set_addrmap(AS_PROGRAM, &aerofgt_sound_cpu_state::karatblzbl_sound_map); + m_audiocpu->set_addrmap(AS_IO, &aerofgt_sound_cpu_state::karatblzbl_sound_portmap); /* video hardware */ screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); @@ -1744,25 +1714,25 @@ void aerofgt_state::karatblzbl(machine_config &config) screen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); screen.set_size(64*8, 32*8); screen.set_visarea(1*8, 45*8-1, 0*8, 30*8-1); - screen.set_screen_update(FUNC(aerofgt_state::screen_update_karatblz)); + screen.set_screen_update(FUNC(aerofgt_sound_cpu_state::screen_update_karatblz)); screen.set_palette(m_palette); GFXDECODE(config, m_gfxdecode, m_palette, gfx_turbofrc); PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 1024); VSYSTEM_SPR2(config, m_spr_old[0], 0); - m_spr_old[0]->set_tile_indirect_cb(FUNC(aerofgt_state::aerofgt_old_tile_callback)); + m_spr_old[0]->set_tile_indirect_cb(FUNC(aerofgt_sound_cpu_state::aerofgt_old_tile_callback)); m_spr_old[0]->set_gfx_region(2); m_spr_old[0]->set_gfxdecode_tag(m_gfxdecode); VSYSTEM_SPR2(config, m_spr_old[1], 0); - m_spr_old[1]->set_tile_indirect_cb(FUNC(aerofgt_state::aerofgt_ol2_tile_callback)); + m_spr_old[1]->set_tile_indirect_cb(FUNC(aerofgt_sound_cpu_state::aerofgt_ol2_tile_callback)); m_spr_old[1]->set_gfx_region(3); m_spr_old[1]->set_gfxdecode_tag(m_gfxdecode); //VSYSTEM_GGA(config, "gga", 0); - MCFG_VIDEO_START_OVERRIDE(aerofgt_state,karatblz) + MCFG_VIDEO_START_OVERRIDE(aerofgt_sound_cpu_state,karatblz) GENERIC_LATCH_8(config, m_soundlatch); GENERIC_LATCH_8(config, "soundlatch2"); @@ -1779,19 +1749,16 @@ void aerofgt_state::karatblzbl(machine_config &config) m_upd7759->add_route(ALL_OUTPUTS, "mono", 1.0); } -void aerofgt_state::spinlbrk(machine_config &config) +void aerofgt_banked_sound_state::spinlbrk(machine_config &config) { /* basic machine hardware */ M68000(config, m_maincpu, XTAL(20'000'000)/2); /* verified on pcb */ - m_maincpu->set_addrmap(AS_PROGRAM, &aerofgt_state::spinlbrk_map); - m_maincpu->set_vblank_int("screen", FUNC(aerofgt_state::irq1_line_hold)); /* there are vectors for 3 and 4 too, analog related? */ + m_maincpu->set_addrmap(AS_PROGRAM, &aerofgt_banked_sound_state::spinlbrk_map); + m_maincpu->set_vblank_int("screen", FUNC(aerofgt_banked_sound_state::irq1_line_hold)); /* there are vectors for 3 and 4 too, analog related? */ Z80(config, m_audiocpu, XTAL(20'000'000)/4); /* 5mhz verified on pcb */ - m_audiocpu->set_addrmap(AS_PROGRAM, &aerofgt_state::sound_map); - m_audiocpu->set_addrmap(AS_IO, &aerofgt_state::spinlbrk_sound_portmap); /* IRQs are triggered by the YM2610 */ - - MCFG_MACHINE_START_OVERRIDE(aerofgt_state,spinlbrk) - MCFG_MACHINE_RESET_OVERRIDE(aerofgt_state,aerofgt) + m_audiocpu->set_addrmap(AS_PROGRAM, &aerofgt_banked_sound_state::sound_map); + m_audiocpu->set_addrmap(AS_IO, &aerofgt_banked_sound_state::spinlbrk_sound_portmap); /* IRQs are triggered by the YM2610 */ /* video hardware */ screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); @@ -1799,7 +1766,7 @@ void aerofgt_state::spinlbrk(machine_config &config) screen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); screen.set_size(64*8, 32*8); screen.set_visarea(1*8, 45*8-1, 0*8, 30*8-1); - screen.set_screen_update(FUNC(aerofgt_state::screen_update_spinlbrk)); + screen.set_screen_update(FUNC(aerofgt_banked_sound_state::screen_update_spinlbrk)); screen.set_palette(m_palette); GFXDECODE(config, m_gfxdecode, m_palette, gfx_turbofrc); @@ -1813,12 +1780,12 @@ void aerofgt_state::spinlbrk(machine_config &config) m_spr_old[0]->set_gfxdecode_tag(m_gfxdecode); VSYSTEM_SPR2(config, m_spr_old[1], 0); - m_spr_old[1]->set_tile_indirect_cb(FUNC(aerofgt_state::spinbrk_tile_callback)); // rom lookup + m_spr_old[1]->set_tile_indirect_cb(FUNC(aerofgt_banked_sound_state::spinbrk_tile_callback)); // rom lookup m_spr_old[1]->set_pritype(1); m_spr_old[1]->set_gfx_region(3); m_spr_old[1]->set_gfxdecode_tag(m_gfxdecode); - MCFG_VIDEO_START_OVERRIDE(aerofgt_state,spinlbrk) + MCFG_VIDEO_START_OVERRIDE(aerofgt_banked_sound_state,spinlbrk) /* sound hardware */ SPEAKER(config, "lspeaker").front_left(); @@ -1836,19 +1803,16 @@ void aerofgt_state::spinlbrk(machine_config &config) ymsnd.add_route(2, "rspeaker", 1.0); } -void aerofgt_state::turbofrc(machine_config &config) +void aerofgt_banked_sound_state::turbofrc(machine_config &config) { /* basic machine hardware */ M68000(config, m_maincpu, XTAL(20'000'000)/2); /* verified on pcb */ - m_maincpu->set_addrmap(AS_PROGRAM, &aerofgt_state::turbofrc_map); - m_maincpu->set_vblank_int("screen", FUNC(aerofgt_state::irq1_line_hold)); /* all irq vectors are the same */ + m_maincpu->set_addrmap(AS_PROGRAM, &aerofgt_banked_sound_state::turbofrc_map); + m_maincpu->set_vblank_int("screen", FUNC(aerofgt_banked_sound_state::irq1_line_hold)); /* all irq vectors are the same */ Z80(config, m_audiocpu, XTAL(5'000'000)); /* verified on pcb */ - m_audiocpu->set_addrmap(AS_PROGRAM, &aerofgt_state::sound_map); - m_audiocpu->set_addrmap(AS_IO, &aerofgt_state::turbofrc_sound_portmap); /* IRQs are triggered by the YM2610 */ - - MCFG_MACHINE_START_OVERRIDE(aerofgt_state,aerofgt) - MCFG_MACHINE_RESET_OVERRIDE(aerofgt_state,aerofgt) + m_audiocpu->set_addrmap(AS_PROGRAM, &aerofgt_banked_sound_state::sound_map); + m_audiocpu->set_addrmap(AS_IO, &aerofgt_banked_sound_state::turbofrc_sound_portmap); /* IRQs are triggered by the YM2610 */ /* video hardware */ screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); @@ -1856,7 +1820,7 @@ void aerofgt_state::turbofrc(machine_config &config) screen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); screen.set_size(64*8, 32*8); screen.set_visarea(0*8, 44*8-1, 0*8, 30*8-1); - screen.set_screen_update(FUNC(aerofgt_state::screen_update_turbofrc)); + screen.set_screen_update(FUNC(aerofgt_banked_sound_state::screen_update_turbofrc)); screen.set_palette(m_palette); GFXDECODE(config, m_gfxdecode, m_palette, gfx_turbofrc); @@ -1865,16 +1829,16 @@ void aerofgt_state::turbofrc(machine_config &config) VSYSTEM_GGA(config, "gga", XTAL(14'318'181) / 2); // divider not verified VSYSTEM_SPR2(config, m_spr_old[0], 0); - m_spr_old[0]->set_tile_indirect_cb(FUNC(aerofgt_state::aerofgt_old_tile_callback)); + m_spr_old[0]->set_tile_indirect_cb(FUNC(aerofgt_banked_sound_state::aerofgt_old_tile_callback)); m_spr_old[0]->set_gfx_region(2); m_spr_old[0]->set_gfxdecode_tag(m_gfxdecode); VSYSTEM_SPR2(config, m_spr_old[1], 0); - m_spr_old[1]->set_tile_indirect_cb(FUNC(aerofgt_state::aerofgt_ol2_tile_callback)); + m_spr_old[1]->set_tile_indirect_cb(FUNC(aerofgt_banked_sound_state::aerofgt_ol2_tile_callback)); m_spr_old[1]->set_gfx_region(3); m_spr_old[1]->set_gfxdecode_tag(m_gfxdecode); - MCFG_VIDEO_START_OVERRIDE(aerofgt_state,turbofrc) + MCFG_VIDEO_START_OVERRIDE(aerofgt_banked_sound_state,turbofrc) /* sound hardware */ SPEAKER(config, "lspeaker").front_left(); @@ -1892,19 +1856,16 @@ void aerofgt_state::turbofrc(machine_config &config) ymsnd.add_route(2, "rspeaker", 1.0); } -void aerofgt_state::aerofgtb(machine_config &config) +void aerofgt_banked_sound_state::aerofgtb(machine_config &config) { /* basic machine hardware */ M68000(config, m_maincpu, 20000000/2); /* 10 MHz (?) */ - m_maincpu->set_addrmap(AS_PROGRAM, &aerofgt_state::aerofgtb_map); - m_maincpu->set_vblank_int("screen", FUNC(aerofgt_state::irq1_line_hold)); /* all irq vectors are the same */ + m_maincpu->set_addrmap(AS_PROGRAM, &aerofgt_banked_sound_state::aerofgtb_map); + m_maincpu->set_vblank_int("screen", FUNC(aerofgt_banked_sound_state::irq1_line_hold)); /* all irq vectors are the same */ Z80(config, m_audiocpu, 8000000/2); /* 4 MHz ??? */ - m_audiocpu->set_addrmap(AS_PROGRAM, &aerofgt_state::sound_map); - m_audiocpu->set_addrmap(AS_IO, &aerofgt_state::aerofgt_sound_portmap); /* IRQs are triggered by the YM2610 */ - - MCFG_MACHINE_START_OVERRIDE(aerofgt_state,aerofgt) - MCFG_MACHINE_RESET_OVERRIDE(aerofgt_state,aerofgt) + m_audiocpu->set_addrmap(AS_PROGRAM, &aerofgt_banked_sound_state::sound_map); + m_audiocpu->set_addrmap(AS_IO, &aerofgt_banked_sound_state::aerofgt_sound_portmap); /* IRQs are triggered by the YM2610 */ /* video hardware */ screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); @@ -1912,7 +1873,7 @@ void aerofgt_state::aerofgtb(machine_config &config) screen.set_vblank_time(ATTOSECONDS_IN_USEC(500)); /* wrong but improves sprite-background synchronization */ screen.set_size(64*8, 32*8); screen.set_visarea(0*8+12, 40*8-1+12, 0*8, 28*8-1); - screen.set_screen_update(FUNC(aerofgt_state::screen_update_turbofrc)); + screen.set_screen_update(FUNC(aerofgt_banked_sound_state::screen_update_turbofrc)); screen.set_palette(m_palette); GFXDECODE(config, m_gfxdecode, m_palette, gfx_turbofrc); @@ -1921,16 +1882,16 @@ void aerofgt_state::aerofgtb(machine_config &config) VSYSTEM_GGA(config, "gga", XTAL(14'318'181) / 2); // divider not verified VSYSTEM_SPR2(config, m_spr_old[0], 0); - m_spr_old[0]->set_tile_indirect_cb(FUNC(aerofgt_state::aerofgt_old_tile_callback)); + m_spr_old[0]->set_tile_indirect_cb(FUNC(aerofgt_banked_sound_state::aerofgt_old_tile_callback)); m_spr_old[0]->set_gfx_region(2); m_spr_old[0]->set_gfxdecode_tag(m_gfxdecode); VSYSTEM_SPR2(config, m_spr_old[1], 0); - m_spr_old[1]->set_tile_indirect_cb(FUNC(aerofgt_state::aerofgt_ol2_tile_callback)); + m_spr_old[1]->set_tile_indirect_cb(FUNC(aerofgt_banked_sound_state::aerofgt_ol2_tile_callback)); m_spr_old[1]->set_gfx_region(3); m_spr_old[1]->set_gfxdecode_tag(m_gfxdecode); - MCFG_VIDEO_START_OVERRIDE(aerofgt_state,turbofrc) + MCFG_VIDEO_START_OVERRIDE(aerofgt_banked_sound_state,turbofrc) /* sound hardware */ SPEAKER(config, "lspeaker").front_left(); @@ -1948,19 +1909,16 @@ void aerofgt_state::aerofgtb(machine_config &config) ymsnd.add_route(2, "rspeaker", 1.0); } -void aerofgt_state::aerofgt(machine_config &config) +void aerofgt_banked_sound_state::aerofgt(machine_config &config) { /* basic machine hardware */ M68000(config, m_maincpu, XTAL(20'000'000)/2); /* verified on pcb */ - m_maincpu->set_addrmap(AS_PROGRAM, &aerofgt_state::aerofgt_map); - m_maincpu->set_vblank_int("screen", FUNC(aerofgt_state::irq1_line_hold)); /* all irq vectors are the same */ + m_maincpu->set_addrmap(AS_PROGRAM, &aerofgt_banked_sound_state::aerofgt_map); + m_maincpu->set_vblank_int("screen", FUNC(aerofgt_banked_sound_state::irq1_line_hold)); /* all irq vectors are the same */ Z80(config, m_audiocpu, XTAL(20'000'000)/4); /* 5 MHz verified on pcb */ - m_audiocpu->set_addrmap(AS_PROGRAM, &aerofgt_state::sound_map); - m_audiocpu->set_addrmap(AS_IO, &aerofgt_state::aerofgt_sound_portmap); /* IRQs are triggered by the YM2610 */ - - MCFG_MACHINE_START_OVERRIDE(aerofgt_state,aerofgt) - MCFG_MACHINE_RESET_OVERRIDE(aerofgt_state,aerofgt) + m_audiocpu->set_addrmap(AS_PROGRAM, &aerofgt_banked_sound_state::sound_map); + m_audiocpu->set_addrmap(AS_IO, &aerofgt_banked_sound_state::aerofgt_sound_portmap); /* IRQs are triggered by the YM2610 */ vs9209_device &io(VS9209(config, "io", 0)); io.porta_input_cb().set_ioport("P1"); @@ -1980,18 +1938,18 @@ void aerofgt_state::aerofgt(machine_config &config) screen.set_vblank_time(ATTOSECONDS_IN_USEC(400)); /* wrong but improves sprite-background synchronization */ screen.set_size(64*8, 32*8); screen.set_visarea(0*8, 40*8-1, 0*8, 28*8-1); - screen.set_screen_update(FUNC(aerofgt_state::screen_update_aerofgt)); + screen.set_screen_update(FUNC(aerofgt_banked_sound_state::screen_update_aerofgt)); screen.set_palette(m_palette); GFXDECODE(config, m_gfxdecode, m_palette, gfx_aerofgt); PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 1024); VSYSTEM_SPR(config, m_spr, 0); - m_spr->set_tile_indirect_cb(FUNC(aerofgt_state::aerofgt_tile_callback)); + m_spr->set_tile_indirect_cb(FUNC(aerofgt_banked_sound_state::aerofgt_tile_callback)); m_spr->set_gfx_region(2); m_spr->set_gfxdecode_tag(m_gfxdecode); - MCFG_VIDEO_START_OVERRIDE(aerofgt_state,turbofrc) + MCFG_VIDEO_START_OVERRIDE(aerofgt_banked_sound_state,turbofrc) /* sound hardware */ SPEAKER(config, "lspeaker").front_left(); @@ -2009,18 +1967,15 @@ void aerofgt_state::aerofgt(machine_config &config) ymsnd.add_route(2, "rspeaker", 1.0); } -void aerofgt_state::aerfboot(machine_config &config) +void aerofgt_sound_cpu_state::aerfboot(machine_config &config) { /* basic machine hardware */ M68000(config, m_maincpu, 20000000/2); /* 10 MHz (?) */ - m_maincpu->set_addrmap(AS_PROGRAM, &aerofgt_state::aerfboot_map); - m_maincpu->set_vblank_int("screen", FUNC(aerofgt_state::irq1_line_hold)); + m_maincpu->set_addrmap(AS_PROGRAM, &aerofgt_sound_cpu_state::aerfboot_map); + m_maincpu->set_vblank_int("screen", FUNC(aerofgt_sound_cpu_state::irq1_line_hold)); Z80(config, m_audiocpu, 8000000/2); /* 4 MHz ??? */ - m_audiocpu->set_addrmap(AS_PROGRAM, &aerofgt_state::aerfboot_sound_map); - - MCFG_MACHINE_START_OVERRIDE(aerofgt_state,common) - MCFG_MACHINE_RESET_OVERRIDE(aerofgt_state,common) + m_audiocpu->set_addrmap(AS_PROGRAM, &aerofgt_sound_cpu_state::aerfboot_sound_map); /* video hardware */ screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); @@ -2028,7 +1983,7 @@ void aerofgt_state::aerfboot(machine_config &config) screen.set_vblank_time(ATTOSECONDS_IN_USEC(500)); /* wrong but improves sprite-background synchronization */ screen.set_size(64*8, 32*8); screen.set_visarea(0*8+12, 40*8-1+12, 0*8, 28*8-1); - screen.set_screen_update(FUNC(aerofgt_state::screen_update_aerfboot)); + screen.set_screen_update(FUNC(aerofgt_sound_cpu_state::screen_update_aerfboot)); screen.set_palette(m_palette); GFXDECODE(config, m_gfxdecode, m_palette, gfx_aerfboot); @@ -2036,7 +1991,7 @@ void aerofgt_state::aerfboot(machine_config &config) //VSYSTEM_GGA(config, "gga", 0); - MCFG_VIDEO_START_OVERRIDE(aerofgt_state,turbofrc) + MCFG_VIDEO_START_OVERRIDE(aerofgt_sound_cpu_state,turbofrc) /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -2045,7 +2000,7 @@ void aerofgt_state::aerfboot(machine_config &config) m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI); OKIM6295(config, m_oki, 1056000, okim6295_device::PIN7_HIGH); // clock frequency & pin 7 not verified - m_oki->set_addrmap(0, &aerofgt_state::oki_map); + m_oki->set_addrmap(0, &aerofgt_sound_cpu_state::oki_map); m_oki->add_route(ALL_OUTPUTS, "mono", 1.0); } @@ -2056,9 +2011,6 @@ void aerofgt_state::aerfboo2(machine_config &config) m_maincpu->set_addrmap(AS_PROGRAM, &aerofgt_state::aerfboo2_map); m_maincpu->set_vblank_int("screen", FUNC(aerofgt_state::irq2_line_hold)); - MCFG_MACHINE_START_OVERRIDE(aerofgt_state,common) - MCFG_MACHINE_RESET_OVERRIDE(aerofgt_state,common) - /* video hardware */ screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_refresh_hz(60); @@ -2082,17 +2034,15 @@ void aerofgt_state::aerfboo2(machine_config &config) m_oki->add_route(ALL_OUTPUTS, "mono", 1.0); } -void aerofgt_state::wbbc97(machine_config &config) +void aerofgt_sound_cpu_state::wbbc97(machine_config &config) { /* basic machine hardware */ M68000(config, m_maincpu, 20000000/2); /* 10 MHz (?) */ - m_maincpu->set_addrmap(AS_PROGRAM, &aerofgt_state::wbbc97_map); - m_maincpu->set_vblank_int("screen", FUNC(aerofgt_state::irq1_line_hold)); /* all irq vectors are the same */ + m_maincpu->set_addrmap(AS_PROGRAM, &aerofgt_sound_cpu_state::wbbc97_map); + m_maincpu->set_vblank_int("screen", FUNC(aerofgt_sound_cpu_state::irq1_line_hold)); /* all irq vectors are the same */ Z80(config, m_audiocpu, 8000000/2); /* 4 MHz ??? */ - m_audiocpu->set_addrmap(AS_PROGRAM, &aerofgt_state::wbbc97_sound_map); /* IRQs are triggered by the YM3812 */ - MCFG_MACHINE_START_OVERRIDE(aerofgt_state,common) - MCFG_MACHINE_RESET_OVERRIDE(aerofgt_state,common) + m_audiocpu->set_addrmap(AS_PROGRAM, &aerofgt_sound_cpu_state::wbbc97_sound_map); /* IRQs are triggered by the YM3812 */ /* video hardware */ screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); @@ -2100,7 +2050,7 @@ void aerofgt_state::wbbc97(machine_config &config) screen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); screen.set_size(64*8, 64*8); screen.set_visarea(0*8+14, 44*8-1+4, 0*8, 30*8-1); - screen.set_screen_update(FUNC(aerofgt_state::screen_update_wbbc97)); + screen.set_screen_update(FUNC(aerofgt_sound_cpu_state::screen_update_wbbc97)); GFXDECODE(config, m_gfxdecode, m_palette, gfx_wbbc97); PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048); @@ -2108,11 +2058,11 @@ void aerofgt_state::wbbc97(machine_config &config) //VSYSTEM_GGA(config, "gga", 0); VSYSTEM_SPR2(config, m_spr_old[0], 0); - m_spr_old[0]->set_tile_indirect_cb(FUNC(aerofgt_state::aerofgt_old_tile_callback)); + m_spr_old[0]->set_tile_indirect_cb(FUNC(aerofgt_sound_cpu_state::aerofgt_old_tile_callback)); m_spr_old[0]->set_gfx_region(1); m_spr_old[0]->set_gfxdecode_tag(m_gfxdecode); - MCFG_VIDEO_START_OVERRIDE(aerofgt_state,wbbc97) + MCFG_VIDEO_START_OVERRIDE(aerofgt_sound_cpu_state,wbbc97) /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -2140,9 +2090,12 @@ ROM_START( pspikes ) ROM_REGION( 0x40000, "maincpu", 0 ) /* 68000 code */ ROM_LOAD16_WORD_SWAP( "pspikes2.bin", 0x00000, 0x40000, CRC(ec0c070e) SHA1(4ddcc184e835a2f9d15f01aaa03734fd75fe797e) ) - ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ + ROM_REGION( 0x20000, "soundbank", 0 ) /* 128k for the audio CPU + banks */ ROM_LOAD( "19", 0x00000, 0x20000, CRC(7e8ed6e5) SHA1(eeb1a1e1989fad8fc1e741928422efaec0598868) ) + ROM_REGION( 0x08000, "audiocpu", 0 ) /* 32k for the audio CPU */ + ROM_COPY( "soundbank", 0, 0x00000, 0x08000 ) + ROM_REGION( 0x080000, "gfx1", 0 ) ROM_LOAD( "g7h", 0x000000, 0x80000, CRC(74c23c3d) SHA1(c0ac57d1f05c42556f97154ce1a08f465948546b) ) @@ -2164,9 +2117,12 @@ ROM_START( pspikesk ) ROM_REGION( 0x40000, "maincpu", 0 ) /* 68000 code */ ROM_LOAD16_WORD_SWAP( "20", 0x00000, 0x40000, CRC(75cdcee2) SHA1(272a08c46c1d0989f9fbb156e28e6a7ffa9c0a53) ) - ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ + ROM_REGION( 0x20000, "soundbank", 0 ) /* 128k for the audio CPU + banks */ ROM_LOAD( "19", 0x00000, 0x20000, CRC(7e8ed6e5) SHA1(eeb1a1e1989fad8fc1e741928422efaec0598868) ) + ROM_REGION( 0x08000, "audiocpu", 0 ) /* 32k for the audio CPU */ + ROM_COPY( "soundbank", 0, 0x00000, 0x08000 ) + ROM_REGION( 0x080000, "gfx1", 0 ) ROM_LOAD( "g7h", 0x000000, 0x80000, CRC(74c23c3d) SHA1(c0ac57d1f05c42556f97154ce1a08f465948546b) ) @@ -2189,9 +2145,12 @@ ROM_START( pspikesu ) ROM_REGION( 0x40000, "maincpu", 0 ) /* 68000 code */ ROM_LOAD16_WORD_SWAP( "svolly91.73", 0x00000, 0x40000, CRC(bfbffcdb) SHA1(2bba99cb6d0cb2fbb3cd1242551dd7e2c6ebef50) ) - ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ + ROM_REGION( 0x20000, "soundbank", 0 ) /* 128k for the audio CPU + banks */ ROM_LOAD( "19", 0x00000, 0x20000, CRC(7e8ed6e5) SHA1(eeb1a1e1989fad8fc1e741928422efaec0598868) ) + ROM_REGION( 0x08000, "audiocpu", 0 ) /* 32k for the audio CPU */ + ROM_COPY( "soundbank", 0, 0x00000, 0x08000 ) + ROM_REGION( 0x080000, "gfx1", 0 ) ROM_LOAD( "g7h", 0x000000, 0x80000, CRC(74c23c3d) SHA1(c0ac57d1f05c42556f97154ce1a08f465948546b) ) @@ -2210,9 +2169,12 @@ ROM_START( svolly91 ) ROM_REGION( 0x40000, "maincpu", 0 ) /* 68000 code */ ROM_LOAD16_WORD_SWAP( "u11.jpn", 0x00000, 0x40000, CRC(ea2e4c82) SHA1(f9cf9122499d9b1e54221fb8b6ef9c12004ca85e) ) - ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ + ROM_REGION( 0x20000, "soundbank", 0 ) /* 64k for the audio CPU + banks */ ROM_LOAD( "19", 0x00000, 0x20000, CRC(7e8ed6e5) SHA1(eeb1a1e1989fad8fc1e741928422efaec0598868) ) + ROM_REGION( 0x08000, "audiocpu", 0 ) /* 32k for the audio CPU */ + ROM_COPY( "soundbank", 0, 0x00000, 0x08000 ) + ROM_REGION( 0x080000, "gfx1", 0 ) ROM_LOAD( "g7h", 0x000000, 0x80000, CRC(74c23c3d) SHA1(c0ac57d1f05c42556f97154ce1a08f465948546b) ) @@ -2440,9 +2402,12 @@ ROM_START( spinlbrk ) ROM_LOAD16_BYTE( "ic93", 0x20000, 0x10000, CRC(726f4683) SHA1(65aff0548333571d47a96d4bf5a7857f12399cc7) ) ROM_LOAD16_BYTE( "ic94", 0x20001, 0x10000, CRC(c4385e03) SHA1(6683eed812fa8a5430125b14e8647f8e9024bbdd) ) - ROM_REGION( 0x18000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ + ROM_REGION( 0x20000, "soundbank", 0 ) + ROM_LOAD( "ic118", 0x00000, 0x10000, CRC(1025f024) SHA1(3e497c74c950d2cd2a0931cf2ae9b0124d11ca6a) ) + ROM_RELOAD( 0x10000, 0x10000 ) + + ROM_REGION( 0x08000, "audiocpu", 0 ) /* 32k for the audio CPU */ ROM_LOAD( "ic117", 0x00000, 0x08000, CRC(625ada41) SHA1(2dd0674c68ea382431115c155afbf880f5b9deb2) ) - ROM_LOAD( "ic118", 0x08000, 0x10000, CRC(1025f024) SHA1(3e497c74c950d2cd2a0931cf2ae9b0124d11ca6a) ) ROM_REGION( 0x100000, "gfx1", 0 ) ROM_LOAD( "ic15", 0x000000, 0x80000, CRC(e318cf3a) SHA1(d634001a0029566ce7b8fa30075970919eb5f44e) ) @@ -2490,9 +2455,12 @@ ROM_START( spinlbrku ) ROM_LOAD16_BYTE( "ic93.u4", 0x20000, 0x10000, CRC(0cf73029) SHA1(e1346b759a41f9eec9536dc90671778582e595b4) ) ROM_LOAD16_BYTE( "ic94.u3", 0x20001, 0x10000, CRC(5cf7c426) SHA1(b201da40c4511d2845004dff72d36adbb8a4fab9) ) - ROM_REGION( 0x18000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ + ROM_REGION( 0x20000, "soundbank", 0 ) + ROM_LOAD( "ic118", 0x00000, 0x10000, CRC(1025f024) SHA1(3e497c74c950d2cd2a0931cf2ae9b0124d11ca6a) ) + ROM_RELOAD( 0x10000, 0x10000 ) + + ROM_REGION( 0x08000, "audiocpu", 0 ) /* 32k for the audio CPU */ ROM_LOAD( "ic117", 0x00000, 0x08000, CRC(625ada41) SHA1(2dd0674c68ea382431115c155afbf880f5b9deb2) ) - ROM_LOAD( "ic118", 0x08000, 0x10000, CRC(1025f024) SHA1(3e497c74c950d2cd2a0931cf2ae9b0124d11ca6a) ) ROM_REGION( 0x100000, "gfx1", 0 ) ROM_LOAD( "ic15", 0x000000, 0x80000, CRC(e318cf3a) SHA1(d634001a0029566ce7b8fa30075970919eb5f44e) ) @@ -2540,9 +2508,12 @@ ROM_START( spinlbrkj ) ROM_LOAD16_BYTE( "j4", 0x20000, 0x10000, CRC(33e33912) SHA1(d6d052cd8dbedfd254bdf5e82ad770e4bf241777) ) ROM_LOAD16_BYTE( "j3", 0x20001, 0x10000, CRC(16ca61d0) SHA1(5d99a1261251412c3c758af751997fe31026c0d6) ) - ROM_REGION( 0x18000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ + ROM_REGION( 0x20000, "soundbank", 0 ) + ROM_LOAD( "ic118", 0x00000, 0x10000, CRC(1025f024) SHA1(3e497c74c950d2cd2a0931cf2ae9b0124d11ca6a) ) + ROM_RELOAD( 0x10000, 0x10000 ) + + ROM_REGION( 0x08000, "audiocpu", 0 ) /* 32k for the audio CPU */ ROM_LOAD( "ic117", 0x00000, 0x08000, CRC(625ada41) SHA1(2dd0674c68ea382431115c155afbf880f5b9deb2) ) - ROM_LOAD( "ic118", 0x08000, 0x10000, CRC(1025f024) SHA1(3e497c74c950d2cd2a0931cf2ae9b0124d11ca6a) ) ROM_REGION( 0x100000, "gfx1", 0 ) ROM_LOAD( "ic15", 0x000000, 0x80000, CRC(e318cf3a) SHA1(d634001a0029566ce7b8fa30075970919eb5f44e) ) @@ -2600,9 +2571,12 @@ ROM_START( spinlbrkup ) // the labels are official Video System without numberin ROM_LOAD16_BYTE( "sbp1-e.ic93", 0x20000, 0x10000, CRC(d6444d1e) SHA1(2aa80b8cf3c44e4a583b57f4a6cc673d984f3a05) ) ROM_LOAD16_BYTE( "sbp1-o.ic94", 0x20001, 0x10000, CRC(a3f7bd8e) SHA1(dc393b4911c6acadb97b0380db15ae5c972a3505) ) - ROM_REGION( 0x18000, "audiocpu", 0 ) + ROM_REGION( 0x20000, "soundbank", 0 ) + ROM_LOAD( "11-14.m.bank.ic118", 0x00000, 0x10000, CRC(a1ed270b) SHA1(f513baed1f7efda3d843982e1fa4857f058e8595) ) // relatively minor differences + ROM_RELOAD( 0x10000, 0x10000 ) + + ROM_REGION( 0x08000, "audiocpu", 0 ) ROM_LOAD( "11-14-15.00.music.ic117", 0x00000, 0x08000, CRC(6b8c8f09) SHA1(d57699ea82f5e48ed8c9909a040c2fa6f988f8b3) ) // this differs quite a lot - ROM_LOAD( "11-14.m.bank.ic118", 0x08000, 0x10000, CRC(a1ed270b) SHA1(f513baed1f7efda3d843982e1fa4857f058e8595) ) // relatively minor differences ROM_REGION( 0x100000, "gfx1", 0 ) ROM_LOAD( "ic15", 0x000000, 0x80000, CRC(e318cf3a) SHA1(d634001a0029566ce7b8fa30075970919eb5f44e) ) @@ -2661,9 +2635,12 @@ ROM_START( karatblz ) ROM_LOAD16_WORD_SWAP( "rom2v3.u14", 0x00000, 0x40000, CRC(01f772e1) SHA1(f87f19a82d75839b5671f23ce14218d7b910eabc) ) // need to verify correct "region" stamped number, should this be "3v2.u14" ?? ROM_LOAD16_WORD_SWAP( "v1.u15", 0x40000, 0x40000, CRC(d16ee21b) SHA1(d454cdf22b72a537b9d7ae73deb8136a4f09da47) ) // chip with VideoSystem logo V and 1 - ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ + ROM_REGION( 0x20000, "soundbank", 0 ) /* 128k for the audio CPU + banks */ ROM_LOAD( "v5.u92", 0x00000, 0x20000, CRC(97d67510) SHA1(1ffd419e3dec7de1099cd5819b0309f7dd0df80e) ) // chip with VideoSystem logo V and 5 + ROM_REGION( 0x08000, "audiocpu", 0 ) /* 32k for the audio CPU */ + ROM_COPY( "soundbank", 0x00000, 0x00000, 0x08000 ) + ROM_REGION( 0x80000, "gfx1", 0 ) ROM_LOAD( "gha.u55", 0x00000, 0x80000, CRC(3e0cea91) SHA1(bab41715f106d364013b64649441d280bc6893cf) ) @@ -2692,9 +2669,12 @@ ROM_START( karatblzt ) // Karate Blazers, Tecmo license ROM_LOAD16_WORD_SWAP( "2v2.u14", 0x00000, 0x40000, CRC(7ae17b7f) SHA1(d7916c3159e22dde56a0de750032da9ee46b3d6c) ) // 2 stamped on chip with VideoSystem logo V and 2 ROM_LOAD16_WORD_SWAP( "v1.u15", 0x40000, 0x40000, CRC(d16ee21b) SHA1(d454cdf22b72a537b9d7ae73deb8136a4f09da47) ) // chip with VideoSystem logo V and 1 - ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ + ROM_REGION( 0x20000, "soundbank", 0 ) /* 128k for the audio CPU + banks */ ROM_LOAD( "v5.u92", 0x00000, 0x20000, CRC(97d67510) SHA1(1ffd419e3dec7de1099cd5819b0309f7dd0df80e) ) // chip with VideoSystem logo V and 5 + ROM_REGION( 0x08000, "audiocpu", 0 ) /* 32k for the audio CPU */ + ROM_COPY( "soundbank", 0x00000, 0x00000, 0x08000 ) + ROM_REGION( 0x80000, "gfx1", 0 ) ROM_LOAD( "gha.u55", 0x00000, 0x80000, CRC(3e0cea91) SHA1(bab41715f106d364013b64649441d280bc6893cf) ) @@ -2723,9 +2703,12 @@ ROM_START( karatblza ) ROM_LOAD16_WORD_SWAP( "_v2.u14", 0x00000, 0x40000, CRC(7a78976e) SHA1(3b74b80765622b8488bdd0729ec98a2c7584cad5) ) // need to verify correct "region" stamped number ROM_LOAD16_WORD_SWAP( "_v1.u15", 0x40000, 0x40000, CRC(47e410fe) SHA1(d26fc93f91ccf00856db2b7dfd0d905d87e99bd8) ) // need to verify correct "region" stamped number, is this one "1v1" ?? - ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ + ROM_REGION( 0x20000, "soundbank", 0 ) /* 128k for the audio CPU + banks */ ROM_LOAD( "v5.u92", 0x00000, 0x20000, CRC(97d67510) SHA1(1ffd419e3dec7de1099cd5819b0309f7dd0df80e) ) // chip with VideoSystem logo V and 5 + ROM_REGION( 0x08000, "audiocpu", 0 ) /* 32k for the audio CPU */ + ROM_COPY( "soundbank", 0x00000, 0x00000, 0x08000 ) + ROM_REGION( 0x80000, "gfx1", 0 ) ROM_LOAD( "gha.u55", 0x00000, 0x80000, CRC(3e0cea91) SHA1(bab41715f106d364013b64649441d280bc6893cf) ) @@ -2754,9 +2737,12 @@ ROM_START( karatblzu ) ROM_LOAD16_WORD_SWAP( "1v2.u14", 0x00000, 0x40000, CRC(202e6220) SHA1(2605511a0574cbc39fdf3d8ae27a0aa9b43345fb) ) // 1 stamped on chip with VideoSystem logo V and 2 ROM_LOAD16_WORD_SWAP( "v1.u15", 0x40000, 0x40000, CRC(d16ee21b) SHA1(d454cdf22b72a537b9d7ae73deb8136a4f09da47) ) // chip with VideoSystem logo V and 1 - ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ + ROM_REGION( 0x20000, "soundbank", 0 ) /* 128k for the audio CPU + banks */ ROM_LOAD( "v5.u92", 0x00000, 0x20000, CRC(97d67510) SHA1(1ffd419e3dec7de1099cd5819b0309f7dd0df80e) ) // chip with VideoSystem logo V and 5 + ROM_REGION( 0x08000, "audiocpu", 0 ) /* 32k for the audio CPU */ + ROM_COPY( "soundbank", 0x00000, 0x00000, 0x08000 ) + ROM_REGION( 0x80000, "gfx1", 0 ) ROM_LOAD( "gha.u55", 0x00000, 0x80000, CRC(3e0cea91) SHA1(bab41715f106d364013b64649441d280bc6893cf) ) @@ -2785,9 +2771,12 @@ ROM_START( karatblzj ) // Toushin Blazers, Tecmo license ROM_LOAD16_WORD_SWAP( "2tecmo.u14", 0x00000, 0x40000, CRC(57e52654) SHA1(15939d8f7c693b9248f3dd2b2ad5fbae2c19621f) ) // need to verify correct "region" stamped number, is this one "4v2" ?? ROM_LOAD16_WORD_SWAP( "v1.u15", 0x40000, 0x40000, CRC(d16ee21b) SHA1(d454cdf22b72a537b9d7ae73deb8136a4f09da47) ) // chip with VideoSystem logo V and 1 - ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ + ROM_REGION( 0x20000, "soundbank", 0 ) /* 128k for the audio CPU + banks */ ROM_LOAD( "v5.u92", 0x00000, 0x20000, CRC(97d67510) SHA1(1ffd419e3dec7de1099cd5819b0309f7dd0df80e) ) // chip with VideoSystem logo V and 5 + ROM_REGION( 0x08000, "audiocpu", 0 ) /* 32k for the audio CPU */ + ROM_COPY( "soundbank", 0x00000, 0x00000, 0x08000 ) + ROM_REGION( 0x80000, "gfx1", 0 ) ROM_LOAD( "gha.u55", 0x00000, 0x80000, CRC(3e0cea91) SHA1(bab41715f106d364013b64649441d280bc6893cf) ) @@ -2888,9 +2877,12 @@ ROM_START( turbofrc ) // World version with no copyright notice ROM_LOAD16_WORD_SWAP( "4v1.subpcb.u1", 0x40000, 0x40000, CRC(6cd5312b) SHA1(57b109fe268fb963e981c91b6d288667a3c9a665) ) // 27c2048 - located on a OR-10 SUB BOARD - 4 stamped on chip with VideoSystem logo V ROM_LOAD16_WORD_SWAP( "4v3.u14", 0x80000, 0x40000, CRC(63f50557) SHA1(f8dba8c9ba412c9a67457ec31a804c57593ab20b) ) // 27c2048 - 4 stamped on chip with VideoSystem logo V - ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ + ROM_REGION( 0x20000, "soundbank", 0 ) /* 128k for the audio CPU + banks */ ROM_LOAD( "6.u166", 0x00000, 0x20000, CRC(2ca14a65) SHA1(95f6e7b4fa7ca26872ff472d7e6fb75fd4f281d5) ) // 27c1001 + ROM_REGION( 0x08000, "audiocpu", 0 ) /* 32k for the audio CPU */ + ROM_COPY( "soundbank", 0x00000, 0x00000, 0x08000 ) + ROM_REGION( 0x0a0000, "gfx1", 0 ) ROM_LOAD( "lh534ggs.u94", 0x000000, 0x80000, CRC(baa53978) SHA1(7f103122dd0bf675226ccf309fba73f645e0c79b) ) // mask rom ROM_LOAD( "7.u95", 0x080000, 0x20000, CRC(71a6c573) SHA1(f14ebca676d85fabcde27631145933abc376dd12) ) // 27c1001a @@ -2922,9 +2914,12 @@ ROM_START( turbofrco ) // World version with no copyright notice ROM_LOAD16_WORD_SWAP( "3v1.subpcb.u1", 0x40000, 0x40000, CRC(71b6431b) SHA1(471bada4730a1a323af9b493f8c5f57c2a147f8d) ) // 27c2048 - located on a OR-10 SUB BOARD - 3 stamped on chip with VideoSystem logo V ROM_LOAD16_WORD_SWAP( "3v3.u14", 0x80000, 0x40000, CRC(63f50557) SHA1(f8dba8c9ba412c9a67457ec31a804c57593ab20b) ) // 27c2048 - 3 stamped on chip with VideoSystem logo V - ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ + ROM_REGION( 0x20000, "soundbank", 0 ) /* 128k for the audio CPU + banks */ ROM_LOAD( "6.u166", 0x00000, 0x20000, CRC(2ca14a65) SHA1(95f6e7b4fa7ca26872ff472d7e6fb75fd4f281d5) ) // 27c1001 + ROM_REGION( 0x08000, "audiocpu", 0 ) /* 32k for the audio CPU */ + ROM_COPY( "soundbank", 0x00000, 0x00000, 0x08000 ) + ROM_REGION( 0x0a0000, "gfx1", 0 ) ROM_LOAD( "lh534ggs.u94", 0x000000, 0x80000, CRC(baa53978) SHA1(7f103122dd0bf675226ccf309fba73f645e0c79b) ) // mask rom ROM_LOAD( "7.u95", 0x080000, 0x20000, CRC(71a6c573) SHA1(f14ebca676d85fabcde27631145933abc376dd12) ) // 27c1001a @@ -2956,9 +2951,12 @@ ROM_START( turbofrcu ) // US version - need to redump 8v3.u14 to verify it's uni ROM_LOAD16_WORD_SWAP( "8v1.subpcb.u1", 0x40000, 0x40000, CRC(cc324da6) SHA1(ed2eaff7351914e3ebaf925ddc01be9d44d89fa6) ) // 27c2048 - located on a OR-10 SUB BOARD - 8 stamped on chip with VideoSystem logo V ROM_LOAD16_WORD_SWAP( "8v3.u14", 0x80000, 0x40000, CRC(c0a15480) SHA1(1ec99382e0a00a8167773b1d454a63cc5cd6199c) ) // 27c2048 - 8 stamped on chip with VideoSystem logo V - 0x240B:3C (vs 0x25 for other sets) - ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ + ROM_REGION( 0x20000, "soundbank", 0 ) /* 128k for the audio CPU + banks */ ROM_LOAD( "6.u166", 0x00000, 0x20000, CRC(2ca14a65) SHA1(95f6e7b4fa7ca26872ff472d7e6fb75fd4f281d5) ) // 27c1001 + ROM_REGION( 0x08000, "audiocpu", 0 ) /* 32k for the audio CPU */ + ROM_COPY( "soundbank", 0x00000, 0x00000, 0x08000 ) + ROM_REGION( 0x0a0000, "gfx1", 0 ) ROM_LOAD( "lh534ggs.u94", 0x000000, 0x80000, CRC(baa53978) SHA1(7f103122dd0bf675226ccf309fba73f645e0c79b) ) // mask rom ROM_LOAD( "7.u95", 0x080000, 0x20000, CRC(71a6c573) SHA1(f14ebca676d85fabcde27631145933abc376dd12) ) // 27c1001a @@ -2990,9 +2988,12 @@ ROM_START( turbofrcua ) // US version ROM_LOAD16_WORD_SWAP( "7v1.subpcb.u1", 0x40000, 0x40000, CRC(d1513f96) SHA1(7acb96a44f661cd9c7561dfab0d60c993942d669) ) // 27c2048 - located on a OR-10 SUB BOARD - 7 stamped on chip with VideoSystem logo V ROM_LOAD16_WORD_SWAP( "7v3.u14", 0x80000, 0x40000, CRC(63f50557) SHA1(f8dba8c9ba412c9a67457ec31a804c57593ab20b) ) // 27c2048 - 7 stamped on chip with VideoSystem logo V - ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ + ROM_REGION( 0x20000, "soundbank", 0 ) /* 128k for the audio CPU + banks */ ROM_LOAD( "6.u166", 0x00000, 0x20000, CRC(2ca14a65) SHA1(95f6e7b4fa7ca26872ff472d7e6fb75fd4f281d5) ) // 27c1001 + ROM_REGION( 0x08000, "audiocpu", 0 ) /* 32k for the audio CPU */ + ROM_COPY( "soundbank", 0x00000, 0x00000, 0x08000 ) + ROM_REGION( 0x0a0000, "gfx1", 0 ) ROM_LOAD( "lh534ggs.u94", 0x000000, 0x80000, CRC(baa53978) SHA1(7f103122dd0bf675226ccf309fba73f645e0c79b) ) // mask rom ROM_LOAD( "7.u95", 0x080000, 0x20000, CRC(71a6c573) SHA1(f14ebca676d85fabcde27631145933abc376dd12) ) // 27c1001a @@ -3022,9 +3023,12 @@ ROM_START( aerofgt ) ROM_REGION( 0x80000, "maincpu", 0 ) /* 68000 code */ ROM_LOAD16_WORD_SWAP( "1.u4", 0x00000, 0x80000, CRC(6fdff0a2) SHA1(7cc9529b426091027aa3e23586cb7d162376c0ff) ) - ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ + ROM_REGION( 0x20000, "soundbank", 0 ) /* 128k for the audio CPU + banks */ ROM_LOAD( "2.153", 0x00000, 0x20000, CRC(a1ef64ec) SHA1(fa3e434738bf4e742ad68882c1e914100ce0f761) ) + ROM_REGION( 0x08000, "audiocpu", 0 ) /* 32k for the audio CPU */ + ROM_COPY( "soundbank", 0x00000, 0x00000, 0x08000 ) + ROM_REGION( 0x100000, "gfx1", 0 ) ROM_LOAD( "538a54.124", 0x000000, 0x80000, CRC(4d2c4df2) SHA1(f51c2b3135f0a921ac1a79e63d6878c03cb6254b) ) ROM_LOAD( "1538a54.124", 0x080000, 0x80000, CRC(286d109e) SHA1(3a5f3d2d89cf58f6ef15e4bd3f570b84e8e695b2) ) @@ -3045,9 +3049,12 @@ ROM_START( aerofgtb ) ROM_LOAD16_BYTE( "v2", 0x00000, 0x40000, CRC(5c9de9f0) SHA1(93b62c59f0bc052c6fdbd5aae292a7ab2122dfd1) ) ROM_LOAD16_BYTE( "v1", 0x00001, 0x40000, CRC(89c1dcf4) SHA1(41401d63049c140e4254dc791022d85c44271390) ) - ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ + ROM_REGION( 0x20000, "soundbank", 0 ) /* 128k for the audio CPU + banks */ ROM_LOAD( "v3", 0x00000, 0x20000, CRC(cbb18cf4) SHA1(7119a7536cf710660ff06d1e7d2879c79ef12b3d) ) + ROM_REGION( 0x08000, "audiocpu", 0 ) /* 32k for the audio CPU */ + ROM_COPY( "soundbank", 0x00000, 0x00000, 0x08000 ) + ROM_REGION( 0x080000, "gfx1", 0 ) ROM_LOAD( "it-19-03", 0x000000, 0x80000, CRC(85eba1a4) SHA1(5691a95d6359fdab29be0d615066370c2b856c0a) ) @@ -3074,9 +3081,12 @@ ROM_START( aerofgtc ) ROM_LOAD16_BYTE( "v2.149", 0x00000, 0x40000, CRC(f187aec6) SHA1(8905af34f114ae22fbfbd3ae115f19280bdd4fb3) ) ROM_LOAD16_BYTE( "v1.111", 0x00001, 0x40000, CRC(9e684b19) SHA1(b5e1e5b74ed9fd223c9315ee2d548e620224c102) ) - ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ + ROM_REGION( 0x20000, "soundbank", 0 ) /* 128k for the audio CPU + banks */ ROM_LOAD( "2.153", 0x00000, 0x20000, CRC(a1ef64ec) SHA1(fa3e434738bf4e742ad68882c1e914100ce0f761) ) + ROM_REGION( 0x08000, "audiocpu", 0 ) /* 32k for the audio CPU */ + ROM_COPY( "soundbank", 0x00000, 0x00000, 0x08000 ) + /* gfx ROMs were missing in this set, I'm using the aerofgtb ones */ ROM_REGION( 0x080000, "gfx1", 0 ) ROM_LOAD( "it-19-03", 0x000000, 0x80000, CRC(85eba1a4) SHA1(5691a95d6359fdab29be0d615066370c2b856c0a) ) @@ -3104,9 +3114,12 @@ ROM_START( sonicwi ) ROM_LOAD16_BYTE( "2.149", 0x00000, 0x40000, CRC(3d1b96ba) SHA1(941be323c0cb15e05c92b897984617b05c5cf676) ) ROM_LOAD16_BYTE( "1.111", 0x00001, 0x40000, CRC(a3d09f94) SHA1(a1064d659488878f5303edc2b8636312ab632a83) ) - ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ + ROM_REGION( 0x20000, "soundbank", 0 ) /* 128k for the audio CPU + banks */ ROM_LOAD( "2.153", 0x00000, 0x20000, CRC(a1ef64ec) SHA1(fa3e434738bf4e742ad68882c1e914100ce0f761) ) // 3.156 + ROM_REGION( 0x08000, "audiocpu", 0 ) /* 32k for the audio CPU */ + ROM_COPY( "soundbank", 0x00000, 0x00000, 0x08000 ) + /* gfx ROMs were missing in this set, I'm using the aerofgtb ones */ ROM_REGION( 0x080000, "gfx1", 0 ) ROM_LOAD( "it-19-03", 0x000000, 0x80000, CRC(85eba1a4) SHA1(5691a95d6359fdab29be0d615066370c2b856c0a) ) @@ -3232,13 +3245,13 @@ ROM_START( kickball ) ROM_LOAD( "kickball.3", 0x000000, 0x040000, CRC(2f3ed4c1) SHA1(4688df5d420343a935d066f3b46580b77ee77b0e) ) ROM_END -void aerofgt_state::init_banked_oki() +void aerofgt_sound_cpu_state::init_banked_oki() { m_okibank->configure_entries(0, 4, memregion("oki")->base() + 0x20000, 0x20000); } -void aerofgt_state::init_kickball() +void aerofgt_sound_cpu_state::init_kickball() { // 2 lines on 1 gfx rom are swapped, why? uint8_t *src = memregion("gfx2")->base(); @@ -3248,41 +3261,41 @@ void aerofgt_state::init_kickball() } } -GAME( 1990, spinlbrk, 0, spinlbrk, spinlbrk, aerofgt_state, empty_init, ROT0, "V-System Co.", "Spinal Breakers (World)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) -GAME( 1990, spinlbrku, spinlbrk, spinlbrk, spinlbrku, aerofgt_state, empty_init, ROT0, "V-System Co.", "Spinal Breakers (US)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) -GAME( 1990, spinlbrkj, spinlbrk, spinlbrk, spinlbrk, aerofgt_state, empty_init, ROT0, "V-System Co.", "Spinal Breakers (Japan)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) -GAME( 1990, spinlbrkup, spinlbrk, spinlbrk, spinlbrk, aerofgt_state, empty_init, ROT0, "V-System Co.", "Spinal Breakers (US, prototype)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) // build date 11/15 15:00 +GAME( 1990, spinlbrk, 0, spinlbrk, spinlbrk, aerofgt_banked_sound_state, empty_init, ROT0, "V-System Co.", "Spinal Breakers (World)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) +GAME( 1990, spinlbrku, spinlbrk, spinlbrk, spinlbrku, aerofgt_banked_sound_state, empty_init, ROT0, "V-System Co.", "Spinal Breakers (US)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) +GAME( 1990, spinlbrkj, spinlbrk, spinlbrk, spinlbrk, aerofgt_banked_sound_state, empty_init, ROT0, "V-System Co.", "Spinal Breakers (Japan)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) +GAME( 1990, spinlbrkup, spinlbrk, spinlbrk, spinlbrk, aerofgt_banked_sound_state, empty_init, ROT0, "V-System Co.", "Spinal Breakers (US, prototype)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) // build date 11/15 15:00 -GAME( 1991, pspikes, 0, pspikes, pspikes, aerofgt_state, empty_init, ROT0, "Video System Co.", "Power Spikes (World)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) -GAME( 1991, pspikesk, pspikes, pspikes, pspikes, aerofgt_state, empty_init, ROT0, "Video System Co.", "Power Spikes (Korea)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) -GAME( 1991, pspikesu, pspikes, pspikes, pspikes, aerofgt_state, empty_init, ROT0, "Video System Co.", "Power Spikes (US)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) -GAME( 1991, svolly91, pspikes, pspikes, pspikes, aerofgt_state, empty_init, ROT0, "Video System Co.", "Super Volley '91 (Japan)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) -GAME( 1991, pspikesb, pspikes, pspikesb, pspikesb, aerofgt_state, empty_init, ROT0, "bootleg", "Power Spikes (bootleg)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) -GAME( 1991, pspikesba, pspikes, pspikesb, pspikesb, aerofgt_state, empty_init, ROT0, "bootleg (Playmark?)", "Power Spikes (Italian bootleg)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) -GAME( 1991, spikes91, pspikes, spikes91, pspikes, aerofgt_state, empty_init, ROT0, "bootleg", "1991 Spikes (Italian bootleg, set 1)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NO_COCKTAIL ) // OKI M5205 not hooked up yet -GAME( 1991, spikes91b, pspikes, spikes91, pspikes, aerofgt_state, empty_init, ROT0, "bootleg", "1991 Spikes (Italian bootleg, set 2)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NO_COCKTAIL ) // OKI M5205 not hooked up yet -GAME( 1991, pspikesc, pspikes, pspikesc, pspikesc, aerofgt_state, empty_init, ROT0, "bootleg", "Power Spikes (China)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL | MACHINE_IMPERFECT_SOUND ) -GAME( 1997, wbbc97, 0, wbbc97, wbbc97, aerofgt_state, empty_init, ROT0, "Comad", "Beach Festival World Championship 1997", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) // based on power spikes codebase -GAME( 1998, kickball, 0, kickball, pspikes, aerofgt_state, init_kickball, ROT0, "Seoung Youn", "Kick Ball", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL | MACHINE_IMPERFECT_GRAPHICS ) // based on power spikes codebase, wrong priorities +GAME( 1991, pspikes, 0, pspikes, pspikes, aerofgt_banked_sound_state, empty_init, ROT0, "Video System Co.", "Power Spikes (World)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) +GAME( 1991, pspikesk, pspikes, pspikes, pspikes, aerofgt_banked_sound_state, empty_init, ROT0, "Video System Co.", "Power Spikes (Korea)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) +GAME( 1991, pspikesu, pspikes, pspikes, pspikes, aerofgt_banked_sound_state, empty_init, ROT0, "Video System Co.", "Power Spikes (US)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) +GAME( 1991, svolly91, pspikes, pspikes, pspikes, aerofgt_banked_sound_state, empty_init, ROT0, "Video System Co.", "Super Volley '91 (Japan)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) +GAME( 1991, pspikesb, pspikes, pspikesb, pspikesb, aerofgt_state, empty_init, ROT0, "bootleg", "Power Spikes (bootleg)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) +GAME( 1991, pspikesba, pspikes, pspikesb, pspikesb, aerofgt_state, empty_init, ROT0, "bootleg (Playmark?)", "Power Spikes (Italian bootleg)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) +GAME( 1991, spikes91, pspikes, spikes91, pspikes, aerofgt_sound_cpu_state, empty_init, ROT0, "bootleg", "1991 Spikes (Italian bootleg, set 1)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NO_COCKTAIL ) // OKI M5205 not hooked up yet +GAME( 1991, spikes91b, pspikes, spikes91, pspikes, aerofgt_sound_cpu_state, empty_init, ROT0, "bootleg", "1991 Spikes (Italian bootleg, set 2)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NO_COCKTAIL ) // OKI M5205 not hooked up yet +GAME( 1991, pspikesc, pspikes, pspikesc, pspikesc, aerofgt_state, empty_init, ROT0, "bootleg", "Power Spikes (China)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL | MACHINE_IMPERFECT_SOUND ) +GAME( 1997, wbbc97, 0, wbbc97, wbbc97, aerofgt_sound_cpu_state, empty_init, ROT0, "Comad", "Beach Festival World Championship 1997", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) // based on power spikes codebase +GAME( 1998, kickball, 0, kickball, pspikes, aerofgt_sound_cpu_state, init_kickball, ROT0, "Seoung Youn", "Kick Ball", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL | MACHINE_IMPERFECT_GRAPHICS ) // based on power spikes codebase, wrong priorities -GAME( 1991, karatblz, 0, karatblz, karatblz, aerofgt_state, empty_init, ROT0, "Video System Co.", "Karate Blazers (World, set 1)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) -GAME( 1991, karatblza, karatblz, karatblz, karatblz, aerofgt_state, empty_init, ROT0, "Video System Co.", "Karate Blazers (World, set 2)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) -GAME( 1991, karatblzt, karatblz, karatblz, karatblz, aerofgt_state, empty_init, ROT0, "Video System Co. (Tecmo license)", "Karate Blazers (World, Tecmo license)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) -GAME( 1991, karatblzu, karatblz, karatblz, karatblzu, aerofgt_state, empty_init, ROT0, "Video System Co.", "Karate Blazers (US)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) -GAME( 1991, karatblzj, karatblz, karatblz, karatblz, aerofgt_state, empty_init, ROT0, "Video System Co. (Tecmo license)", "Toushin Blazers (Japan, Tecmo license)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) -GAME( 1991, karatblzbl, karatblz, karatblzbl, karatblz, aerofgt_state, empty_init, ROT0, "bootleg", "Karate Blazers (bootleg with Street Smart sound hardware)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL | MACHINE_IMPERFECT_SOUND ) +GAME( 1991, karatblz, 0, karatblz, karatblz, aerofgt_banked_sound_state, empty_init, ROT0, "Video System Co.", "Karate Blazers (World, set 1)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) +GAME( 1991, karatblza, karatblz, karatblz, karatblz, aerofgt_banked_sound_state, empty_init, ROT0, "Video System Co.", "Karate Blazers (World, set 2)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) +GAME( 1991, karatblzt, karatblz, karatblz, karatblz, aerofgt_banked_sound_state, empty_init, ROT0, "Video System Co. (Tecmo license)", "Karate Blazers (World, Tecmo license)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) +GAME( 1991, karatblzu, karatblz, karatblz, karatblzu, aerofgt_banked_sound_state, empty_init, ROT0, "Video System Co.", "Karate Blazers (US)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) +GAME( 1991, karatblzj, karatblz, karatblz, karatblz, aerofgt_banked_sound_state, empty_init, ROT0, "Video System Co. (Tecmo license)", "Toushin Blazers (Japan, Tecmo license)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) +GAME( 1991, karatblzbl, karatblz, karatblzbl, karatblz, aerofgt_sound_cpu_state, empty_init, ROT0, "bootleg", "Karate Blazers (bootleg with Street Smart sound hardware)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL | MACHINE_IMPERFECT_SOUND ) // according to Gamest magazine in new revision they changed the points value of the rocks in level 6 (5.000 versus 500) // -> our three sets all gives 5k points, huh? -GAME( 1991, turbofrc, 0, turbofrc, turbofrc, aerofgt_state, empty_init, ROT270, "Video System Co.", "Turbo Force (World, set 1)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) // region code 4 -GAME( 1991, turbofrco, turbofrc, turbofrc, turbofrc, aerofgt_state, empty_init, ROT270, "Video System Co.", "Turbo Force (World, set 2)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) // region code 3 -GAME( 1991, turbofrcu, turbofrc, turbofrc, turbofrc, aerofgt_state, empty_init, ROT270, "Video System Co.", "Turbo Force (US, set 1)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) // region code 8 -GAME( 1991, turbofrcua, turbofrc, turbofrc, turbofrc, aerofgt_state, empty_init, ROT270, "Video System Co.", "Turbo Force (US, set 2)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) // region code 7 +GAME( 1991, turbofrc, 0, turbofrc, turbofrc, aerofgt_banked_sound_state, empty_init, ROT270, "Video System Co.", "Turbo Force (World, set 1)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) // region code 4 +GAME( 1991, turbofrco, turbofrc, turbofrc, turbofrc, aerofgt_banked_sound_state, empty_init, ROT270, "Video System Co.", "Turbo Force (World, set 2)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) // region code 3 +GAME( 1991, turbofrcu, turbofrc, turbofrc, turbofrc, aerofgt_banked_sound_state, empty_init, ROT270, "Video System Co.", "Turbo Force (US, set 1)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) // region code 8 +GAME( 1991, turbofrcua, turbofrc, turbofrc, turbofrc, aerofgt_banked_sound_state, empty_init, ROT270, "Video System Co.", "Turbo Force (US, set 2)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) // region code 7 // the tiles on these also contain an alt title 'The Final War' for both the title screen and attract logo was it ever used? -GAME( 1992, aerofgt, 0, aerofgt, aerofgt, aerofgt_state, empty_init, ROT270, "Video System Co.", "Aero Fighters (World / USA + Canada / Korea / Hong Kong / Taiwan) (newer hardware)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) // this has the newer sprite chip etc. unlike all other games in this driver.. -GAME( 1992, aerofgtb, aerofgt, aerofgtb, aerofgtb, aerofgt_state, empty_init, ROT270, "Video System Co.", "Aero Fighters (Taiwan / Japan, set 1)", MACHINE_SUPPORTS_SAVE ) // probably intended for Taiwan because the Japanese name is Sonic Wings (below) -GAME( 1992, aerofgtc, aerofgt, aerofgtb, aerofgtb, aerofgt_state, empty_init, ROT270, "Video System Co.", "Aero Fighters (Taiwan / Japan, set 2)", MACHINE_SUPPORTS_SAVE ) -GAME( 1992, sonicwi, aerofgt, aerofgtb, aerofgtb, aerofgt_state, empty_init, ROT270, "Video System Co.", "Sonic Wings (Japan)", MACHINE_SUPPORTS_SAVE ) -GAME( 1992, aerfboot, aerofgt, aerfboot, aerofgtb, aerofgt_state, init_banked_oki, ROT270, "bootleg", "Aero Fighters (bootleg, set 1)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL | MACHINE_IMPERFECT_SOUND ) -GAME( 1992, aerfboo2, aerofgt, aerfboo2, aerofgtb, aerofgt_state, empty_init, ROT270, "bootleg", "Aero Fighters (bootleg, set 2)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL | MACHINE_IMPERFECT_SOUND ) +GAME( 1992, aerofgt, 0, aerofgt, aerofgt, aerofgt_banked_sound_state, empty_init, ROT270, "Video System Co.", "Aero Fighters (World / USA + Canada / Korea / Hong Kong / Taiwan) (newer hardware)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) // this has the newer sprite chip etc. unlike all other games in this driver.. +GAME( 1992, aerofgtb, aerofgt, aerofgtb, aerofgtb, aerofgt_banked_sound_state, empty_init, ROT270, "Video System Co.", "Aero Fighters (Taiwan / Japan, set 1)", MACHINE_SUPPORTS_SAVE ) // probably intended for Taiwan because the Japanese name is Sonic Wings (below) +GAME( 1992, aerofgtc, aerofgt, aerofgtb, aerofgtb, aerofgt_banked_sound_state, empty_init, ROT270, "Video System Co.", "Aero Fighters (Taiwan / Japan, set 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1992, sonicwi, aerofgt, aerofgtb, aerofgtb, aerofgt_banked_sound_state, empty_init, ROT270, "Video System Co.", "Sonic Wings (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1992, aerfboot, aerofgt, aerfboot, aerofgtb, aerofgt_sound_cpu_state, init_banked_oki, ROT270, "bootleg", "Aero Fighters (bootleg, set 1)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL | MACHINE_IMPERFECT_SOUND ) +GAME( 1992, aerfboo2, aerofgt, aerfboo2, aerofgtb, aerofgt_state, empty_init, ROT270, "bootleg", "Aero Fighters (bootleg, set 2)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL | MACHINE_IMPERFECT_SOUND ) diff --git a/src/mame/vsystem/aerofgt.h b/src/mame/vsystem/aerofgt.h index 20182d3978a..34993d1b4e2 100644 --- a/src/mame/vsystem/aerofgt.h +++ b/src/mame/vsystem/aerofgt.h @@ -5,14 +5,17 @@ #pragma once -#include "machine/gen_latch.h" #include "vsystem_spr.h" #include "vsystem_spr2.h" + +#include "machine/gen_latch.h" #include "sound/okim6295.h" #include "sound/upd7759.h" + #include "emupal.h" #include "tilemap.h" + class aerofgt_state : public driver_device { public: @@ -25,19 +28,18 @@ public: , m_spriteram(*this, "spriteram") , m_tx_tilemap_ram(*this, "tx_tilemap_ram") , m_maincpu(*this, "maincpu") - , m_audiocpu(*this, "audiocpu") , m_oki(*this, "oki") - , m_upd7759(*this, "upd") , m_gfxdecode(*this, "gfxdecode") , m_palette(*this, "palette") , m_spr(*this, "vsystem_spr") , m_spr_old(*this, "vsystem_spr_old%u", 1) - , m_soundlatch(*this, "soundlatch") - , m_sprlookuprom(*this, "sprlookuprom") - , m_soundbank(*this, "soundbank") - , m_okibank(*this, "okibank") { } + void pspikesb(machine_config &config) ATTR_COLD; + void pspikesc(machine_config &config) ATTR_COLD; + void aerfboo2(machine_config &config) ATTR_COLD; + +protected: /* memory pointers */ optional_shared_ptr_array m_vram; optional_shared_ptr m_rasterram; @@ -48,18 +50,11 @@ public: /* devices referenced above */ required_device m_maincpu; - optional_device m_audiocpu; optional_device m_oki; - optional_device m_upd7759; // karatblzbl required_device m_gfxdecode; required_device m_palette; optional_device m_spr; // only the aerofgt parent uses this chip optional_device_array m_spr_old; // every other (non-bootleg) uses this or a pair of them.. - optional_device m_soundlatch; - - optional_region_ptr m_sprlookuprom; - optional_memory_bank m_soundbank; - optional_memory_bank m_okibank; /* video-related */ tilemap_t *m_tilemap[2]{}; @@ -68,27 +63,16 @@ public: uint16_t m_scrollx[2]{}; uint16_t m_scrolly[2]{}; bool m_flip_screen = false; - uint16_t m_wbbc97_bitmap_enable = 0; int m_charpalettebank = 0; int m_spritepalettebank = 0; int m_sprite_gfx = 0; - int m_spikes91_lookup = 0; - uint32_t aerofgt_tile_callback( uint32_t code ); - uint32_t aerofgt_old_tile_callback( uint32_t code ); - uint32_t aerofgt_ol2_tile_callback( uint32_t code ); - uint32_t spinbrk_tile_callback( uint32_t code ); + uint32_t aerofgt_old_tile_callback(uint32_t code); /* handlers */ - void karatblzbl_soundlatch_w(uint8_t data); - uint8_t pending_command_r(); - void aerofgt_sh_bankswitch_w(uint8_t data); - void spinlbrk_sh_bankswitch_w(uint8_t data); - void aerfboot_okim6295_banking_w(uint8_t data); template void vram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); void pspikes_gfxbank_w(uint8_t data); void pspikesb_gfxbank_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - void spikes91_lookup_w(uint16_t data); void karatblz_gfxbank_w(uint8_t data); void spinlbrk_gfxbank_w(uint8_t data); void kickball_gfxbank_w(uint8_t data); @@ -97,86 +81,155 @@ public: template void scrollx_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); template void scrolly_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); void pspikes_palette_bank_w(uint8_t data); - void spinlbrk_flip_screen_w(uint8_t data); void turbofrc_flip_screen_w(uint8_t data); - void wbbc97_bitmap_enable_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); void pspikesb_oki_banking_w(uint16_t data); void aerfboo2_okim6295_banking_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - void karatblzbl_d7759_write_port_0_w(uint8_t data); - void karatblzbl_d7759_reset_w(uint8_t data); TILE_GET_INFO_MEMBER(get_pspikes_tile_info); template TILE_GET_INFO_MEMBER(karatblz_tile_info); template TILE_GET_INFO_MEMBER(spinlbrk_tile_info); template TILE_GET_INFO_MEMBER(get_tile_info); - DECLARE_MACHINE_START(aerofgt); - DECLARE_MACHINE_START(spinlbrk); - DECLARE_MACHINE_RESET(aerofgt); - DECLARE_VIDEO_START(pspikes); - DECLARE_MACHINE_START(common); - DECLARE_MACHINE_RESET(common); - DECLARE_VIDEO_START(karatblz); - DECLARE_VIDEO_START(spinlbrk); - DECLARE_VIDEO_START(turbofrc); - DECLARE_VIDEO_START(wbbc97); - void init_banked_oki(); - void init_kickball(); + DECLARE_VIDEO_START(pspikes) ATTR_COLD; + DECLARE_VIDEO_START(karatblz) ATTR_COLD; + DECLARE_VIDEO_START(turbofrc) ATTR_COLD; uint32_t screen_update_pspikes(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_spikes91(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); uint32_t screen_update_pspikesb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_karatblz(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_spinlbrk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_turbofrc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_aerofgt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); uint32_t screen_update_aerfboot(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); uint32_t screen_update_aerfboo2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_wbbc97(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); void aerofgt_register_state_globals( ); void setbank( int layer, int num, int bank ); void aerfboo2_draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int chip, int chip_disabled_pri ); void pspikesb_draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ); - void spikes91_draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ); void aerfboot_draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ); - void wbbc97_draw_bitmap( bitmap_rgb32 &bitmap ); - void spinlbrk(machine_config &config); - void aerofgt(machine_config &config); - void karatblz(machine_config &config); - void pspikesb(machine_config &config); - void aerfboo2(machine_config &config); - void pspikes(machine_config &config); - void wbbc97(machine_config &config); - void aerfboot(machine_config &config); - void pspikesc(machine_config &config); - void karatblzbl(machine_config &config); - void spikes91(machine_config &config); - void aerofgtb(machine_config &config); - void turbofrc(machine_config &config); - void kickball(machine_config &config); - void aerfboo2_map(address_map &map); - void aerfboot_map(address_map &map); - void aerfboot_sound_map(address_map &map); - void aerofgt_map(address_map &map); - void aerofgt_sound_portmap(address_map &map); - void aerofgtb_map(address_map &map); - void karatblz_map(address_map &map); - void karatblzbl_map(address_map &map); - void karatblzbl_sound_map(address_map &map); - void karatblzbl_sound_portmap(address_map &map); - void kickball_map(address_map &map); - void kickball_sound_map(address_map &map); - void kickball_sound_portmap(address_map &map); - void oki_map(address_map &map); - void pspikes_map(address_map &map); - void pspikesb_map(address_map &map); - void pspikesc_map(address_map &map); - void sound_map(address_map &map); + + void pspikesb_map(address_map &map) ATTR_COLD; + void pspikesc_map(address_map &map) ATTR_COLD; + void aerfboo2_map(address_map &map) ATTR_COLD; +}; + + +class aerofgt_sound_cpu_state : public aerofgt_state +{ +public: + aerofgt_sound_cpu_state(const machine_config &mconfig, device_type type, const char *tag) + : aerofgt_state(mconfig, type, tag) + , m_audiocpu(*this, "audiocpu") + , m_upd7759(*this, "upd") + , m_soundlatch(*this, "soundlatch") + , m_okibank(*this, "okibank") + , m_sprlookuprom(*this, "sprlookuprom") + { + } + + void init_banked_oki() ATTR_COLD; + void init_kickball() ATTR_COLD; + + void spikes91(machine_config &config) ATTR_COLD; + void kickball(machine_config &config) ATTR_COLD; + void karatblzbl(machine_config &config) ATTR_COLD; + void aerfboot(machine_config &config) ATTR_COLD; + void wbbc97(machine_config &config) ATTR_COLD; + +protected: + required_device m_audiocpu; + optional_device m_upd7759; // karatblzbl + required_device m_soundlatch; + + optional_memory_bank m_okibank; + + optional_region_ptr m_sprlookuprom; + + virtual void machine_start() override ATTR_COLD; + + DECLARE_VIDEO_START(wbbc97); + + uint8_t pending_command_r(); + void spinlbrk_flip_screen_w(uint8_t data); + + uint32_t aerofgt_ol2_tile_callback(uint32_t code); + + uint32_t screen_update_karatblz(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + +private: + uint16_t m_spikes91_lookup = 0; + uint16_t m_wbbc97_bitmap_enable = 0; + + void spikes91_lookup_w(uint16_t data); + void wbbc97_bitmap_enable_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + void aerfboot_okim6295_banking_w(uint8_t data); + + void karatblzbl_soundlatch_w(uint8_t data); + void karatblzbl_d7759_write_port_0_w(uint8_t data); + void karatblzbl_d7759_reset_w(uint8_t data); + + uint32_t screen_update_spikes91(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + uint32_t screen_update_wbbc97(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + void spikes91_draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void wbbc97_draw_bitmap(bitmap_rgb32 &bitmap); + void spikes91_map(address_map &map); - void spikes91_sound_map(address_map &map); - void spinlbrk_map(address_map &map); - void spinlbrk_sound_portmap(address_map &map); - void turbofrc_map(address_map &map); - void turbofrc_sound_portmap(address_map &map); + void kickball_map(address_map &map); + void karatblzbl_map(address_map &map); + void aerfboot_map(address_map &map); + + void aerfboot_sound_map(address_map &map); void wbbc97_map(address_map &map); void wbbc97_sound_map(address_map &map); + void karatblzbl_sound_map(address_map &map); + void karatblzbl_sound_portmap(address_map &map); + void kickball_sound_map(address_map &map); + void kickball_sound_portmap(address_map &map); + void spikes91_sound_map(address_map &map); + + void oki_map(address_map &map); +}; + + +class aerofgt_banked_sound_state : public aerofgt_sound_cpu_state +{ +public: + aerofgt_banked_sound_state(const machine_config &mconfig, device_type type, const char *tag) + : aerofgt_sound_cpu_state(mconfig, type, tag) + , m_soundbank(*this, "soundbank") + { + } + + void pspikes(machine_config &config) ATTR_COLD; + void karatblz(machine_config &config) ATTR_COLD; + void spinlbrk(machine_config &config) ATTR_COLD; + void turbofrc(machine_config &config) ATTR_COLD; + void aerofgtb(machine_config &config) ATTR_COLD; + void aerofgt(machine_config &config) ATTR_COLD; + +protected: + required_memory_bank m_soundbank; + + virtual void machine_start() override ATTR_COLD; + virtual void machine_reset() override ATTR_COLD; + + DECLARE_VIDEO_START(spinlbrk); + +private: + uint32_t aerofgt_tile_callback( uint32_t code ); + uint32_t spinbrk_tile_callback(uint32_t code); + + void sh_bankswitch_w(uint8_t data); + + uint32_t screen_update_spinlbrk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + uint32_t screen_update_turbofrc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + uint32_t screen_update_aerofgt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + void pspikes_map(address_map &map); + void karatblz_map(address_map &map); + void spinlbrk_map(address_map &map) ATTR_COLD; + void turbofrc_map(address_map &map) ATTR_COLD; + void aerofgtb_map(address_map &map); + void aerofgt_map(address_map &map); + + void sound_map(address_map &map); + void spinlbrk_sound_portmap(address_map &map) ATTR_COLD; + void turbofrc_sound_portmap(address_map &map) ATTR_COLD; + void aerofgt_sound_portmap(address_map &map) ATTR_COLD; }; #endif // MAME_VSYSTEM_AEROFGT_H diff --git a/src/mame/vsystem/aerofgt_v.cpp b/src/mame/vsystem/aerofgt_v.cpp index 91aebfc1e14..315b80444d3 100644 --- a/src/mame/vsystem/aerofgt_v.cpp +++ b/src/mame/vsystem/aerofgt_v.cpp @@ -77,11 +77,9 @@ VIDEO_START_MEMBER(aerofgt_state,pspikes) /* no bg2 in this game */ m_sprite_gfx = 1; - m_spikes91_lookup = 0; m_charpalettebank = 0; aerofgt_register_state_globals(); - save_item(NAME(m_spikes91_lookup)); } VIDEO_START_MEMBER(aerofgt_state,karatblz) @@ -96,10 +94,10 @@ VIDEO_START_MEMBER(aerofgt_state,karatblz) aerofgt_register_state_globals(); } -VIDEO_START_MEMBER(aerofgt_state,spinlbrk) +VIDEO_START_MEMBER(aerofgt_banked_sound_state,spinlbrk) { - m_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(aerofgt_state::spinlbrk_tile_info<0>)), TILEMAP_SCAN_ROWS, 8, 8, 64, 64); - m_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(aerofgt_state::karatblz_tile_info<1>)), TILEMAP_SCAN_ROWS, 8, 8, 64, 64); + m_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(aerofgt_banked_sound_state::spinlbrk_tile_info<0>)), TILEMAP_SCAN_ROWS, 8, 8, 64, 64); + m_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(aerofgt_banked_sound_state::karatblz_tile_info<1>)), TILEMAP_SCAN_ROWS, 8, 8, 64, 64); m_tilemap[1]->set_transparent_pen(15); @@ -126,24 +124,24 @@ VIDEO_START_MEMBER(aerofgt_state,turbofrc) /* new hw type */ -uint32_t aerofgt_state::aerofgt_tile_callback( uint32_t code ) +uint32_t aerofgt_banked_sound_state::aerofgt_tile_callback(uint32_t code) { return m_sprlookupram[0][code&0x7fff]; } /* old hw type */ -uint32_t aerofgt_state::aerofgt_old_tile_callback( uint32_t code ) +uint32_t aerofgt_state::aerofgt_old_tile_callback(uint32_t code) { return m_sprlookupram[0][code % (m_sprlookupram[0].bytes()/2)]; } -uint32_t aerofgt_state::aerofgt_ol2_tile_callback( uint32_t code ) +uint32_t aerofgt_sound_cpu_state::aerofgt_ol2_tile_callback(uint32_t code) { return m_sprlookupram[1][code % (m_sprlookupram[1].bytes()/2)]; } -uint32_t aerofgt_state::spinbrk_tile_callback( uint32_t code ) +uint32_t aerofgt_banked_sound_state::spinbrk_tile_callback(uint32_t code) { /* enemy sprites use ROM instead of RAM */ return m_sprlookuprom[code % m_sprlookuprom.length()]; @@ -221,7 +219,7 @@ void aerofgt_state::pspikes_palette_bank_w(uint8_t data) m_tilemap[0]->set_flip(m_flip_screen ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0); } -void aerofgt_state::spinlbrk_flip_screen_w(uint8_t data) +void aerofgt_sound_cpu_state::spinlbrk_flip_screen_w(uint8_t data) { m_flip_screen = BIT(data, 7); m_tilemap[0]->set_flip(m_flip_screen ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0); @@ -264,7 +262,7 @@ uint32_t aerofgt_state::screen_update_pspikes(screen_device &screen, bitmap_ind1 } -uint32_t aerofgt_state::screen_update_karatblz(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +uint32_t aerofgt_sound_cpu_state::screen_update_karatblz(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { m_tilemap[0]->set_scrollx(0, m_scrollx[0] - 8); m_tilemap[0]->set_scrolly(0, m_scrolly[0]); @@ -282,16 +280,15 @@ uint32_t aerofgt_state::screen_update_karatblz(screen_device &screen, bitmap_ind m_spr_old[0]->turbofrc_draw_sprites(m_spriteram+0x000,m_spriteram.bytes()/2,m_spritepalettebank, bitmap, cliprect, screen.priority(), 1, m_flip_screen); m_spr_old[0]->turbofrc_draw_sprites(m_spriteram+0x000,m_spriteram.bytes()/2,m_spritepalettebank, bitmap, cliprect, screen.priority(), 0, m_flip_screen); + return 0; } -uint32_t aerofgt_state::screen_update_spinlbrk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +uint32_t aerofgt_banked_sound_state::screen_update_spinlbrk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int i, scrolly; - m_tilemap[0]->set_scroll_rows(512); - scrolly = 0; - for (i = 0; i < 256; i++) + int scrolly = 0; + for (int i = 0; i < 256; i++) m_tilemap[0]->set_scrollx((i + scrolly) & 0x1ff, m_rasterram[i] - 8); // m_tilemap[0]->set_scrolly(0, m_scrolly[0]); m_tilemap[1]->set_scrollx(0, m_scrollx[1] - 4); @@ -308,16 +305,15 @@ uint32_t aerofgt_state::screen_update_spinlbrk(screen_device &screen, bitmap_ind m_spr_old[1]->turbofrc_draw_sprites(m_spriteram+0x200,m_spriteram.bytes()/2,m_spritepalettebank, bitmap, cliprect, screen.priority(), 0, m_flip_screen); m_spr_old[1]->turbofrc_draw_sprites(m_spriteram+0x200,m_spriteram.bytes()/2,m_spritepalettebank, bitmap, cliprect, screen.priority(), 1, m_flip_screen); + return 0; } -uint32_t aerofgt_state::screen_update_turbofrc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +uint32_t aerofgt_banked_sound_state::screen_update_turbofrc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int i, scrolly; - m_tilemap[0]->set_scroll_rows(512); - scrolly = m_scrolly[0] + 2; - for (i = 0; i < 256; i++) + int scrolly = m_scrolly[0] + 2; + for (int i = 0; i < 256; i++) // m_tilemap[0]->set_scrollx((i + scrolly) & 0x1ff, m_rasterram[i] - 11); m_tilemap[0]->set_scrollx((i + scrolly) & 0x1ff, m_rasterram[7] - 11 - (m_flip_screen ? 188 : 0)); m_tilemap[0]->set_scrolly(0, scrolly - (m_flip_screen ? 2 : 0)); @@ -335,10 +331,11 @@ uint32_t aerofgt_state::screen_update_turbofrc(screen_device &screen, bitmap_ind m_spr_old[0]->turbofrc_draw_sprites(m_spriteram+0x000,m_spriteram.bytes()/2,m_spritepalettebank, bitmap, cliprect, screen.priority(), 1, m_flip_screen); //enemy m_spr_old[0]->turbofrc_draw_sprites(m_spriteram+0x000,m_spriteram.bytes()/2,m_spritepalettebank, bitmap, cliprect, screen.priority(), 0, m_flip_screen); //enemy + return 0; } -uint32_t aerofgt_state::screen_update_aerofgt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +uint32_t aerofgt_banked_sound_state::screen_update_aerofgt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { m_tilemap[0]->set_scrollx(0, m_rasterram[0x0000] - 18); m_tilemap[0]->set_scrolly(0, m_scrolly[0]); @@ -356,6 +353,7 @@ uint32_t aerofgt_state::screen_update_aerofgt(screen_device &screen, bitmap_ind1 m_spr->draw_sprites(m_spriteram, m_spriteram.bytes(), screen, bitmap, cliprect, 0x03, 0x02); m_spr->draw_sprites(m_spriteram, m_spriteram.bytes(), screen, bitmap, cliprect, 0x03, 0x03); + return 0; } @@ -367,9 +365,9 @@ uint32_t aerofgt_state::screen_update_aerofgt(screen_device &screen, bitmap_ind1 ***************************************************************************/ // BOOTLEG -VIDEO_START_MEMBER(aerofgt_state,wbbc97) +VIDEO_START_MEMBER(aerofgt_sound_cpu_state,wbbc97) { - m_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(aerofgt_state::get_pspikes_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); + m_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(aerofgt_sound_cpu_state::get_pspikes_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); /* no bg2 in this game */ m_tilemap[0]->set_transparent_pen(15); @@ -391,13 +389,13 @@ void aerofgt_state::pspikesb_gfxbank_w(offs_t offset, uint16_t data, uint16_t me } // BOOTLEG -void aerofgt_state::spikes91_lookup_w(uint16_t data) +void aerofgt_sound_cpu_state::spikes91_lookup_w(uint16_t data) { m_spikes91_lookup = data & 1; } // BOOTLEG -void aerofgt_state::wbbc97_bitmap_enable_w(offs_t offset, uint16_t data, uint16_t mem_mask) +void aerofgt_sound_cpu_state::wbbc97_bitmap_enable_w(offs_t offset, uint16_t data, uint16_t mem_mask) { COMBINE_DATA(&m_wbbc97_bitmap_enable); } @@ -405,66 +403,59 @@ void aerofgt_state::wbbc97_bitmap_enable_w(offs_t offset, uint16_t data, uint16_ // BOOTLEG void aerofgt_state::aerfboo2_draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int chip, int chip_disabled_pri ) { - int attr_start, base, first; + int base, first; base = chip * 0x0200; // first = 4 * m_spriteram[0x1fe + base]; first = 0; - for (attr_start = base + 0x0200 - 4; attr_start >= first + base; attr_start -= 4) + for (int attr_start = base + 0x0200 - 4; attr_start >= first + base; attr_start -= 4) { - int map_start; - int ox, oy, x, y, xsize, ysize, zoomx, zoomy, flipx, flipy, color, pri; // some other drivers still use this wrong table, they have to be upgraded // int zoomtable[16] = { 0,7,14,20,25,30,34,38,42,46,49,52,54,57,59,61 }; if (!(m_spriteram[attr_start + 2] & 0x0080)) continue; - pri = m_spriteram[attr_start + 2] & 0x0010; + const int pri = m_spriteram[attr_start + 2] & 0x0010; - if ( chip_disabled_pri && !pri) + if (chip_disabled_pri && !pri) continue; if ((!chip_disabled_pri) && (pri >> 4)) continue; - ox = m_spriteram[attr_start + 1] & 0x01ff; - xsize = (m_spriteram[attr_start + 2] & 0x0700) >> 8; - zoomx = (m_spriteram[attr_start + 1] & 0xf000) >> 12; - oy = m_spriteram[attr_start + 0] & 0x01ff; - ysize = (m_spriteram[attr_start + 2] & 0x7000) >> 12; - zoomy = (m_spriteram[attr_start + 0] & 0xf000) >> 12; - flipx = m_spriteram[attr_start + 2] & 0x0800; - flipy = m_spriteram[attr_start + 2] & 0x8000; - color = (m_spriteram[attr_start + 2] & 0x000f) + 16 * m_spritepalettebank; + const int ox = m_spriteram[attr_start + 1] & 0x01ff; + const int xsize = (m_spriteram[attr_start + 2] & 0x0700) >> 8; + const int zoomx = 32 - ((m_spriteram[attr_start + 1] & 0xf000) >> 12); + const int oy = m_spriteram[attr_start + 0] & 0x01ff; + const int ysize = (m_spriteram[attr_start + 2] & 0x7000) >> 12; + const int zoomy = 32 - ((m_spriteram[attr_start + 0] & 0xf000) >> 12); + const int flipx = m_spriteram[attr_start + 2] & 0x0800; + const int flipy = m_spriteram[attr_start + 2] & 0x8000; + const int color = (m_spriteram[attr_start + 2] & 0x000f) + 16 * m_spritepalettebank; - map_start = m_spriteram[attr_start + 3]; + int map_start = m_spriteram[attr_start + 3]; // aerofgt has this adjustment, but doing it here would break turbo force title screen -// ox += (xsize*zoomx+2)/4; -// oy += (ysize*zoomy+2)/4; +// ox += (xsize*(32 - zoomx)+2)/4; +// oy += (ysize*(32 - zoomy)+2)/4; - zoomx = 32 - zoomx; - zoomy = 32 - zoomy; - - for (y = 0; y <= ysize; y++) + for (int y = 0; y <= ysize; y++) { - int sx, sy; - + int sy; if (flipy) sy = ((oy + zoomy * (ysize - y)/2 + 16) & 0x1ff) - 16; else sy = ((oy + zoomy * y / 2 + 16) & 0x1ff) - 16; - for (x = 0; x <= xsize; x++) + for (int x = 0; x <= xsize; x++) { - int code; - + int sx; if (flipx) sx = ((ox + zoomx * (xsize - x) / 2 + 16) & 0x1ff) - 16; else sx = ((ox + zoomx * x / 2 + 16) & 0x1ff) - 16; - code = m_sprlookupram[chip][map_start % (m_sprlookupram[chip].bytes()/2)]; + const int code = m_sprlookupram[chip][map_start % (m_sprlookupram[chip].bytes()/2)]; m_gfxdecode->gfx(m_sprite_gfx + chip)->prio_zoom_transpen(bitmap,cliprect, code, @@ -487,9 +478,7 @@ void aerofgt_state::aerfboo2_draw_sprites( screen_device &screen, bitmap_ind16 & // BOOTLEG void aerofgt_state::pspikesb_draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ) { - int i; - - for (i = 4; i < m_spriteram.bytes() / 2; i += 4) + for (int i = 4; i < m_spriteram.bytes() / 2; i += 4) { int xpos, ypos, color, flipx, flipy, code; @@ -520,12 +509,11 @@ void aerofgt_state::pspikesb_draw_sprites( screen_device &screen, bitmap_ind16 & } // BOOTLEG -void aerofgt_state::spikes91_draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void aerofgt_sound_cpu_state::spikes91_draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ) { - int i; m_spritepalettebank = 1; - for (i = m_spriteram.bytes() / 2 - 4; i >= 4; i -= 4) + for (int i = m_spriteram.bytes() / 2 - 4; i >= 4; i -= 4) { int xpos, ypos, color, flipx, flipy, code; @@ -642,16 +630,16 @@ void aerofgt_state::aerfboot_draw_sprites( screen_device &screen, bitmap_ind16 & } // BOOTLEG -void aerofgt_state::wbbc97_draw_bitmap( bitmap_rgb32 &bitmap ) +void aerofgt_sound_cpu_state::wbbc97_draw_bitmap( bitmap_rgb32 &bitmap ) { int count = 16; // weird, the bitmap doesn't start at 0? for (int y = 0; y < 256; y++) for (int x = 0; x < 512; x++) { - int color = m_bitmapram[count] >> 1; + const int color = m_bitmapram[count] >> 1; /* data is GRB; convert to RGB */ - rgb_t pen = rgb_t(pal5bit((color & 0x3e0) >> 5), pal5bit((color & 0x7c00) >> 10), pal5bit(color & 0x1f)); + const rgb_t pen = rgb_t(pal5bit((color & 0x3e0) >> 5), pal5bit((color & 0x7c00) >> 10), pal5bit(color & 0x1f)); bitmap.pix(y, (10 + x - m_rasterram[(y & 0x7f)]) & 0x1ff) = pen; count++; @@ -674,17 +662,14 @@ uint32_t aerofgt_state::screen_update_pspikesb(screen_device &screen, bitmap_ind } // BOOTLEG -uint32_t aerofgt_state::screen_update_spikes91(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +uint32_t aerofgt_sound_cpu_state::screen_update_spikes91(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int i, scrolly; - int y, x; - int count; - gfx_element *gfx = m_gfxdecode->gfx(0); + gfx_element *const gfx = m_gfxdecode->gfx(0); m_tilemap[0]->set_scroll_rows(256); - scrolly = m_scrolly[0]; + const int scrolly = m_scrolly[0]; - for (i = 0; i < 256; i++) + for (int i = 0; i < 256; i++) m_tilemap[0]->set_scrollx((i + scrolly) & 0xff, m_rasterram[i + 0x01f0 / 2] + 0x96 + 0x16); m_tilemap[0]->set_scrolly(0, scrolly); @@ -692,10 +677,10 @@ uint32_t aerofgt_state::screen_update_spikes91(screen_device &screen, bitmap_ind spikes91_draw_sprites(screen, bitmap, cliprect); /* we could use a tilemap, but it's easier to just do it here */ - count = 0; - for (y = 0; y < 32; y++) + int count = 0; + for (int y = 0; y < 32; y++) { - for (x = 0; x < 64; x++) + for (int x = 0; x < 64; x++) { uint16_t tileno = m_tx_tilemap_ram[count] & 0x1fff; uint16_t colour = m_tx_tilemap_ram[count] & 0xe000; @@ -764,13 +749,11 @@ uint32_t aerofgt_state::screen_update_aerfboo2(screen_device &screen, bitmap_ind } // BOOTLEG (still uses original sprite type) -uint32_t aerofgt_state::screen_update_wbbc97(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +uint32_t aerofgt_sound_cpu_state::screen_update_wbbc97(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int i, scrolly; - m_tilemap[0]->set_scroll_rows(256); - scrolly = m_scrolly[0]; - for (i = 0; i < 256; i++) + const int scrolly = m_scrolly[0]; + for (int i = 0; i < 256; i++) m_tilemap[0]->set_scrollx((i + scrolly) & 0xff, m_rasterram[i]); m_tilemap[0]->set_scrolly(0, scrolly);