From 63bb76784175d7c97f6c081cb5bc8ebbc43d669f Mon Sep 17 00:00:00 2001 From: hap Date: Sat, 23 Nov 2024 22:50:03 +0100 Subject: gotcha: remove audiocpu nmi (unknown purpose, causes music bug), and merge driver --- src/mame/f32/silvmil.cpp | 20 +++--- src/mame/misc/gotcha.cpp | 168 +++++++++++++++++++++++++++++++++++++++++++-- src/mame/misc/gotcha.h | 86 ----------------------- src/mame/misc/gotcha_v.cpp | 102 --------------------------- src/mame/misc/winbingo.cpp | 6 +- src/mame/pinball/bingo.cpp | 36 +++++----- 6 files changed, 198 insertions(+), 220 deletions(-) delete mode 100644 src/mame/misc/gotcha.h delete mode 100644 src/mame/misc/gotcha_v.cpp diff --git a/src/mame/f32/silvmil.cpp b/src/mame/f32/silvmil.cpp index 9ae2acca51d..113574b346b 100644 --- a/src/mame/f32/silvmil.cpp +++ b/src/mame/f32/silvmil.cpp @@ -1,16 +1,19 @@ // license:BSD-3-Clause // copyright-holders:David Haywood /* - Silver Millennium - yet another Data East / Tumble Pop derived hardware - this one seems similar to (but not identical to) - the f32/crospang.cpp hardware from F2 system - also very close to gotcha.c, which was also a Para - board. +Silver Millennium - todo: refresh rate - verify dipswitches - difficulty & unknown dips +yet another Data East / Tumble Pop derived hardware +this one seems similar to (but not identical to) +the f32/crospang.cpp hardware from F2 system +also very close to gotcha.cpp, which was also a Para +board. + +TODO: +- refresh rate +- verify dipswitches - difficulty & unknown dips +- like gotcha, what is the audiocpu NMI for? OSC on Silver Millennium are 12MHz, 14.31818MHz & 4.096MHz The above has been verified on two boards. @@ -31,6 +34,7 @@ Very likely to be 'whatever crystals we had on hand which were close enough for #include "machine/gen_latch.h" #include "sound/okim6295.h" #include "sound/ymopm.h" + #include "emupal.h" #include "screen.h" #include "speaker.h" diff --git a/src/mame/misc/gotcha.cpp b/src/mame/misc/gotcha.cpp index aa624d6e403..7ea36700927 100644 --- a/src/mame/misc/gotcha.cpp +++ b/src/mame/misc/gotcha.cpp @@ -10,8 +10,9 @@ TODO: - Find out what the "Explane Type" dip switch actually does. - Unknown writes to 0x30000c. It changes for some levels, it's probably gfx related but since everything seems fine I've no idea what it might do. -- Unknown sound writes at c00f; also, there's an NMI handler that would - read from c00f. +- Unknown sound writes at c00f. +- What is the audiocpu NMI for? It reads from c00f, and if you let NMI trigger + periodically, music will eventually fail. - Sound samples were getting chopped; I fixed this by changing sound/adpcm.cpp to disregard requests to play new samples until the previous one is finished*. @@ -58,7 +59,7 @@ Notes: ***************************************************************************/ #include "emu.h" -#include "gotcha.h" +#include "decospr.h" #include "cpu/m68000/m68000.h" #include "cpu/z80/z80.h" @@ -69,10 +70,167 @@ Notes: #include "emupal.h" #include "screen.h" #include "speaker.h" +#include "tilemap.h" #include "gotcha.lh" +namespace { + +class gotcha_state : public driver_device +{ +public: + gotcha_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_fgvideoram(*this, "fgvideoram"), + m_bgvideoram(*this, "bgvideoram"), + m_spriteram(*this, "spriteram"), + m_sprgen(*this, "spritegen"), + m_audiocpu(*this, "audiocpu"), + m_maincpu(*this, "maincpu"), + m_oki(*this, "oki"), + m_gfxdecode(*this, "gfxdecode"), + m_lamp_r(*this, "lamp_p%u_r", 1U), + m_lamp_g(*this, "lamp_p%u_g", 1U), + m_lamp_b(*this, "lamp_p%u_b", 1U), + m_lamp_s(*this, "lamp_p%u_s", 1U) + { + } + + void gotcha(machine_config &config); + +protected: + virtual void machine_start() override ATTR_COLD; + virtual void machine_reset() override ATTR_COLD; + virtual void video_start() override ATTR_COLD; + +private: + void lamps_w(uint16_t data); + void fgvideoram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + void bgvideoram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + void gfxbank_select_w(uint8_t data); + void gfxbank_w(uint8_t data); + void scroll_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + void oki_bank_w(uint8_t data); + TILEMAP_MAPPER_MEMBER(tilemap_scan); + TILE_GET_INFO_MEMBER(fg_get_tile_info); + TILE_GET_INFO_MEMBER(bg_get_tile_info); + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + inline void get_tile_info( tile_data &tileinfo, int tile_index ,uint16_t *vram, int color_offs); + void main_map(address_map &map) ATTR_COLD; + void sound_map(address_map &map) ATTR_COLD; + + // memory pointers + required_shared_ptr m_fgvideoram; + required_shared_ptr m_bgvideoram; + required_shared_ptr m_spriteram; + optional_device m_sprgen; + + // video-related + tilemap_t *m_bg_tilemap = nullptr; + tilemap_t *m_fg_tilemap = nullptr; + uint8_t m_banksel = 0U; + uint8_t m_gfxbank[4]{}; + uint16_t m_scroll[4]{}; + + // devices + required_device m_audiocpu; + required_device m_maincpu; + required_device m_oki; + required_device m_gfxdecode; + + output_finder<3> m_lamp_r; + output_finder<3> m_lamp_g; + output_finder<3> m_lamp_b; + output_finder<3> m_lamp_s; +}; + + +TILEMAP_MAPPER_MEMBER(gotcha_state::tilemap_scan) +{ + return (col & 0x1f) | (row << 5) | ((col & 0x20) << 5); +} + +inline void gotcha_state::get_tile_info( tile_data &tileinfo, int tile_index ,uint16_t *vram, int color_offs) +{ + uint16_t data = vram[tile_index]; + int code = (data & 0x3ff) | (m_gfxbank[(data & 0x0c00) >> 10] << 10); + + tileinfo.set(0, code, (data >> 12) + color_offs, 0); +} + +TILE_GET_INFO_MEMBER(gotcha_state::fg_get_tile_info) +{ + get_tile_info(tileinfo, tile_index, m_fgvideoram, 0); +} + +TILE_GET_INFO_MEMBER(gotcha_state::bg_get_tile_info) +{ + get_tile_info(tileinfo, tile_index, m_bgvideoram, 16); +} + + +void gotcha_state::video_start() +{ + m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(gotcha_state::fg_get_tile_info)), tilemap_mapper_delegate(*this, FUNC(gotcha_state::tilemap_scan)), 16, 16, 64, 32); + m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(gotcha_state::bg_get_tile_info)), tilemap_mapper_delegate(*this, FUNC(gotcha_state::tilemap_scan)), 16, 16, 64, 32); + + m_fg_tilemap->set_transparent_pen(0); + + m_fg_tilemap->set_scrolldx(-1, 0); + m_bg_tilemap->set_scrolldx(-5, 0); +} + + +void gotcha_state::fgvideoram_w(offs_t offset, uint16_t data, uint16_t mem_mask) +{ + COMBINE_DATA(&m_fgvideoram[offset]); + m_fg_tilemap->mark_tile_dirty(offset); +} + +void gotcha_state::bgvideoram_w(offs_t offset, uint16_t data, uint16_t mem_mask) +{ + COMBINE_DATA(&m_bgvideoram[offset]); + m_bg_tilemap->mark_tile_dirty(offset); +} + +void gotcha_state::gfxbank_select_w(uint8_t data) +{ + m_banksel = data & 0x03; +} + +void gotcha_state::gfxbank_w(uint8_t data) +{ + if (m_gfxbank[m_banksel] != (data & 0x0f)) + { + m_gfxbank[m_banksel] = data & 0x0f; + machine().tilemap().mark_all_dirty(); + } +} + +void gotcha_state::scroll_w(offs_t offset, uint16_t data, uint16_t mem_mask) +{ + COMBINE_DATA(&m_scroll[offset]); + + switch (offset) + { + case 0: m_fg_tilemap->set_scrollx(0, m_scroll[0]); break; + case 1: m_fg_tilemap->set_scrolly(0, m_scroll[1]); break; + case 2: m_bg_tilemap->set_scrollx(0, m_scroll[2]); break; + case 3: m_bg_tilemap->set_scrolly(0, m_scroll[3]); break; + } +} + + +uint32_t gotcha_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_bg_tilemap->draw(screen, bitmap, cliprect); + m_fg_tilemap->draw(screen, bitmap, cliprect); + m_sprgen->draw_sprites(bitmap, cliprect, m_spriteram, 0x400); + return 0; +} + + void gotcha_state::lamps_w(uint16_t data) { for (int p = 0; p < 3; p++) @@ -273,7 +431,6 @@ void gotcha_state::gotcha(machine_config &config) screen.set_screen_update(FUNC(gotcha_state::screen_update)); screen.set_palette("palette"); screen.screen_vblank().set_inputline(m_maincpu, M68K_IRQ_6, HOLD_LINE); - screen.screen_vblank().append_inputline(m_audiocpu, INPUT_LINE_NMI); // ? GFXDECODE(config, m_gfxdecode, "palette", gfx_gotcha); PALETTE(config, "palette").set_format(palette_device::xRGB_555, 768); @@ -411,6 +568,9 @@ ROM_START( ppchampa ) ROM_LOAD( "uz11", 0x00000, 0x80000, CRC(3d96274c) SHA1(c7a670af86194c370bf8fb30afbe027ab78a0227) ) ROM_END +} // anonymous namespace + + GAMEL( 1997, gotcha, 0, gotcha, gotcha, gotcha_state, empty_init, ROT0, "Dongsung / Para", "Got-cha Mini Game Festival", MACHINE_SUPPORTS_SAVE, layout_gotcha ) GAMEL( 1997, ppchamp, gotcha, gotcha, gotcha, gotcha_state, empty_init, ROT0, "Dongsung / Para", "Pasha Pasha Champ Mini Game Festival (Korea, set 1)", MACHINE_SUPPORTS_SAVE, layout_gotcha ) GAMEL( 1997, ppchampa, gotcha, gotcha, gotcha, gotcha_state, empty_init, ROT0, "Dongsung / Para", "Pasha Pasha Champ Mini Game Festival (Korea, set 2)", MACHINE_SUPPORTS_SAVE, layout_gotcha ) diff --git a/src/mame/misc/gotcha.h b/src/mame/misc/gotcha.h deleted file mode 100644 index 7543d333bdb..00000000000 --- a/src/mame/misc/gotcha.h +++ /dev/null @@ -1,86 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nicola Salmoria -/************************************************************************* - - Gotcha - -*************************************************************************/ -#ifndef MAME_MISC_GOTCHA_H -#define MAME_MISC_GOTCHA_H - -#pragma once - -#include "decospr.h" - -#include "sound/okim6295.h" -#include "tilemap.h" - -class gotcha_state : public driver_device -{ -public: - gotcha_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_fgvideoram(*this, "fgvideoram"), - m_bgvideoram(*this, "bgvideoram"), - m_spriteram(*this, "spriteram"), - m_sprgen(*this, "spritegen"), - m_audiocpu(*this, "audiocpu"), - m_maincpu(*this, "maincpu"), - m_oki(*this, "oki"), - m_gfxdecode(*this, "gfxdecode"), - m_lamp_r(*this, "lamp_p%u_r", 1U), - m_lamp_g(*this, "lamp_p%u_g", 1U), - m_lamp_b(*this, "lamp_p%u_b", 1U), - m_lamp_s(*this, "lamp_p%u_s", 1U) - { - } - - void gotcha(machine_config &config); - -protected: - virtual void machine_start() override ATTR_COLD; - virtual void machine_reset() override ATTR_COLD; - virtual void video_start() override ATTR_COLD; - -private: - void lamps_w(uint16_t data); - void fgvideoram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - void bgvideoram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - void gfxbank_select_w(uint8_t data); - void gfxbank_w(uint8_t data); - void scroll_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - void oki_bank_w(uint8_t data); - TILEMAP_MAPPER_MEMBER(tilemap_scan); - TILE_GET_INFO_MEMBER(fg_get_tile_info); - TILE_GET_INFO_MEMBER(bg_get_tile_info); - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - inline void get_tile_info( tile_data &tileinfo, int tile_index ,uint16_t *vram, int color_offs); - void main_map(address_map &map) ATTR_COLD; - void sound_map(address_map &map) ATTR_COLD; - - /* memory pointers */ - required_shared_ptr m_fgvideoram; - required_shared_ptr m_bgvideoram; - required_shared_ptr m_spriteram; - optional_device m_sprgen; - - /* video-related */ - tilemap_t *m_bg_tilemap = nullptr; - tilemap_t *m_fg_tilemap = nullptr; - uint8_t m_banksel = 0U; - uint8_t m_gfxbank[4]{}; - uint16_t m_scroll[4]{}; - - /* devices */ - required_device m_audiocpu; - required_device m_maincpu; - required_device m_oki; - required_device m_gfxdecode; - - output_finder<3> m_lamp_r; - output_finder<3> m_lamp_g; - output_finder<3> m_lamp_b; - output_finder<3> m_lamp_s; -}; - -#endif // MAME_MISC_GOTCHA_H diff --git a/src/mame/misc/gotcha_v.cpp b/src/mame/misc/gotcha_v.cpp deleted file mode 100644 index b78878f7c20..00000000000 --- a/src/mame/misc/gotcha_v.cpp +++ /dev/null @@ -1,102 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nicola Salmoria -#include "emu.h" -#include "gotcha.h" - - -/*************************************************************************** - - Callbacks for the TileMap code - -***************************************************************************/ - -TILEMAP_MAPPER_MEMBER(gotcha_state::tilemap_scan) -{ - return (col & 0x1f) | (row << 5) | ((col & 0x20) << 5); -} - -inline void gotcha_state::get_tile_info( tile_data &tileinfo, int tile_index ,uint16_t *vram, int color_offs) -{ - uint16_t data = vram[tile_index]; - int code = (data & 0x3ff) | (m_gfxbank[(data & 0x0c00) >> 10] << 10); - - tileinfo.set(0, code, (data >> 12) + color_offs, 0); -} - -TILE_GET_INFO_MEMBER(gotcha_state::fg_get_tile_info) -{ - get_tile_info(tileinfo, tile_index, m_fgvideoram, 0); -} - -TILE_GET_INFO_MEMBER(gotcha_state::bg_get_tile_info) -{ - get_tile_info(tileinfo, tile_index, m_bgvideoram, 16); -} - - - -/*************************************************************************** - - Start the video hardware emulation. - -***************************************************************************/ - -void gotcha_state::video_start() -{ - m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(gotcha_state::fg_get_tile_info)), tilemap_mapper_delegate(*this, FUNC(gotcha_state::tilemap_scan)), 16, 16, 64, 32); - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(gotcha_state::bg_get_tile_info)), tilemap_mapper_delegate(*this, FUNC(gotcha_state::tilemap_scan)), 16, 16, 64, 32); - - m_fg_tilemap->set_transparent_pen(0); - - m_fg_tilemap->set_scrolldx(-1, 0); - m_bg_tilemap->set_scrolldx(-5, 0); -} - - -void gotcha_state::fgvideoram_w(offs_t offset, uint16_t data, uint16_t mem_mask) -{ - COMBINE_DATA(&m_fgvideoram[offset]); - m_fg_tilemap->mark_tile_dirty(offset); -} - -void gotcha_state::bgvideoram_w(offs_t offset, uint16_t data, uint16_t mem_mask) -{ - COMBINE_DATA(&m_bgvideoram[offset]); - m_bg_tilemap->mark_tile_dirty(offset); -} - -void gotcha_state::gfxbank_select_w(uint8_t data) -{ - m_banksel = data & 0x03; -} - -void gotcha_state::gfxbank_w(uint8_t data) -{ - if (m_gfxbank[m_banksel] != (data & 0x0f)) - { - m_gfxbank[m_banksel] = data & 0x0f; - machine().tilemap().mark_all_dirty(); - } -} - -void gotcha_state::scroll_w(offs_t offset, uint16_t data, uint16_t mem_mask) -{ - COMBINE_DATA(&m_scroll[offset]); - - switch (offset) - { - case 0: m_fg_tilemap->set_scrollx(0, m_scroll[0]); break; - case 1: m_fg_tilemap->set_scrolly(0, m_scroll[1]); break; - case 2: m_bg_tilemap->set_scrollx(0, m_scroll[2]); break; - case 3: m_bg_tilemap->set_scrolly(0, m_scroll[3]); break; - } -} - - -uint32_t gotcha_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_bg_tilemap->draw(screen, bitmap, cliprect); - m_fg_tilemap->draw(screen, bitmap, cliprect); - m_sprgen->draw_sprites(bitmap, cliprect, m_spriteram, 0x400); - return 0; -} diff --git a/src/mame/misc/winbingo.cpp b/src/mame/misc/winbingo.cpp index 686a03a9ad4..1221d8fe070 100644 --- a/src/mame/misc/winbingo.cpp +++ b/src/mame/misc/winbingo.cpp @@ -25,10 +25,12 @@ Others: */ #include "emu.h" + +#include "cpu/h8/h83048.h" + #include "emupal.h" #include "screen.h" #include "speaker.h" -#include "cpu/h8/h83048.h" namespace { @@ -38,7 +40,7 @@ class winbingo_state : public driver_device public: winbingo_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) - {} + { } void wbingo06(machine_config &config); diff --git a/src/mame/pinball/bingo.cpp b/src/mame/pinball/bingo.cpp index 39cded702d3..213c9643576 100644 --- a/src/mame/pinball/bingo.cpp +++ b/src/mame/pinball/bingo.cpp @@ -2,6 +2,7 @@ // copyright-holders:Miodrag Milanovic #include "emu.h" + #include "cpu/s2650/s2650.h" #include "cpu/i8085/i8085.h" #include "cpu/i86/i186.h" @@ -12,22 +13,22 @@ namespace { class bingo_state : public driver_device { public: - bingo_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu") + bingo_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu") { } void bingo(machine_config &config); void bingo_map(address_map &map) ATTR_COLD; -protected: + void init_bingo(); + +protected: // devices required_device m_maincpu; // driver_device overrides virtual void machine_reset() override ATTR_COLD; -public: - void init_bingo(); }; @@ -59,22 +60,22 @@ void bingo_state::bingo(machine_config &config) class seeben_state : public driver_device { public: - seeben_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu") + seeben_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu") { } void seeben(machine_config &config); void seeben_map(address_map &map) ATTR_COLD; -protected: + void init_seeben(); + +protected: // devices required_device m_maincpu; // driver_device overrides virtual void machine_reset() override ATTR_COLD; -public: - void init_seeben(); }; @@ -103,22 +104,21 @@ void seeben_state::seeben(machine_config &config) class splin_state : public driver_device { public: - splin_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu") + splin_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu") { } void splin(machine_config &config); void splin_map(address_map &map) ATTR_COLD; -protected: + void init_splin(); +protected: // devices required_device m_maincpu; // driver_device overrides virtual void machine_reset() override ATTR_COLD; -public: - void init_splin(); }; void splin_state::splin_map(address_map &map) -- cgit v1.2.3