From 94858142286e6dcbc0dfa0c1081b3bd83fa101b9 Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Tue, 15 Nov 2022 18:02:03 +0100 Subject: [PATCH] - merit/merit.cpp: dumped crt-209 module for dodgcitya, dodgcityb and dodgcityc [Team Europe, Brian Troha] - misc/ssingles.cpp: some minor cleanups - mr/dribling.cpp: consolidated driver in single file --- src/mame/merit/merit.cpp | 15 +-- src/mame/misc/ssingles.cpp | 195 ++++++++++++++++++------------------- src/mame/mr/dribling.cpp | 171 ++++++++++++++++++++++++++++++-- src/mame/mr/dribling.h | 74 -------------- src/mame/mr/dribling_v.cpp | 82 ---------------- 5 files changed, 268 insertions(+), 269 deletions(-) delete mode 100644 src/mame/mr/dribling.h delete mode 100644 src/mame/mr/dribling_v.cpp diff --git a/src/mame/merit/merit.cpp b/src/mame/merit/merit.cpp index af2c8a456c4..8306d346f37 100644 --- a/src/mame/merit/merit.cpp +++ b/src/mame/merit/merit.cpp @@ -1952,8 +1952,9 @@ ROM_START( dodgectya ) ROM_REGION( 0x8000, "gfx2", ROMREGION_ERASEFF ) /* No U40 char rom - Verified on 4 PCBs */ - ROM_REGION( 0x0800, "crt209", ROMREGION_ERASEFF ) - ROM_LOAD( "crt-209_2131-82", 0x00000, 0x0800, NO_DUMP ) /* 2816 EEPROM in Z80 epoxy CPU module */ + ROM_REGION( 0x0800, "crt209", ROMREGION_ERASEFF ) // two dumps from two PCBs, probably the second one is the good one but loading both until it can be determined for sure + ROM_LOAD( "crt-209_2131-82", 0x0000, 0x0800, CRC(f73402df) SHA1(342c3516b4ba09c3f0fa6737ff4b1970662efcb9) ) + ROM_LOAD( "crt-209_2131-82_alt", 0x0000, 0x0800, CRC(ec540d8a) SHA1(fbc64d4cc56f418bc090b47bb6798e3a90282f56) ) ROM_END ROM_START( dodgectyb ) @@ -1968,8 +1969,9 @@ ROM_START( dodgectyb ) ROM_REGION( 0x8000, "gfx2", ROMREGION_ERASEFF ) /* No U40 char rom - Verified on 4 PCBs */ - ROM_REGION( 0x0800, "crt209", ROMREGION_ERASEFF ) - ROM_LOAD( "crt-209_2131-82", 0x00000, 0x0800, NO_DUMP ) /* 2816 EEPROM in Z80 epoxy CPU module */ + ROM_REGION( 0x0800, "crt209", ROMREGION_ERASEFF ) // two dumps from two PCBs, probably the second one is the good one but loading both until it can be determined for sure + ROM_LOAD( "crt-209_2131-82", 0x0000, 0x0800, CRC(f73402df) SHA1(342c3516b4ba09c3f0fa6737ff4b1970662efcb9) ) + ROM_LOAD( "crt-209_2131-82_alt", 0x0000, 0x0800, CRC(ec540d8a) SHA1(fbc64d4cc56f418bc090b47bb6798e3a90282f56) ) ROM_END ROM_START( dodgectyc ) @@ -1984,8 +1986,9 @@ ROM_START( dodgectyc ) ROM_REGION( 0x8000, "gfx2", ROMREGION_ERASEFF ) /* No U40 char rom - Verified on 4 PCBs */ - ROM_REGION( 0x0800, "crt209", ROMREGION_ERASEFF ) - ROM_LOAD( "crt-209_2131-82", 0x00000, 0x0800, NO_DUMP ) /* 2816 EEPROM in Z80 epoxy CPU module */ + ROM_REGION( 0x0800, "crt209", ROMREGION_ERASEFF ) // two dumps from two PCBs, probably the second one is the good one but loading both until it can be determined for sure + ROM_LOAD( "crt-209_2131-82", 0x0000, 0x0800, CRC(f73402df) SHA1(342c3516b4ba09c3f0fa6737ff4b1970662efcb9) ) + ROM_LOAD( "crt-209_2131-82_alt", 0x0000, 0x0800, CRC(ec540d8a) SHA1(fbc64d4cc56f418bc090b47bb6798e3a90282f56) ) ROM_END ROM_START( trvwzh ) diff --git a/src/mame/misc/ssingles.cpp b/src/mame/misc/ssingles.cpp index 298bd908811..2f7adf3db93 100644 --- a/src/mame/misc/ssingles.cpp +++ b/src/mame/misc/ssingles.cpp @@ -1,5 +1,6 @@ // license:BSD-3-Clause -// copyright-holders:Tomasz Slanina +// copyright-holders: Tomasz Slanina + /* 'Swinging Singles' US distribution by Ent. Ent. Ltd Original Japan release is 'Utamaro' by 'Yachiyo' (undumped!) @@ -7,14 +8,14 @@ Crap XXX game. - Three roms contains text "BY YACHIYO" + Three ROMs contain text "BY YACHIYO" Upper half of 7.bin = upper half of 8.bin = intentional or bad dump ? TODO: - atamanot: needs a trojan, in order to understand how the protection really works. - - colors (missing prom(s) ?) - - samples (at least two of unused roms contains samples (unkn. format , adpcm ?) + - colors (missing PROM(s) ?) + - samples (at least two of unused ROMs contains samples (unkn. format , ADPCM ?) - dips (one is tested in game (difficulty related?), another 2 are tested at start) Unknown reads/writes: @@ -147,15 +148,29 @@ Dumped by Chack'n */ #include "emu.h" + #include "cpu/z80/z80.h" #include "sound/ay8910.h" #include "video/mc6845.h" + #include "emupal.h" #include "screen.h" #include "speaker.h" -#define NUM_PENS (4*8) -#define VMEM_SIZE 0x100 + +// configurable logging +#define LOG_ATAMANOTPROT (1U << 1) + +//#define VERBOSE (LOG_GENERAL | LOG_ATAMANOTPROT) + +#include "logmacro.h" + +#define LOGATAMANOTPROT(...) LOGMASKED(LOG_ATAMANOTPROT, __VA_ARGS__) + + +namespace { + +static constexpr uint8_t NUM_PENS = 4 * 8; class ssingles_state : public driver_device { @@ -163,33 +178,43 @@ public: ssingles_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu") + , m_videoram(*this, "videoram") + , m_colorram(*this, "colorram") + , m_gfx_rom(*this, "gfx") + , m_extra(*this, "EXTRA") { } void ssingles(machine_config &config); void atamanot(machine_config &config); - void init_ssingles(); - DECLARE_CUSTOM_INPUT_MEMBER(controls_r); protected: virtual void video_start() override; private: - uint8_t m_videoram[VMEM_SIZE]; - uint8_t m_colorram[VMEM_SIZE]; - uint8_t m_prot_data = 0; - pen_t m_pens[NUM_PENS]; - - uint8_t m_atamanot_prot_state = 0; - required_device m_maincpu; - void ssingles_videoram_w(offs_t offset, uint8_t data); - void ssingles_colorram_w(offs_t offset, uint8_t data); + required_shared_ptr m_videoram; + required_shared_ptr m_colorram; + required_region_ptr m_gfx_rom; + + required_ioport m_extra; + + pen_t m_pens[NUM_PENS]; + + // ssingles + uint8_t m_prot_data = 0; + + // atamanot + uint8_t m_atamanot_prot_state = 0; + + // ssingles uint8_t c000_r(); uint8_t c001_r(); void c001_w(uint8_t data); + + // atamanot uint8_t atamanot_prot_r(offs_t offset); void atamanot_prot_w(uint8_t data); @@ -216,29 +241,27 @@ static constexpr rgb_t ssingles_colors[NUM_PENS] = { 0x00,0x00,0x00 }, { 0xff,0x00,0xff }, { 0x80,0x00,0x80 }, { 0x40,0x00,0x40 } }; -MC6845_UPDATE_ROW( ssingles_state::ssingles_update_row ) +MC6845_UPDATE_ROW(ssingles_state::ssingles_update_row) { - uint8_t const *const gfx = memregion("gfx1")->base(); - for (int cx = 0; cx < x_count; ++cx) { - int address = ((ma >> 1) + (cx >> 1)) & 0xff; + int const address = ((ma >> 1) + (cx >> 1)) & 0xff; - uint16_t cell = m_videoram[address] + (m_colorram[address] << 8); + uint16_t const cell = m_videoram[address] + (m_colorram[address] << 8); - uint32_t tile_address = ((cell & 0x3ff) << 4) + ra; - uint16_t palette = (cell >> 10) & 0x1c; + uint32_t const tile_address = ((cell & 0x3ff) << 4) + ra; + uint16_t const palette = (cell >> 10) & 0x1c; uint8_t b0, b1; if (cx & 1) { - b0 = gfx[tile_address + 0x0000]; /* 9.bin */ - b1 = gfx[tile_address + 0x8000]; /* 11.bin */ + b0 = m_gfx_rom[tile_address + 0x0000]; // 9.bin + b1 = m_gfx_rom[tile_address + 0x8000]; // 11.bin } else { - b0 = gfx[tile_address + 0x4000]; /* 10.bin */ - b1 = gfx[tile_address + 0xc000]; /* 12.bin */ + b0 = m_gfx_rom[tile_address + 0x4000]; // 10.bin + b1 = m_gfx_rom[tile_address + 0xc000]; // 12.bin } for (int x = 7; x >= 0; --x) @@ -250,29 +273,27 @@ MC6845_UPDATE_ROW( ssingles_state::ssingles_update_row ) } } -MC6845_UPDATE_ROW( ssingles_state::atamanot_update_row ) +MC6845_UPDATE_ROW(ssingles_state::atamanot_update_row) { - const uint8_t *gfx = memregion("gfx1")->base(); - for (int cx = 0; cx < x_count; ++cx) { - int address = ((ma >> 1) + (cx >> 1)) & 0xff; + int const address = ((ma >> 1) + (cx >> 1)) & 0xff; - uint16_t cell = m_videoram[address] + (m_colorram[address] << 8); + uint16_t const cell = m_videoram[address] + (m_colorram[address] << 8); - uint32_t tile_address = ((cell & 0x1ff) << 4) + ra; - uint16_t palette = (cell >> 10) & 0x1c; + uint32_t const tile_address = ((cell & 0x1ff) << 4) + ra; + uint16_t const palette = (cell >> 10) & 0x1c; uint8_t b0, b1; if (cx & 1) { - b0 = gfx[tile_address + 0x0000]; /* 9.bin */ - b1 = gfx[tile_address + 0x4000]; /* 11.bin */ + b0 = m_gfx_rom[tile_address + 0x0000]; // 9.bin + b1 = m_gfx_rom[tile_address + 0x4000]; // 11.bin } else { - b0 = gfx[tile_address + 0x2000]; /* 10.bin */ - b1 = gfx[tile_address + 0x6000]; /* 12.bin */ + b0 = m_gfx_rom[tile_address + 0x2000]; // 10.bin + b1 = m_gfx_rom[tile_address + 0x6000]; // 12.bin } for (int x = 7; x >= 0; --x) @@ -285,24 +306,9 @@ MC6845_UPDATE_ROW( ssingles_state::atamanot_update_row ) } -void ssingles_state::ssingles_videoram_w(offs_t offset, uint8_t data) -{ - uint8_t *vram = memregion("vram")->base(); - vram[offset] = data; - m_videoram[offset]=data; -} - -void ssingles_state::ssingles_colorram_w(offs_t offset, uint8_t data) -{ - uint8_t *cram = memregion("cram")->base(); - cram[offset] = data; - m_colorram[offset]=data; -} - - void ssingles_state::video_start() { - for (int i=0; iread()) //multiplexed + switch (m_extra->read()) //multiplexed { case 0x01: data = 1; break; case 0x02: data = 2; break; @@ -342,8 +348,8 @@ CUSTOM_INPUT_MEMBER(ssingles_state::controls_r) void ssingles_state::ssingles_map(address_map &map) { - map(0x0000, 0x00ff).w(FUNC(ssingles_state::ssingles_videoram_w)); - map(0x0800, 0x08ff).w(FUNC(ssingles_state::ssingles_colorram_w)); + map(0x0000, 0x00ff).ram().share(m_videoram); + map(0x0800, 0x08ff).ram().share(m_colorram); map(0x0000, 0x1fff).rom(); map(0xc000, 0xc000).r(FUNC(ssingles_state::c000_r)); map(0xc001, 0xc001).rw(FUNC(ssingles_state::c001_r), FUNC(ssingles_state::c001_w)); @@ -356,9 +362,9 @@ uint8_t ssingles_state::atamanot_prot_r(offs_t offset) { static const char prot_id[] = { "PROGRAM BY KOYAMA" }; - logerror("%04x %02x\n",offset,m_atamanot_prot_state); + LOGATAMANOTPROT("%04x %02x\n", offset, m_atamanot_prot_state); - switch(m_atamanot_prot_state) + switch (m_atamanot_prot_state) { case 0x20: case 0x21: @@ -381,11 +387,11 @@ void ssingles_state::atamanot_prot_w(uint8_t data) void ssingles_state::atamanot_map(address_map &map) { - map(0x0000, 0x00ff).w(FUNC(ssingles_state::ssingles_videoram_w)); - map(0x0800, 0x08ff).w(FUNC(ssingles_state::ssingles_colorram_w)); + map(0x0000, 0x00ff).ram().share(m_videoram); + map(0x0800, 0x08ff).ram().share(m_colorram); map(0x0000, 0x3fff).rom(); map(0x4000, 0x47ff).ram(); - map(0x6000, 0x60ff).ram(); //kanji tilemap? + map(0x6000, 0x60ff).ram(); // kanji tilemap? // map(0x6000, 0x7fff).rom(); map(0x8000, 0x83ff).r(FUNC(ssingles_state::atamanot_prot_r)); // map(0x8000, 0x9fff).rom().region("question", 0x10000); @@ -404,7 +410,7 @@ void ssingles_state::ssingles_io_map(address_map &map) map(0x16, 0x16).portr("DSW0"); map(0x18, 0x18).portr("DSW1"); map(0x1c, 0x1c).portr("INPUTS"); -// map(0x1a, 0x1a).nopw(); //video/crt related +// map(0x1a, 0x1a).nopw(); // video/crt related map(0xfe, 0xfe).w("crtc", FUNC(mc6845_device::address_w)); map(0xff, 0xff).w("crtc", FUNC(mc6845_device::register_w)); } @@ -420,7 +426,7 @@ void ssingles_state::atamanot_io_map(address_map &map) map(0x16, 0x16).portr("DSW0"); map(0x18, 0x18).portr("DSW1").w(FUNC(ssingles_state::atamanot_prot_w)); map(0x1c, 0x1c).portr("INPUTS"); -// map(0x1a, 0x1a).nopw(); //video/crt related +// map(0x1a, 0x1a).nopw(); // video/crt related map(0xfe, 0xfe).w("crtc", FUNC(mc6845_device::address_w)); map(0xff, 0xff).w("crtc", FUNC(mc6845_device::register_w)); } @@ -428,7 +434,7 @@ void ssingles_state::atamanot_io_map(address_map &map) static INPUT_PORTS_START( ssingles ) PORT_START("INPUTS") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN ) //must be LOW + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN ) // must be LOW PORT_BIT( 0x1c, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(ssingles_state, controls_r) PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2 ) @@ -461,7 +467,7 @@ static INPUT_PORTS_START( ssingles ) PORT_DIPNAME( 0x10, 0x10, "Unk3" ) PORT_DIPSETTING( 0x00, DEF_STR( No ) ) PORT_DIPSETTING( 0x10, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x40, 0x40, "Unk4" ) //tested in game, every frame, could be difficulty related + PORT_DIPNAME( 0x40, 0x40, "Unk4" ) // tested in game, every frame, could be difficulty related PORT_DIPSETTING( 0x00, DEF_STR( No ) ) PORT_DIPSETTING( 0x40, DEF_STR( Yes ) ) PORT_DIPNAME( 0x80, 0x80, "Unk5" ) @@ -539,11 +545,11 @@ static const gfx_layout layout_8x16 = }; static GFXDECODE_START( gfx_ssingles ) - GFXDECODE_ENTRY( "gfx1", 0, layout_8x8, 0, 8 ) + GFXDECODE_ENTRY( "gfx", 0, layout_8x8, 0, 8 ) GFXDECODE_END static GFXDECODE_START( gfx_atamanot ) - GFXDECODE_ENTRY( "gfx1", 0, layout_8x8, 0, 8 ) + GFXDECODE_ENTRY( "gfx", 0, layout_8x8, 0, 8 ) GFXDECODE_ENTRY( "kanji", 0, layout_16x16, 0, 8 ) GFXDECODE_ENTRY( "kanji_uc", 0, layout_8x16, 0, 8 ) GFXDECODE_ENTRY( "kanji_lc", 0, layout_8x16, 0, 8 ) @@ -551,31 +557,31 @@ GFXDECODE_END void ssingles_state::ssingles(machine_config &config) { - Z80(config, m_maincpu, 4000000); /* ? MHz */ + Z80(config, m_maincpu, 4'000'000); // ? MHz m_maincpu->set_addrmap(AS_PROGRAM, &ssingles_state::ssingles_map); m_maincpu->set_addrmap(AS_IO, &ssingles_state::ssingles_io_map); screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); - screen.set_raw(4000000, 256, 0, 256, 256, 0, 256); /* temporary, CRTC will configure screen */ + screen.set_raw(4'000'000, 256, 0, 256, 256, 0, 256); // temporary, CRTC will configure screen screen.set_screen_update("crtc", FUNC(mc6845_device::screen_update)); - PALETTE(config, "palette").set_entries(4); //guess + PALETTE(config, "palette").set_entries(4); // guess GFXDECODE(config, "gfxdecode", "palette", gfx_ssingles); - mc6845_device &crtc(MC6845(config, "crtc", 1000000 /* ? MHz */)); + mc6845_device &crtc(MC6845(config, "crtc", 1'000'000)); // ? MHz crtc.set_screen("screen"); crtc.set_show_border_area(false); crtc.set_char_width(8); crtc.set_update_row_callback(FUNC(ssingles_state::ssingles_update_row)); crtc.out_vsync_callback().set_inputline(m_maincpu, INPUT_LINE_NMI); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); - AY8910(config, "ay1", 1500000).add_route(ALL_OUTPUTS, "mono", 0.5); /* ? MHz */ + AY8910(config, "ay1", 1'500'000).add_route(ALL_OUTPUTS, "mono", 0.5); // ? MHz - AY8910(config, "ay2", 1500000).add_route(ALL_OUTPUTS, "mono", 0.5); /* ? MHz */ + AY8910(config, "ay2", 1'500'000).add_route(ALL_OUTPUTS, "mono", 0.5); // ? MHz } WRITE_LINE_MEMBER(ssingles_state::atamanot_irq) @@ -598,22 +604,19 @@ void ssingles_state::atamanot(machine_config &config) } ROM_START( ssingles ) - ROM_REGION( 0x10000, "maincpu", 0 ) /* Z80 main CPU */ + ROM_REGION( 0x10000, "maincpu", 0 ) // Z80 ROM_LOAD( "1.bin", 0x00000, 0x2000, CRC(43f02215) SHA1(9f04a7d4671ff39fd2bd8ec7afced4981ee7be05) ) ROM_LOAD( "2.bin", 0x06000, 0x2000, CRC(281f27e4) SHA1(cef28717ab2ed991a5709464c01490f0ab1dc17c) ) ROM_LOAD( "3.bin", 0x08000, 0x2000, CRC(14fdcb65) SHA1(70f7fcb46e74937de0e4037c9fe79349a30d0d07) ) ROM_LOAD( "4.bin", 0x0a000, 0x2000, CRC(acb44685) SHA1(d68aab8b7e68d842a350d3fb76985ac857b1d972) ) - ROM_REGION( 0x100, "vram", ROMREGION_ERASE00 ) - ROM_REGION( 0x100, "cram", ROMREGION_ERASE00 ) - - ROM_REGION( 0x10000, "gfx1", 0 ) + ROM_REGION( 0x10000, "gfx", 0 ) ROM_LOAD( "9.bin", 0x0000, 0x4000, CRC(57fac6f9) SHA1(12f6695c9831399e599a95008ebf9db943725437) ) ROM_LOAD( "10.bin", 0x4000, 0x4000, CRC(cd3ba260) SHA1(2499ad9982cc6356e2eb3a0f10d77886872a0c9f) ) ROM_LOAD( "11.bin", 0x8000, 0x4000, CRC(f7107b29) SHA1(a405926fd3cb4b3d2a1c705dcde25d961dba5884) ) ROM_LOAD( "12.bin", 0xc000, 0x4000, CRC(e5585a93) SHA1(04d55699b56d869066f2be2c6ac48042aa6c3108) ) - ROM_REGION( 0x08000, "user1", 0) /* samples ? data ?*/ + ROM_REGION( 0x08000, "user1", 0) // samples ? data ? ROM_LOAD( "5.bin", 0x00000, 0x2000, CRC(242a8dda) SHA1(e140893cc05fb8cee75904d98b02626f2565ed1b) ) ROM_LOAD( "6.bin", 0x02000, 0x2000, CRC(85ab8aab) SHA1(566f034e1ba23382442f27457447133a0e0f1cfc) ) ROM_LOAD( "7.bin", 0x04000, 0x2000, CRC(57cc112d) SHA1(fc861c58ae39503497f04d302a9f16fca19b37fb) ) @@ -627,10 +630,7 @@ ROM_START( atamanot ) ROM_LOAD( "tt1.2", 0x0000, 0x2000, CRC(da9e270d) SHA1(b7408be913dad8abf022c6153f2493204dd74952) ) ROM_LOAD( "tt2.3", 0x2000, 0x2000, CRC(7595ade8) SHA1(71f9d6d987407f88cdd3b28bd1e35e00ac17e1f5) ) - ROM_REGION( 0x100, "vram", ROMREGION_ERASE00 ) - ROM_REGION( 0x100, "cram", ROMREGION_ERASE00 ) - - ROM_REGION( 0x18000, "question", 0 ) //question roms? + ROM_REGION( 0x18000, "question", 0 ) // question ROMs? ROM_LOAD( "ta.bin", 0x00000, 0x2000, CRC(5c61edaf) SHA1(ea56df6b320aa7e52828aaccbb5838cd0c756f24) ) ROM_LOAD( "tb.bin", 0x02000, 0x2000, CRC(07bd2e6f) SHA1(bf245d8208db447572e484057b9daa6276f03683) ) ROM_LOAD( "tc.bin", 0x04000, 0x2000, CRC(1e09ac09) SHA1(91ec1b2c5767b5bad8915f7c9984f423fcb399c9) ) @@ -644,7 +644,7 @@ ROM_START( atamanot ) ROM_LOAD( "k.bin", 0x14000, 0x2000, CRC(c75c7a1e) SHA1(59b136626267fa3ba5a2e1709acb632142e1560e) ) ROM_LOAD( "l.bin", 0x16000, 0x2000, CRC(dbb4ed60) SHA1(b5054ba3ccd268594d22e1e67f70bb227095ca4c) ) - ROM_REGION( 0x8000, "gfx1", 0 ) + ROM_REGION( 0x8000, "gfx", 0 ) ROM_LOAD( "ca.49", 0x0000, 0x2000, CRC(28d20b52) SHA1(a104ef1cd103f31803b88bd2d4804eab5a26e7fa) ) ROM_LOAD( "cc.48", 0x2000, 0x2000, CRC(209cab0d) SHA1(9a89af1f7186e4845e43f9cdafd273e69d280bfb) ) ROM_LOAD( "cb.47", 0x4000, 0x2000, CRC(8bc85c0c) SHA1(64701bc910c28666d15ee22f59f32888cc2302ae) ) @@ -656,25 +656,22 @@ ROM_START( atamanot ) ROM_LOAD( "ic34.bin", 0x08000, 0x8000, CRC(06e7c7da) SHA1(a222c0b0eccfda613f916320e6afbb33385921ba) ) ROM_LOAD( "ic33.bin", 0x00000, 0x8000, CRC(323a70e7) SHA1(55e570f039c97d15b06bfcb1ebf03562cbcf8324) ) - ROM_REGION( 0x10000, "kanji_uc", 0 ) //upper case + ROM_REGION( 0x10000, "kanji_uc", 0 ) // upper case ROM_COPY( "kanji", 0x10000, 0x08000, 0x08000 ) ROM_COPY( "kanji", 0x00000, 0x00000, 0x08000 ) - ROM_REGION( 0x10000, "kanji_lc", 0 ) //lower case + ROM_REGION( 0x10000, "kanji_lc", 0 ) // lower case ROM_COPY( "kanji", 0x18000, 0x08000, 0x08000 ) ROM_COPY( "kanji", 0x08000, 0x00000, 0x08000 ) - ROM_REGION( 0x0300, "proms", 0 ) //NOT color proms + ROM_REGION( 0x0300, "proms", 0 ) // NOT color proms ROM_LOAD( "1.52", 0x00000, 0x0100, CRC(13f5762b) SHA1(da9cc51eda0681b0d3c17b212d23ab89af2813ff) ) ROM_LOAD( "2.53", 0x00100, 0x0100, CRC(4142f525) SHA1(2e2e896ba7b49df9cf3fddff6becc07a3d50d926) ) ROM_LOAD( "3.54", 0x00200, 0x0100, CRC(88acb21e) SHA1(18fe5280dad6687daf6bf42d37dde45157fab5e3) ) ROM_END -void ssingles_state::init_ssingles() -{ - save_item(NAME(m_videoram)); - save_item(NAME(m_colorram)); -} +} // anonymous namespace -GAME( 1983, ssingles, 0, ssingles, ssingles, ssingles_state, init_ssingles, ROT90, "Yachiyo Denki (Entertainment Enterprises, Ltd. license)", "Swinging Singles (US)", MACHINE_SUPPORTS_SAVE | MACHINE_WRONG_COLORS | MACHINE_IMPERFECT_SOUND ) -GAME( 1983, atamanot, 0, atamanot, ssingles, ssingles_state, init_ssingles, ROT90, "Yachiyo Denki / Uni Enterprize", "Computer Quiz Atama no Taisou (Japan)", MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION ) + +GAME( 1983, ssingles, 0, ssingles, ssingles, ssingles_state, empty_init, ROT90, "Yachiyo Denki (Entertainment Enterprises, Ltd. license)", "Swinging Singles (US)", MACHINE_SUPPORTS_SAVE | MACHINE_WRONG_COLORS | MACHINE_IMPERFECT_SOUND ) +GAME( 1983, atamanot, 0, atamanot, ssingles, ssingles_state, empty_init, ROT90, "Yachiyo Denki / Uni Enterprize", "Computer Quiz Atama no Taisou (Japan)", MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION ) diff --git a/src/mame/mr/dribling.cpp b/src/mame/mr/dribling.cpp index 98db54deef3..90665125250 100644 --- a/src/mame/mr/dribling.cpp +++ b/src/mame/mr/dribling.cpp @@ -1,5 +1,6 @@ // license:BSD-3-Clause -// copyright-holders:Aaron Giles +// copyright-holders: Aaron Giles + /*************************************************************************** Model Racing Dribbling hardware @@ -34,13 +35,165 @@ ***************************************************************************/ #include "emu.h" -#include "dribling.h" #include "cpu/z80/z80.h" #include "machine/i8255.h" +#include "machine/watchdog.h" + +#include "emupal.h" #include "screen.h" +// configurable logging +#define LOG_MISC (1U << 1) +#define LOG_SOUND (1U << 2) +#define LOG_PB (1U << 3) + +//#define VERBOSE (LOG_GENERAL | LOG_MISC | LOG_SOUND | LOG_PB) + +#include "logmacro.h" + +#define LOGMISC(...) LOGMASKED(LOG_MISC, __VA_ARGS__) +#define LOGSOUND(...) LOGMASKED(LOG_SOUND, __VA_ARGS__) +#define LOGPB(...) LOGMASKED(LOG_PB, __VA_ARGS__) + + +namespace { + +class dribling_state : public driver_device +{ +public: + dribling_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_ppi8255(*this, "ppi8255%d", 0), + m_videoram(*this, "videoram"), + m_colorram(*this, "colorram"), + m_mux(*this, "MUX%u", 0), + m_proms(*this, "proms"), + m_gfxroms(*this, "gfx") + { } + + void dribling(machine_config &config); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + +private: + // devices + required_device m_maincpu; + required_device m_watchdog; + required_device_array m_ppi8255; + + // memory pointers + required_shared_ptr m_videoram; + required_shared_ptr m_colorram; + required_ioport_array<3> m_mux; + required_region_ptr m_proms; + required_region_ptr m_gfxroms; + + // misc + uint8_t m_abca = 0U; + uint8_t m_dr = 0U; + uint8_t m_ds = 0U; + uint8_t m_sh = 0U; + uint8_t m_input_mux = 0U; + uint8_t m_di = 0U; + + uint8_t ioread(offs_t offset); + void iowrite(offs_t offset, uint8_t data); + void colorram_w(offs_t offset, uint8_t data); + uint8_t dsr_r(); + uint8_t input_mux0_r(); + void misc_w(uint8_t data); + void sound_w(uint8_t data); + void pb_w(uint8_t data); + void shr_w(uint8_t data); + void palette(palette_device &palette) const; + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(irq_gen); + void prg_map(address_map &map); + void io_map(address_map &map); +}; + + +// video + +/************************************* + * + * Convert the palette PROM into + * a real palette + * + *************************************/ + +void dribling_state::palette(palette_device &palette) const +{ + uint8_t const *const prom = memregion("proms")->base() + 0x400; + + for (int i = 0; i < 256; i++) + { + int r = (~prom[i] >> 0) & 1; // 220 + int g = (~prom[i] >> 1) & 3; // 820 + 560 (332 max) + int b = (~prom[i] >> 3) & 1; // 220 + + r *= 0xff; + g *= 0x55; + b *= 0xff; + + palette.set_pen_color(i, rgb_t(r, g, b)); + } +} + + + +/************************************* + * + * Color control writes + * + *************************************/ + +void dribling_state::colorram_w(offs_t offset, uint8_t data) +{ + // it is very important that we mask off the two bits here + m_colorram[offset & 0x1f9f] = data; +} + + + +/************************************* + * + * Video update routine + * + *************************************/ + +uint32_t dribling_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + // loop over rows + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) + { + uint16_t *const dst = &bitmap.pix(y); + + // loop over columns + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) + { + int const b7 = m_proms[(x >> 3) | ((y >> 3) << 5)] & 1; + int const b6 = m_abca; + int const b5 = (x >> 3) & 1; + int const b4 = (m_gfxroms[(x >> 3) | (y << 5)] >> (x & 7)) & 1; + int const b3 = (m_videoram[(x >> 3) | (y << 5)] >> (x & 7)) & 1; + int const b2_0 = m_colorram[(x >> 3) | ((y >> 2) << 7)] & 7; + + // assemble the various bits into a palette PROM index + dst[x] = (b7 << 7) | (b6 << 6) | (b5 << 5) | (b4 << 4) | (b3 << 3) | b2_0; + } + } + return 0; +} + + +// machine /************************************* * @@ -108,7 +261,7 @@ void dribling_state::misc_w(uint8_t data) // bit 1 = (10) = PC1 // bit 0 = (32) = PC0 m_input_mux = data & 7; - logerror("%s:misc_w(%02X)\n", machine().describe_context(), data); + LOGMISC("%s:misc_w(%02X)\n", machine().describe_context(), data); } @@ -122,14 +275,14 @@ void dribling_state::sound_w(uint8_t data) // bit 2 = folla a (crowd a) // bit 1 = folla m (crowd m) // bit 0 = folla b (crowd b) - logerror("%s:sound_w(%02X)\n", machine().describe_context(), data); + LOGSOUND("%s:sound_w(%02X)\n", machine().describe_context(), data); } void dribling_state::pb_w(uint8_t data) { // write PB0-7 - logerror("%s:pb_w(%02X)\n", machine().describe_context(), data); + LOGPB("%s:pb_w(%02X)\n", machine().describe_context(), data); } @@ -318,10 +471,10 @@ void dribling_state::dribling(machine_config &config) ROM_START( dribling ) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "5p.bin", 0x0000, 0x1000, CRC(0e791947) SHA1(57bc4f4e9e1fe3fbac1017601c9c75029b2601a4) ) - ROM_LOAD( "5n.bin", 0x1000, 0x1000, CRC(bd0f223a) SHA1(f9fbc5670a8723c091d61012e545774d315eb18f) ) // + ROM_LOAD( "5n.bin", 0x1000, 0x1000, CRC(bd0f223a) SHA1(f9fbc5670a8723c091d61012e545774d315eb18f) ) ROM_LOAD( "5l.bin", 0x4000, 0x1000, CRC(1fccfc85) SHA1(c0365ad54144414218f52209173b858b927c9626) ) - ROM_LOAD( "5k.bin", 0x5000, 0x1000, CRC(737628c4) SHA1(301fda413388c26da5b5150aec2cefc971801749) ) // - ROM_LOAD( "5h.bin", 0x6000, 0x1000, CRC(30d0957f) SHA1(52135e12094ee1c8828a48c355bdd565aa5895de) ) // + ROM_LOAD( "5k.bin", 0x5000, 0x1000, CRC(737628c4) SHA1(301fda413388c26da5b5150aec2cefc971801749) ) + ROM_LOAD( "5h.bin", 0x6000, 0x1000, CRC(30d0957f) SHA1(52135e12094ee1c8828a48c355bdd565aa5895de) ) ROM_REGION( 0x2000, "gfx", 0 ) ROM_LOAD( "3p.bin", 0x0000, 0x1000, CRC(208971b8) SHA1(f91f3ea04d75beb58a61c844472b4dba53d84c0f) ) @@ -394,6 +547,8 @@ ROM_START( driblingbr ) ROM_LOAD( "tbp24s10.2d", 0x0500, 0x0100, CRC(a17d6956) SHA1(81724daf2e2d319f55cc34cc881b6a9a4e64e7ac) ) ROM_END +} // anonymous namespace + /************************************* * diff --git a/src/mame/mr/dribling.h b/src/mame/mr/dribling.h deleted file mode 100644 index 4fd5777b747..00000000000 --- a/src/mame/mr/dribling.h +++ /dev/null @@ -1,74 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Aaron Giles -/************************************************************************* - - Model Racing Dribbling hardware - -*************************************************************************/ -#ifndef MAME_INCLUDES_DRIBLING_H -#define MAME_INCLUDES_DRIBLING_H - -#pragma once - -#include "machine/i8255.h" -#include "machine/watchdog.h" -#include "emupal.h" - -class dribling_state : public driver_device -{ -public: - dribling_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_ppi8255(*this, "ppi8255%d", 0), - m_videoram(*this, "videoram"), - m_colorram(*this, "colorram"), - m_mux(*this, "MUX%u", 0), - m_proms(*this, "proms"), - m_gfxroms(*this, "gfx") - { } - - void dribling(machine_config &config); - -protected: - virtual void machine_start() override; - virtual void machine_reset() override; - -private: - // devices - required_device m_maincpu; - required_device m_watchdog; - required_device_array m_ppi8255; - // memory pointers - required_shared_ptr m_videoram; - required_shared_ptr m_colorram; - required_ioport_array<3> m_mux; - required_region_ptr m_proms; - required_region_ptr m_gfxroms; - - // misc - uint8_t m_abca = 0U; - uint8_t m_dr = 0U; - uint8_t m_ds = 0U; - uint8_t m_sh = 0U; - uint8_t m_input_mux = 0U; - uint8_t m_di = 0U; - - uint8_t ioread(offs_t offset); - void iowrite(offs_t offset, uint8_t data); - void colorram_w(offs_t offset, uint8_t data); - uint8_t dsr_r(); - uint8_t input_mux0_r(); - void misc_w(uint8_t data); - void sound_w(uint8_t data); - void pb_w(uint8_t data); - void shr_w(uint8_t data); - void palette(palette_device &palette) const; - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(irq_gen); - void prg_map(address_map &map); - void io_map(address_map &map); -}; - -#endif // MAME_INCLUDES_DRIBLING_H diff --git a/src/mame/mr/dribling_v.cpp b/src/mame/mr/dribling_v.cpp deleted file mode 100644 index 1f6977af69e..00000000000 --- a/src/mame/mr/dribling_v.cpp +++ /dev/null @@ -1,82 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Aaron Giles -/*************************************************************************** - - Model Racing Dribbling hardware - -***************************************************************************/ - -#include "emu.h" -#include "dribling.h" - - -/************************************* - * - * Convert the palette PROM into - * a real palette - * - *************************************/ - -void dribling_state::palette(palette_device &palette) const -{ - uint8_t const *const prom = memregion("proms")->base() + 0x400; - - for (int i = 0; i < 256; i++) - { - int r = (~prom[i] >> 0) & 1; // 220 - int g = (~prom[i] >> 1) & 3; // 820 + 560 (332 max) - int b = (~prom[i] >> 3) & 1; // 220 - - r *= 0xff; - g *= 0x55; - b *= 0xff; - - palette.set_pen_color(i, rgb_t(r, g, b)); - } -} - - - -/************************************* - * - * Color control writes - * - *************************************/ - -void dribling_state::colorram_w(offs_t offset, uint8_t data) -{ - // it is very important that we mask off the two bits here - m_colorram[offset & 0x1f9f] = data; -} - - - -/************************************* - * - * Video update routine - * - *************************************/ - -uint32_t dribling_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - // loop over rows - for (int y = cliprect.min_y; y <= cliprect.max_y; y++) - { - uint16_t *const dst = &bitmap.pix(y); - - // loop over columns - for (int x = cliprect.min_x; x <= cliprect.max_x; x++) - { - int b7 = m_proms[(x >> 3) | ((y >> 3) << 5)] & 1; - int b6 = m_abca; - int b5 = (x >> 3) & 1; - int b4 = (m_gfxroms[(x >> 3) | (y << 5)] >> (x & 7)) & 1; - int b3 = (m_videoram[(x >> 3) | (y << 5)] >> (x & 7)) & 1; - int b2_0 = m_colorram[(x >> 3) | ((y >> 2) << 7)] & 7; - - // assemble the various bits into a palette PROM index - dst[x] = (b7 << 7) | (b6 << 6) | (b5 << 5) | (b4 << 4) | (b3 << 3) | b2_0; - } - } - return 0; -}