diff options
Diffstat (limited to 'src/mame/taito/pitnrun.cpp')
-rw-r--r-- | src/mame/taito/pitnrun.cpp | 205 |
1 files changed, 132 insertions, 73 deletions
diff --git a/src/mame/taito/pitnrun.cpp b/src/mame/taito/pitnrun.cpp index f6c92a625a4..06225b3bc0e 100644 --- a/src/mame/taito/pitnrun.cpp +++ b/src/mame/taito/pitnrun.cpp @@ -71,6 +71,7 @@ K1000233A #include "cpu/m6805/m68705.h" #include "cpu/z80/z80.h" +#include "machine/74157.h" #include "machine/74259.h" #include "machine/gen_latch.h" #include "machine/watchdog.h" @@ -90,6 +91,8 @@ public: pitnrun_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), + m_watchdog(*this, "watchdog"), + m_inputmux(*this, "inputmux"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), m_videoram(*this, "videoram%u", 1U), @@ -99,15 +102,21 @@ public: void pitnrun(machine_config &config); + void tilt_w(int state); // TODO: privatize eventually + protected: virtual void machine_start() override; virtual void video_start() override; + uint8_t inputs_r(); + required_device<cpu_device> m_maincpu; - void main_map(address_map &map); + void base_map(address_map &map); private: + required_device<watchdog_timer_device> m_watchdog; + required_device<ls157_x2_device> m_inputmux; required_device<gfxdecode_device> m_gfxdecode; required_device<palette_device> m_palette; @@ -127,22 +136,25 @@ private: tilemap_t *m_bg = nullptr; tilemap_t *m_fg = nullptr; - DECLARE_WRITE_LINE_MEMBER(nmi_enable_w); - DECLARE_WRITE_LINE_MEMBER(hflip_w); - DECLARE_WRITE_LINE_MEMBER(vflip_w); + void nmi_enable_w(int state); + void hflip_w(int state); + void vflip_w(int state); + uint8_t inputs_watchdog_r(); template <uint8_t Which> void videoram_w(offs_t offset, uint8_t data); - DECLARE_WRITE_LINE_MEMBER(char_bank_select_w); + void char_bank_select_w(int state); void scroll_w(offs_t offset, uint8_t data); void scroll_y_w(uint8_t data); void ha_w(uint8_t data); void h_heed_w(uint8_t data); void v_heed_w(uint8_t data); - DECLARE_WRITE_LINE_MEMBER(color_select_w); + void color_select_w(int state); TILE_GET_INFO_MEMBER(get_tile_info_fg); TILE_GET_INFO_MEMBER(get_tile_info_bg); - INTERRUPT_GEN_MEMBER(nmi_source); + void vbl_w(int state); + + void main_map(address_map &map); void palette(palette_device &palette) const; @@ -195,8 +207,6 @@ private: }; -// video - /*************************************************************************** - BG layer 32x128 , 8x8 tiles 4bpp , 2 palettes (2nd is black ) @@ -242,7 +252,7 @@ void pitnrun_state::videoram_w(offs_t offset, uint8_t data) Which ? m_bg->mark_all_dirty() : m_fg->mark_all_dirty(); } -WRITE_LINE_MEMBER(pitnrun_state::char_bank_select_w) +void pitnrun_state::char_bank_select_w(int state) { m_char_bank = state; m_bg->mark_all_dirty(); @@ -275,7 +285,7 @@ void pitnrun_state::v_heed_w(uint8_t data) m_v_heed = data; } -WRITE_LINE_MEMBER(pitnrun_state::color_select_w) +void pitnrun_state::color_select_w(int state) { m_color_select = state; machine().tilemap().mark_all_dirty(); @@ -388,7 +398,7 @@ void pitnrun_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect if (flip_screen_x()) { - sx = 256 - sx; + sx = 242 - sx; flipx = !flipx; } if (flip_screen_y()) @@ -599,8 +609,6 @@ uint8_t pitnrun_mcu_state::m68705_portc_r() } -// machine - void pitnrun_state::machine_start() { save_item(NAME(m_nmi)); @@ -626,30 +634,49 @@ void pitnrun_mcu_state::machine_reset() m_mcu->set_input_line(0, CLEAR_LINE); } -INTERRUPT_GEN_MEMBER(pitnrun_state::nmi_source) +void pitnrun_state::tilt_w(int state) { - if (m_nmi) - device.execute().set_input_line(INPUT_LINE_NMI, ASSERT_LINE); + // HACK: this input actually asserts the master reset line on all devices + if (state) + reset(); } -WRITE_LINE_MEMBER(pitnrun_state::nmi_enable_w) +void pitnrun_state::vbl_w(int state) +{ + if (state && m_nmi) + m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); +} + +void pitnrun_state::nmi_enable_w(int state) { m_nmi = state; if (!m_nmi) m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); } -WRITE_LINE_MEMBER(pitnrun_state::hflip_w) +void pitnrun_state::hflip_w(int state) { flip_screen_x_set(state); } -WRITE_LINE_MEMBER(pitnrun_state::vflip_w) +void pitnrun_state::vflip_w(int state) { flip_screen_y_set(state); } -void pitnrun_state::main_map(address_map &map) +uint8_t pitnrun_state::inputs_r() +{ + return ~m_inputmux->output_r(); +} + +uint8_t pitnrun_state::inputs_watchdog_r() +{ + if (!machine().side_effects_disabled()) + m_watchdog->reset_w(); + return ~m_inputmux->output_r(); +} + +void pitnrun_state::base_map(address_map &map) { map(0x0000, 0x7fff).rom(); map(0x8000, 0x87ff).ram(); @@ -660,21 +687,28 @@ void pitnrun_state::main_map(address_map &map) map(0xa800, 0xa807).w("noiselatch", FUNC(ls259_device::write_d0)); // analog sound map(0xb000, 0xb000).portr("DSW"); map(0xb000, 0xb007).w("mainlatch", FUNC(ls259_device::write_d0)); - map(0xb800, 0xb800).portr("INPUTS").w("soundlatch", FUNC(generic_latch_8_device::write)); + map(0xb800, 0xb800).w("soundlatch", FUNC(generic_latch_8_device::write)); map(0xc800, 0xc801).w(FUNC(pitnrun_state::scroll_w)); map(0xc802, 0xc802).w(FUNC(pitnrun_state::scroll_y_w)); map(0xc805, 0xc805).w(FUNC(pitnrun_state::h_heed_w)); map(0xc806, 0xc806).w(FUNC(pitnrun_state::v_heed_w)); map(0xc807, 0xc807).w(FUNC(pitnrun_state::ha_w)); - map(0xf000, 0xf000).r("watchdog", FUNC(watchdog_timer_device::reset_r)); +} + +void pitnrun_state::main_map(address_map &map) +{ + base_map(map); + map(0xb800, 0xb800).r(FUNC(pitnrun_state::inputs_watchdog_r)); } void pitnrun_mcu_state::mcu_map(address_map &map) { - main_map(map); + base_map(map); + map(0xb800, 0xb800).r(FUNC(pitnrun_mcu_state::inputs_r)); map(0xc804, 0xc804).w(FUNC(pitnrun_mcu_state::mcu_data_w)); map(0xd000, 0xd000).r(FUNC(pitnrun_mcu_state::mcu_data_r)); map(0xd800, 0xd800).r(FUNC(pitnrun_mcu_state::mcu_status_r)); + map(0xf000, 0xf000).r("watchdog", FUNC(watchdog_timer_device::reset_r)); } void pitnrun_state::sound_prg_map(address_map &map) @@ -702,20 +736,25 @@ static INPUT_PORTS_START( pitnrun ) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START2 ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) + PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("INPUTS") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_4WAY - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_4WAY - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_4WAY - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_4WAY - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("COCKTAIL") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_COCKTAIL + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_COCKTAIL + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_COCKTAIL + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_COCKTAIL + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_START("DSW") PORT_DIPNAME( 0x07, 0x01, DEF_STR( Coinage ) ) PORT_DIPLOCATION("DSW:1,2,3") @@ -738,39 +777,21 @@ static INPUT_PORTS_START( pitnrun ) PORT_DIPNAME( 0x80, 0x00, "No Hit (Cheat)") PORT_DIPLOCATION("DSW:8") PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x80, DEF_STR( On ) ) // also enables bootup test + + PORT_START("TILT") + PORT_BIT( 1, IP_ACTIVE_HIGH, IPT_TILT ) PORT_WRITE_LINE_MEMBER(pitnrun_state, tilt_w) INPUT_PORTS_END static INPUT_PORTS_START( jumpkun ) - PORT_START("SYSTEM") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SERVICE1 ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START2 ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) + PORT_INCLUDE(pitnrun) - PORT_START("INPUTS") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_4WAY - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_4WAY - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_4WAY - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_4WAY - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) + PORT_MODIFY("INPUTS") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) - PORT_START("DSW") - PORT_DIPNAME( 0x07, 0x01, DEF_STR( Coinage ) ) PORT_DIPLOCATION("DSW:1,2,3") - PORT_DIPSETTING( 0x00, DEF_STR( 2C_1C ) ) - PORT_DIPSETTING( 0x01, DEF_STR( 1C_1C ) ) - PORT_DIPSETTING( 0x02, DEF_STR( 1C_2C ) ) - PORT_DIPSETTING( 0x03, DEF_STR( 1C_3C ) ) - PORT_DIPSETTING( 0x04, DEF_STR( 1C_4C ) ) - PORT_DIPSETTING( 0x05, DEF_STR( 1C_5C ) ) - PORT_DIPSETTING( 0x06, DEF_STR( 1C_6C ) ) - PORT_DIPSETTING( 0x07, DEF_STR( 1C_7C ) ) + PORT_MODIFY("COCKTAIL") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL + + PORT_MODIFY("DSW") PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW:4") PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x08, DEF_STR( On ) ) @@ -821,9 +842,8 @@ GFXDECODE_END void pitnrun_state::pitnrun(machine_config &config) { - Z80(config, m_maincpu, XTAL(18'432'000) / 6); // verified on PCB + Z80(config, m_maincpu, 18.432_MHz_XTAL / 6); // verified on PCB m_maincpu->set_addrmap(AS_PROGRAM, &pitnrun_state::main_map); - m_maincpu->set_vblank_int("screen", FUNC(pitnrun_state::nmi_source)); ls259_device &mainlatch(LS259(config, "mainlatch")); // 7B (mislabeled LS156 on schematic) mainlatch.q_out_cb<0>().set(FUNC(pitnrun_state::nmi_enable_w)); // NMION @@ -831,25 +851,28 @@ void pitnrun_state::pitnrun(machine_config &config) mainlatch.q_out_cb<4>().set_nop(); // COLOR SEL 2 - not used ? mainlatch.q_out_cb<5>().set(FUNC(pitnrun_state::char_bank_select_w)); mainlatch.q_out_cb<6>().set(FUNC(pitnrun_state::hflip_w)); // HFLIP + mainlatch.q_out_cb<6>().append(m_inputmux, FUNC(ls157_x2_device::select_w)); mainlatch.q_out_cb<7>().set(FUNC(pitnrun_state::vflip_w)); // VFLIP - z80_device &audiocpu(Z80(config, "audiocpu", XTAL(5'000'000) / 2)); // verified on PCB + LS157_X2(config, m_inputmux); // 2F (0-3) & 2H (4-7) + m_inputmux->a_in_callback().set_ioport("INPUTS"); + m_inputmux->b_in_callback().set_ioport("COCKTAIL"); + + z80_device &audiocpu(Z80(config, "audiocpu", 5_MHz_XTAL / 2)); // verified on PCB audiocpu.set_addrmap(AS_PROGRAM, &pitnrun_state::sound_prg_map); audiocpu.set_addrmap(AS_IO, &pitnrun_state::sound_io_map); audiocpu.set_vblank_int("screen", FUNC(pitnrun_state::irq0_line_hold)); - WATCHDOG_TIMER(config, "watchdog"); + WATCHDOG_TIMER(config, m_watchdog).set_vblank_count("screen", 16); // LS393 at 8N (+ misc. gates) config.set_maximum_quantum(attotime::from_hz(6000)); // video hardware screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); - screen.set_refresh_hz(60); - screen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); - screen.set_size(256, 256); - screen.set_visarea(0*8, 32*8-1, 2*8, 30*8-1); + screen.set_raw(18.432_MHz_XTAL / 3, 384, 0, 256, 264, 16, 240); screen.set_screen_update(FUNC(pitnrun_state::screen_update)); screen.set_palette(m_palette); + screen.screen_vblank().set(FUNC(pitnrun_state::vbl_w)); GFXDECODE(config, m_gfxdecode, m_palette, gfx_pitnrun); PALETTE(config, m_palette, FUNC(pitnrun_state::palette), 32 * 3); @@ -878,7 +901,7 @@ void pitnrun_mcu_state::pitnrun_mcu(machine_config &config) m_maincpu->set_addrmap(AS_PROGRAM, &pitnrun_mcu_state::mcu_map); - M68705P5(config, m_mcu, XTAL(18'432'000) / 6); // verified on PCB + M68705P5(config, m_mcu, 18.432_MHz_XTAL / 6); // verified on PCB m_mcu->porta_r().set(FUNC(pitnrun_mcu_state::m68705_porta_r)); m_mcu->portb_r().set(FUNC(pitnrun_mcu_state::m68705_portb_r)); m_mcu->portc_r().set(FUNC(pitnrun_mcu_state::m68705_portc_r)); @@ -956,6 +979,41 @@ ROM_START( pitnruna ) ROM_LOAD( "clr.3", 0x0040, 0x0020, CRC(25e70e5e) SHA1(fdb9c69e9568a725dd0e3ac25835270fb4f49280) ) ROM_END +ROM_START( pitnrunb ) // all labels handwritten + ROM_REGION( 0x8000, "maincpu", 0 ) + ROM_LOAD( "test.a1", 0x0000, 0x2000, CRC(395b5514) SHA1(af5c8eb4b99a0bdcd3565e121a407febd560a2a5) ) + ROM_LOAD( "test.a2", 0x2000, 0x2000, CRC(09ffb063) SHA1(cf0aaf938366122a1c4f1b8f38f92c322ae9cb48) ) + ROM_LOAD( "test.a3", 0x4000, 0x2000, CRC(4f96e346) SHA1(e33c82fce30f769fb4e706f937c6c5344065cba6) ) + ROM_LOAD( "test.a4", 0x6000, 0x2000, CRC(3d04ef80) SHA1(17c966eb1256813302e1bce86fb6bd860138ef88) ) + + ROM_REGION( 0x2000, "audiocpu", 0 ) + ROM_LOAD( "sound", 0x0000, 0x1000, CRC(fbd63042) SHA1(a473b42b76599a37434772ea1aa113397a842c1f) ) + + ROM_REGION( 0x0800, "mcu", 0 ) // not dumped for this set, but seems to work fine. Marked 15-00011-001 DA68233 + ROM_LOAD( "a11_17.3a", 0x0000, 0x0800, BAD_DUMP CRC(e7d5d6e1) SHA1(c1131d6fcc36926e287be26090a3c89f22feaa35) ) + + ROM_REGION( 0x6000, "sprites", 0 ) + ROM_LOAD( "obj3", 0x0000, 0x2000, CRC(c3b3131e) SHA1(ed0463e7eef452d7fbdcb031f9477825e9780943) ) + ROM_LOAD( "obj2", 0x2000, 0x2000, CRC(2fa1682a) SHA1(9daefb525fd69f0d9a45ff27e89865545e177a5a) ) + ROM_LOAD( "obj1", 0x4000, 0x2000, CRC(e678fe39) SHA1(134e36fd30bf3cf5884732f3455ca4d9dab6b665) ) + + ROM_REGION( 0x4000, "bgtiles", 0 ) + ROM_LOAD( "chr1", 0x0000, 0x2000, CRC(fbae3504) SHA1(ce799dfd653462c0814e7530f3f8a686ab0ad7f4) ) + ROM_LOAD( "chr2", 0x2000, 0x2000, CRC(c9177180) SHA1(98c8f8f586b78b88dba254bd662642ee27f9b131) ) + + ROM_REGION( 0x2000, "fgtiles", 0 ) + ROM_LOAD( "bsc1", 0x0000, 0x1000, CRC(c53cb897) SHA1(81a73e6031b52fa45ec507ff4264b14474ef42a2) ) + ROM_LOAD( "bsc2", 0x1000, 0x1000, CRC(7cdf9a55) SHA1(404dface7e09186e486945981e39063929599efc) ) + + ROM_REGION( 0x2000, "spot", 0 ) + ROM_LOAD( "lightdata", 0x0000, 0x2000, CRC(8e346d10) SHA1(1362ce4362c2d28c48fbd8a33da0cec5ef8e321f) ) + + ROM_REGION( 0x0060, "proms", 0 ) + ROM_LOAD( "bp1", 0x0000, 0x0020, CRC(643012f4) SHA1(4a0c9766b9da456e39ce379ad62d695bf82413b0) ) + ROM_LOAD( "bp2", 0x0020, 0x0020, CRC(50705f02) SHA1(a3d348678fd66f37c7a0d29af88f40740918b8d3) ) + ROM_LOAD( "bp3", 0x0040, 0x0020, CRC(25e70e5e) SHA1(fdb9c69e9568a725dd0e3ac25835270fb4f49280) ) +ROM_END + ROM_START( jumpkun ) ROM_REGION( 0x8000, "maincpu", 0 ) ROM_LOAD( "pr1.5d.2764", 0x00000, 0x02000, CRC(b0eabe9f) SHA1(e662f3946efe72b0bbf6c6934201163f765bb7aa) ) @@ -997,4 +1055,5 @@ ROM_END GAME( 1984, pitnrun, 0, pitnrun_mcu, pitnrun, pitnrun_mcu_state, empty_init, ROT90, "Taito Corporation", "Pit & Run - F-1 Race (set 1)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) GAME( 1984, pitnruna, pitnrun, pitnrun_mcu, pitnrun, pitnrun_mcu_state, empty_init, ROT90, "Taito Corporation", "Pit & Run - F-1 Race (set 2)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) +GAME( 1984, pitnrunb, pitnrun, pitnrun_mcu, pitnrun, pitnrun_mcu_state, empty_init, ROT90, "Taito Corporation", "Pit & Run - F-1 Race (set 3)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) GAME( 1984, jumpkun, 0, pitnrun, jumpkun, pitnrun_state, empty_init, ROT90, "Kaneko", "Jump Kun (prototype)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) // no copyright message |