diff --git a/scripts/target/mame/arcade.lua b/scripts/target/mame/arcade.lua index 516ceb27c83..1f2ab550f8c 100644 --- a/scripts/target/mame/arcade.lua +++ b/scripts/target/mame/arcade.lua @@ -3656,8 +3656,6 @@ files { MAME_DIR .. "src/mame/video/ashnojoe.cpp", MAME_DIR .. "src/mame/drivers/asuka.cpp", MAME_DIR .. "src/mame/includes/asuka.h", - MAME_DIR .. "src/mame/machine/bonzeadv.cpp", - MAME_DIR .. "src/mame/machine/bonzeadv.h", MAME_DIR .. "src/mame/video/asuka.cpp", MAME_DIR .. "src/mame/drivers/bigevglf.cpp", MAME_DIR .. "src/mame/includes/bigevglf.h", diff --git a/src/mame/drivers/asuka.cpp b/src/mame/drivers/asuka.cpp index d28fc60ca69..32bafa4500e 100644 --- a/src/mame/drivers/asuka.cpp +++ b/src/mame/drivers/asuka.cpp @@ -223,7 +223,6 @@ DIP locations verified for: #include "cpu/m68000/m68000.h" #include "cpu/z180/z180.h" #include "cpu/z80/z80.h" -#include "machine/bonzeadv.h" #include "machine/watchdog.h" #include "sound/2610intf.h" #include "sound/msm5205.h" @@ -340,9 +339,8 @@ ADDRESS_MAP_START(asuka_state::bonzeadv_map) AM_RANGE(0x3d0000, 0x3d0001) AM_READNOP AM_RANGE(0x3e0000, 0x3e0001) AM_DEVWRITE8("tc0140syt", tc0140syt_device, master_port_w, 0x00ff) AM_RANGE(0x3e0002, 0x3e0003) AM_DEVREADWRITE8("tc0140syt", tc0140syt_device, master_comm_r, master_comm_w, 0x00ff) - AM_RANGE(0x800000, 0x8007ff) AM_READWRITE(bonzeadv_cchip_ram_r, bonzeadv_cchip_ram_w) - AM_RANGE(0x800802, 0x800803) AM_READWRITE(bonzeadv_cchip_ctrl_r, bonzeadv_cchip_ctrl_w) - AM_RANGE(0x800c00, 0x800c01) AM_WRITE(bonzeadv_cchip_bank_w) + AM_RANGE(0x800000, 0x8007ff) AM_DEVREADWRITE8("cchip", taito_cchip_device, mem68_r, mem68_w, 0x00ff) + AM_RANGE(0x800800, 0x800fff) AM_DEVREADWRITE8("cchip", taito_cchip_device, asic_r, asic68_w, 0x00ff) AM_RANGE(0xc00000, 0xc0ffff) AM_DEVREADWRITE("tc0100scn", tc0100scn_device, word_r, word_w) /* tilemaps */ AM_RANGE(0xc20000, 0xc2000f) AM_DEVREADWRITE("tc0100scn", tc0100scn_device, ctrl_word_r, ctrl_word_w) AM_RANGE(0xd00000, 0xd03fff) AM_DEVREADWRITE("pc090oj", pc090oj_device, word_r, word_w) /* sprite ram */ @@ -517,11 +515,11 @@ static INPUT_PORTS_START( bonzeadv ) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL // as with all c-chip through ADC reads this ends up on 0x80 instead of 0x08 PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) INPUT_PORTS_END static INPUT_PORTS_START( jigkmgri ) @@ -792,28 +790,16 @@ void asuka_state::machine_start() save_item(NAME(m_adpcm_pos)); save_item(NAME(m_adpcm_ff)); - - save_item(NAME(m_current_round)); - save_item(NAME(m_current_bank)); save_item(NAME(m_video_ctrl)); save_item(NAME(m_video_mask)); - save_item(NAME(m_cc_port)); - save_item(NAME(m_restart_status)); - save_item(NAME(m_cval)); } void asuka_state::machine_reset() { m_adpcm_pos = 0; m_adpcm_ff = false; - m_current_round = 0; - m_current_bank = 0; m_video_ctrl = 0; m_video_mask = 0; - m_cc_port = 0; - m_restart_status = 0; - - memset(m_cval, 0, 26); } WRITE_LINE_MEMBER(asuka_state::screen_vblank_asuka) @@ -825,17 +811,44 @@ WRITE_LINE_MEMBER(asuka_state::screen_vblank_asuka) } } +INTERRUPT_GEN_MEMBER(asuka_state::bonze_interrupt) +{ + m_maincpu->set_input_line(4, HOLD_LINE); + if (m_cchip) m_cchip->ext_interrupt(ASSERT_LINE); + if (m_cchip_irq_clear) m_cchip_irq_clear->adjust(attotime::zero); +} + +TIMER_DEVICE_CALLBACK_MEMBER(asuka_state::cchip_irq_clear_cb) +{ + m_cchip->ext_interrupt(CLEAR_LINE); +} + +WRITE8_MEMBER(asuka_state::counters_w) +{ + machine().bookkeeping().coin_lockout_w(1, data & 0x80); + machine().bookkeeping().coin_lockout_w(0, data & 0x40); + machine().bookkeeping().coin_counter_w(1, data & 0x20); + machine().bookkeeping().coin_counter_w(0, data & 0x10); +} + MACHINE_CONFIG_START(asuka_state::bonzeadv) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", M68000, 8000000) /* checked on PCB */ MCFG_CPU_PROGRAM_MAP(bonzeadv_map) - MCFG_CPU_VBLANK_INT_DRIVER("screen", asuka_state, irq4_line_hold) + MCFG_CPU_VBLANK_INT_DRIVER("screen", asuka_state, bonze_interrupt) MCFG_CPU_ADD("audiocpu", Z80,4000000) /* sound CPU, also required for test mode */ MCFG_CPU_PROGRAM_MAP(bonzeadv_z80_map) - MCFG_TAITO_CCHIP_ADD("cchip", XTAL(12'000'000)/2) /* ? MHz */ + MCFG_TAITO_CCHIP_ADD("cchip", XTAL(20'000'000)/2) /* 20MHz OSC next to C-Chip, 10MHz?? */ + MCFG_CCHIP_IN_PORTA_CB(IOPORT("800007")) + MCFG_CCHIP_IN_PORTB_CB(IOPORT("800009")) + MCFG_CCHIP_IN_PORTC_CB(IOPORT("80000B")) + MCFG_CCHIP_IN_PORTAD_CB(IOPORT("80000D")) + MCFG_CCHIP_OUT_PORTB_CB(WRITE8(asuka_state, counters_w)) + + MCFG_TIMER_DRIVER_ADD("cchip_irq_clear", asuka_state, cchip_irq_clear_cb) MCFG_QUANTUM_TIME(attotime::from_hz(600)) @@ -1233,7 +1246,7 @@ ROM_START( bonzeadv ) ROM_LOAD16_WORD_SWAP( "b41-01.15", 0x80000, 0x80000, CRC(5d072fa4) SHA1(6ffe1b8531381eb6dd3f1fec18c91294a6aca9f6) ) ROM_REGION( 0x2000, "cchip:cchip_eprom", 0 ) - ROM_LOAD( "cchip_b41-05.43", 0x0000, 0x2000, NO_DUMP ) + ROM_LOAD( "cchip_b41-05.43", 0x0000, 0x2000, CRC(75c52553) SHA1(87bbaefab90e7d43f63556fbae3e937baf9d397b) ) ROM_REGION( 0x80000, "gfx1", 0 ) ROM_LOAD( "b41-03.1", 0x00000, 0x80000, CRC(736d35d0) SHA1(7d41a7d71e117714bbd2cdda2953589cda6e763a) ) /* SCR tiles (8 x 8) */ @@ -1258,7 +1271,7 @@ ROM_START( bonzeadvo ) ROM_LOAD16_WORD_SWAP( "b41-01.15", 0x80000, 0x80000, CRC(5d072fa4) SHA1(6ffe1b8531381eb6dd3f1fec18c91294a6aca9f6) ) ROM_REGION( 0x2000, "cchip:cchip_eprom", 0 ) - ROM_LOAD( "cchip_b41-05.43", 0x0000, 0x2000, NO_DUMP ) + ROM_LOAD( "cchip_b41-05.43", 0x0000, 0x2000, CRC(75c52553) SHA1(87bbaefab90e7d43f63556fbae3e937baf9d397b) ) ROM_REGION( 0x80000, "gfx1", 0 ) ROM_LOAD( "b41-03.1", 0x00000, 0x80000, CRC(736d35d0) SHA1(7d41a7d71e117714bbd2cdda2953589cda6e763a) ) /* SCR tiles (8 x 8) */ @@ -1283,7 +1296,7 @@ ROM_START( bonzeadvu ) ROM_LOAD16_WORD_SWAP( "b41-01.15", 0x80000, 0x80000, CRC(5d072fa4) SHA1(6ffe1b8531381eb6dd3f1fec18c91294a6aca9f6) ) ROM_REGION( 0x2000, "cchip:cchip_eprom", 0 ) - ROM_LOAD( "cchip_b41-05.43", 0x0000, 0x2000, NO_DUMP ) + ROM_LOAD( "cchip_b41-05.43", 0x0000, 0x2000, CRC(75c52553) SHA1(87bbaefab90e7d43f63556fbae3e937baf9d397b) ) ROM_REGION( 0x80000, "gfx1", 0 ) ROM_LOAD( "b41-03.1", 0x00000, 0x80000, CRC(736d35d0) SHA1(7d41a7d71e117714bbd2cdda2953589cda6e763a) ) /* SCR tiles (8 x 8) */ @@ -1308,7 +1321,7 @@ ROM_START( jigkmgri ) ROM_LOAD16_WORD_SWAP( "b41-01.15", 0x80000, 0x80000, CRC(5d072fa4) SHA1(6ffe1b8531381eb6dd3f1fec18c91294a6aca9f6) ) ROM_REGION( 0x2000, "cchip:cchip_eprom", 0 ) - ROM_LOAD( "cchip_b41-05.43", 0x0000, 0x2000, NO_DUMP ) + ROM_LOAD( "cchip_b41-05.43", 0x0000, 0x2000, CRC(75c52553) SHA1(87bbaefab90e7d43f63556fbae3e937baf9d397b) ) ROM_REGION( 0x80000, "gfx1", 0 ) ROM_LOAD( "b41-03.1", 0x00000, 0x80000, CRC(736d35d0) SHA1(7d41a7d71e117714bbd2cdda2953589cda6e763a) ) /* Tiles (8 x 8) */ @@ -1336,7 +1349,7 @@ ROM_START( bonzeadvp ) /* Labels consists of hand written checksum values of the ROM_LOAD16_BYTE( "0e7e.ic28", 0xc0000, 0x20000, CRC(dc1f9fd0) SHA1(88addfa2c3bb854efd88a3556d23a7607b6ec848) ) // ^ ROM_REGION( 0x2000, "cchip:cchip_eprom", 0 ) - ROM_LOAD( "cchip_b41-05.43", 0x0000, 0x2000, NO_DUMP ) /* is the C-Chip the same as the final? */ + ROM_LOAD( "cchip_b41-05.43", 0x0000, 0x2000, CRC(75c52553) SHA1(87bbaefab90e7d43f63556fbae3e937baf9d397b) ) /* is the C-Chip the same as the final? */ ROM_REGION( 0x80000, "gfx1", 0 ) ROM_LOAD16_BYTE( "abbe.ic9", 0x00000, 0x20000, CRC(50e6581c) SHA1(230724d65c9b1ea5d72117dca077464dd599ad68) ) // first 2 == first half b41-03.1 but split diff --git a/src/mame/drivers/taito_x.cpp b/src/mame/drivers/taito_x.cpp index bb8b0906d1b..87f24f43f4d 100644 --- a/src/mame/drivers/taito_x.cpp +++ b/src/mame/drivers/taito_x.cpp @@ -796,18 +796,11 @@ MACHINE_START_MEMBER(taitox_state,taitox) membank("z80bank")->configure_entries(0, banks, memregion("audiocpu")->base(), 0x4000); } -TIMER_DEVICE_CALLBACK_MEMBER(taitox_state::scanline) +INTERRUPT_GEN_MEMBER(taitox_state::interrupt) { - if (param == 240) - { - m_maincpu->set_input_line(6, HOLD_LINE); - } - else if (param == 40) - { - // see notes in volfied.cpp - m_cchip->ext_interrupt(ASSERT_LINE); - m_cchip_irq_clear->adjust(attotime::zero); - } + m_maincpu->set_input_line(6, HOLD_LINE); + m_cchip->ext_interrupt(ASSERT_LINE); + m_cchip_irq_clear->adjust(attotime::zero); } TIMER_DEVICE_CALLBACK_MEMBER(taitox_state::cchip_irq_clear_cb) @@ -823,8 +816,7 @@ MACHINE_CONFIG_START(taitox_state::superman) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", M68000, XTAL(16'000'000)/2) /* verified on pcb */ MCFG_CPU_PROGRAM_MAP(superman_map) - //MCFG_CPU_VBLANK_INT_DRIVER("screen", taitox_state, irq6_line_hold) - MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", taitox_state, scanline, "screen", 0, 1) + MCFG_CPU_VBLANK_INT_DRIVER("screen", taitox_state, interrupt) MCFG_CPU_ADD("audiocpu", Z80, XTAL(16'000'000)/4) /* verified on pcb */ MCFG_CPU_PROGRAM_MAP(sound_map) diff --git a/src/mame/drivers/volfied.cpp b/src/mame/drivers/volfied.cpp index 255ac8b2727..bc612b40c61 100644 --- a/src/mame/drivers/volfied.cpp +++ b/src/mame/drivers/volfied.cpp @@ -224,20 +224,11 @@ WRITE8_MEMBER(volfied_state::counters_w) machine().bookkeeping().coin_counter_w(0, data & 0x10); } -TIMER_DEVICE_CALLBACK_MEMBER(volfied_state::scanline) +INTERRUPT_GEN_MEMBER(volfied_state::interrupt) { - if (param == 240) - { - m_maincpu->set_input_line(4, HOLD_LINE); - } - else if (param == 40) - { - /* it isn't clear when / how this should be generated. if it's too close to the main vblank you get spurious inputs, including TILT and additional coins when ingame - so for now we generate it at a fixed interval after vbl. test mode doesn't use 68k interrupts so you get the odd bad frame in the input test as the idle loop - drifts out of sync with the vbl signal */ - m_cchip->ext_interrupt(ASSERT_LINE); - m_cchip_irq_clear->adjust(attotime::zero); - } + m_maincpu->set_input_line(4, HOLD_LINE); + m_cchip->ext_interrupt(ASSERT_LINE); + m_cchip_irq_clear->adjust(attotime::zero); } TIMER_DEVICE_CALLBACK_MEMBER(volfied_state::cchip_irq_clear_cb) @@ -251,8 +242,7 @@ MACHINE_CONFIG_START(volfied_state::volfied) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", M68000, CPU_CLOCK) /* 8MHz */ MCFG_CPU_PROGRAM_MAP(main_map) -// MCFG_CPU_VBLANK_INT_DRIVER("screen", volfied_state, irq4_line_hold) - MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", volfied_state, scanline, "screen", 0, 1) + MCFG_CPU_VBLANK_INT_DRIVER("screen", volfied_state, interrupt) MCFG_CPU_ADD("audiocpu", Z80, SOUND_CPU_CLOCK) /* 4MHz sound CPU, required to run the game */ MCFG_CPU_PROGRAM_MAP(z80_map) diff --git a/src/mame/includes/asuka.h b/src/mame/includes/asuka.h index 4b01c3915ff..ee3a90125ce 100644 --- a/src/mame/includes/asuka.h +++ b/src/mame/includes/asuka.h @@ -20,6 +20,7 @@ #include "video/pc090oj.h" #include "video/tc0100scn.h" #include "video/tc0110pcr.h" +#include "machine/timer.h" class asuka_state : public driver_device @@ -42,20 +43,54 @@ public: m_pc090oj(*this, "pc090oj"), m_tc0100scn(*this, "tc0100scn"), m_tc0110pcr(*this, "tc0110pcr"), - m_tc0220ioc(*this, "tc0220ioc") { } + m_tc0220ioc(*this, "tc0220ioc"), + m_cchip_irq_clear(*this, "cchip_irq_clear") + { } + + DECLARE_WRITE8_MEMBER(coin_control_w); + DECLARE_WRITE8_MEMBER(sound_bankswitch_w); + DECLARE_WRITE8_MEMBER(asuka_msm5205_address_w); + DECLARE_READ16_MEMBER(cadash_share_r); + DECLARE_WRITE16_MEMBER(cadash_share_w); + DECLARE_WRITE16_MEMBER(asuka_spritectrl_w); + DECLARE_WRITE8_MEMBER(sound_bankswitch_2151_w); + DECLARE_WRITE8_MEMBER(asuka_msm5205_start_w); + DECLARE_WRITE8_MEMBER(asuka_msm5205_stop_w); + DECLARE_WRITE8_MEMBER(counters_w); + virtual void machine_start() override; + virtual void machine_reset() override; + uint32_t screen_update_bonzeadv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + uint32_t screen_update_asuka(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_WRITE_LINE_MEMBER(screen_vblank_asuka); + INTERRUPT_GEN_MEMBER(cadash_interrupt); + DECLARE_DRIVER_INIT(cadash); + INTERRUPT_GEN_MEMBER(bonze_interrupt); + TIMER_DEVICE_CALLBACK_MEMBER(cchip_irq_clear_cb); + + DECLARE_WRITE_LINE_MEMBER(asuka_msm5205_vck); + + void mofflott(machine_config &config); + void asuka(machine_config &config); + void cadash(machine_config &config); + void eto(machine_config &config); + void galmedes(machine_config &config); + void bonzeadv(machine_config &config); + void asuka_map(address_map &map); + void bonzeadv_map(address_map &map); + void bonzeadv_z80_map(address_map &map); + void cadash_map(address_map &map); + void cadash_sub_io(address_map &map); + void cadash_sub_map(address_map &map); + void cadash_z80_map(address_map &map); + void eto_map(address_map &map); + void z80_map(address_map &map); +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; /* video-related */ u16 m_video_ctrl; u16 m_video_mask; - /* c-chip */ - int m_current_round; - int m_current_bank; - - u8 m_cval[26]; - u8 m_cc_port; - u8 m_restart_status; - /* misc */ u16 m_adpcm_pos; bool m_adpcm_ff; @@ -75,51 +110,8 @@ public: required_device m_tc0100scn; required_device m_tc0110pcr; optional_device m_tc0220ioc; - DECLARE_WRITE8_MEMBER(coin_control_w); - DECLARE_WRITE8_MEMBER(sound_bankswitch_w); - DECLARE_WRITE8_MEMBER(asuka_msm5205_address_w); - DECLARE_READ16_MEMBER(cadash_share_r); - DECLARE_WRITE16_MEMBER(cadash_share_w); - DECLARE_WRITE16_MEMBER(asuka_spritectrl_w); - DECLARE_WRITE8_MEMBER(sound_bankswitch_2151_w); - DECLARE_WRITE8_MEMBER(asuka_msm5205_start_w); - DECLARE_WRITE8_MEMBER(asuka_msm5205_stop_w); - virtual void machine_start() override; - virtual void machine_reset() override; - uint32_t screen_update_bonzeadv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_asuka(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_WRITE_LINE_MEMBER(screen_vblank_asuka); - INTERRUPT_GEN_MEMBER(cadash_interrupt); - DECLARE_DRIVER_INIT(cadash); - /*----------- defined in machine/bonzeadv.c -----------*/ - void WriteLevelData(); - void WriteRestartPos(int level ); - - DECLARE_READ16_MEMBER( bonzeadv_cchip_ctrl_r ); - DECLARE_READ16_MEMBER( bonzeadv_cchip_ram_r ); - DECLARE_WRITE16_MEMBER( bonzeadv_cchip_ctrl_w ); - DECLARE_WRITE16_MEMBER( bonzeadv_cchip_bank_w ); - DECLARE_WRITE16_MEMBER( bonzeadv_cchip_ram_w ); - DECLARE_WRITE_LINE_MEMBER(asuka_msm5205_vck); - - void mofflott(machine_config &config); - void asuka(machine_config &config); - void cadash(machine_config &config); - void eto(machine_config &config); - void galmedes(machine_config &config); - void bonzeadv(machine_config &config); - void asuka_map(address_map &map); - void bonzeadv_map(address_map &map); - void bonzeadv_z80_map(address_map &map); - void cadash_map(address_map &map); - void cadash_sub_io(address_map &map); - void cadash_sub_map(address_map &map); - void cadash_z80_map(address_map &map); - void eto_map(address_map &map); - void z80_map(address_map &map); -protected: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + optional_device m_cchip_irq_clear; }; #endif // MAME_INCLUDES_ASUKA_H diff --git a/src/mame/includes/taito_x.h b/src/mame/includes/taito_x.h index b0e5b6d7673..7e8ced532b6 100644 --- a/src/mame/includes/taito_x.h +++ b/src/mame/includes/taito_x.h @@ -28,7 +28,7 @@ public: DECLARE_DRIVER_INIT(kyustrkr); DECLARE_MACHINE_START(taitox); - TIMER_DEVICE_CALLBACK_MEMBER(scanline); + INTERRUPT_GEN_MEMBER(interrupt); TIMER_DEVICE_CALLBACK_MEMBER(cchip_irq_clear_cb); void superman(machine_config &config); diff --git a/src/mame/includes/volfied.h b/src/mame/includes/volfied.h index 13c315b8d6c..b1280af475f 100644 --- a/src/mame/includes/volfied.h +++ b/src/mame/includes/volfied.h @@ -44,7 +44,7 @@ public: virtual void machine_reset() override; virtual void video_start() override; uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_DEVICE_CALLBACK_MEMBER(scanline); + INTERRUPT_GEN_MEMBER(interrupt); TIMER_DEVICE_CALLBACK_MEMBER(cchip_irq_clear_cb); void refresh_pixel_layer( bitmap_ind16 &bitmap ); diff --git a/src/mame/machine/bonzeadv.cpp b/src/mame/machine/bonzeadv.cpp deleted file mode 100644 index 66c34528b5a..00000000000 --- a/src/mame/machine/bonzeadv.cpp +++ /dev/null @@ -1,463 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ernesto Corvi, Nicola Salmoria -/************************************************************************* - - Bonze Adventure C-Chip - ====================== - - Based on RAINE. Improvements with a lot of help from Ruben Panossian. - Additional thanks to Robert Gallagher and stephh. - - Verification on real hardware by Bryan McPhail, Feb 2006: - The restart positions on real hardware are affected by the level - variable, as well as scroll & player position. The old implementation - did not account for this and so overlapping map positions between - levels reported the wrong data. - - Restart data is confirmed correct & complete. Previously many - restart points were missed. - - Mapping of restart positions now accurate to the real hardware - - previously these values were approximated by hand (and many - missing). - -*************************************************************************/ - -#include "emu.h" -#include "includes/asuka.h" - -struct cchip_mapping -{ - uint16_t xmin; - uint16_t xmax; - uint16_t ymin; - uint16_t ymax; - uint16_t sx; - uint16_t sy; - uint16_t px; - uint16_t py; -}; - -static const uint16_t CLEV[][13] = -{ -/* map start player start player y-range player x-range map y-range map x-range time */ - { 0x0000, 0x0018, 0x0020, 0x0030, 0x0028, 0x00D0, 0x0050, 0x0090, 0x0000, 0x0118, 0x0000, 0x0C90, 0x3800 }, - { 0x0000, 0x0100, 0x0048, 0x0028, 0x0028, 0x0090, 0x0070, 0x00B0, 0x0000, 0x02C0, 0x0000, 0x0CA0, 0x3000 }, - { 0x0000, 0x0518, 0x0068, 0x00B8, 0x0028, 0x00D0, 0x0068, 0x00B0, 0x02F8, 0x0518, 0x0000, 0x0EF8, 0x3000 }, - { 0x0978, 0x0608, 0x00C8, 0x00B0, 0x0028, 0x00D0, 0x0098, 0x00C8, 0x0608, 0x06E8, 0x0000, 0x0A48, 0x2000 }, - { 0x0410, 0x0708, 0x0070, 0x0030, 0x0028, 0x00D0, 0x0060, 0x0090, 0x0708, 0x0708, 0x0410, 0x1070, 0x3800 }, - { 0x1288, 0x0808, 0x0099, 0x00CE, 0x0028, 0x00D0, 0x0060, 0x00C0, 0x0000, 0x0808, 0x1288, 0x1770, 0x3000 }, - { 0x11B0, 0x0908, 0x0118, 0x0040, 0x0028, 0x00D0, 0x00B0, 0x00C0, 0x0900, 0x0910, 0x0050, 0x11B0, 0x3800 }, - { 0x0000, 0x0808, 0x0028, 0x00B8, 0x0028, 0x00D0, 0x0070, 0x00B0, 0x0808, 0x0808, 0x0000, 0x0398, 0x1000 }, - { 0x06F8, 0x0808, 0x0028, 0x00B8, 0x0028, 0x00D0, 0x0070, 0x00B0, 0x0808, 0x0808, 0x06F8, 0x06F8, 0x8800 }, - { 0x06F8, 0x0808, 0x0028, 0x00B8, 0x0028, 0x00D0, 0x0070, 0x00B0, 0x0808, 0x0808, 0x06F8, 0x06F8, 0xffff }, - { 0x06F8, 0x0808, 0x0028, 0x00B8, 0x0028, 0x00D0, 0x0070, 0x00B0, 0x0808, 0x0808, 0x06F8, 0x06F8, 0xffff }, -}; - -static const struct cchip_mapping level00[] = -{ - /* X1 X2 Y1 Y2 => SX SY PX PY */ - { 0x0000, 0x0200, 0x0000, 0x0100, 0x0000, 0x0018, 0x0020, 0x00a8 }, - { 0x0200, 0x0380, 0x0000, 0x0100, 0x01e0, 0x0018, 0x0070, 0x0098 }, - { 0x0380, 0x0620, 0x0000, 0x0100, 0x04a0, 0x0018, 0x0070, 0x0090 }, - { 0x0620, 0x08f0, 0x0000, 0x0100, 0x06b8, 0x0018, 0x0078, 0x0078 }, - { 0x08f0, 0x0a20, 0x0000, 0x0100, 0x08c8, 0x0018, 0x0070, 0x0028 }, - { 0x0a20, 0x0c80, 0x0000, 0x0100, 0x0a68, 0x0018, 0x0070, 0x0058 }, - { 0x0c80, 0x0e00, 0x0000, 0x0100, 0x0c40, 0x0018, 0x0070, 0x0040 }, - - { 0x0380, 0x07c0, 0x0100, 0x0200, 0x0038, 0x0418, 0x0070, 0x00a8 }, - { 0xff } -}; - -static const struct cchip_mapping level01[] = -{ - /* X1 X2 Y1 Y2 => SX SY PX PY */ - { 0x0000, 0x0120, 0x0100, 0x0200, 0x0000, 0x0208, 0x0040, 0x0070 }, - - { 0x0000, 0x0120, 0x0200, 0x0300, 0x0000, 0x0208, 0x0040, 0x0070 }, - { 0x0120, 0x0460, 0x0200, 0x0300, 0x0080, 0x0218, 0x00b0, 0x0080 }, - { 0x0460, 0x0690, 0x0200, 0x0278, 0x0450, 0x01f8, 0x0090, 0x0030 }, - { 0x0460, 0x0690, 0x0278, 0x0300, 0x0450, 0x0218, 0x00a0, 0x00a0 }, - { 0x0690, 0x07d0, 0x0200, 0x0278, 0x0618, 0x01f8, 0x00a0, 0x0040 }, - { 0x0690, 0x07d0, 0x0278, 0x0300, 0x0628, 0x0218, 0x00a8, 0x00b0 }, - { 0x07d0, 0x08b0, 0x0200, 0x0300, 0x07a8, 0x0218, 0x0090, 0x0060 }, - { 0x08b0, 0x09d0, 0x0200, 0x0300, 0x0840, 0x0218, 0x0088, 0x0060 }, - { 0x09d0, 0x0b00, 0x0200, 0x0300, 0x0958, 0x0218, 0x00a0, 0x0070 }, - { 0x0b00, 0x0c90, 0x0200, 0x0300, 0x0a98, 0x0218, 0x0088, 0x0050 }, - { 0x0c90, 0x0e00, 0x0200, 0x0300, 0x0c20, 0x0200, 0x00a0, 0x0028 }, - { 0xff } -}; - -static const struct cchip_mapping level02[] = -{ - /* X1 X2 Y1 Y2 => SX SY PX PY */ - { 0x0000, 0x01c0, 0x04f4, 0x05f8, 0x0000, 0x0518, 0x0068, 0x00b0 }, - { 0x01c0, 0x03c0, 0x04f4, 0x05f8, 0x00d0, 0x0518, 0x0078, 0x0060 }, - { 0x03c0, 0x06e0, 0x04f4, 0x05f8, 0x02f0, 0x0518, 0x0078, 0x0048 }, - { 0x06e0, 0x0840, 0x04f4, 0x05f8, 0x0670, 0x0518, 0x0078, 0x0048 }, - { 0x0840, 0x0a10, 0x04f4, 0x05f8, 0x07d8, 0x0518, 0x0070, 0x0060 }, - { 0x0a10, 0x0b80, 0x04f4, 0x05f8, 0x09e8, 0x0500, 0x0080, 0x0080 }, - { 0x0b80, 0x1090, 0x04f4, 0x05f8, 0x0b20, 0x0418, 0x0070, 0x0080 }, - - { 0x0230, 0x03a0, 0x040c, 0x04f4, 0x02e8, 0x04b0, 0x0080, 0x0090 }, - { 0x03a0, 0x03b0, 0x040c, 0x04f4, 0x0278, 0x0318, 0x0078, 0x00a8 }, - { 0x0520, 0x08e0, 0x040c, 0x04f4, 0x0608, 0x0318, 0x0080, 0x0058 }, - { 0x08e0, 0x0a00, 0x040c, 0x04f4, 0x0878, 0x0318, 0x0078, 0x0098 }, - - { 0x0230, 0x03b0, 0x02f8, 0x040c, 0x0278, 0x0318, 0x0078, 0x00a8 }, - { 0x03b0, 0x0520, 0x02f8, 0x040c, 0x0390, 0x0318, 0x0070, 0x00b8 }, - { 0x0520, 0x08e0, 0x02f8, 0x040c, 0x0608, 0x0318, 0x0080, 0x0058 }, - { 0x08e0, 0x0a00, 0x02f8, 0x040c, 0x0878, 0x0318, 0x0078, 0x0098 } -}; - -static const struct cchip_mapping level03[] = -{ - /* X1 X2 Y1 Y2 => SX SY PX PY */ - { 0x0000, 0x0280, 0x0618, 0x06f8, 0x00d8, 0x0608, 0x00b8, 0x00a0 }, - { 0x0280, 0x0380, 0x0618, 0x06f8, 0x02b0, 0x0608, 0x00b8, 0x0090 }, - { 0x0380, 0x0620, 0x0618, 0x06f8, 0x02c8, 0x0608, 0x00c0, 0x0090 }, - { 0x0620, 0x0760, 0x0618, 0x06f8, 0x0630, 0x0608, 0x00c0, 0x0028 }, - { 0x0760, 0x0910, 0x0618, 0x06f8, 0x07e8, 0x0608, 0x00b8, 0x0078 }, - { 0x0910, 0x0a30, 0x0618, 0x06f8, 0x0930, 0x0608, 0x00b8, 0x0080 }, - { 0x0a30, 0x0b60, 0x0618, 0x06f8, 0x0a48, 0x0608, 0x00c0, 0x0068 }, - - { 0x0090, 0x01d0, 0x06f8, 0x07f8, 0x0020, 0x0610, 0x00b8, 0x00a8 }, - { 0xff } -}; - -static const struct cchip_mapping level04[] = -{ - /* X1 X2 Y1 Y2 => SX SY PX PY */ - { 0x0390, 0x06a0, 0x0704, 0x0804, 0x0560, 0x0708, 0x0068, 0x0090 }, - { 0x06a0, 0x0850, 0x0704, 0x0804, 0x0600, 0x0708, 0x0080, 0x0070 }, - { 0x0850, 0x09e0, 0x0704, 0x0804, 0x0860, 0x0708, 0x0060, 0x0090 }, - { 0x09e0, 0x0c00, 0x0704, 0x0804, 0x09c0, 0x0708, 0x0068, 0x0080 }, - { 0x0c00, 0x0da0, 0x0704, 0x0804, 0x0c58, 0x0708, 0x0068, 0x0070 }, - { 0x0da0, 0x0f80, 0x0704, 0x0804, 0x0d80, 0x0708, 0x0070, 0x00b0 }, - { 0x0f80, 0x1080, 0x0704, 0x0804, 0x0ea8, 0x0708, 0x0070, 0x00b0 }, - { 0x1080, 0x1230, 0x0704, 0x0804, 0x0fc0, 0x0708, 0x0080, 0x0030 }, - { 0xff } -}; - -static const struct cchip_mapping level05[] = -{ - /* X1 X2 Y1 Y2 => SX SY PX PY */ - { 0x1280, 0x1370, 0x800, 0x900, 0x1288, 0x0808, 0x0099, 0x00ce }, - { 0x1370, 0x14e0, 0x800, 0x900, 0x12f0, 0x0808, 0x0078, 0x0028 }, - { 0x14e0, 0x1660, 0x800, 0x900, 0x1488, 0x0808, 0x0080, 0x0070 }, - { 0x1660, 0x18f0, 0x800, 0x900, 0x1600, 0x0808, 0x0080, 0x0090 }, - - { 0x1480, 0x1640, 0x6f8, 0x800, 0x1508, 0x0708, 0x0080, 0x0090 }, - { 0x1640, 0x1760, 0x6f8, 0x800, 0x16e8, 0x06f0, 0x0080, 0x0058 }, - { 0x1760, 0x1900, 0x6f8, 0x800, 0x1770, 0x0728, 0x0080, 0x0080 }, - - { 0x14e0, 0x1570, 0x6a0, 0x6f8, 0x1508, 0x05e8, 0x0040, 0x0088 }, - { 0x1570, 0x1680, 0x6a0, 0x6f8, 0x1568, 0x0608, 0x0080, 0x0090 }, - { 0x1680, 0x1770, 0x6a0, 0x6f8, 0x1640, 0x05e8, 0x0088, 0x0088 }, - { 0x1770, 0x18d0, 0x6a0, 0x6f8, 0x1770, 0x0650, 0x00d8, 0x0070 }, - - { 0x14e0, 0x1570, 0x664, 0x6a0, 0x1508, 0x05e8, 0x0040, 0x0088 }, - { 0x1570, 0x1680, 0x664, 0x6a0, 0x1578, 0x05d0, 0x0098, 0x0060 }, - { 0x1680, 0x1770, 0x664, 0x6a0, 0x1640, 0x05e8, 0x0088, 0x0088 }, - { 0x1770, 0x18d0, 0x664, 0x6a0, 0x1770, 0x0650, 0x00d8, 0x0070 }, - - { 0x14e0, 0x1570, 0x624, 0x664, 0x1508, 0x05e8, 0x0040, 0x0088 }, - { 0x1570, 0x1680, 0x624, 0x664, 0x1578, 0x05d0, 0x0098, 0x0060 }, - { 0x1680, 0x1770, 0x624, 0x664, 0x1640, 0x05e8, 0x0088, 0x0088 }, - { 0x1770, 0x18d0, 0x624, 0x664, 0x1770, 0x0588, 0x0090, 0x0088 }, - - { 0x14e0, 0x1570, 0x5d4, 0x624, 0x1508, 0x05e8, 0x0040, 0x0088 }, - { 0x1570, 0x1680, 0x5d4, 0x624, 0x1578, 0x05d0, 0x0098, 0x0060 }, - { 0x1680, 0x16a0, 0x5d4, 0x624, 0x1630, 0x0528, 0x0088, 0x0088 }, - { 0x16a0, 0x1770, 0x5d4, 0x624, 0x1658, 0x0528, 0x0088, 0x0088 }, - { 0x1770, 0x18d0, 0x5d4, 0x624, 0x1770, 0x0588, 0x0090, 0x0088 }, - - { 0x14e0, 0x15d0, 0x5a4, 0x5d4, 0x1508, 0x0580, 0x0040, 0x0080 }, - { 0x15d0, 0x15f0, 0x5a4, 0x5d4, 0x1508, 0x04f8, 0x0080, 0x0060 }, - { 0x15f0, 0x1630, 0x5a4, 0x5d4, 0x1580, 0x04f8, 0x0068, 0x0080 }, - { 0x1630, 0x16a0, 0x5a4, 0x5d4, 0x1630, 0x0530, 0x0088, 0x0080 }, - { 0x16a0, 0x17b0, 0x5a4, 0x5d4, 0x1658, 0x0528, 0x0088, 0x0088 }, - { 0x17b0, 0x18c0, 0x5a4, 0x5d4, 0x1770, 0x0508, 0x0098, 0x0088 }, - - { 0x14e0, 0x15f0, 0x4f8, 0x5a4, 0x1508, 0x04f8, 0x0080, 0x0060 }, - { 0x15f0, 0x1670, 0x4f8, 0x5a4, 0x15c8, 0x0548, 0x00a8, 0x0070 }, - { 0x1670, 0x1750, 0x4f8, 0x5a4, 0x1680, 0x0528, 0x00a8, 0x0070 }, - { 0x1750, 0x18d0, 0x4f8, 0x5a4, 0x1770, 0x04a0, 0x00a8, 0x0078 }, - - { 0x14e0, 0x1630, 0x478, 0x4f8, 0x1508, 0x04f8, 0x0080, 0x0060 }, - { 0x1630, 0x16b0, 0x478, 0x4f8, 0x15d0, 0x0440, 0x00b8, 0x0078 }, - { 0x16b0, 0x1760, 0x478, 0x4f8, 0x1660, 0x0460, 0x0080, 0x0060 }, - { 0x1760, 0x17f0, 0x478, 0x4f8, 0x1738, 0x0420, 0x0090, 0x0070 }, - { 0x17f0, 0x18d0, 0x478, 0x4f8, 0x1770, 0x0450, 0x00d8, 0x0060 }, - - { 0x14e0, 0x16d0, 0x3f8, 0x478, 0x1500, 0x03e8, 0x0090, 0x0058 }, - { 0x16d0, 0x17f0, 0x3f8, 0x478, 0x16e0, 0x0398, 0x0068, 0x0068 }, - { 0x17f0, 0x18d0, 0x3f8, 0x478, 0x1770, 0x0450, 0x00d8, 0x0060 }, - - { 0x14e0, 0x1610, 0x35c, 0x3f8, 0x1518, 0x0368, 0x0090, 0x0058 }, - { 0x1610, 0x16b0, 0x35c, 0x3f8, 0x15b0, 0x0340, 0x0098, 0x0058 }, - { 0x16b0, 0x17e0, 0x35c, 0x3f8, 0x1728, 0x0320, 0x0068, 0x0068 }, - { 0x17e0, 0x18d0, 0x35c, 0x3f8, 0x1770, 0x0330, 0x00c0, 0x0080 }, - - { 0x14e0, 0x1650, 0x2f8, 0x35c, 0x1518, 0x0368, 0x0090, 0x0058 }, - { 0x1650, 0x17d0, 0x2f8, 0x35c, 0x1630, 0x02b0, 0x0088, 0x0060 }, - { 0x17d0, 0x18d0, 0x2f8, 0x35c, 0x1740, 0x02a8, 0x0090, 0x0058 }, - - { 0x14e0, 0x1650, 0x268, 0x2f8, 0x15a8, 0x0268, 0x0080, 0x0058 }, - { 0x1650, 0x17b0, 0x268, 0x2f8, 0x1650, 0x0250, 0x0080, 0x0058 }, - { 0x17b0, 0x18d0, 0x268, 0x2f8, 0x1740, 0x02a8, 0x0090, 0x0058 }, - - { 0x14e0, 0x15f0, 0x1d8, 0x268, 0x1508, 0x0208, 0x0078, 0x0060 }, - { 0x15f0, 0x17b0, 0x1d8, 0x268, 0x16c8, 0x0178, 0x0080, 0x0060 }, - { 0x17b0, 0x18d0, 0x1d8, 0x268, 0x1740, 0x02a8, 0x0090, 0x0058 }, - - { 0x14e0, 0x18d0, 0x158, 0x1d8, 0x1610, 0x0110, 0x0078, 0x0068 }, - { 0x14e0, 0x18d0, 0x158, 0x1d8, 0x1610, 0x0110, 0x0078, 0x0068 }, - - { 0x14d0, 0x18d0, 0x15c, 0x19c, 0x1618, 0x0110, 0x0078, 0x0068 }, - { 0x14d0, 0x15b0, 0x19c, 0x1bc, 0x1618, 0x0110, 0x0078, 0x0068 }, - { 0x15b0, 0x1670, 0x19c, 0x1bc, 0x1580, 0x0128, 0x0070, 0x0080 }, - { 0x1670, 0x18d0, 0x19c, 0x1bc, 0x1618, 0x0110, 0x0078, 0x0068 }, - { 0x14d0, 0x14f0, 0x1bc, 0x1dc, 0x1618, 0x0110, 0x0078, 0x0068 }, - { 0x14f0, 0x15f0, 0x1bc, 0x1dc, 0x1508, 0x0208, 0x0078, 0x0060 }, - { 0x15f0, 0x1670, 0x1bc, 0x1dc, 0x1580, 0x0128, 0x0070, 0x0080 }, - { 0x1670, 0x18d0, 0x1bc, 0x1dc, 0x1618, 0x0110, 0x0078, 0x0068 }, - - { 0x14d0, 0x14f0, 0x1bc, 0x1dc, 0x1618, 0x0110, 0x0078, 0x0068 }, - { 0x14f0, 0x1670, 0x18c, 0x1bc, 0x1508, 0x0208, 0x0078, 0x0060 }, - - { 0x14d0, 0x15b0, 0x18c, 0x1bc, 0x1618, 0x0110, 0x0078, 0x0068 }, - { 0x15b0, 0x1670, 0x18c, 0x1bc, 0x1580, 0x0128, 0x0070, 0x0080 }, - { 0x1670, 0x18d0, 0x18c, 0x1bc, 0x1618, 0x0110, 0x0078, 0x0068 }, - - { 0x14d0, 0x18d0, 0x15c, 0x18c, 0x1618, 0x0110, 0x0078, 0x0068 }, - - { 0x14e0, 0x1840, 0x098, 0x15c, 0x16b0, 0x00b0, 0x0088, 0x0060 }, - { 0x1840, 0x18d0, 0x088, 0x15c, 0x1770, 0x0118, 0x00c0, 0x0060 }, - - { 0x1250, 0x15a0, 0x000, 0x108, 0x1500, 0x0000, 0x0080, 0x0048 }, - { 0x15a0, 0x16f0, 0x000, 0x098, 0x1698, 0x0000, 0x0080, 0x0050 }, - { 0x16f0, 0x18d0, 0x000, 0x088, 0x1770, 0x0000, 0x00b8, 0x0060 }, - - { 0x1250, 0x14e0, 0x000, 0x10c, 0x1500, 0x0000, 0x0080, 0x0048 }, - { 0x14e0, 0x15a0, 0x000, 0x09c, 0x1500, 0x0000, 0x0080, 0x0048 }, - { 0x15a0, 0x16f0, 0x000, 0x09c, 0x1698, 0x0000, 0x0080, 0x0050 }, - { 0x16f0, 0x1830, 0x000, 0x09c, 0x1770, 0x0000, 0x00b8, 0x0060 }, - { 0x1830, 0x18d0, 0x000, 0x09c, 0x1770, 0x0118, 0x00c0, 0x0060 }, - - { 0x14e0, 0x1830, 0x09c, 0x158, 0x16b0, 0x00b0, 0x0088, 0x0060 }, - { 0x1830, 0x18d0, 0x09c, 0x158, 0x1770, 0x0118, 0x00c0, 0x0060 }, - - //-------------------------- - { 0x14e0, 0x1650, 0x29c, 0x2f0, 0x15a8, 0x0268, 0x0080, 0x0058 }, - { 0x14e0, 0x1610, 0x2f0, 0x3fc, 0x1518, 0x0368, 0x0090, 0x0058 }, - { 0x14e0, 0x1630, 0x3fc, 0x46c, 0x1500, 0x03e8, 0x0090, 0x0058 }, - { 0x14e0, 0x1630, 0x46c, 0x51c, 0x1508, 0x04f8, 0x0080, 0x0060 }, - { 0x14e0, 0x15f0, 0x51c, 0x59c, 0x1508, 0x04f8, 0x0080, 0x0060 }, - { 0x14e0, 0x15f0, 0x59c, 0x5d8, 0x1508, 0x0580, 0x0040, 0x0080 }, - { 0x14e0, 0x1570, 0x5d8, 0x700, 0x1508, 0x05e8, 0x0040, 0x0088 }, - { 0x1480, 0x1640, 0x700, 0x808, 0x1508, 0x0708, 0x0080, 0x0090 }, - - { 0x0000, 0x18d0, 0x000, 0x900, 0x1288, 0x0808, 0x0099, 0x00ce }, - { 0xff } -}; - -static const struct cchip_mapping level06[] = -{ - /* X1 X2 Y1 Y2 => SX SY PX PY */ - { 0x0000, 0x01a0, 0x0904, 0x0a04, 0x00d0, 0x0908, 0x00b0, 0x0090 }, - { 0x01a0, 0x04e0, 0x0904, 0x0a04, 0x03d0, 0x0908, 0x00b0, 0x0038 }, - { 0x04e0, 0x0740, 0x0904, 0x0a04, 0x0660, 0x0908, 0x00b0, 0x0098 }, - { 0x0740, 0x0950, 0x0904, 0x0a04, 0x07e8, 0x0908, 0x00b8, 0x00b8 }, - { 0x0950, 0x0a80, 0x0904, 0x0a04, 0x08f8, 0x0908, 0x00b0, 0x0080 }, - { 0x0a80, 0x0da0, 0x0904, 0x0a04, 0x0cd0, 0x0908, 0x00b8, 0x00b0 }, - { 0x0da0, 0x0f40, 0x0904, 0x0a04, 0x0e08, 0x0908, 0x00b8, 0x0070 }, - { 0x0f40, 0x10c0, 0x0904, 0x0a04, 0x0fe8, 0x0908, 0x00b8, 0x0098 }, - { 0x10c0, 0x1370, 0x0904, 0x0a04, 0x1140, 0x0908, 0x00b8, 0x0068 }, - { 0xff } -}; - -static const struct cchip_mapping level07[] = -{ - /* X1 X2 Y1 Y2 => SX SY PX PY */ - { 0x0000, 0x0570, 0x0804, 0x0904, 0x0000, 0x0808, 0x0028, 0x00b8 }, - { 0xff } -}; - -static const struct cchip_mapping level08[] = -{ - /* X1 X2 Y1 Y2 => SX SY PX PY */ - { 0x0000, 0xf000, 0x0000, 0xf000, 0x06f8, 0x0808, 0x0028, 0x00b8 }, - { 0xff } -}; - -static const struct cchip_mapping *const levelData[]= -{ - level00, - level01, - level02, - level03, - level04, - level05, - level06, - level07, - level08 -}; - -void asuka_state::WriteLevelData() -{ - int i; - - for (i = 0; i < 13; i++) - { - uint16_t v = CLEV[m_current_round][i]; - - m_cval[2 * i + 0] = v & 0xff; - m_cval[2 * i + 1] = v >> 8; - } -} - -void asuka_state::WriteRestartPos(int level ) -{ - /* - Cval0/1 = scroll x position - Cval4/5 = player x screen position - Cval2/3 = scroll y position - Cval6/7 = player y screen position - - These are combined to find the absolute player position - on the map, which is then given to the C-Chip in order - for the restart position to be returned. - */ - int x = m_cval[0] + 256 * m_cval[1] + m_cval[4] + 256 * m_cval[5]; - int y = m_cval[2] + 256 * m_cval[3] + m_cval[6] + 256 * m_cval[7]; - - const struct cchip_mapping* thisLevel = levelData[level]; - - while (thisLevel->xmin != 0xff) - { - if (x >= thisLevel->xmin && x < thisLevel->xmax && - y >= thisLevel->ymin && y < thisLevel->ymax) - { - m_cval[0] = thisLevel->sx & 0xff; - m_cval[1] = thisLevel->sx >> 8; - m_cval[2] = thisLevel->sy & 0xff; - m_cval[3] = thisLevel->sy >> 8; - m_cval[4] = thisLevel->px & 0xff; - m_cval[5] = thisLevel->px >> 8; - m_cval[6] = thisLevel->py & 0xff; - m_cval[7] = thisLevel->py >> 8; - - // Restart position found ok - m_restart_status = 0; - - return; - } - - thisLevel++; - } - - // No restart position found for this position (cval0-7 confirmed unchanged in this case) - m_restart_status = 0xff; -} - - -/************************************* - * - * Writes to C-Chip - Important Bits - * - *************************************/ - -WRITE16_MEMBER(asuka_state::bonzeadv_cchip_ctrl_w) -{ - /* value 2 is written here */ -} - -WRITE16_MEMBER(asuka_state::bonzeadv_cchip_bank_w) -{ - m_current_bank = data & 7; -} - -WRITE16_MEMBER(asuka_state::bonzeadv_cchip_ram_w) -{ -// if (m_maincpu->pc()!=0xa028) -// logerror("%08x: write %04x %04x cchip\n", m_maincpu->pc(), offset, data); - data &= mem_mask; - - if (m_current_bank == 0) - { - if (offset == 0x08) - { - m_cc_port = data; - - machine().bookkeeping().coin_lockout_w(1, data & 0x80); - machine().bookkeeping().coin_lockout_w(0, data & 0x40); - machine().bookkeeping().coin_counter_w(1, data & 0x20); - machine().bookkeeping().coin_counter_w(0, data & 0x10); - } - - if (offset == 0x0e && data != 0x00) - { - WriteRestartPos(m_current_round); - } - - if (offset == 0x0f && data != 0x00) - { - WriteLevelData(); - } - - if (offset == 0x10) - { - m_current_round = data; - } - - if (offset >= 0x11 && offset <= 0x2a) - { - m_cval[offset - 0x11] = data; - } - } -} - -/************************************* - * - * Reads from C-Chip - * - *************************************/ - -READ16_MEMBER(asuka_state::bonzeadv_cchip_ctrl_r) -{ - /* - Bit 2 = Error signal - Bit 0 = Ready signal - */ - return 0x01; /* Return 0x05 for C-Chip error */ -} - -READ16_MEMBER(asuka_state::bonzeadv_cchip_ram_r) -{ -// logerror("%08x: read %04x cchip\n", m_maincpu->pc(), offset); - - if (m_current_bank == 0) - { - switch (offset) - { - case 0x03: return ioport("800007")->read(); /* STARTn + SERVICE1 */ - case 0x04: return ioport("800009")->read(); /* COINn */ - case 0x05: return ioport("80000B")->read(); /* Player controls + TILT */ - case 0x06: return ioport("80000D")->read(); /* Player controls (cocktail) */ - case 0x08: return m_cc_port; - } - - if (offset == 0x0e) - { - return m_restart_status; /* 0xff signals error, 0 signals ok */ - } - - if (offset >= 0x11 && offset <= 0x2a) - { - return m_cval[offset - 0x11]; - } - } - - return 0; -} diff --git a/src/mame/machine/bonzeadv.h b/src/mame/machine/bonzeadv.h deleted file mode 100644 index ec8eae48de4..00000000000 --- a/src/mame/machine/bonzeadv.h +++ /dev/null @@ -1,2 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ernesto Corvi, Nicola Salmoria