From 022c0f32eead81d7ac604ad4494e144b511e15d9 Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Fri, 31 Jan 2025 16:57:08 +0100 Subject: [PATCH] New clones marked not working ----------------------------- Head Panic (ver. 8.30) [trol] - seta/speedatk: merged driver into single file --- src/mame/mame.lst | 1 + src/mame/misc/esd16.cpp | 68 ++++++--- src/mame/seta/speedatk.cpp | 274 ++++++++++++++++++++++++++++------- src/mame/seta/speedatk.h | 68 --------- src/mame/seta/speedatk_v.cpp | 102 ------------- 5 files changed, 267 insertions(+), 246 deletions(-) delete mode 100644 src/mame/seta/speedatk.h delete mode 100644 src/mame/seta/speedatk_v.cpp diff --git a/src/mame/mame.lst b/src/mame/mame.lst index aeb4e3f875a00..7a5d30d97c077 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -30251,6 +30251,7 @@ deluxe4u // (c) 2000 ESD fantstry // (c) 2002 Z Soft fantstrya // (c) 2002 Z Soft hedpanic // (c) 2000 ESD +hedpanic830 // (c) 1999 ESD hedpanica // (c) 1999 ESD hedpanicf // (c) 2000 ESD + Fuuki, Co. Ltd. hedpanico // (c) 1999 ESD diff --git a/src/mame/misc/esd16.cpp b/src/mame/misc/esd16.cpp index d0d51e8a7ecb1..04bfbb70e9b33 100644 --- a/src/mame/misc/esd16.cpp +++ b/src/mame/misc/esd16.cpp @@ -1307,6 +1307,33 @@ ROM_START( hedpanico ) // Story line & game instructions in English, copyright y ROM_END +ROM_START( hedpanic830 ) // Story line & game instructions in English + ROM_REGION( 0x080000, "maincpu", 0 ) // 68000 Code + ROM_LOAD16_BYTE( "esd2.cu03", 0x000000, 0x040000, CRC(955be87f) SHA1(835ec1c9a6d77d095bac7427e428ec25861d91dd) ) + ROM_LOAD16_BYTE( "esd1.cu02", 0x000001, 0x040000, CRC(b56a4fe8) SHA1(dc64c81c1a04af8b248d3e46ddee73eca23c74fd) ) + + ROM_REGION( 0x40000, "audiocpu", 0 ) // Z80 Code, quite different to the other sets + ROM_LOAD( "esd3.su06", 0x00000, 0x40000, CRC(f4588a2c) SHA1(c9c26561f7ce2574032dfada707fcf99b913b1d5) ) + + ROM_REGION( 0x600000, "spr", 0 ) // Sprites, 16x16x5 + ROM_LOAD( "esd6.ju01", 0x200000, 0x200000, CRC(ffa6eb26) SHA1(c2e3371925604db0f46991cbfd39d763518ed89c) ) + ROM_LOAD( "esd7.ju02", 0x000000, 0x200000, CRC(5554ba0f) SHA1(6d02fa6d0712aa820231a24ee7a8396cc575e788) ) + // expand this to take up 0x200000 bytes too so we can decode it + ROM_LOAD16_BYTE( "esd5.ju07", 0x400000, 0x080000, CRC(95269b3c) SHA1(df106d9e8d4c1484ff86170adcb1932d4d02f265) ) + ROM_FILL( 0x500000, 0x100000, 0x00 ) + + ROM_REGION( 0x400000, "bgs", 0 ) // Layers, 16x16x8 + ROM_LOAD32_WORD( "esd8.fu35", 0x000000, 0x200000, CRC(23aceb4f) SHA1(35d9ebc33b9e1515e47750cfcdfc0bf8bf44b71d) ) + ROM_LOAD32_WORD( "esd9.fu34", 0x000002, 0x200000, CRC(76b46cd2) SHA1(679cbf50ae5935e8848868081ecef4ec66424f6c) ) + + ROM_REGION( 0x40000, "oki", 0 ) // Samples + ROM_LOAD( "esd4.su10", 0x000000, 0x040000, CRC(5ba89bf1) SHA1(f3c5b588dc3fbd0dba3120aa60f76c08db4c6e08) ) // 1ST AND 2ND HALF IDENTICAL + + ROM_REGION16_BE( 0x80, "eeprom", 0 ) + ROM_LOAD( "hedpanic.nv", 0x0000, 0x0080, CRC(e91f4038) SHA1(f492de71170900f87912a272ab4f4a3a37ba31fe) ) +ROM_END + + /* @@ -1805,35 +1832,36 @@ ROM_END ***************************************************************************/ // ESD 11-09-98 -GAME( 1999, multchmp, 0, esd16, multchmp, esd16_state, empty_init, ROT0, "ESD", "Multi Champ (World, ver. 2.5)", MACHINE_SUPPORTS_SAVE ) -GAME( 1998, multchmpk, multchmp, esd16, multchmp, esd16_state, empty_init, ROT0, "ESD", "Multi Champ (Korea, older)", MACHINE_SUPPORTS_SAVE ) -GAME( 1998, multchmpa, multchmp, esd16, multchmp, esd16_state, empty_init, ROT0, "ESD", "Multi Champ (World, older)", MACHINE_SUPPORTS_SAVE ) +GAME( 1999, multchmp, 0, esd16, multchmp, esd16_state, empty_init, ROT0, "ESD", "Multi Champ (World, ver. 2.5)", MACHINE_SUPPORTS_SAVE ) +GAME( 1998, multchmpk, multchmp, esd16, multchmp, esd16_state, empty_init, ROT0, "ESD", "Multi Champ (Korea, older)", MACHINE_SUPPORTS_SAVE ) +GAME( 1998, multchmpa, multchmp, esd16, multchmp, esd16_state, empty_init, ROT0, "ESD", "Multi Champ (World, older)", MACHINE_SUPPORTS_SAVE ) -GAME( 2001, jumppop, 0, jumppop, jumppop, esd16_state, empty_init, ROT0, "ESD", "Jumping Pop (set 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 2001, jumppope, jumppop, jumppop, jumppop, esd16_state, empty_init, ROT0, "Emag Soft", "Jumping Pop (set 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 2001, jumppop, 0, jumppop, jumppop, esd16_state, empty_init, ROT0, "ESD", "Jumping Pop (set 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 2001, jumppope, jumppop, jumppop, jumppop, esd16_state, empty_init, ROT0, "Emag Soft", "Jumping Pop (set 2)", MACHINE_SUPPORTS_SAVE ) // ESD 05-28-99 -GAME( 1999, hedpanico, hedpanic, hedpanio, hedpanic, esd16_state, empty_init, ROT0, "ESD", "Head Panic (ver. 0615, 15/06/1999)", MACHINE_SUPPORTS_SAVE ) +GAME( 1999, hedpanico, hedpanic, hedpanio, hedpanic, esd16_state, empty_init, ROT0, "ESD", "Head Panic (ver. 0615, 15/06/1999)", MACHINE_SUPPORTS_SAVE ) // ESD 06-10-1999 -GAME( 1999, hedpanica, hedpanic, hedpanic, hedpanic, esd16_state, empty_init, ROT0, "ESD", "Head Panic (ver. 0702, 02/07/1999)", MACHINE_SUPPORTS_SAVE ) +GAME( 1999, hedpanica, hedpanic, hedpanic, hedpanic, esd16_state, empty_init, ROT0, "ESD", "Head Panic (ver. 0702, 02/07/1999)", MACHINE_SUPPORTS_SAVE ) // ESD 08-26-1999 -GAME( 2000, mchampdx, 0, mchampdx, hedpanic, esd16_state, empty_init, ROT0, "ESD", "Multi Champ Deluxe (ver. 0106, 06/01/2000)", MACHINE_SUPPORTS_SAVE ) -GAME( 1999, mchampdxa, mchampdx, mchampdx, hedpanic, esd16_state, empty_init, ROT0, "ESD", "Multi Champ Deluxe (ver. 1126, 26/11/1999)", MACHINE_SUPPORTS_SAVE ) -GAME( 1999, mchampdxb, mchampdx, mchampdx, hedpanic, esd16_state, empty_init, ROT0, "ESD", "Multi Champ Deluxe (ver. 1114, 14/11/1999)", MACHINE_SUPPORTS_SAVE ) -GAME( 2000, hedpanic, 0, hedpanic, hedpanic, esd16_state, empty_init, ROT0, "ESD", "Head Panic (ver. 0117, 17/01/2000)", MACHINE_SUPPORTS_SAVE ) -GAME( 2000, hedpanicf, hedpanic, hedpanic, hedpanic, esd16_state, empty_init, ROT0, "ESD / Fuuki", "Head Panic (ver. 0315, 15/03/2000)", MACHINE_SUPPORTS_SAVE ) +GAME( 2000, mchampdx, 0, mchampdx, hedpanic, esd16_state, empty_init, ROT0, "ESD", "Multi Champ Deluxe (ver. 0106, 06/01/2000)", MACHINE_SUPPORTS_SAVE ) +GAME( 1999, mchampdxa, mchampdx, mchampdx, hedpanic, esd16_state, empty_init, ROT0, "ESD", "Multi Champ Deluxe (ver. 1126, 26/11/1999)", MACHINE_SUPPORTS_SAVE ) +GAME( 1999, mchampdxb, mchampdx, mchampdx, hedpanic, esd16_state, empty_init, ROT0, "ESD", "Multi Champ Deluxe (ver. 1114, 14/11/1999)", MACHINE_SUPPORTS_SAVE ) +GAME( 1999, hedpanic830, hedpanic, hedpanic, hedpanic, esd16_state, empty_init, ROT0, "ESD", "Head Panic (ver. 8.30)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE ) // playable, just no sound +GAME( 2000, hedpanic, 0, hedpanic, hedpanic, esd16_state, empty_init, ROT0, "ESD", "Head Panic (ver. 0117, 17/01/2000)", MACHINE_SUPPORTS_SAVE ) +GAME( 2000, hedpanicf, hedpanic, hedpanic, hedpanic, esd16_state, empty_init, ROT0, "ESD / Fuuki", "Head Panic (ver. 0315, 15/03/2000)", MACHINE_SUPPORTS_SAVE ) // ESD - This PCB looks identical to the ESD 08-26-1999 PCB -GAME( 2000, deluxe5, 0, tangtang, hedpanic, esd16_state, empty_init, ROT0, "ESD", "Deluxe 5 (ver. 0107, 07/01/2000, set 1)", MACHINE_SUPPORTS_SAVE ) // all 4 sets report the same version number? -GAME( 2000, deluxe5a, deluxe5, tangtang, hedpanic, esd16_state, empty_init, ROT0, "ESD", "Deluxe 5 (ver. 0107, 07/01/2000, set 2)", MACHINE_SUPPORTS_SAVE ) -GAME( 2000, deluxe5b, deluxe5, tangtang, hedpanic, esd16_state, empty_init, ROT0, "ESD", "Deluxe 5 (ver. 0107, 07/01/2000, set 3)", MACHINE_SUPPORTS_SAVE ) -GAME( 2000, deluxe4u, deluxe5, tangtang, hedpanic, esd16_state, empty_init, ROT0, "ESD", "Deluxe 4 U (ver. 0107, 07/01/2000)", MACHINE_SUPPORTS_SAVE ) +GAME( 2000, deluxe5, 0, tangtang, hedpanic, esd16_state, empty_init, ROT0, "ESD", "Deluxe 5 (ver. 0107, 07/01/2000, set 1)", MACHINE_SUPPORTS_SAVE ) // all 4 sets report the same version number? +GAME( 2000, deluxe5a, deluxe5, tangtang, hedpanic, esd16_state, empty_init, ROT0, "ESD", "Deluxe 5 (ver. 0107, 07/01/2000, set 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 2000, deluxe5b, deluxe5, tangtang, hedpanic, esd16_state, empty_init, ROT0, "ESD", "Deluxe 5 (ver. 0107, 07/01/2000, set 3)", MACHINE_SUPPORTS_SAVE ) +GAME( 2000, deluxe4u, deluxe5, tangtang, hedpanic, esd16_state, empty_init, ROT0, "ESD", "Deluxe 4 U (ver. 0107, 07/01/2000)", MACHINE_SUPPORTS_SAVE ) -GAME( 2000, tangtang, 0, tangtang, hedpanic, esd16_state, empty_init, ROT0, "ESD", "Tang Tang (ver. 0526, 26/05/2000)", MACHINE_SUPPORTS_SAVE ) -GAME( 2001, swatpolc, 0, hedpanic, swatpolc, esd16_state, empty_init, ROT0, "ESD", "SWAT Police", MACHINE_SUPPORTS_SAVE ) +GAME( 2000, tangtang, 0, tangtang, hedpanic, esd16_state, empty_init, ROT0, "ESD", "Tang Tang (ver. 0526, 26/05/2000)", MACHINE_SUPPORTS_SAVE ) +GAME( 2001, swatpolc, 0, hedpanic, swatpolc, esd16_state, empty_init, ROT0, "ESD", "SWAT Police", MACHINE_SUPPORTS_SAVE ) // Z Soft PCB, uses PIC instead of Z80 -GAME( 2002, fantstry, 0, fantstry, fantstry, esd16_state, empty_init, ROT0, "Z Soft", "Fantasy Story (set 1)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE ) // playable, just no sound -GAME( 2002, fantstrya, fantstry, fantstrya, fantstry, esd16_state, empty_init, ROT0, "Z Soft", "Fantasy Story (set 2)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE ) // same +GAME( 2002, fantstry, 0, fantstry, fantstry, esd16_state, empty_init, ROT0, "Z Soft", "Fantasy Story (set 1)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE ) // playable, just no sound +GAME( 2002, fantstrya, fantstry, fantstrya, fantstry, esd16_state, empty_init, ROT0, "Z Soft", "Fantasy Story (set 2)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE ) // same diff --git a/src/mame/seta/speedatk.cpp b/src/mame/seta/speedatk.cpp index 62390d5517fa9..7a8b537586e93 100644 --- a/src/mame/seta/speedatk.cpp +++ b/src/mame/seta/speedatk.cpp @@ -1,5 +1,6 @@ // license:BSD-3-Clause // copyright-holders:Angelo Salese, Pierpaolo Prazzoli, Takahiro Nogi + /************************************************************************************************** Dai-Fugo (c) 1983 Sega / Seta @@ -9,17 +10,17 @@ driver by Pierpaolo Prazzoli & Angelo Salese, based on early work by David Haywo TODO: - Improve IOX device for daifugo (many hardwired reads); - - It's possible that there is only one coin chute and not two,needs a real board to know + - It's possible that there is only one coin chute and not two, needs a real board to know more about it. How to play: - - A to D selects a card. + - A to D select a card. - Turn takes one or more cards into your hand (depends on how many cards you - putted on the stacks). + put on the stacks). - Left & right puts a card on one of the two stacks. Notes: - - According to the text gfx rom, there are also a Taito and a KKK versions out there. + - According to the text GFX ROM, there are also Taito and KKK versions out there. =================================================================================================== @@ -111,16 +112,176 @@ DIPSW 8 Elements Switch Array x1 **************************************************************************************************/ #include "emu.h" -#include "speedatk.h" #include "cpu/z80/z80.h" #include "machine/watchdog.h" #include "sound/ay8910.h" +#include "video/mc6845.h" + +#include "emupal.h" #include "screen.h" #include "speaker.h" -#define MASTER_CLOCK XTAL(12'000'000) +namespace { + +class speedatk_state : public driver_device +{ +public: + speedatk_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_crtc(*this, "crtc"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette"), + m_videoram(*this, "videoram"), + m_colorram(*this, "colorram"), + m_coins(*this, "COINS"), + m_speedatk_input(*this, { "P1_ROW0", "P1_ROW1", "P2_ROW0", "P2_ROW1" }), + m_daifugo_input(*this, "PLAYER%u", 1U) + { } + + void speedatk(machine_config &config); + void daifugo(machine_config &config); + +protected: + virtual void machine_start() override ATTR_COLD; + virtual void video_start() override ATTR_COLD; + +private: + required_device m_maincpu; + required_device m_crtc; + required_device m_gfxdecode; + required_device m_palette; + + required_shared_ptr m_videoram; + required_shared_ptr m_colorram; + + required_ioport m_coins; + optional_ioport_array<4> m_speedatk_input; + optional_ioport_array<2> m_daifugo_input; + + uint8_t m_crtc_vreg[0x100]{}; + uint8_t m_crtc_index = 0; + uint8_t m_flip_scr = 0; + uint8_t m_mux_data = 0; + uint8_t m_km_status = 0; + uint8_t m_coin_settings = 0; + uint8_t m_coin_impulse = 0; + + uint8_t key_matrix_r(); + void key_matrix_w(uint8_t data); + uint8_t daifugo_key_matrix_r(); + uint8_t key_matrix_status_r(); + void key_matrix_status_w(uint8_t data); + void m6845_w(offs_t offset, uint8_t data); + void output_w(uint8_t data); + + void palette_init(palette_device &palette) const; + + uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + uint8_t iox_key_matrix_calc(uint8_t p_side); + + void io_map(address_map &map) ATTR_COLD; + void speedatk_program_map(address_map &map) ATTR_COLD; + void daifugo_program_map(address_map &map) ATTR_COLD; +}; + + +/***************************************************************************************** + + Speed Attack video hardware emulation + +*****************************************************************************************/ + +void speedatk_state::palette_init(palette_device &palette) const +{ + uint8_t const *color_prom = memregion("proms")->base(); + + // create a lookup table for the palette + for (int i = 0; i < 0x10; i++) + { + int bit0, bit1, bit2; + + // red component + bit0 = BIT(color_prom[i], 0); + bit1 = BIT(color_prom[i], 1); + bit2 = BIT(color_prom[i], 2); + int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + // green component + bit0 = BIT(color_prom[i], 3); + bit1 = BIT(color_prom[i], 4); + bit2 = BIT(color_prom[i], 5); + int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + // blue component + bit0 = 0; + bit1 = BIT(color_prom[i], 6); + bit2 = BIT(color_prom[i], 7); + int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + palette.set_indirect_color(i, rgb_t(r, g, b)); + } + + // color_prom now points to the beginning of the lookup table + color_prom += 0x20; + + for (int i = 0; i < 0x100; i++) + { + uint8_t const ctabentry = color_prom[i] & 0x0f; + palette.set_pen_indirect(i, ctabentry); + } +} + +void speedatk_state::video_start() +{ + save_item(NAME(m_crtc_vreg)); + save_item(NAME(m_crtc_index)); + save_item(NAME(m_flip_scr)); +} + +void speedatk_state::m6845_w(offs_t offset, uint8_t data) +{ + if (offset == 0) + { + m_crtc_index = data; + m_crtc->address_w(data); + } + else + { + m_crtc_vreg[m_crtc_index] = data; + m_crtc->register_w(data); + } +} + +uint32_t speedatk_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + bitmap.fill(rgb_t::black(), cliprect); + + int count = (m_crtc_vreg[0x0c] << 8) | (m_crtc_vreg[0x0d] & 0xff); + + if (m_flip_scr) { count = 0x3ff - count; } + + for (int y = 0; y < m_crtc_vreg[6]; y++) + { + for (int x = 0; x < m_crtc_vreg[1]; x++) + { + uint16_t const tile = m_videoram[count] + ((m_colorram[count] & 0x60) << 3); + uint8_t const color = m_colorram[count] & 0x1f; + uint8_t const region = (m_colorram[count] & 0x80) >> 7; + + m_gfxdecode->gfx(region)->opaque(bitmap, cliprect, tile, color, m_flip_scr, m_flip_scr, x * 8, y * 8); + + count = (m_flip_scr) ? count - 1 : count + 1; + count &= 0x3ff; + } + } + + return 0; +} + void speedatk_state::machine_start() { @@ -134,17 +295,13 @@ void speedatk_state::machine_start() uint8_t speedatk_state::iox_key_matrix_calc(uint8_t p_side) { - static const char *const keynames[] = { "P1_ROW0", "P1_ROW1", "P2_ROW0", "P2_ROW1" }; - - int i, j, t; - - for (i = 0x00 ; i < 0x10 ; i += 8) + for (int i = 0x00; i < 0x10; i += 8) { - j = (i / 0x08); + int const j = (i / 0x08); - for (t = 0 ; t < 8 ; t ++) + for (int t = 0; t < 8; t++) { - if (!(ioport(keynames[j+p_side])->read() & ( 1 << t ))) + if (!(m_speedatk_input[j + p_side]->read() & ( 1 << t ))) { return (i + t) | (p_side ? 0x20 : 0x00); } @@ -156,62 +313,59 @@ uint8_t speedatk_state::iox_key_matrix_calc(uint8_t p_side) uint8_t speedatk_state::key_matrix_r() { - if(m_coin_impulse > 0) + if (m_coin_impulse > 0) { m_coin_impulse--; return 0x80; } - if((ioport("COINS")->read() & 1) || (ioport("COINS")->read() & 2)) + if ((m_coins->read() & 1) || (m_coins->read() & 2)) { m_coin_impulse = m_coin_settings; m_coin_impulse--; return 0x80; } - if(m_mux_data != 1 && m_mux_data != 2 && m_mux_data != 4) + if (m_mux_data != 1 && m_mux_data != 2 && m_mux_data != 4) return 0xff; //unknown command - /* both side checks */ - if(m_mux_data == 1) + // both side checks + if (m_mux_data == 1) { uint8_t p1_side = iox_key_matrix_calc(0); uint8_t p2_side = iox_key_matrix_calc(2); - if(p1_side != 0) + if (p1_side != 0) return p1_side; return p2_side; } - /* check individual input side */ + // check individual input side return iox_key_matrix_calc((m_mux_data == 2) ? 0 : 2); } uint8_t speedatk_state::daifugo_key_matrix_r() { - if(m_coin_impulse > 0) + if (m_coin_impulse > 0) { m_coin_impulse--; return 0x80; } - if(ioport("COINS")->read() & 1) + if (m_coins->read() & 1) { m_coin_impulse = m_coin_settings; m_coin_impulse--; return 0x80; } - static const char *const keynames[] = { "PLAYER1", "PLAYER2" }; - - int i; - const uint8_t player_side = (m_mux_data >> 2) & 1; + uint8_t const player_side = (m_mux_data >> 2) & 1; // key matrix check and change binary digit to decimal number - for (i = 0 ; i < 16 ; i++) + for (int i = 0; i < 16; i++) { - if (ioport(keynames[player_side])->read() & (1 << i)) + if (m_daifugo_input[player_side]->read() & (1 << i)) { return (i + 1); } @@ -225,17 +379,17 @@ void speedatk_state::key_matrix_w(uint8_t data) m_mux_data = data; } -/* Key matrix status,used for coin settings and I don't know what else... */ +// Key matrix status,used for coin settings and I don't know what else... uint8_t speedatk_state::key_matrix_status_r() { - /* bit 0: busy flag,active low */ + // bit 0: busy flag, active low return (m_km_status & 0xfe) | 1; } /* xxxx ---- command ---- xxxx param -My guess is that the other commands configs the key matrix, it probably needs some tests on the real thing. +My guess is that the other commands configure the key matrix, it probably needs some tests on the real thing. 1f 3f 41 @@ -246,24 +400,24 @@ a1 void speedatk_state::key_matrix_status_w(uint8_t data) { m_km_status = data; - if((m_km_status & 0xf0) == 0x80) //coinage setting command + if ((m_km_status & 0xf0) == 0x80) //coinage setting command m_coin_settings = m_km_status & 0xf; } -void speedatk_state::speedatk_mem(address_map &map) +void speedatk_state::speedatk_program_map(address_map &map) { map(0x0000, 0x7fff).rom(); map(0x8000, 0x8000).rw(FUNC(speedatk_state::key_matrix_r), FUNC(speedatk_state::key_matrix_w)); map(0x8001, 0x8001).rw(FUNC(speedatk_state::key_matrix_status_r), FUNC(speedatk_state::key_matrix_status_w)); map(0x8588, 0x858f).nopr(); // speedatk only map(0x8800, 0x8fff).ram(); - map(0xa000, 0xa3ff).ram().share("videoram"); - map(0xb000, 0xb3ff).ram().share("colorram"); + map(0xa000, 0xa3ff).ram().share(m_videoram); + map(0xb000, 0xb3ff).ram().share(m_colorram); } -void speedatk_state::daifugo_mem(address_map &map) +void speedatk_state::daifugo_program_map(address_map &map) { - speedatk_mem(map); + speedatk_program_map(map); map(0x8000, 0x8000).rw(FUNC(speedatk_state::daifugo_key_matrix_r), FUNC(speedatk_state::key_matrix_w)); map(0x8001, 0x8001).lr8(NAME([] (offs_t offset) { // TODO: bit 1 seems to be a busy flag, will throw a "BAD CSTM 2" if that is high. @@ -287,7 +441,7 @@ void speedatk_state::daifugo_mem(address_map &map) })); } -void speedatk_state::speedatk_io(address_map &map) +void speedatk_state::io_map(address_map &map) { map.global_mask(0xff); map(0x00, 0x01).w(FUNC(speedatk_state::m6845_w)); //h46505 address / data routing @@ -298,6 +452,7 @@ void speedatk_state::speedatk_io(address_map &map) //what's 60-6f for? Seems used only in attract mode and read back when a 2p play ends ... } + static INPUT_PORTS_START( daifugo ) PORT_START("DSW") PORT_DIPNAME( 0x03, 0x00, DEF_STR( Difficulty ) ) @@ -432,6 +587,7 @@ static INPUT_PORTS_START( speedatk ) PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_IMPULSE(1) INPUT_PORTS_END + static const gfx_layout charlayout_1bpp = { 8,8, @@ -448,24 +604,26 @@ static GFXDECODE_START( gfx_speedatk ) GFXDECODE_ENTRY( "gfx2", 0, gfx_8x8x3_planar, 0, 32 ) GFXDECODE_END + void speedatk_state::output_w(uint8_t data) { m_flip_scr = data & 0x80; - if((data & 0x7f) != 0x7f) - logerror("%02x\n",data); + if ((data & 0x7f) != 0x7f) + logerror("output_w: %02x\n", data); } + void speedatk_state::speedatk(machine_config &config) { - Z80(config, m_maincpu, MASTER_CLOCK/4); //divider is unknown - m_maincpu->set_addrmap(AS_PROGRAM, &speedatk_state::speedatk_mem); - m_maincpu->set_addrmap(AS_IO, &speedatk_state::speedatk_io); + Z80(config, m_maincpu, 12_MHz_XTAL / 4); //divider is unknown + m_maincpu->set_addrmap(AS_PROGRAM, &speedatk_state::speedatk_program_map); + m_maincpu->set_addrmap(AS_IO, &speedatk_state::io_map); m_maincpu->set_vblank_int("screen", FUNC(speedatk_state::irq0_line_hold)); WATCHDOG_TIMER(config, "watchdog"); // timing is unknown - /* video hardware */ + // video hardware screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_refresh_hz(60); screen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); @@ -473,18 +631,18 @@ void speedatk_state::speedatk(machine_config &config) screen.set_visarea(0*8, 32*8-1, 0*8, 32*8-1); screen.set_screen_update(FUNC(speedatk_state::screen_update)); - HD6845S(config, m_crtc, MASTER_CLOCK/16); /* HD46505SP/HD6845SP; hand tuned to get ~60 fps */ + HD6845S(config, m_crtc, 12_MHz_XTAL / 16); // HD46505SP/HD6845SP; hand tuned to get ~60 fps m_crtc->set_screen("screen"); m_crtc->set_show_border_area(false); m_crtc->set_char_width(8); GFXDECODE(config, m_gfxdecode, m_palette, gfx_speedatk); - PALETTE(config, m_palette, FUNC(speedatk_state::speedatk_palette), 0x100, 16); + PALETTE(config, m_palette, FUNC(speedatk_state::palette_init), 0x100, 16); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); - ay8910_device &aysnd(AY8910(config, "aysnd", MASTER_CLOCK/8)); //divider is unknown + ay8910_device &aysnd(AY8910(config, "aysnd", 12_MHz_XTAL / 8)); //divider is unknown aysnd.port_b_read_callback().set_ioport("DSW"); aysnd.port_a_write_callback().set(FUNC(speedatk_state::output_w)); aysnd.add_route(ALL_OUTPUTS, "mono", 0.5); @@ -493,9 +651,10 @@ void speedatk_state::speedatk(machine_config &config) void speedatk_state::daifugo(machine_config &config) { speedatk(config); - m_maincpu->set_addrmap(AS_PROGRAM, &speedatk_state::daifugo_mem); + m_maincpu->set_addrmap(AS_PROGRAM, &speedatk_state::daifugo_program_map); } + ROM_START( daifugo ) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "ca2_1.1c", 0x0000, 0x2000, CRC(cef063a1) SHA1(851c8f7f723822c19c02a35908b6246bd5d5c806) ) @@ -529,13 +688,16 @@ ROM_START( speedatk ) ROM_REGION( 0x6000, "gfx2", 0 ) ROM_LOAD( "cb0-5", 0x0000, 0x2000, CRC(47a966e7) SHA1(fdaa0f88656afc431bae367679ce6298fa962e0f) ) ROM_LOAD( "cb0-6", 0x2000, 0x2000, CRC(cc1da937) SHA1(1697bb008bfa5c33a282bd470ac39c324eea7509) ) - ROM_COPY( "gfx2", 0x0000, 0x4000, 0x1000 ) /* Fill the blank space with cards gfx */ - ROM_COPY( "gfx1", 0x1000, 0x5000, 0x1000 ) /* Gfx from cb0-7 */ + ROM_COPY( "gfx2", 0x0000, 0x4000, 0x1000 ) // Fill the blank space with cards GFX + ROM_COPY( "gfx1", 0x1000, 0x5000, 0x1000 ) // GFX from cb0-7 ROM_REGION( 0x0120, "proms", 0 ) - ROM_LOAD( "cb1.bpr", 0x0000, 0x0020, CRC(a0176c23) SHA1(133fb9eef8a6595cac2dcd7edce4789899a59e84) ) /* color PROM */ - ROM_LOAD( "cb2.bpr", 0x0020, 0x0100, CRC(a604cf96) SHA1(a4ef6e77dcd3abe4c27e8e636222a5ee711a51f5) ) /* lookup table */ + ROM_LOAD( "cb1.bpr", 0x0000, 0x0020, CRC(a0176c23) SHA1(133fb9eef8a6595cac2dcd7edce4789899a59e84) ) // color PROM + ROM_LOAD( "cb2.bpr", 0x0020, 0x0100, CRC(a604cf96) SHA1(a4ef6e77dcd3abe4c27e8e636222a5ee711a51f5) ) // lookup table ROM_END -GAME( 1983, daifugo, 0, daifugo, daifugo, speedatk_state, empty_init, ROT90, "Seta Kikaku / Sega (Esco Trading Co license)", "Daifugo (Japan)", MACHINE_SUPPORTS_SAVE | MACHINE_UNEMULATED_PROTECTION ) -GAME( 1984, speedatk, 0, speedatk, speedatk, speedatk_state, empty_init, ROT0, "Seta Kikaku", "Speed Attack! (Japan)", MACHINE_SUPPORTS_SAVE ) +} // anonymous namespace + + +GAME( 1983, daifugo, 0, daifugo, daifugo, speedatk_state, empty_init, ROT90, "Seta Kikaku / Sega (Esco Trading Co license)", "Daifugo (Japan)", MACHINE_SUPPORTS_SAVE | MACHINE_UNEMULATED_PROTECTION ) +GAME( 1984, speedatk, 0, speedatk, speedatk, speedatk_state, empty_init, ROT0, "Seta Kikaku", "Speed Attack! (Japan)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/seta/speedatk.h b/src/mame/seta/speedatk.h deleted file mode 100644 index 5dd2babd74a4d..0000000000000 --- a/src/mame/seta/speedatk.h +++ /dev/null @@ -1,68 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese, Pierpaolo Prazzoli, Takahiro Nogi -#ifndef MAME_SETA_SPEEDATK_H -#define MAME_SETA_SPEEDATK_H - -#pragma once - -#include "video/mc6845.h" -#include "emupal.h" - -class speedatk_state : public driver_device -{ -public: - speedatk_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_crtc(*this, "crtc"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_videoram(*this, "videoram"), - m_colorram(*this, "colorram") - { } - - void speedatk(machine_config &config); - void daifugo(machine_config &config); - -protected: - virtual void machine_start() override ATTR_COLD; - virtual void video_start() override ATTR_COLD; - -private: - required_device m_maincpu; - required_device m_crtc; - required_device m_gfxdecode; - required_device m_palette; - - required_shared_ptr m_videoram; - required_shared_ptr m_colorram; - - uint8_t m_crtc_vreg[0x100]{}; - uint8_t m_crtc_index = 0; - uint8_t m_flip_scr = 0; - uint8_t m_mux_data = 0; - uint8_t m_km_status = 0; - uint8_t m_coin_settings = 0; - uint8_t m_coin_impulse = 0; - - uint8_t key_matrix_r(); - void key_matrix_w(uint8_t data); - uint8_t daifugo_key_matrix_r(); - uint8_t key_matrix_status_r(); - void key_matrix_status_w(uint8_t data); - void m6845_w(offs_t offset, uint8_t data); - void output_w(uint8_t data); - - void speedatk_palette(palette_device &palette) const; - - uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - - uint8_t iox_key_matrix_calc(uint8_t p_side); - - void speedatk_io(address_map &map) ATTR_COLD; - void speedatk_mem(address_map &map) ATTR_COLD; - void daifugo_mem(address_map &map) ATTR_COLD; -}; - - -#endif // MAME_SETA_SPEEDATK_H diff --git a/src/mame/seta/speedatk_v.cpp b/src/mame/seta/speedatk_v.cpp deleted file mode 100644 index dd32c853be9b0..0000000000000 --- a/src/mame/seta/speedatk_v.cpp +++ /dev/null @@ -1,102 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese, Pierpaolo Prazzoli, Takahiro Nogi -/***************************************************************************************** - - Speed Attack video hardware emulation - -*****************************************************************************************/ -#include "emu.h" -#include "speedatk.h" - - -void speedatk_state::speedatk_palette(palette_device &palette) const -{ - uint8_t const *color_prom = memregion("proms")->base(); - - // create a lookup table for the palette - for (int i = 0; i < 0x10; i++) - { - int bit0, bit1, bit2; - - // red component - bit0 = BIT(color_prom[i], 0); - bit1 = BIT(color_prom[i], 1); - bit2 = BIT(color_prom[i], 2); - int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - // green component - bit0 = BIT(color_prom[i], 3); - bit1 = BIT(color_prom[i], 4); - bit2 = BIT(color_prom[i], 5); - int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - // blue component - bit0 = 0; - bit1 = BIT(color_prom[i], 6); - bit2 = BIT(color_prom[i], 7); - int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - palette.set_indirect_color(i, rgb_t(r, g, b)); - } - - // color_prom now points to the beginning of the lookup table - color_prom += 0x20; - - for (int i = 0; i < 0x100; i++) - { - uint8_t const ctabentry = color_prom[i] & 0x0f; - palette.set_pen_indirect(i, ctabentry); - } -} - -void speedatk_state::video_start() -{ - save_item(NAME(m_crtc_vreg)); - save_item(NAME(m_crtc_index)); - save_item(NAME(m_flip_scr)); -} - -void speedatk_state::m6845_w(offs_t offset, uint8_t data) -{ - if(offset == 0) - { - m_crtc_index = data; - m_crtc->address_w(data); - } - else - { - m_crtc_vreg[m_crtc_index] = data; - m_crtc->register_w(data); - } -} - -uint32_t speedatk_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - int x,y; - int count; - uint16_t tile; - uint8_t color, region; - - bitmap.fill(rgb_t::black(), cliprect); - - count = (m_crtc_vreg[0x0c]<<8)|(m_crtc_vreg[0x0d] & 0xff); - - if(m_flip_scr) { count = 0x3ff - count; } - - for(y=0;y> 7; - - m_gfxdecode->gfx(region)->opaque(bitmap,cliprect,tile,color,m_flip_scr,m_flip_scr,x*8,y*8); - - count = (m_flip_scr) ? count-1 : count+1; - count&=0x3ff; - } - } - - return 0; -}