From c8d2f8ddcf4c359c60eba5ff8091908d7f9cd55c Mon Sep 17 00:00:00 2001 From: hap Date: Mon, 7 Aug 2023 18:36:02 +0200 Subject: [PATCH] circus: split classes part1 --- src/mame/exidy/circus.cpp | 277 ++++++++++++++++++------------------ src/mame/exidy/circus.h | 130 ++++++++++++----- src/mame/exidy/circus_a.cpp | 13 +- src/mame/exidy/circus_v.cpp | 175 ++++++++++++----------- src/mame/misc/tugboat.cpp | 9 +- 5 files changed, 341 insertions(+), 263 deletions(-) diff --git a/src/mame/exidy/circus.cpp b/src/mame/exidy/circus.cpp index 4a74e9c0558..0f9e0fb29b6 100644 --- a/src/mame/exidy/circus.cpp +++ b/src/mame/exidy/circus.cpp @@ -1,6 +1,6 @@ // license:BSD-3-Clause // copyright-holders:Mike Coates -/*************************************************************************** +/******************************************************************************* Exidy 'Universal' Game Board V1 @@ -14,7 +14,7 @@ Rip Cord May 1979 6502 RC30-0014 (cpu) 0015 (snd) 9023-9026, 9027-9034, 9035 Crash July 1979 6502 CR30-3162 (cpu) 3161 (snd) 9036 (?) -*************************************************************************** +******************************************************************************** driver (initial) by Mike Coates @@ -34,50 +34,89 @@ A000 Control Switches C000 Option Switches D000 Paddle Position and Interrupt Reset (where applicable) - NOTES: - - Circus: Taito licensed and released the game as "Acrobat TV" +******************************************************************************** - TODO: - - generic video timing (vsync, vblank, # of scanlines) - - circus/ripcord collision detection is accurate? - - crash: irq timing - - improve discrete sound +NOTES: +- Circus: Taito licensed and released the game as "Acrobat TV" -***************************************************************************/ +TODO: +- generic video timing (vsync, vblank, # of scanlines) +- circus/ripcord collision detection is accurate? +- crash: irq timing +- improve discrete sound + +*******************************************************************************/ #include "emu.h" #include "circus.h" #include "cpu/m6502/m6502.h" -#include "screen.h" #include "speaker.h" #include "circus.lh" #include "crash.lh" -uint8_t circus_state::circus_paddle_r() + +/******************************************************************************* + Initialization +*******************************************************************************/ + +void circus_state::machine_start() { - // also clears irq - m_maincpu->set_input_line(0, CLEAR_LINE); - return ioport("PADDLE")->read(); + save_item(NAME(m_clown_x)); + save_item(NAME(m_clown_y)); + save_item(NAME(m_clown_z)); } -void circus_state::circus_map(address_map &map) +void circus_state::machine_reset() +{ + m_clown_x = 0; + m_clown_y = 0; + m_clown_z = 0; +} + + + +/******************************************************************************* + Misc. I/O +*******************************************************************************/ + +uint8_t circus_state::paddle_r() +{ + // also clears irq + if (!machine().side_effects_disabled()) + m_maincpu->set_input_line(0, CLEAR_LINE); + + return m_paddle->read(); +} + + + +/******************************************************************************* + Address Maps +*******************************************************************************/ + +void circus_state::main_map(address_map &map) { map(0x0000, 0x01ff).ram(); map(0x1000, 0x1fff).rom(); - map(0x2000, 0x2000).w(FUNC(circus_state::circus_clown_x_w)); - map(0x3000, 0x3000).w(FUNC(circus_state::circus_clown_y_w)); - map(0x4000, 0x43ff).ram().w(FUNC(circus_state::circus_videoram_w)).share("videoram"); - map(0x8000, 0x8000).ram().w(FUNC(circus_state::circus_clown_z_w)); + map(0x2000, 0x2000).w(FUNC(circus_state::clown_x_w)); + map(0x3000, 0x3000).w(FUNC(circus_state::clown_y_w)); + map(0x4000, 0x43ff).ram().w(FUNC(circus_state::videoram_w)).share("videoram"); + map(0x8000, 0x8000).ram().w(FUNC(circus_state::clown_z_w)); map(0xa000, 0xa000).portr("INPUTS"); map(0xc000, 0xc000).portr("DSW"); - map(0xd000, 0xd000).r(FUNC(circus_state::circus_paddle_r)); + map(0xd000, 0xd000).r(FUNC(circus_state::paddle_r)); map(0xf000, 0xffff).rom(); } + +/******************************************************************************* + Input Ports +*******************************************************************************/ + static INPUT_PORTS_START( circus ) PORT_START("INPUTS") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 ) @@ -218,6 +257,11 @@ static INPUT_PORTS_START( ripcord ) INPUT_PORTS_END + +/******************************************************************************* + GFX Layouts +*******************************************************************************/ + static const gfx_layout charlayout = { 8,8, /* 8*8 characters */ @@ -265,45 +309,36 @@ GFXDECODE_END -/*************************************************************************** - Machine drivers -***************************************************************************/ -void circus_state::machine_start() +/******************************************************************************* + Machine Configs +*******************************************************************************/ + +void circus_state::base_mcfg(machine_config &config) { - save_item(NAME(m_clown_x)); - save_item(NAME(m_clown_y)); - save_item(NAME(m_clown_z)); -} + // basic machine hardware + M6502(config, m_maincpu, XTAL(11'289'000) / 16); // 705.562kHz + m_maincpu->set_addrmap(AS_PROGRAM, &circus_state::main_map); -void circus_state::machine_reset() -{ - m_clown_x = 0; - m_clown_y = 0; - m_clown_z = 0; -} - - -void circus_state::circus(machine_config &config) -{ - /* basic machine hardware */ - M6502(config, m_maincpu, XTAL(11'289'000) / 16); /* 705.562kHz */ - m_maincpu->set_addrmap(AS_PROGRAM, &circus_state::circus_map); - - /* video hardware */ - screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); - screen.set_video_attributes(VIDEO_ALWAYS_UPDATE); /* needed for proper hardware collisions */ - screen.set_refresh_hz(57); - screen.set_vblank_time(ATTOSECONDS_IN_USEC(3500)); /* (complete guess) */ - screen.set_size(32*8, 32*8); - screen.set_visarea(0*8, 31*8-1, 0*8, 32*8-1); - screen.set_screen_update(FUNC(circus_state::screen_update_circus)); - screen.set_palette(m_palette); - - GFXDECODE(config, m_gfxdecode, m_palette, gfx_circus); + // video hardware + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_video_attributes(VIDEO_ALWAYS_UPDATE); // needed for proper hardware collisions + m_screen->set_refresh_hz(57); + m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(3500)); // complete guess + m_screen->set_size(32*8, 32*8); + m_screen->set_visarea(0*8, 31*8-1, 0*8, 32*8-1); + m_screen->set_screen_update(FUNC(circus_state::screen_update)); + m_screen->set_palette(m_palette); PALETTE(config, m_palette, palette_device::MONOCHROME); - /* sound hardware */ + GFXDECODE(config, m_gfxdecode, m_palette, gfx_circus); +} + +void circus_state::circus(machine_config &config) +{ + base_mcfg(config); + + // sound hardware SPEAKER(config, "mono").front_center(); SAMPLES(config, m_samples); @@ -315,27 +350,14 @@ void circus_state::circus(machine_config &config) m_discrete->add_route(ALL_OUTPUTS, "mono", 0.50); } -void circus_state::robotbwl(machine_config &config) +void robotbwl_state::robotbwl(machine_config &config) { - /* basic machine hardware */ - M6502(config, m_maincpu, XTAL(11'289'000) / 16); /* 705.562kHz */ - m_maincpu->set_addrmap(AS_PROGRAM, &circus_state::circus_map); - // does not generate irq! + base_mcfg(config); - /* video hardware */ - screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); - screen.set_refresh_hz(57); - screen.set_vblank_time(ATTOSECONDS_IN_USEC(3500)); /* (complete guess) */ - screen.set_size(32*8, 32*8); - screen.set_visarea(0*8, 31*8-1, 0*8, 32*8-1); - screen.set_screen_update(FUNC(circus_state::screen_update_robotbwl)); - screen.set_palette(m_palette); + GFXDECODE(config.replace(), m_gfxdecode, m_palette, gfx_robotbwl); + m_screen->set_video_attributes(0); - GFXDECODE(config, m_gfxdecode, m_palette, gfx_robotbwl); - - PALETTE(config, m_palette, palette_device::MONOCHROME); - - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); SAMPLES(config, m_samples); @@ -347,35 +369,15 @@ void circus_state::robotbwl(machine_config &config) m_discrete->add_route(ALL_OUTPUTS, "mono", 1.0); } -TIMER_DEVICE_CALLBACK_MEMBER(circus_state::crash_scanline) +void crash_state::crash(machine_config &config) { - int scanline = param; + base_mcfg(config); - if(scanline == 256 || scanline == 0) // vblank-out / in irq - m_maincpu->set_input_line(0, ASSERT_LINE); -} + // vblank-out / in irq + m_screen->screen_vblank().set([this](int state) { m_maincpu->set_input_line(0, ASSERT_LINE); }); + m_screen->set_video_attributes(0); -void circus_state::crash(machine_config &config) -{ - /* basic machine hardware */ - M6502(config, m_maincpu, XTAL(11'289'000) / 16); /* 705.562kHz */ - m_maincpu->set_addrmap(AS_PROGRAM, &circus_state::circus_map); - TIMER(config, "scantimer").configure_scanline(FUNC(circus_state::crash_scanline), "screen", 0, 1); - - /* video hardware */ - screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); - screen.set_refresh_hz(57); - screen.set_vblank_time(ATTOSECONDS_IN_USEC(3500)); /* (complete guess) */ - screen.set_size(40*8, 40*8); // TODO // to do what? - screen.set_visarea(0*8, 31*8-1, 0*8, 32*8-1); - screen.set_screen_update(FUNC(circus_state::screen_update_crash)); - screen.set_palette(m_palette); - - GFXDECODE(config, m_gfxdecode, m_palette, gfx_circus); - - PALETTE(config, m_palette, palette_device::MONOCHROME); - - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); SAMPLES(config, m_samples); @@ -387,27 +389,11 @@ void circus_state::crash(machine_config &config) m_discrete->add_route(ALL_OUTPUTS, "mono", 0.80); } -void circus_state::ripcord(machine_config &config) +void ripcord_state::ripcord(machine_config &config) { - /* basic machine hardware */ - M6502(config, m_maincpu, XTAL(11'289'000) / 16); /* 705.562kHz */ - m_maincpu->set_addrmap(AS_PROGRAM, &circus_state::circus_map); + base_mcfg(config); - /* video hardware */ - screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); - screen.set_video_attributes(VIDEO_ALWAYS_UPDATE); /* needed for proper hardware collisions */ - screen.set_refresh_hz(57); - screen.set_vblank_time(ATTOSECONDS_IN_USEC(3500)); /* (complete guess) */ - screen.set_size(32*8, 32*8); - screen.set_visarea(0*8, 31*8-1, 0*8, 32*8-1); - screen.set_screen_update(FUNC(circus_state::screen_update_ripcord)); - screen.set_palette(m_palette); - - GFXDECODE(config, m_gfxdecode, m_palette, gfx_circus); - - PALETTE(config, m_palette, palette_device::MONOCHROME); - - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); SAMPLES(config, m_samples); @@ -419,6 +405,12 @@ void circus_state::ripcord(machine_config &config) m_discrete->add_route(ALL_OUTPUTS, "mono", 0.50); } + + +/******************************************************************************* + ROM Definitions +*******************************************************************************/ + ROM_START( circus ) ROM_REGION( 0x10000, "maincpu", 0 ) // code ROM_LOAD( "9004a.1a", 0x1000, 0x0200, CRC(7654ea75) SHA1(fa29417618157002b8ecb21f4c15104c8145a742) ) @@ -440,7 +432,7 @@ ROM_START( circus ) ROM_REGION( 0x0200, "gfx2", 0 ) // clown sprite ROM_LOAD( "9012.14d", 0x0000, 0x0200, CRC(2fde3930) SHA1(a21e2d342f16a39a07edf4bea8d698a52216ecba) ) - ROM_REGION( 0x400, "extra_proms", 0 ) // timing? not used by the emulation, dumped for the circusb bootleg but might match + ROM_REGION( 0x400, "proms", 0 ) // timing? not used by the emulation, dumped for the circusb bootleg but might match ROM_LOAD( "dm74s570-d4.4d", 0x000, 0x200, BAD_DUMP CRC(aad8da33) SHA1(1d60a6b75b94f5be5bad190ef56e9e3da20bf81a) ) ROM_LOAD( "dm74s570-d5.5d", 0x200, 0x200, BAD_DUMP CRC(ed2493fa) SHA1(57ee357b68383b0880bfa385820605bede500747) ) ROM_END @@ -466,7 +458,7 @@ ROM_START( circuso ) // older set, there exist several bootlegs identical to thi ROM_REGION( 0x0200, "gfx2", 0 ) // clown sprite ROM_LOAD( "9012.14d", 0x0000, 0x0200, CRC(2fde3930) SHA1(a21e2d342f16a39a07edf4bea8d698a52216ecba) ) - ROM_REGION( 0x400, "extra_proms", 0 ) // timing? not used by the emulation, dumped for the circusb bootleg but might match + ROM_REGION( 0x400, "proms", 0 ) // timing? not used by the emulation, dumped for the circusb bootleg but might match ROM_LOAD( "dm74s570-d4.4d", 0x000, 0x200, BAD_DUMP CRC(aad8da33) SHA1(1d60a6b75b94f5be5bad190ef56e9e3da20bf81a) ) ROM_LOAD( "dm74s570-d5.5d", 0x200, 0x200, BAD_DUMP CRC(ed2493fa) SHA1(57ee357b68383b0880bfa385820605bede500747) ) ROM_END @@ -492,7 +484,7 @@ ROM_START( springbd ) ROM_REGION( 0x0200, "gfx2", 0 ) // clown sprite ROM_LOAD( "93448.14d", 0x0000, 0x0200, CRC(2fde3930) SHA1(a21e2d342f16a39a07edf4bea8d698a52216ecba) ) - ROM_REGION( 0x400, "extra_proms", 0 ) // timing? not used by the emulation, dumped for the circusb bootleg but should match + ROM_REGION( 0x400, "proms", 0 ) // timing? not used by the emulation, dumped for the circusb bootleg but should match ROM_LOAD( "dm74s570-d4.4d", 0x000, 0x200, BAD_DUMP CRC(aad8da33) SHA1(1d60a6b75b94f5be5bad190ef56e9e3da20bf81a) ) ROM_LOAD( "dm74s570-d5.5d", 0x200, 0x200, BAD_DUMP CRC(ed2493fa) SHA1(57ee357b68383b0880bfa385820605bede500747) ) ROM_END @@ -509,17 +501,17 @@ ROM_START( robotbwl ) ROM_LOAD( "4027b.9a", 0xfe00, 0x0200, CRC(07487e27) SHA1(b5528fb3fec474df2b66f36e28df13a7e81f9ce3) ) ROM_REGION( 0x0800, "gfx1", 0 ) // character set - ROM_LOAD( "4010.4c", 0x0000, 0x0200, CRC(a5f7acb9) SHA1(556dd34d0fa50415b128477e208e96bf0c050c2c) ) // these are all N82S141N BPROMs - ROM_LOAD( "4011.3c", 0x0200, 0x0200, CRC(d5380c9b) SHA1(b9670e87011a1b3aebd1d386f1fe6a74f8c77be9) ) - ROM_LOAD( "4012.2c", 0x0400, 0x0200, CRC(47b3e39c) SHA1(393c680fba3bd384e2c773150c3bae4d735a91bf) ) - ROM_LOAD( "4013.1c", 0x0600, 0x0200, CRC(b2991e7e) SHA1(32b6d42bb9312d6cbe5b4113fcf2262bfeef3777) ) + ROM_LOAD( "4010.4c", 0x0000, 0x0200, CRC(a5f7acb9) SHA1(556dd34d0fa50415b128477e208e96bf0c050c2c) ) // these are all N82S141N BPROMs + ROM_LOAD( "4011.3c", 0x0200, 0x0200, CRC(d5380c9b) SHA1(b9670e87011a1b3aebd1d386f1fe6a74f8c77be9) ) + ROM_LOAD( "4012.2c", 0x0400, 0x0200, CRC(47b3e39c) SHA1(393c680fba3bd384e2c773150c3bae4d735a91bf) ) + ROM_LOAD( "4013.1c", 0x0600, 0x0200, CRC(b2991e7e) SHA1(32b6d42bb9312d6cbe5b4113fcf2262bfeef3777) ) ROM_REGION( 0x0020, "gfx2", ROMREGION_INVERT ) // ball sprite - ROM_LOAD( "6000.14d",0x0000, 0x0020, CRC(a402ac06) SHA1(3bd75630786bcc86d9e9fbc826adc909eef9b41f) ) + ROM_LOAD( "6000.14d", 0x0000, 0x0020, CRC(a402ac06) SHA1(3bd75630786bcc86d9e9fbc826adc909eef9b41f) ) - ROM_REGION( 0x100, "extra_proms", 0 ) // timing? not used by the emulation - ROM_LOAD( "5000.4d", 0x000, 0x020, NO_DUMP ) // both of these are MMI6306-1J (N82S131 equivalent) BPROMs - ROM_LOAD( "5001.5d", 0x020, 0x020, NO_DUMP ) + ROM_REGION( 0x0100, "proms", 0 ) // timing? not used by the emulation + ROM_LOAD( "5000.4d", 0x0000, 0x0020, NO_DUMP ) // both of these are MMI6306-1J (N82S131 equivalent) BPROMs + ROM_LOAD( "5001.5d", 0x0020, 0x0020, NO_DUMP ) ROM_END ROM_START( crash ) @@ -544,8 +536,6 @@ ROM_START( crash ) ROM_LOAD( "crash.d14", 0x0000, 0x0200, CRC(833f81e4) SHA1(78a0ace3510546691ecaf6f6275cb3269495edc9) ) ROM_END -// colours: the playfield is cyan. The entire centre box (and contents) is pale green -// see http://forum.arcadecontrols.com/index.php/topic,146323.msg1526542.html ROM_START( crasha ) ROM_REGION( 0x10000, "maincpu", 0 ) // code ROM_LOAD( "nsa7.a8", 0x1000, 0x0800, CRC(2e47c5ee) SHA1(4712ec3080ce3797420266d6efb26e7d146a965a) ) @@ -622,11 +612,20 @@ void circus_state::init_ripcord() m_game_id = 4; } -GAMEL( 1977, circus, 0, circus, circus, circus_state, init_circus, ROT0, "Exidy / Taito", "Circus / Acrobat TV", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND, layout_circus ) -GAMEL( 1977, circuso, circus, circus, circus, circus_state, init_circus, ROT0, "Exidy / Taito", "Circus / Acrobat TV (older)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND, layout_circus ) -GAMEL( 1977, springbd, circus, circus, circus, circus_state, init_circus, ROT0, "bootleg (Sub-Electro)", "Springboard (bootleg of Circus)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND, layout_circus ) // looks like a text hack, but we've seen 2 identical copies so it's worth supporting -GAME( 1977, robotbwl, 0, robotbwl, robotbwl, circus_state, init_robotbwl, ROT0, "Exidy", "Robot Bowl", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) -GAMEL( 1979, crash, 0, crash, crash, circus_state, init_crash, ROT0, "Exidy", "Crash", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND, layout_crash ) -GAMEL( 1979, crasha, crash, crash, crash, circus_state, init_crash, ROT0, "Exidy", "Crash (alt)", MACHINE_IMPERFECT_COLORS | MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND, layout_crash ) -GAMEL( 1979, smash, crash, crash, crash, circus_state, init_crash, ROT0, "bootleg", "Smash (Crash bootleg)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND, layout_crash ) // looks like a text hack, but it also had a different bezel -GAME( 1979, ripcord, 0, ripcord, ripcord, circus_state, init_ripcord, ROT0, "Exidy", "Rip Cord", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) + + +/******************************************************************************* + Game Drivers +*******************************************************************************/ + +GAMEL( 1977, circus, 0, circus, circus, circus_state, init_circus, ROT0, "Exidy / Taito", "Circus / Acrobat TV", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND, layout_circus ) // named Acrobat TV when Taito published it in Japan +GAMEL( 1977, circuso, circus, circus, circus, circus_state, init_circus, ROT0, "Exidy / Taito", "Circus / Acrobat TV (older)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND, layout_circus ) // " +GAMEL( 1977, springbd, circus, circus, circus, circus_state, init_circus, ROT0, "bootleg (Sub-Electro)", "Springboard (bootleg of Circus)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND, layout_circus ) // looks like a text hack, but it also had a different bezel + +GAME( 1977, robotbwl, 0, robotbwl, robotbwl, robotbwl_state, init_robotbwl, ROT0, "Exidy", "Robot Bowl", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) + +GAMEL( 1979, crash, 0, crash, crash, crash_state, init_crash, ROT0, "Exidy", "Crash (set 1)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND, layout_crash ) +GAMEL( 1979, crasha, crash, crash, crash, crash_state, init_crash, ROT0, "Exidy", "Crash (set 2)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND, layout_crash ) +GAMEL( 1979, smash, crash, crash, crash, crash_state, init_crash, ROT0, "bootleg", "Smash (Crash bootleg)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND, layout_crash ) // looks like a text hack, but it also had a different bezel + +GAME( 1979, ripcord, 0, ripcord, ripcord, ripcord_state, init_ripcord, ROT0, "Exidy", "Rip Cord", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) diff --git a/src/mame/exidy/circus.h b/src/mame/exidy/circus.h index de0546fa603..015f571e976 100644 --- a/src/mame/exidy/circus.h +++ b/src/mame/exidy/circus.h @@ -5,28 +5,31 @@ #pragma once -#include "machine/timer.h" #include "sound/discrete.h" #include "sound/samples.h" + #include "emupal.h" +#include "screen.h" #include "tilemap.h" +// circus + class circus_state : public driver_device { public: circus_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_videoram(*this, "videoram"), m_maincpu(*this, "maincpu"), m_samples(*this, "samples"), m_discrete(*this, "discrete"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") + m_screen(*this, "screen"), + m_palette(*this, "palette"), + m_videoram(*this, "videoram"), + m_paddle(*this, "PADDLE") { } - void robotbwl(machine_config &config); - void ripcord(machine_config &config); - void crash(machine_config &config); + void base_mcfg(machine_config &config); void circus(machine_config &config); void init_ripcord(); @@ -39,51 +42,102 @@ protected: virtual void machine_reset() override; virtual void video_start() override; -private: - /* memory pointers */ - required_shared_ptr m_videoram; - - /* video-related */ - tilemap_t *m_bg_tilemap = nullptr; - int m_clown_x = 0; - int m_clown_y = 0; - int m_clown_z = 0; - - /* devices */ required_device m_maincpu; required_device m_samples; required_device m_discrete; required_device m_gfxdecode; + required_device m_screen; required_device m_palette; + required_shared_ptr m_videoram; + required_ioport m_paddle; + + tilemap_t *m_bg_tilemap = nullptr; + int m_clown_x = 0; + int m_clown_y = 0; + int m_clown_z = 0; - /* game id */ int m_game_id = 0; - uint8_t circus_paddle_r(); - void circus_videoram_w(offs_t offset, uint8_t data); - void circus_clown_x_w(uint8_t data); - void circus_clown_y_w(uint8_t data); - void circus_clown_z_w(uint8_t data); + void videoram_w(offs_t offset, uint8_t data); + void clown_x_w(uint8_t data) { m_clown_x = 240 - data; } + void clown_y_w(uint8_t data) { m_clown_y = 240 - data; } + void clown_z_w(uint8_t data); + uint8_t paddle_r(); + TILE_GET_INFO_MEMBER(get_bg_tile_info); - uint32_t screen_update_circus(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_robotbwl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_crash(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_ripcord(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_DEVICE_CALLBACK_MEMBER(crash_scanline); - void draw_line( bitmap_ind16 &bitmap, const rectangle &cliprect, int x1, int y1, int x2, int y2, int dotted ); - void draw_sprite_collision( bitmap_ind16 &bitmap, const rectangle &cliprect ); - void circus_draw_fg( bitmap_ind16 &bitmap, const rectangle &cliprect ); - void robotbwl_draw_box( bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y ); - void robotbwl_draw_scoreboard( bitmap_ind16 &bitmap, const rectangle &cliprect ); - void robotbwl_draw_bowling_alley( bitmap_ind16 &bitmap, const rectangle &cliprect ); - void robotbwl_draw_ball( bitmap_ind16 &bitmap, const rectangle &cliprect ); - void crash_draw_car( bitmap_ind16 &bitmap, const rectangle &cliprect ); - void circus_map(address_map &map); + virtual uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_line(bitmap_ind16 &bitmap, const rectangle &cliprect, int x1, int y1, int x2, int y2, int dotted); + void draw_sprite_collision(bitmap_ind16 &bitmap, const rectangle &cliprect); + + void main_map(address_map &map); + +private: + void draw_fg(bitmap_ind16 &bitmap, const rectangle &cliprect); }; -/*----------- defined in audio/circus.c -----------*/ + + +// robotbwl + +class robotbwl_state : public circus_state +{ +public: + robotbwl_state(const machine_config &mconfig, device_type type, const char *tag) : + circus_state(mconfig, type, tag) + { } + + void robotbwl(machine_config &config); + +protected: + virtual uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) override; + +private: + void draw_box(bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y); + void draw_scoreboard(bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_bowling_alley(bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_ball(bitmap_ind16 &bitmap, const rectangle &cliprect); +}; + + +// crash + +class crash_state : public circus_state +{ +public: + crash_state(const machine_config &mconfig, device_type type, const char *tag) : + circus_state(mconfig, type, tag) + { } + + void crash(machine_config &config); + +protected: + virtual uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) override; + +private: + void draw_car(bitmap_ind16 &bitmap, const rectangle &cliprect); +}; + + +// ripcord + +class ripcord_state : public circus_state +{ +public: + ripcord_state(const machine_config &mconfig, device_type type, const char *tag) : + circus_state(mconfig, type, tag) + { } + + void ripcord(machine_config &config); + +protected: + virtual uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) override; +}; + + +// defined in circus_a.cpp DISCRETE_SOUND_EXTERN( circus_discrete ); DISCRETE_SOUND_EXTERN( robotbwl_discrete ); DISCRETE_SOUND_EXTERN( crash_discrete ); + extern const char *const circus_sample_names[]; extern const char *const crash_sample_names[]; extern const char *const ripcord_sample_names[]; diff --git a/src/mame/exidy/circus_a.cpp b/src/mame/exidy/circus_a.cpp index 127bc1a86d5..8654bccf38d 100644 --- a/src/mame/exidy/circus_a.cpp +++ b/src/mame/exidy/circus_a.cpp @@ -1,7 +1,14 @@ // license:BSD-3-Clause // copyright-holders:Mike Coates +/******************************************************************************* + + circus_a.cpp + + Functions to emulate the audio hardware of the machine. + +*******************************************************************************/ + #include "emu.h" -#include "sound/samples.h" #include "circus.h" const char *const circus_sample_names[] = @@ -51,7 +58,7 @@ DISCRETE_SOUND_START(circus_discrete) /************************************************/ /* Input register mapping for circus */ /************************************************/ - DISCRETE_INPUTX_NOT(CIRCUS_MUSIC_BIT, 20000, 0, 1) + DISCRETE_INPUTX_NOT(CIRCUS_MUSIC_BIT, 20000, 0, 1) /************************************************/ /* Music is just a 1 bit DAC */ @@ -133,7 +140,7 @@ DISCRETE_SOUND_START(robotbwl_discrete) /************************************************/ /* Input register mapping for robotbwl */ /************************************************/ - DISCRETE_INPUTX_LOGIC(ROBOTBWL_MUSIC_BIT, 30000, 0, 0) + DISCRETE_INPUTX_LOGIC(ROBOTBWL_MUSIC_BIT, 30000, 0, 0) /************************************************/ /* Music is just a 1 bit DAC */ diff --git a/src/mame/exidy/circus_v.cpp b/src/mame/exidy/circus_v.cpp index c84367a3822..bc0b4a6877e 100644 --- a/src/mame/exidy/circus_v.cpp +++ b/src/mame/exidy/circus_v.cpp @@ -1,39 +1,30 @@ // license:BSD-3-Clause // copyright-holders:Mike Coates -/*************************************************************************** +/******************************************************************************* - circus.c video + circus_v.cpp Functions to emulate the video hardware of the machine. -***************************************************************************/ +*******************************************************************************/ #include "emu.h" -#include "sound/samples.h" #include "circus.h" -void circus_state::circus_videoram_w(offs_t offset, uint8_t data) +/******************************************************************************* + Shared +*******************************************************************************/ + +void circus_state::videoram_w(offs_t offset, uint8_t data) { m_videoram[offset] = data; m_bg_tilemap->mark_tile_dirty(offset); } -void circus_state::circus_clown_x_w(uint8_t data) -{ - m_clown_x = 240 - data; -} - -void circus_state::circus_clown_y_w(uint8_t data) -{ - m_clown_y = 240 - data; -} - TILE_GET_INFO_MEMBER(circus_state::get_bg_tile_info) { - int code = m_videoram[tile_index]; - - tileinfo.set(0, code, 0, 0); + tileinfo.set(0, m_videoram[tile_index], 0, 0); } void circus_state::video_start() @@ -41,41 +32,39 @@ void circus_state::video_start() m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(circus_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); } -void circus_state::draw_line( bitmap_ind16 &bitmap, const rectangle &cliprect, int x1, int y1, int x2, int y2, int dotted ) +void circus_state::draw_line(bitmap_ind16 &bitmap, const rectangle &cliprect, int x1, int y1, int x2, int y2, int dotted) { - /* Draws horizontal and Vertical lines only! */ - int count, skip; - - /* Draw the Line */ - if (dotted > 0) - skip = 2; - else - skip = 1; + // Draws horizontal and Vertical lines only! + int skip = dotted ? 2 : 1; if (x1 == x2) - for (count = y2; count >= y1; count -= skip) + { + for (int count = y2; count >= y1; count -= skip) bitmap.pix(count, x1) = 1; + } else - for (count = x2; count >= x1; count -= skip) + { + for (int count = x2; count >= x1; count -= skip) bitmap.pix(y1, count) = 1; + } } -void circus_state::draw_sprite_collision( bitmap_ind16 &bitmap, const rectangle &cliprect ) +void circus_state::draw_sprite_collision(bitmap_ind16 &bitmap, const rectangle &cliprect) { gfx_element *sprite_gfx = m_gfxdecode->gfx(1); - const uint8_t *sprite_data = sprite_gfx->get_data(m_clown_z); + const uint8_t *sprite_data = sprite_gfx->get_data(m_clown_z & 0xf); int collision = 0; // draw sprite and check collision on a pixel basis for (int sy = 0; sy < 16; sy++) { - int dy = m_clown_x + sy-1; - if (dy>=0 && dy= 0 && dy < bitmap.height()) { for (int sx = 0; sx < 16; sx++) { int dx = m_clown_y + sx; - if (dx>=0 && dx= 0 && dx < bitmap.width()) { int pixel = sprite_data[sy * sprite_gfx->rowbytes() + sx]; if (pixel) @@ -92,11 +81,15 @@ void circus_state::draw_sprite_collision( bitmap_ind16 &bitmap, const rectangle m_maincpu->set_input_line(0, ASSERT_LINE); } -void circus_state::circus_draw_fg( bitmap_ind16 &bitmap, const rectangle &cliprect ) -{ - /* The sync generator hardware is used to */ - /* draw the border and diving boards */ + +/******************************************************************************* + Circus +*******************************************************************************/ + +void circus_state::draw_fg(bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + // The sync generator hardware is used to draw the border and diving boards draw_line(bitmap, cliprect, 0, 18, 255, 18, 0); draw_line(bitmap, cliprect, 0, 249, 255, 249, 1); draw_line(bitmap, cliprect, 0, 18, 0, 248, 0); @@ -108,58 +101,60 @@ void circus_state::circus_draw_fg( bitmap_ind16 &bitmap, const rectangle &clipre draw_line(bitmap, cliprect, 231, 192, 248, 192, 0); } -uint32_t circus_state::screen_update_circus(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +uint32_t circus_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - circus_draw_fg(bitmap, cliprect); + draw_fg(bitmap, cliprect); draw_sprite_collision(bitmap, cliprect); return 0; } -void circus_state::robotbwl_draw_box( bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y ) + + +/******************************************************************************* + Robot Bowl +*******************************************************************************/ + +void robotbwl_state::draw_box(bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y) { - /* Box */ + // Box int ex = x + 24; int ey = y + 26; - draw_line(bitmap, cliprect, x, y, ex, y, 0); /* Top */ - draw_line(bitmap, cliprect, x, ey, ex, ey, 0); /* Bottom */ - draw_line(bitmap, cliprect, x, y, x, ey, 0); /* Left */ - draw_line(bitmap, cliprect, ex, y, ex, ey, 0); /* Right */ + draw_line(bitmap, cliprect, x, y, ex, y, 0); // Top + draw_line(bitmap, cliprect, x, ey, ex, ey, 0); // Bottom + draw_line(bitmap, cliprect, x, y, x, ey, 0); // Left + draw_line(bitmap, cliprect, ex, y, ex, ey, 0); // Right - /* Score Grid */ + // Score Grid ey = y + 10; - draw_line(bitmap, cliprect, x + 8, ey, ex, ey, 0); /* Horizontal Divide Line */ + draw_line(bitmap, cliprect, x + 8, ey, ex, ey, 0); // Horizontal Divide Line draw_line(bitmap, cliprect, x + 8, y, x + 8, ey, 0); draw_line(bitmap, cliprect, x + 16, y, x + 16, ey, 0); } -void circus_state::robotbwl_draw_scoreboard( bitmap_ind16 &bitmap, const rectangle &cliprect ) +void robotbwl_state::draw_scoreboard(bitmap_ind16 &bitmap, const rectangle &cliprect) { - int offs; - - /* The sync generator hardware is used to */ - /* draw the bowling alley & scorecards */ - - for (offs = 15; offs <= 63; offs += 24) + // The sync generator hardware is used to draw the bowling alley & scorecards + for (int offs = 15; offs <= 63; offs += 24) { - robotbwl_draw_box(bitmap, cliprect, offs, 31); - robotbwl_draw_box(bitmap, cliprect, offs, 63); - robotbwl_draw_box(bitmap, cliprect, offs, 95); + draw_box(bitmap, cliprect, offs, 31); + draw_box(bitmap, cliprect, offs, 63); + draw_box(bitmap, cliprect, offs, 95); - robotbwl_draw_box(bitmap, cliprect, offs + 152, 31); - robotbwl_draw_box(bitmap, cliprect, offs + 152, 63); - robotbwl_draw_box(bitmap, cliprect, offs + 152, 95); + draw_box(bitmap, cliprect, offs + 152, 31); + draw_box(bitmap, cliprect, offs + 152, 63); + draw_box(bitmap, cliprect, offs + 152, 95); } - robotbwl_draw_box(bitmap, cliprect, 39, 127); /* 10th Frame */ - draw_line(bitmap, cliprect, 39, 137, 47, 137, 0); /* Extra digit box */ + draw_box(bitmap, cliprect, 39, 127); // 10th Frame + draw_line(bitmap, cliprect, 39, 137, 47, 137, 0); // Extra digit box - robotbwl_draw_box(bitmap, cliprect, 39 + 152, 127); + draw_box(bitmap, cliprect, 39 + 152, 127); draw_line(bitmap, cliprect, 39 + 152, 137, 47 + 152, 137, 0); } -void circus_state::robotbwl_draw_bowling_alley( bitmap_ind16 &bitmap, const rectangle &cliprect ) +void robotbwl_state::draw_bowling_alley(bitmap_ind16 &bitmap, const rectangle &cliprect) { draw_line(bitmap, cliprect, 103, 17, 103, 205, 0); draw_line(bitmap, cliprect, 111, 17, 111, 203, 1); @@ -167,43 +162,59 @@ void circus_state::robotbwl_draw_bowling_alley( bitmap_ind16 &bitmap, const rect draw_line(bitmap, cliprect, 144, 17, 144, 203, 1); } -void circus_state::robotbwl_draw_ball( bitmap_ind16 &bitmap, const rectangle &cliprect ) +void robotbwl_state::draw_ball(bitmap_ind16 &bitmap, const rectangle &cliprect) { - m_gfxdecode->gfx(1)->transpen(bitmap,/* Y is horizontal position */ + m_gfxdecode->gfx(1)->transpen(bitmap, cliprect, m_clown_z, 0, 0,0, - m_clown_y + 8, m_clown_x + 8, 0); + m_clown_y + 8, // Y is horizontal position + m_clown_x + 8, + 0); } -uint32_t circus_state::screen_update_robotbwl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +uint32_t robotbwl_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - robotbwl_draw_scoreboard(bitmap, cliprect); - robotbwl_draw_bowling_alley(bitmap, cliprect); - robotbwl_draw_ball(bitmap, cliprect); + draw_scoreboard(bitmap, cliprect); + draw_bowling_alley(bitmap, cliprect); + draw_ball(bitmap, cliprect); return 0; } -void circus_state::crash_draw_car( bitmap_ind16 &bitmap, const rectangle &cliprect ) + + +/******************************************************************************* + Crash +*******************************************************************************/ + +void crash_state::draw_car(bitmap_ind16 &bitmap, const rectangle &cliprect) { - m_gfxdecode->gfx(1)->transpen(bitmap,/* Y is horizontal position */ - cliprect, - m_clown_z, - 0, - 0,0, - m_clown_y, m_clown_x - 1, 0); + m_gfxdecode->gfx(1)->transpen(bitmap, + cliprect, + m_clown_z, + 0, + 0,0, + m_clown_y, // Y is horizontal position + m_clown_x - 1, + 0); } -uint32_t circus_state::screen_update_crash(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +uint32_t crash_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - crash_draw_car(bitmap, cliprect); + draw_car(bitmap, cliprect); return 0; } -uint32_t circus_state::screen_update_ripcord(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) + + +/******************************************************************************* + Rip Cord +*******************************************************************************/ + +uint32_t ripcord_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); draw_sprite_collision(bitmap, cliprect); diff --git a/src/mame/misc/tugboat.cpp b/src/mame/misc/tugboat.cpp index cb2a5f886ab..b94823e3bdf 100644 --- a/src/mame/misc/tugboat.cpp +++ b/src/mame/misc/tugboat.cpp @@ -393,6 +393,13 @@ static INPUT_PORTS_START( noahsark ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY INPUT_PORTS_END +static INPUT_PORTS_START( berenstn ) + PORT_INCLUDE( noahsark ) + + PORT_MODIFY("IN1") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) +INPUT_PORTS_END + /******************************************************************************* @@ -557,4 +564,4 @@ ROM_END // YEAR NAME PARENT MACHINE INPUT CLASS INIT SCREEN COMPANY FULLNAME FLAGS GAME( 1982, tugboat, 0, tugboat, tugboat, tugboat_state, empty_init, ROT90, "Enter-Tech, Ltd.", "Tugboat", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) GAME( 1983, noahsark, 0, noahsark, noahsark, tugboat_state, empty_init, ROT90, "Enter-Tech, Ltd.", "Noah's Ark", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -GAME( 1984, berenstn, 0, noahsark, noahsark, tugboat_state, empty_init, ROT90, "Enter-Tech, Ltd.", "The Berenstain Bears in Bigpaw's Cave", MACHINE_IMPERFECT_GRAPHICS | MACHINE_WRONG_COLORS | MACHINE_SUPPORTS_SAVE ) +GAME( 1984, berenstn, 0, noahsark, berenstn, tugboat_state, empty_init, ROT90, "Enter-Tech, Ltd.", "The Berenstain Bears in Bigpaw's Cave", MACHINE_IMPERFECT_GRAPHICS | MACHINE_WRONG_COLORS | MACHINE_SUPPORTS_SAVE )