diff --git a/src/mame/arcade.flt b/src/mame/arcade.flt index ef7c1947108..c5c0ef56a7c 100644 --- a/src/mame/arcade.flt +++ b/src/mame/arcade.flt @@ -613,6 +613,7 @@ misc/amaticmg.cpp misc/amerihok.cpp misc/ampoker2.cpp misc/amspdwy.cpp +misc/amstarz80.cpp misc/amusco.cpp misc/anes.cpp misc/arachnid.cpp diff --git a/src/mame/mame.lst b/src/mame/mame.lst index 2cc99947868..7448d976d39 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -1377,6 +1377,9 @@ ampscarp // Motorola Amps Car Phone amspdwy // no copyright notice, but (c) 1987 Enerdyne Technologies, Inc. amspdwya // no copyright notice, but (c) 1987 Enerdyne Technologies, Inc. +@source:misc/amstarz80.cpp +holddraw + @source:amstrad/amstr_pc.cpp pc20 // 1988 Amstrad PC20 pc200 // 1988 Sinclair PC200 diff --git a/src/mame/misc/amstarz80.cpp b/src/mame/misc/amstarz80.cpp new file mode 100644 index 00000000000..cf7d09db2d4 --- /dev/null +++ b/src/mame/misc/amstarz80.cpp @@ -0,0 +1,159 @@ +// license:BSD-3-Clause +// copyright-holders: + +/* +Amstar Z80 based hardware for card games + +Dumper's notes: + +Etched in copper AMSTAR ELEC + ASSY 1061-3700/ + SER NO 42-109 42-109 was hand written + +graphics dump showed card characters + +.e5 2708 stickered 001-1201 +.d5 AMD 4708 stickered 1102 read as a 2708 - couldn't get a steady reading +.b6 2708 stickered 001-8000 +.b7 2708 stickered 001-8200 +.c7 2708 stickered 001-8100 +.c8 2708 stickered 001-8500 +.d8 2708 stickered 001-8400 +.e8 2708 stickered 001-8300 +.d2 7611 stickered 001-1400 +.f2 7611 stickered 001-1500 +.g1 7611 stickered 001-130 +.g2 6301 stickered G2- read as 7611 +.h2 6301 stickered H2- read as 7611 +.j2 6301 stickered J2- read as 7611 + +empty 14 pin socket at j1 +empty 24 pin socket at b8 +empty 16 pin socket at g11 + +Z80 +10MHz Crystal +2101 x8 +5101 x2 + +2 24 pin chips (.b4 and .b5) that look like EPROMs, but no window +Couldn't read as 2708 or 2716 or any of the 24 pin 82sxxx types +Stamped with the following + .b4 + "S" logo + 8001E + C27139M + 4502 + .b5 + "S" logo + 7847E + C27138M + 4501 +*/ + +#include "emu.h" + +#include "cpu/z80/z80.h" + +#include "emupal.h" +#include "screen.h" + + +namespace { + +class amstarz80_state : public driver_device +{ +public: + amstarz80_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + { } + + void amstarz80(machine_config &config); + +private: + required_device m_maincpu; + + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + void prg_map(address_map &map); +}; + + +uint32_t amstarz80_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + return 0; +} + + +void amstarz80_state::prg_map(address_map &map) +{ + map(0x0000, 0x17ff).rom(); +} + + +static INPUT_PORTS_START( holddraw ) +// 2x 8 dip banks +// 1x 4 dip bank +INPUT_PORTS_END + + +static const gfx_layout charlayout = +{ +}; + +static GFXDECODE_START( gfx_amstarz80 ) + GFXDECODE_ENTRY( "tiles", 0, charlayout, 0, 1 ) +GFXDECODE_END + +void amstarz80_state::amstarz80(machine_config &config) +{ + // basic machine hardware + Z80(config, m_maincpu, 10_MHz_XTAL / 4); // divisor not verified + m_maincpu->set_addrmap(AS_PROGRAM, &amstarz80_state::prg_map); + + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); // TODO: all wrong, verify when redumped and working + screen.set_refresh_hz(60); + screen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); + screen.set_size(64*8, 32*8); + screen.set_visarea(8*8, 48*8-1, 2*8, 30*8-1); + screen.set_screen_update(FUNC(amstarz80_state::screen_update)); + screen.set_palette("palette"); + + PALETTE(config, "palette", palette_device::RGB_3BIT); // TODO: wrong + + GFXDECODE(config, "gfxdecode", "palette", gfx_amstarz80); + + // TODO: sound (TTL?) +} + + +ROM_START( holddraw ) + ROM_REGION( 0x1800, "maincpu", 0 ) + ROM_LOAD( "001-8000.b6", 0x0000, 0x0400, CRC(a25d17d4) SHA1(a5b9c83ace554811ac1442b44cdd72542ea2c425) ) + ROM_LOAD( "001-8100.c7", 0x0400, 0x0400, CRC(2208a37a) SHA1(8cb528c3f83f779873e82b0d959810d5e3073291) ) + ROM_LOAD( "001-8200.b7", 0x0800, 0x0400, CRC(9c27e9d7) SHA1(43103979e014ecc7b17a44a935257869ca184c2f) ) + ROM_LOAD( "001-8300.e8", 0x0c00, 0x0400, CRC(2b703868) SHA1(ac4e2903e0eeb6d248acd931ca37032bd9d928cc) ) + ROM_LOAD( "001-8400.d8", 0x1000, 0x0400, CRC(1b66fa9f) SHA1(98a1d53701a4dedeec9fa61a85dcbc0ce6910d5f) ) + ROM_LOAD( "001-8500.c8", 0x1400, 0x0400, CRC(9c219088) SHA1(7430fe4eb3a6bf1838fd5513127f5248723bec0a) ) + // one empty ROM socket at b8 + + ROM_REGION(0x800, "tiles", 0 ) + ROM_LOAD( "001_1201.e5", 0x000, 0x400, CRC(32197f7d) SHA1(07c8739033820e4e4e2fe4428f921d8fc7c8698b) ) + ROM_LOAD( "1102.d5_a", 0x400, 0x400, BAD_DUMP CRC(bb4bd952) SHA1(a869d5d5c8bc45d414b1103c6fe2b2d7bb07291e) ) // handwritten label, 3 different reads until it can be determined if one is good or a good one can be assembled + ROM_LOAD( "1102.d5_b", 0x400, 0x400, BAD_DUMP CRC(ce57a4ee) SHA1(732fc54f32212d7590daa2da738acd1cce4d7c0d) ) + ROM_LOAD( "1102.d5_c", 0x400, 0x400, BAD_DUMP CRC(0b30d921) SHA1(992709bb0ad18f646bfa1bccea45454a5f273457) ) + + ROM_REGION(0xc00, "proms", 0 ) + ROM_LOAD( "001-1400.d2", 0x000, 0x200, CRC(32c99cfc) SHA1(64d561230d69514a02f30d7bc69caa563e069d69) ) + ROM_LOAD( "001-1500.f2", 0x200, 0x200, CRC(a27a7513) SHA1(84f5a29e55112d99a757b902aeef28e1370ef78f) ) + ROM_LOAD( "001-1300.g1", 0x400, 0x200, CRC(eb581932) SHA1(b04cf5bb18bfc91654f63984aaf8e656e616b36f) ) + ROM_LOAD( "g2.g2", 0x600, 0x200, CRC(6aa24121) SHA1(63fe82043653e753fb3d6ffb8a750b0433dae679) ) // handwritten label + ROM_LOAD( "h2.h2", 0x800, 0x200, CRC(9096f7c8) SHA1(b51b068ae279f0cee6048415bffe14995fb7d269) ) // handwritten label + ROM_LOAD( "j2.j2", 0xa00, 0x200, CRC(d7195174) SHA1(660e52c0d1c250ec9566d629c9e57e7b20acff26) ) // handwritten label +ROM_END + +} // anonymous namespace + + +GAME( 1981, holddraw, 0, amstarz80, holddraw, amstarz80_state, empty_init, ROT0, "Amstar", "Hold & Draw", MACHINE_IS_SKELETON ) // supposedly, but might actually be another similar game diff --git a/src/mame/technos/bogeyman.cpp b/src/mame/technos/bogeyman.cpp index 6dea253b82e..b08b9ecbe1f 100644 --- a/src/mame/technos/bogeyman.cpp +++ b/src/mame/technos/bogeyman.cpp @@ -5,6 +5,10 @@ Bogey Manor (c) 1985 Technos Japan This game runs on Data East designed hardware. + It uses the following Data East customs: + - HMC20 + - TC15G032AY + - VSC30 Emulation by Bryan McPhail, mish@tendril.co.uk and T.Nogi @@ -14,14 +18,207 @@ ***************************************************************************/ #include "emu.h" -#include "bogeyman.h" #include "cpu/m6502/m6502.h" +#include "sound/ay8910.h" + +#include "emupal.h" #include "screen.h" #include "speaker.h" +#include "tilemap.h" -/* Read/Write Handlers */ +namespace { + +class bogeyman_state : public driver_device +{ +public: + bogeyman_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette"), + m_ay(*this, "ay%u", 1U), + m_videoram(*this, "videoram%u", 1U), + m_colorram(*this, "colorram%u", 1U), + m_spriteram(*this, "spriteram") + { } + + void bogeyman(machine_config &config); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + +private: + // devices + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_palette; + required_device_array m_ay; + + // memory pointers + required_shared_ptr_array m_videoram; + required_shared_ptr_array m_colorram; + required_shared_ptr m_spriteram; + + // video-related + tilemap_t *m_bg_tilemap = nullptr; + tilemap_t *m_fg_tilemap = nullptr; + + // misc + uint8_t m_psg_latch = 0U; + uint8_t m_last_write = 0U; + uint8_t m_colbank = 0U; + + void ay8910_latch_w(uint8_t data); + void ay8910_control_w(uint8_t data); + template void videoram_w(offs_t offset, uint8_t data); + template void colorram_w(offs_t offset, uint8_t data); + void colbank_w(uint8_t data); + + TILE_GET_INFO_MEMBER(get_bg_tile_info); + TILE_GET_INFO_MEMBER(get_fg_tile_info); + + void palette(palette_device &palette) const; + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); + void prg_map(address_map &map); +}; + + +// video + +void bogeyman_state::palette(palette_device &palette) const +{ + uint8_t const *color_prom = memregion("proms")->base(); + + // first 16 colors are RAM + for (int i = 0; i < 256; i++) + { + int bit0, bit1, bit2; + + // red component + bit0 = BIT(color_prom[0], 0); + bit1 = BIT(color_prom[0], 1); + bit2 = BIT(color_prom[0], 2); + int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + // green component + bit0 = BIT(color_prom[0], 3); + bit1 = BIT(color_prom[256], 0); + bit2 = BIT(color_prom[256], 1); + int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + // blue component + bit0 = 0; + bit1 = BIT(color_prom[256], 2); + bit2 = BIT(color_prom[256], 3); + int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + palette.set_pen_color(i + 16, rgb_t(r, g, b)); + color_prom++; + } +} + +template +void bogeyman_state::videoram_w(offs_t offset, uint8_t data) +{ + m_videoram[Which][offset] = data; + Which ? m_fg_tilemap->mark_tile_dirty(offset) : m_bg_tilemap->mark_tile_dirty(offset); +} + +template +void bogeyman_state::colorram_w(offs_t offset, uint8_t data) +{ + m_colorram[Which][offset] = data; + Which ? m_fg_tilemap->mark_tile_dirty(offset) : m_bg_tilemap->mark_tile_dirty(offset); +} + +TILE_GET_INFO_MEMBER(bogeyman_state::get_bg_tile_info) +{ + int attr = m_colorram[0][tile_index]; + int gfxbank = ((((attr & 0x01) << 8) + m_videoram[0][tile_index]) / 0x80) + 3; + int code = m_videoram[0][tile_index] & 0x7f; + int color = (attr >> 1) & 0x07; + + tileinfo.set(gfxbank, code, color, 0); +} + +TILE_GET_INFO_MEMBER(bogeyman_state::get_fg_tile_info) +{ + int attr = m_colorram[1][tile_index]; + int tile = m_videoram[1][tile_index] | ((attr & 0x03) << 8); + int gfxbank = tile / 0x200; + int code = tile & 0x1ff; + + tileinfo.set(gfxbank, code, m_colbank, 0); +} + +void bogeyman_state::video_start() +{ + m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(bogeyman_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 16, 16); + m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(bogeyman_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); + + m_fg_tilemap->set_transparent_pen(0); +} + +void bogeyman_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + for (int offs = 0; offs < m_spriteram.bytes(); offs += 4) + { + int const attr = m_spriteram[offs]; + + if (attr & 0x01) + { + int const code = m_spriteram[offs + 1] + ((attr & 0x40) << 2); + int const color = (attr & 0x08) >> 3; + int flipx = !(attr & 0x04); + int flipy = attr & 0x02; + int sx = m_spriteram[offs + 3]; + int sy = (240 - m_spriteram[offs + 2]) & 0xff; + int const multi = attr & 0x10; + + if (multi) sy -= 16; + + if (flip_screen()) + { + sx = 240 - sx; + sy = 240 - sy; + flipx = !flipx; + flipy = !flipy; + } + + + m_gfxdecode->gfx(2)->transpen(bitmap, cliprect, + code, color, + flipx, flipy, + sx, sy, 0); + + if (multi) + { + m_gfxdecode->gfx(2)->transpen(bitmap, cliprect, + code + 1, color, + flipx, flipy, + sx, sy + (flip_screen() ? -16 : 16), 0); + } + } + } +} + +uint32_t bogeyman_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + draw_sprites(bitmap, cliprect); + m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + return 0; +} + + +// machine + +// Read/Write Handlers // Sound section is copied from Mysterious Stones driver by Nicola, Mike, Brad @@ -37,25 +234,25 @@ void bogeyman_state::ay8910_control_w(uint8_t data) // bit 5 goes to 8910 #0 BDIR pin if ((m_last_write & 0x20) == 0x20 && (data & 0x20) == 0x00) - m_ay1->data_address_w(m_last_write >> 4, m_psg_latch); + m_ay[0]->data_address_w(m_last_write >> 4, m_psg_latch); // bit 7 goes to 8910 #1 BDIR pin if ((m_last_write & 0x80) == 0x80 && (data & 0x80) == 0x00) - m_ay2->data_address_w(m_last_write >> 6, m_psg_latch); + m_ay[1]->data_address_w(m_last_write >> 6, m_psg_latch); m_last_write = data; } -/* Memory Map */ +// Memory Map -void bogeyman_state::bogeyman_map(address_map &map) +void bogeyman_state::prg_map(address_map &map) { map(0x0000, 0x17ff).ram(); - map(0x1800, 0x1bff).ram().w(FUNC(bogeyman_state::videoram2_w)).share("videoram2"); - map(0x1c00, 0x1fff).ram().w(FUNC(bogeyman_state::colorram2_w)).share("colorram2"); - map(0x2000, 0x20ff).ram().w(FUNC(bogeyman_state::videoram_w)).share("videoram"); - map(0x2100, 0x21ff).ram().w(FUNC(bogeyman_state::colorram_w)).share("colorram"); - map(0x2800, 0x2bff).ram().share("spriteram"); + map(0x1800, 0x1bff).ram().w(FUNC(bogeyman_state::videoram_w<1>)).share(m_videoram[1]); + map(0x1c00, 0x1fff).ram().w(FUNC(bogeyman_state::colorram_w<1>)).share(m_colorram[1]); + map(0x2000, 0x20ff).ram().w(FUNC(bogeyman_state::videoram_w<0>)).share(m_videoram[0]); + map(0x2100, 0x21ff).ram().w(FUNC(bogeyman_state::colorram_w<0>)).share(m_colorram[0]); + map(0x2800, 0x2bff).ram().share(m_spriteram); map(0x3000, 0x300f).ram().w(m_palette, FUNC(palette_device::write8)).share("palette"); map(0x3800, 0x3800).portr("P1").w(FUNC(bogeyman_state::ay8910_control_w)); map(0x3801, 0x3801).portr("P2").w(FUNC(bogeyman_state::ay8910_latch_w)); @@ -64,7 +261,7 @@ void bogeyman_state::bogeyman_map(address_map &map) map(0x4000, 0xffff).rom(); } -/* Input Ports */ +// Input Ports static INPUT_PORTS_START( bogeyman ) PORT_START("P1") @@ -127,7 +324,7 @@ static INPUT_PORTS_START( bogeyman ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 ) INPUT_PORTS_END -/* Graphics Layouts */ +// Graphics Layouts static const gfx_layout charlayout1 = { @@ -190,21 +387,21 @@ static const gfx_layout sprites = 16*16 }; -/* Graphics Decode Information */ +// Graphics Decode Information static GFXDECODE_START( gfx_bogeyman ) - GFXDECODE_ENTRY( "gfx1", 0x00000, charlayout1, 16, 32 ) - GFXDECODE_ENTRY( "gfx1", 0x00000, charlayout2, 16, 32 ) - GFXDECODE_ENTRY( "gfx2", 0x00000, sprites, 0, 2 ) - GFXDECODE_ENTRY( "gfx3", 0x00000, tiles1a, 16+128, 8 ) - GFXDECODE_ENTRY( "gfx3", 0x00000, tiles1b, 16+128, 8 ) - GFXDECODE_ENTRY( "gfx3", 0x04000, tiles1a, 16+128, 8 ) - GFXDECODE_ENTRY( "gfx3", 0x04000, tiles1b, 16+128, 8 ) + GFXDECODE_ENTRY( "chars", 0x00000, charlayout1, 16, 32 ) + GFXDECODE_ENTRY( "chars", 0x00000, charlayout2, 16, 32 ) + GFXDECODE_ENTRY( "sprites", 0x00000, sprites, 0, 2 ) + GFXDECODE_ENTRY( "tiles", 0x00000, tiles1a, 16+128, 8 ) + GFXDECODE_ENTRY( "tiles", 0x00000, tiles1b, 16+128, 8 ) + GFXDECODE_ENTRY( "tiles", 0x04000, tiles1a, 16+128, 8 ) + GFXDECODE_ENTRY( "tiles", 0x04000, tiles1b, 16+128, 8 ) // colors 16+192 to 16+255 are currently unassigned GFXDECODE_END -/* Machine Driver */ +// Machine Driver void bogeyman_state::machine_start() { @@ -222,7 +419,7 @@ void bogeyman_state::machine_reset() void bogeyman_state::colbank_w(uint8_t data) { - if((data & 1) != (m_colbank & 1)) + if ((data & 1) != (m_colbank & 1)) { m_colbank = data & 1; m_fg_tilemap->mark_all_dirty(); @@ -232,9 +429,9 @@ void bogeyman_state::colbank_w(uint8_t data) void bogeyman_state::bogeyman(machine_config &config) { // basic machine hardware - M6502(config, m_maincpu, 1500000); /* Verified */ - m_maincpu->set_addrmap(AS_PROGRAM, &bogeyman_state::bogeyman_map); - m_maincpu->set_periodic_int(FUNC(bogeyman_state::irq0_line_hold), attotime::from_hz(16*60)); // Controls sound + M6502(config, m_maincpu, XTAL(12'000'000) / 8); // Verified + m_maincpu->set_addrmap(AS_PROGRAM, &bogeyman_state::prg_map); + m_maincpu->set_periodic_int(FUNC(bogeyman_state::irq0_line_hold), attotime::from_hz(16 * 60)); // Controls sound // video hardware screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); @@ -244,44 +441,44 @@ void bogeyman_state::bogeyman(machine_config &config) // screen.set_size(32*8, 32*8); // screen.set_visarea(0*8, 32*8-1, 1*8, 31*8-1); // DECO video CRTC, unverified - screen.set_raw(XTAL(12'000'000)/2,384,0,256,272,8,248); + screen.set_raw(XTAL(12'000'000) / 2, 384, 0, 256, 272, 8, 248); screen.set_screen_update(FUNC(bogeyman_state::screen_update)); screen.set_palette(m_palette); GFXDECODE(config, m_gfxdecode, m_palette, gfx_bogeyman); - PALETTE(config, m_palette, FUNC(bogeyman_state::bogeyman_palette)).set_format(palette_device::BGR_233_inverted, 16 + 256); + PALETTE(config, m_palette, FUNC(bogeyman_state::palette)).set_format(palette_device::BGR_233_inverted, 16 + 256); // sound hardware SPEAKER(config, "mono").front_center(); - // verified to be YM2149s from PCB pic - YM2149(config, m_ay1, 1500000); /* Verified */ - m_ay1->port_a_write_callback().set(FUNC(bogeyman_state::colbank_w)); - m_ay1->add_route(ALL_OUTPUTS, "mono", 0.30); + // verified to be YM2149s from PCB pic. Another PCB had 2 AY-8910s + YM2149(config, m_ay[0], XTAL(12'000'000) / 8); // Verified + m_ay[0]->port_a_write_callback().set(FUNC(bogeyman_state::colbank_w)); + m_ay[0]->add_route(ALL_OUTPUTS, "mono", 0.30); - YM2149(config, m_ay2, 1500000).add_route(ALL_OUTPUTS, "mono", 0.30); /* Verified */ + YM2149(config, m_ay[1], XTAL(12'000'000) / 8).add_route(ALL_OUTPUTS, "mono", 0.30); // Verified } -/* ROMs */ +// ROMs -ROM_START( bogeyman ) +ROM_START( bogeyman ) // PCB 0204-0 ROM_REGION( 0x58000, "maincpu", 0 ) ROM_LOAD( "j20.c14", 0x04000, 0x04000, CRC(ea90d637) SHA1(aa89bee806badb05119516d84e7674cd302aaf4e) ) ROM_LOAD( "j10.c15", 0x08000, 0x04000, CRC(0a8f218d) SHA1(5e5958cccfe634e3d274d187a0a7fe4789f3a9c3) ) ROM_LOAD( "j00.c17", 0x0c000, 0x04000, CRC(5d486de9) SHA1(40ea14a4a25f8f38d33a8844f627ba42503e1280) ) - ROM_REGION( 0x10000, "gfx1", 0 ) - ROM_LOAD( "j70.h15", 0x00000, 0x04000, CRC(fdc787bf) SHA1(1f185a1927fff6ce793d673ebd882a852ac547e4) ) /* Characters */ + ROM_REGION( 0x10000, "chars", 0 ) + ROM_LOAD( "j70.h15", 0x00000, 0x04000, CRC(fdc787bf) SHA1(1f185a1927fff6ce793d673ebd882a852ac547e4) ) ROM_LOAD( "j60.c17", 0x08000, 0x01000, CRC(cc03ceb2) SHA1(0149eacac2c1469be6e19f7a43c13d1fe8790f2c) ) ROM_CONTINUE( 0x0a000, 0x01000 ) - ROM_REGION( 0x0c000, "gfx2", 0 ) - ROM_LOAD( "j30.c9", 0x00000, 0x04000, CRC(41af81c0) SHA1(d8465622cdf16bc906818641d7988fc412454a45) ) /* Sprites */ + ROM_REGION( 0x0c000, "sprites", 0 ) + ROM_LOAD( "j30.c9", 0x00000, 0x04000, CRC(41af81c0) SHA1(d8465622cdf16bc906818641d7988fc412454a45) ) ROM_LOAD( "j40.c7", 0x04000, 0x04000, CRC(8b438421) SHA1(295806c119f4ddc01afc15550e1ff397fbf5d862) ) ROM_LOAD( "j50.c5", 0x08000, 0x04000, CRC(b507157f) SHA1(471f67eb5e7aedef52353581405d9613d2a86898) ) - ROM_REGION( 0x10000, "gfx3", 0 ) - ROM_LOAD( "j90.h12", 0x00000, 0x04000, CRC(46b2d4d0) SHA1(35cd320d4db7aa6a89f83ba4d9ff88925357d640) ) /* Tiles */ + ROM_REGION( 0x10000, "tiles", 0 ) + ROM_LOAD( "j90.h12", 0x00000, 0x04000, CRC(46b2d4d0) SHA1(35cd320d4db7aa6a89f83ba4d9ff88925357d640) ) ROM_LOAD( "j80.h13", 0x04000, 0x04000, CRC(77ebd0a4) SHA1(c6921ee59633eeeda97c73cb7833578fa8a84fa3) ) ROM_LOAD( "ja0.h10", 0x08000, 0x01000, CRC(f2aa05ed) SHA1(e6df96e4128eff6de7e6483254608dd8a7b258b9) ) ROM_CONTINUE( 0x0a000, 0x01000 ) @@ -289,11 +486,14 @@ ROM_START( bogeyman ) ROM_CONTINUE( 0x0e000, 0x01000 ) ROM_REGION( 0x0200, "proms", 0 ) - ROM_LOAD( "82s129.5k", 0x0000, 0x0100, CRC(4a7c5367) SHA1(a67f5b90c18238cbfb1507230b4614191d37eef4) ) /* Colour prom 1 */ - ROM_LOAD( "82s129.6k", 0x0100, 0x0100, CRC(b6127713) SHA1(5bd8627453916ac6605af7d1193f79c748eab981) ) /* Colour prom 2 */ + ROM_LOAD( "82s129.5k", 0x0000, 0x0100, CRC(4a7c5367) SHA1(a67f5b90c18238cbfb1507230b4614191d37eef4) ) // Colour prom 1 + ROM_LOAD( "82s129.6k", 0x0100, 0x0100, CRC(b6127713) SHA1(5bd8627453916ac6605af7d1193f79c748eab981) ) // Colour prom 2 ROM_END -/* Game Driver */ +} // anonymous namespace + + +// Game Driver // ROT180 confirmed by Kold GAME( 1985, bogeyman, 0, bogeyman, bogeyman, bogeyman_state, empty_init, ROT180, "Technos Japan", "Bogey Manor", MACHINE_IMPERFECT_COLORS | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/technos/bogeyman.h b/src/mame/technos/bogeyman.h deleted file mode 100644 index bd46da31bf7..00000000000 --- a/src/mame/technos/bogeyman.h +++ /dev/null @@ -1,82 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Bryan McPhail -/************************************************************************* - - Bogey Manor - -*************************************************************************/ -#ifndef MAME_INCLUDES_BOGEYMAN_H -#define MAME_INCLUDES_BOGEYMAN_H - -#pragma once - -#include "sound/ay8910.h" -#include "emupal.h" -#include "tilemap.h" - -class bogeyman_state : public driver_device -{ -public: - bogeyman_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_ay1(*this, "ay1"), - m_ay2(*this, "ay2"), - m_videoram(*this, "videoram"), - m_videoram2(*this, "videoram2"), - m_colorram(*this, "colorram"), - m_colorram2(*this, "colorram2"), - m_spriteram(*this, "spriteram") - { } - - void bogeyman(machine_config &config); - -protected: - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; - -private: - /* devices */ - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_palette; - required_device m_ay1; - required_device m_ay2; - - /* memory pointers */ - required_shared_ptr m_videoram; - required_shared_ptr m_videoram2; - required_shared_ptr m_colorram; - required_shared_ptr m_colorram2; - required_shared_ptr m_spriteram; - - /* video-related */ - tilemap_t *m_bg_tilemap = nullptr; - tilemap_t *m_fg_tilemap = nullptr; - - /* misc */ - int m_psg_latch = 0; - int m_last_write = 0; - int m_colbank = 0; - - void ay8910_latch_w(uint8_t data); - void ay8910_control_w(uint8_t data); - void videoram_w(offs_t offset, uint8_t data); - void colorram_w(offs_t offset, uint8_t data); - void videoram2_w(offs_t offset, uint8_t data); - void colorram2_w(offs_t offset, uint8_t data); - void colbank_w(uint8_t data); - - TILE_GET_INFO_MEMBER(get_bg_tile_info); - TILE_GET_INFO_MEMBER(get_fg_tile_info); - - void bogeyman_palette(palette_device &palette) const; - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); - void bogeyman_map(address_map &map); -}; - -#endif // MAME_INCLUDES_BOGEYMAN_H diff --git a/src/mame/technos/bogeyman_v.cpp b/src/mame/technos/bogeyman_v.cpp deleted file mode 100644 index 85e5efd0a24..00000000000 --- a/src/mame/technos/bogeyman_v.cpp +++ /dev/null @@ -1,140 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Bryan McPhail -#include "emu.h" -#include "bogeyman.h" - - -void bogeyman_state::bogeyman_palette(palette_device &palette) const -{ - uint8_t const *color_prom = memregion("proms")->base(); - - // first 16 colors are RAM - for (int i = 0; i < 256; i++) - { - int bit0, bit1, bit2; - - // red component - bit0 = BIT(color_prom[0], 0); - bit1 = BIT(color_prom[0], 1); - bit2 = BIT(color_prom[0], 2); - int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - // green component - bit0 = BIT(color_prom[0], 3); - bit1 = BIT(color_prom[256], 0); - bit2 = BIT(color_prom[256], 1); - int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - // blue component - bit0 = 0; - bit1 = BIT(color_prom[256], 2); - bit2 = BIT(color_prom[256], 3); - int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - palette.set_pen_color(i + 16, rgb_t(r, g, b)); - color_prom++; - } -} - -void bogeyman_state::videoram_w(offs_t offset, uint8_t data) -{ - m_videoram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset); -} - -void bogeyman_state::colorram_w(offs_t offset, uint8_t data) -{ - m_colorram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset); -} - -void bogeyman_state::videoram2_w(offs_t offset, uint8_t data) -{ - m_videoram2[offset] = data; - m_fg_tilemap->mark_tile_dirty(offset); -} - -void bogeyman_state::colorram2_w(offs_t offset, uint8_t data) -{ - m_colorram2[offset] = data; - m_fg_tilemap->mark_tile_dirty(offset); -} - -TILE_GET_INFO_MEMBER(bogeyman_state::get_bg_tile_info) -{ - int attr = m_colorram[tile_index]; - int gfxbank = ((((attr & 0x01) << 8) + m_videoram[tile_index]) / 0x80) + 3; - int code = m_videoram[tile_index] & 0x7f; - int color = (attr >> 1) & 0x07; - - tileinfo.set(gfxbank, code, color, 0); -} - -TILE_GET_INFO_MEMBER(bogeyman_state::get_fg_tile_info) -{ - int attr = m_colorram2[tile_index]; - int tile = m_videoram2[tile_index] | ((attr & 0x03) << 8); - int gfxbank = tile / 0x200; - int code = tile & 0x1ff; - - tileinfo.set(gfxbank, code, m_colbank, 0); -} - -void bogeyman_state::video_start() -{ - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(bogeyman_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 16, 16); - m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(bogeyman_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); - - m_fg_tilemap->set_transparent_pen(0); -} - -void bogeyman_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - for (int offs = 0; offs < m_spriteram.bytes(); offs += 4) - { - int attr = m_spriteram[offs]; - - if (attr & 0x01) - { - int code = m_spriteram[offs + 1] + ((attr & 0x40) << 2); - int color = (attr & 0x08) >> 3; - int flipx = !(attr & 0x04); - int flipy = attr & 0x02; - int sx = m_spriteram[offs + 3]; - int sy = (240 - m_spriteram[offs + 2]) & 0xff; - int multi = attr & 0x10; - - if (multi) sy -= 16; - - if (flip_screen()) - { - sx = 240 - sx; - sy = 240 - sy; - flipx = !flipx; - flipy = !flipy; - } - - - m_gfxdecode->gfx(2)->transpen(bitmap,cliprect, - code, color, - flipx, flipy, - sx, sy, 0); - - if (multi) - { - m_gfxdecode->gfx(2)->transpen(bitmap,cliprect, - code + 1, color, - flipx, flipy, - sx, sy + (flip_screen() ? -16 : 16), 0); - } - } - } -} - -uint32_t bogeyman_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - draw_sprites(bitmap, cliprect); - m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - return 0; -} diff --git a/src/mame/technos/dogfgt.cpp b/src/mame/technos/dogfgt.cpp index bdc0ee14595..74181d84854 100644 --- a/src/mame/technos/dogfgt.cpp +++ b/src/mame/technos/dogfgt.cpp @@ -10,15 +10,323 @@ driver by Nicola Salmoria ***************************************************************************/ #include "emu.h" -#include "dogfgt.h" #include "cpu/m6502/m6502.h" -#include "speaker.h" +#include "machine/gen_latch.h" +#include "sound/ay8910.h" +#include "emupal.h" +#include "screen.h" +#include "speaker.h" +#include "tilemap.h" + + +// configurable logging +#define LOG_BITMAPRAM (1U << 1) +#define LOG_1800 (1U << 2) + +//#define VERBOSE (LOG_GENERAL | LOG_BITMAPRAM | LOG_1800) + +#include "logmacro.h" + +#define LOGBITMAPRAM(...) LOGMASKED(LOG_BITMAPRAM, __VA_ARGS__) +#define LOG1800(...) LOGMASKED(LOG_1800, __VA_ARGS__) + + +namespace { + +class dogfgt_state : public driver_device +{ +public: + dogfgt_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_bgvideoram(*this, "bgvideoram"), + m_spriteram(*this, "spriteram"), + m_bitmapram(*this, "bitmapram", 0x6000, ENDIANNESS_BIG), + m_subcpu(*this, "sub") , + m_maincpu(*this, "maincpu"), + m_gfxdecode(*this, "gfxdecode"), + m_screen(*this, "screen"), + m_palette(*this, "palette"), + m_ay(*this, "ay%u", 0U), + m_soundlatch(*this, "soundlatch") + { } + + void dogfgt(machine_config &config); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + +private: + // memory pointers + required_shared_ptr m_bgvideoram; + required_shared_ptr m_spriteram; + memory_share_creator m_bitmapram; + + // devices + required_device m_subcpu; + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_screen; + required_device m_palette; + required_device_array m_ay; + required_device m_soundlatch; + + // video-related + bitmap_ind16 m_pixbitmap{}; + tilemap_t *m_bg_tilemap = nullptr; + uint8_t m_bm_plane = 0U; + uint8_t m_pixcolor = 0U; + uint8_t m_scroll[4]{}; + uint8_t m_lastflip = 0U; + uint8_t m_lastpixcolor = 0U; + static constexpr uint8_t PIXMAP_COLOR_BASE = (16 + 32); + static constexpr uint16_t BITMAPRAM_SIZE = 0x6000; + + // sound-related + uint8_t m_last_snd_ctrl = 0U; + + void subirqtrigger_w(uint8_t data); + void sub_irqack_w(uint8_t data); + void soundcontrol_w(uint8_t data); + void plane_select_w(uint8_t data); + uint8_t bitmapram_r(offs_t offset); + void internal_bitmapram_w(offs_t offset, uint8_t data); + void bitmapram_w(offs_t offset, uint8_t data); + void bgvideoram_w(offs_t offset, uint8_t data); + void scroll_w(offs_t offset, uint8_t data); + void _1800_w(uint8_t data); + + TILE_GET_INFO_MEMBER(get_tile_info); + void palette(palette_device &palette) const; + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); + + void main_map(address_map &map); + void sub_map(address_map &map); +}; + + +// video + +/*************************************************************************** + + Convert the color PROMs into a more useable format. + + Dog-Fight has both palette RAM and PROMs. The PROMs are used for tiles & + pixmap, RAM for sprites. + +***************************************************************************/ + +void dogfgt_state::palette(palette_device &palette) const +{ + uint8_t const *const color_prom = memregion("proms")->base(); + + // first 16 colors are RAM + for (int i = 0; i < 64; 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_pen_color(i + 16, rgb_t(r, g, b)); + } +} + + +/*************************************************************************** + + Callbacks for the TileMap code + +***************************************************************************/ + +TILE_GET_INFO_MEMBER(dogfgt_state::get_tile_info) +{ + tileinfo.set(0, + m_bgvideoram[tile_index], + m_bgvideoram[tile_index + 0x400] & 0x03, + 0); +} + + +/*************************************************************************** + + Start the video hardware emulation. + +***************************************************************************/ + +void dogfgt_state::video_start() +{ + m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(dogfgt_state::get_tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 32, 32); + + m_screen->register_screen_bitmap(m_pixbitmap); + save_item(NAME(m_pixbitmap)); +} + + +/*************************************************************************** + + Memory handlers + +***************************************************************************/ + +void dogfgt_state::plane_select_w(uint8_t data) +{ + m_bm_plane = data; +} + +uint8_t dogfgt_state::bitmapram_r(offs_t offset) +{ + if (m_bm_plane > 2) + { + LOGBITMAPRAM("bitmapram_r offs %04x plane %d\n", offset, m_bm_plane); + return 0; + } + + return m_bitmapram[offset + BITMAPRAM_SIZE / 3 * m_bm_plane]; +} + +void dogfgt_state::internal_bitmapram_w(offs_t offset, uint8_t data) +{ + m_bitmapram[offset] = data; + + offset &= (BITMAPRAM_SIZE / 3 - 1); + int const x = 8 * (offset / 256); + int const y = offset % 256; + + for (int subx = 0; subx < 8; subx++) + { + int color = 0; + + for (int i = 0; i < 3; i++) + color |= ((m_bitmapram[offset + BITMAPRAM_SIZE / 3 * i] >> subx) & 1) << i; + + if (flip_screen()) + m_pixbitmap.pix(y ^ 0xff, (x + subx) ^ 0xff) = PIXMAP_COLOR_BASE + 8 * m_pixcolor + color; + else + m_pixbitmap.pix(y, x + subx) = PIXMAP_COLOR_BASE + 8 * m_pixcolor + color; + } +} + +void dogfgt_state::bitmapram_w(offs_t offset, uint8_t data) +{ + if (m_bm_plane > 2) + { + LOGBITMAPRAM("bitmapram_w offs %04x plane %d\n", offset, m_bm_plane); + return; + } + + internal_bitmapram_w(offset + BITMAPRAM_SIZE / 3 * m_bm_plane, data); +} + +void dogfgt_state::bgvideoram_w(offs_t offset, uint8_t data) +{ + m_bgvideoram[offset] = data; + m_bg_tilemap->mark_tile_dirty(offset & 0x3ff); +} + +void dogfgt_state::scroll_w(offs_t offset, uint8_t data) +{ + m_scroll[offset] = data; + m_bg_tilemap->set_scrollx(0, m_scroll[0] + 256 * m_scroll[1] + 256); + m_bg_tilemap->set_scrolly(0, m_scroll[2] + 256 * m_scroll[3]); +} + +void dogfgt_state::_1800_w(uint8_t data) +{ + // bits 0 and 1 are probably text color (not verified because PROM is missing) + m_pixcolor = ((data & 0x01) << 1) | ((data & 0x02) >> 1); + + // bits 4 and 5 are coin counters + machine().bookkeeping().coin_counter_w(0, data & 0x10); + machine().bookkeeping().coin_counter_w(1, data & 0x20); + + // bit 7 is screen flip + flip_screen_set(data & 0x80); + + // other bits unused? + LOG1800("PC %04x: 1800 = %02x\n", m_maincpu->pc(), data); +} + + +/*************************************************************************** + + Display refresh + +***************************************************************************/ + +void dogfgt_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + for (int offs = 0; offs < m_spriteram.bytes(); offs += 4) + { + if (m_spriteram[offs] & 0x01) + { + int sx = m_spriteram[offs + 3]; + int sy = (240 - m_spriteram[offs + 2]) & 0xff; + int flipx = m_spriteram[offs] & 0x04; + int flipy = m_spriteram[offs] & 0x02; + if (flip_screen()) + { + sx = 240 - sx; + sy = 240 - sy; + flipx = !flipx; + flipy = !flipy; + } + + m_gfxdecode->gfx(1)->transpen(bitmap, cliprect, + m_spriteram[offs + 1] + ((m_spriteram[offs] & 0x30) << 4), + (m_spriteram[offs] & 0x08) >> 3, + flipx, flipy, + sx, sy, 0); + } + } +} + + +uint32_t dogfgt_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + if (m_lastflip != flip_screen() || m_lastpixcolor != m_pixcolor) + { + m_lastflip = flip_screen(); + m_lastpixcolor = m_pixcolor; + + for (int offs = 0; offs < BITMAPRAM_SIZE; offs++) + internal_bitmapram_w(offs, m_bitmapram[offs]); + } + + + m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + + draw_sprites(bitmap, cliprect); + + copybitmap_trans(bitmap, m_pixbitmap, 0, 0, 0, 0, cliprect, PIXMAP_COLOR_BASE + 8 * m_pixcolor); + return 0; +} + + +// machine void dogfgt_state::subirqtrigger_w(uint8_t data) { - /* bit 0 used but unknown */ + // bit 0 used but unknown if (data & 0x04) m_subcpu->set_input_line(0, ASSERT_LINE); } @@ -28,20 +336,15 @@ void dogfgt_state::sub_irqack_w(uint8_t data) m_subcpu->set_input_line(0, CLEAR_LINE); } -void dogfgt_state::soundlatch_w(uint8_t data) -{ - m_soundlatch = data; -} - void dogfgt_state::soundcontrol_w(uint8_t data) { - /* bit 5 goes to YM2149 #0 BDIR pin */ + // bit 5 goes to YM2149 #0 BDIR pin if ((m_last_snd_ctrl & 0x20) == 0x20 && (data & 0x20) == 0x00) - m_ay[0]->data_address_w(m_last_snd_ctrl >> 4, m_soundlatch); + m_ay[0]->data_address_w(m_last_snd_ctrl >> 4, m_soundlatch->read()); - /* bit 7 goes to YM2149 #1 BDIR pin */ + // bit 7 goes to YM2149 #1 BDIR pin if ((m_last_snd_ctrl & 0x80) == 0x80 && (data & 0x80) == 0x00) - m_ay[1]->data_address_w(m_last_snd_ctrl >> 6, m_soundlatch); + m_ay[1]->data_address_w(m_last_snd_ctrl >> 6, m_soundlatch->read()); m_last_snd_ctrl = data; } @@ -51,17 +354,17 @@ void dogfgt_state::soundcontrol_w(uint8_t data) void dogfgt_state::main_map(address_map &map) { map(0x0000, 0x07ff).ram().share("sharedram"); - map(0x0f80, 0x0fdf).writeonly().share("spriteram"); - map(0x1000, 0x17ff).w(FUNC(dogfgt_state::bgvideoram_w)).share("bgvideoram"); + map(0x0f80, 0x0fdf).writeonly().share(m_spriteram); + map(0x1000, 0x17ff).w(FUNC(dogfgt_state::bgvideoram_w)).share(m_bgvideoram); map(0x1800, 0x1800).portr("P1"); - map(0x1800, 0x1800).w(FUNC(dogfgt_state::_1800_w)); /* text color, flip screen & coin counters */ + map(0x1800, 0x1800).w(FUNC(dogfgt_state::_1800_w)); // text color, flip screen & coin counters map(0x1810, 0x1810).portr("P2"); map(0x1810, 0x1810).w(FUNC(dogfgt_state::subirqtrigger_w)); map(0x1820, 0x1820).portr("DSW1"); map(0x1820, 0x1823).w(FUNC(dogfgt_state::scroll_w)); map(0x1824, 0x1824).w(FUNC(dogfgt_state::plane_select_w)); map(0x1830, 0x1830).portr("DSW2"); - map(0x1830, 0x1830).w(FUNC(dogfgt_state::soundlatch_w)); + map(0x1830, 0x1830).w(m_soundlatch, FUNC(generic_latch_8_device::write)); map(0x1840, 0x1840).w(FUNC(dogfgt_state::soundcontrol_w)); map(0x1870, 0x187f).w(m_palette, FUNC(palette_device::write8)).share("palette"); map(0x2000, 0x3fff).rw(FUNC(dogfgt_state::bitmapram_r), FUNC(dogfgt_state::bitmapram_w)); @@ -112,7 +415,7 @@ static INPUT_PORTS_START( dogfgt ) PORT_DIPNAME( 0x08, 0x08, DEF_STR( Allow_Continue ) ) PORT_DIPSETTING( 0x00, DEF_STR( No ) ) PORT_DIPSETTING( 0x08, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) ) /* Manual states dips 5 & 6 are "Unused" */ + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) ) // Manual states dips 5 & 6 are "Unused" PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) ) @@ -121,7 +424,7 @@ static INPUT_PORTS_START( dogfgt ) PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Cabinet ) ) PORT_DIPSETTING( 0x00, "Upright 1 Player" ) PORT_DIPSETTING( 0x80, "Upright 2 Players" ) -// PORT_DIPSETTING( 0x40, DEF_STR( Cocktail ) ) // "Cocktail 1 Player" - IMPOSSIBLE ! + PORT_DIPSETTING( 0x40, DEF_STR( Cocktail ) ) // "Cocktail 1 Player" - IMPOSSIBLE ! PORT_DIPSETTING( 0xc0, DEF_STR( Cocktail ) ) // "Cocktail 2 Players" @@ -193,8 +496,8 @@ static const gfx_layout spritelayout = }; static GFXDECODE_START( gfx_dogfgt ) - GFXDECODE_ENTRY( "gfx1", 0, tilelayout, 16, 4 ) - GFXDECODE_ENTRY( "gfx2", 0, spritelayout, 0, 2 ) + GFXDECODE_ENTRY( "tiles", 0, tilelayout, 16, 4 ) + GFXDECODE_ENTRY( "sprites", 0, spritelayout, 0, 2 ) GFXDECODE_END @@ -205,7 +508,6 @@ void dogfgt_state::machine_start() save_item(NAME(m_lastflip)); save_item(NAME(m_pixcolor)); save_item(NAME(m_lastpixcolor)); - save_item(NAME(m_soundlatch)); save_item(NAME(m_last_snd_ctrl)); save_item(NAME(m_scroll)); @@ -213,49 +515,48 @@ void dogfgt_state::machine_start() void dogfgt_state::machine_reset() { - int i; - m_bm_plane = 0; m_lastflip = 0; m_pixcolor = 0; m_lastpixcolor = 0; - m_soundlatch = 0; m_last_snd_ctrl = 0; - for (i = 0; i < 3; i++) + for (int i = 0; i < 3; i++) m_scroll[i] = 0; } void dogfgt_state::dogfgt(machine_config &config) { - /* basic machine hardware */ - M6502(config, m_maincpu, 1500000); /* 1.5 MHz ???? */ + // basic machine hardware + M6502(config, m_maincpu, 12_MHz_XTAL / 8); // 1.5 MHz ???? divisor not verified m_maincpu->set_addrmap(AS_PROGRAM, &dogfgt_state::main_map); - m_maincpu->set_periodic_int(FUNC(dogfgt_state::irq0_line_hold), attotime::from_hz(16*60)); /* ? controls music tempo */ + m_maincpu->set_periodic_int(FUNC(dogfgt_state::irq0_line_hold), attotime::from_hz(16 * 60)); // ? controls music tempo - M6502(config, m_subcpu, 1500000); /* 1.5 MHz ???? */ + M6502(config, m_subcpu, 12_MHz_XTAL / 8); // 1.5 MHz ???? divisor not verified m_subcpu->set_addrmap(AS_PROGRAM, &dogfgt_state::sub_map); config.set_maximum_quantum(attotime::from_hz(6000)); - /* video hardware */ + // video hardware SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_refresh_hz(60); - m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(2500) /* not accurate */); + m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(2500)); // not accurate m_screen->set_size(32*8, 32*8); m_screen->set_visarea(0*8, 32*8-1, 1*8, 31*8-1); m_screen->set_screen_update(FUNC(dogfgt_state::screen_update)); m_screen->set_palette(m_palette); GFXDECODE(config, m_gfxdecode, m_palette, gfx_dogfgt); - PALETTE(config, m_palette, FUNC(dogfgt_state::dogfgt_palette)).set_format(palette_device::BGR_233, 16 + 64); + PALETTE(config, m_palette, FUNC(dogfgt_state::palette)).set_format(palette_device::BGR_233, 16 + 64); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); - YM2149(config, m_ay[0], 1500000).add_route(ALL_OUTPUTS, "mono", 0.30); - YM2149(config, m_ay[1], 1500000).add_route(ALL_OUTPUTS, "mono", 0.30); + GENERIC_LATCH_8(config, m_soundlatch); + + YM2149(config, m_ay[0], 12_MHz_XTAL / 8).add_route(ALL_OUTPUTS, "mono", 0.30); // 1.5 MHz ???? divisor not verified + YM2149(config, m_ay[1], 12_MHz_XTAL / 8).add_route(ALL_OUTPUTS, "mono", 0.30); // 1.5 MHz ???? divisor not verified } @@ -267,18 +568,18 @@ ROM_START( dogfgt ) ROM_LOAD( "bx02-5.36", 0xc000, 0x2000, CRC(d11b50c3) SHA1(99dbbc85e8ff66eadc48a9f65f800676b10e35e4) ) ROM_LOAD( "bx03-5.22", 0xe000, 0x2000, CRC(0e4813fb) SHA1(afcbd17029bc3c2de83c15cc941fe8f2ad062a5d) ) - ROM_REGION( 0x10000, "sub", 0 ) /* 64k for audio code */ + ROM_REGION( 0x10000, "sub", 0 ) ROM_LOAD( "bx04.117", 0x8000, 0x2000, CRC(f8945f9d) SHA1(a0782a5007dc5efc302c4fd61827e1b68475e7ab) ) ROM_LOAD( "bx05.118", 0xa000, 0x2000, CRC(3ade57ad) SHA1(cc0a35257c00c463614a6718a24cc6dee75c2e5d) ) ROM_LOAD( "bx06.119", 0xc000, 0x2000, CRC(4a3b34cf) SHA1(f2e0bf9923a288b8137840f46fd90a23010f8018) ) ROM_LOAD( "bx07.120", 0xe000, 0x2000, CRC(ae21f907) SHA1(6374619f930a1ea8a222d95435158a0847450aac) ) - ROM_REGION( 0x06000, "gfx1", 0 ) + ROM_REGION( 0x06000, "tiles", 0 ) ROM_LOAD( "bx17.56", 0x0000, 0x2000, CRC(fd3245d7) SHA1(4cbe887e0988382a38b7376c41ec1406fa66d18d) ) ROM_LOAD( "bx18.57", 0x2000, 0x2000, CRC(03a5ef06) SHA1(44931222c722dec91516577d732478d01734efb3) ) ROM_LOAD( "bx19.58", 0x4000, 0x2000, CRC(f62a16f4) SHA1(e7f2891aba1cf708d765229b76e36ee9c91596ea) ) - ROM_REGION( 0x12000, "gfx2", 0 ) + ROM_REGION( 0x12000, "sprites", 0 ) ROM_LOAD( "bx08.128", 0x00000, 0x2000, CRC(8bf41b27) SHA1(346da090ba216c182530df40bd8d0af96c7a705b) ) ROM_LOAD( "bx09.127", 0x02000, 0x2000, CRC(c3ea6509) SHA1(4ebe36f1cc59f44808d2975fe3d30ee089535bbc) ) ROM_LOAD( "bx10.126", 0x04000, 0x2000, CRC(474a1c64) SHA1(14b2967d23903175e8e0b9340fcd11f7ce9d15dd) ) @@ -301,18 +602,18 @@ ROM_START( dogfgtu ) ROM_LOAD( "bx02-7.36", 0xc000, 0x2000, CRC(afaf10e6) SHA1(67b1e0722ae0e8110acc44bc582b308e86743d60) ) ROM_LOAD( "bx03-6.33", 0xe000, 0x2000, CRC(51b20e8b) SHA1(0247345b3f9736e9140faf765cb33f97660f0ddd) ) - ROM_REGION( 0x10000, "sub", 0 ) /* 64k for audio code */ + ROM_REGION( 0x10000, "sub", 0 ) ROM_LOAD( "bx04-7.117", 0x8000, 0x2000, CRC(c4c2183b) SHA1(27cf40d6f03b078c5cc4497f393309bf33dea9dc) ) ROM_LOAD( "bx05-7.118", 0xa000, 0x2000, CRC(d9a705ab) SHA1(7a49769d6c32e3d9840e4b24e3cbcd84a075d36d) ) ROM_LOAD( "bx06.119", 0xc000, 0x2000, CRC(4a3b34cf) SHA1(f2e0bf9923a288b8137840f46fd90a23010f8018) ) ROM_LOAD( "bx07-7.120", 0xe000, 0x2000, CRC(868df3dd) SHA1(482a461bce5555ac02b5ffa7723ee671139a2d54) ) - ROM_REGION( 0x06000, "gfx1", 0 ) + ROM_REGION( 0x06000, "tiles", 0 ) ROM_LOAD( "bx17.56", 0x0000, 0x2000, CRC(fd3245d7) SHA1(4cbe887e0988382a38b7376c41ec1406fa66d18d) ) ROM_LOAD( "bx18.57", 0x2000, 0x2000, CRC(03a5ef06) SHA1(44931222c722dec91516577d732478d01734efb3) ) ROM_LOAD( "bx19.58", 0x4000, 0x2000, CRC(f62a16f4) SHA1(e7f2891aba1cf708d765229b76e36ee9c91596ea) ) - ROM_REGION( 0x12000, "gfx2", 0 ) + ROM_REGION( 0x12000, "sprites", 0 ) ROM_LOAD( "bx08.128", 0x00000, 0x2000, CRC(8bf41b27) SHA1(346da090ba216c182530df40bd8d0af96c7a705b) ) ROM_LOAD( "bx09.127", 0x02000, 0x2000, CRC(c3ea6509) SHA1(4ebe36f1cc59f44808d2975fe3d30ee089535bbc) ) ROM_LOAD( "bx10.126", 0x04000, 0x2000, CRC(474a1c64) SHA1(14b2967d23903175e8e0b9340fcd11f7ce9d15dd) ) @@ -335,18 +636,18 @@ ROM_START( dogfgtj ) ROM_LOAD( "bx02.36", 0xc000, 0x2000, CRC(91f1b9b3) SHA1(dd939538abf615d3a0271fd561038acc6a2a616d) ) ROM_LOAD( "bx03.22", 0xe000, 0x2000, CRC(959ebf93) SHA1(de79dd44c68a232278b8d251e39c0ad35d160595) ) - ROM_REGION( 0x10000, "sub", 0 ) /* 64k for audio code */ + ROM_REGION( 0x10000, "sub", 0 ) ROM_LOAD( "bx04.117", 0x8000, 0x2000, CRC(f8945f9d) SHA1(a0782a5007dc5efc302c4fd61827e1b68475e7ab) ) ROM_LOAD( "bx05.118", 0xa000, 0x2000, CRC(3ade57ad) SHA1(cc0a35257c00c463614a6718a24cc6dee75c2e5d) ) ROM_LOAD( "bx06.119", 0xc000, 0x2000, CRC(4a3b34cf) SHA1(f2e0bf9923a288b8137840f46fd90a23010f8018) ) ROM_LOAD( "bx07.120", 0xe000, 0x2000, CRC(ae21f907) SHA1(6374619f930a1ea8a222d95435158a0847450aac) ) - ROM_REGION( 0x06000, "gfx1", 0 ) + ROM_REGION( 0x06000, "tiles", 0 ) ROM_LOAD( "bx17.56", 0x0000, 0x2000, CRC(fd3245d7) SHA1(4cbe887e0988382a38b7376c41ec1406fa66d18d) ) ROM_LOAD( "bx18.57", 0x2000, 0x2000, CRC(03a5ef06) SHA1(44931222c722dec91516577d732478d01734efb3) ) ROM_LOAD( "bx19.58", 0x4000, 0x2000, CRC(f62a16f4) SHA1(e7f2891aba1cf708d765229b76e36ee9c91596ea) ) - ROM_REGION( 0x12000, "gfx2", 0 ) + ROM_REGION( 0x12000, "sprites", 0 ) ROM_LOAD( "bx08.128", 0x00000, 0x2000, CRC(8bf41b27) SHA1(346da090ba216c182530df40bd8d0af96c7a705b) ) ROM_LOAD( "bx09.127", 0x02000, 0x2000, CRC(c3ea6509) SHA1(4ebe36f1cc59f44808d2975fe3d30ee089535bbc) ) ROM_LOAD( "bx10.126", 0x04000, 0x2000, CRC(474a1c64) SHA1(14b2967d23903175e8e0b9340fcd11f7ce9d15dd) ) @@ -362,8 +663,9 @@ ROM_START( dogfgtj ) ROM_LOAD( "bx21.64", 0x0020, 0x0020, CRC(5de4319f) SHA1(f70e116b80627d3eccc27c1964b08a0c8cdfff44) ) ROM_END +} // anonymous namespace -GAME( 1984, dogfgt, 0, dogfgt, dogfgt, dogfgt_state, empty_init, ROT0, "Technos Japan", "Acrobatic Dog-Fight", MACHINE_SUPPORTS_SAVE ) -GAME( 1985, dogfgtu, dogfgt, dogfgt, dogfgt, dogfgt_state, empty_init, ROT0, "Technos Japan (Data East USA, Inc. license)", "Acrobatic Dog-Fight (USA)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, dogfgt, 0, dogfgt, dogfgt, dogfgt_state, empty_init, ROT0, "Technos Japan", "Acrobatic Dog-Fight", MACHINE_SUPPORTS_SAVE ) +GAME( 1985, dogfgtu, dogfgt, dogfgt, dogfgt, dogfgt_state, empty_init, ROT0, "Technos Japan (Data East USA, Inc. license)", "Acrobatic Dog-Fight (USA)", MACHINE_SUPPORTS_SAVE ) GAME( 1984, dogfgtj, dogfgt, dogfgt, dogfgt, dogfgt_state, empty_init, ROT0, "Technos Japan", "But-ten Ohara's Suit-Cha Luck-a Dog-Fight (Japan)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/technos/dogfgt.h b/src/mame/technos/dogfgt.h deleted file mode 100644 index 7c009dbbc4d..00000000000 --- a/src/mame/technos/dogfgt.h +++ /dev/null @@ -1,90 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nicola Salmoria -#ifndef MAME_INCLUDES_DOGFGT_H -#define MAME_INCLUDES_DOGFGT_H - -#pragma once - -#include "sound/ay8910.h" -#include "emupal.h" -#include "screen.h" -#include "tilemap.h" - -#define PIXMAP_COLOR_BASE (16 + 32) -#define BITMAPRAM_SIZE 0x6000 - - -class dogfgt_state : public driver_device -{ -public: - dogfgt_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_bgvideoram(*this, "bgvideoram"), - m_spriteram(*this, "spriteram"), - m_sharedram(*this, "sharedram"), - m_subcpu(*this, "sub") , - m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen"), - m_palette(*this, "palette"), - m_ay(*this, "ay%u", 0U) - { } - - void dogfgt(machine_config &config); - -protected: - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; - -private: - /* memory pointers */ - required_shared_ptr m_bgvideoram; - required_shared_ptr m_spriteram; - required_shared_ptr m_sharedram; - - /* devices */ - required_device m_subcpu; - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_screen; - required_device m_palette; - required_device_array m_ay; - - /* video-related */ - bitmap_ind16 m_pixbitmap{}; - tilemap_t *m_bg_tilemap = nullptr; - std::unique_ptr m_bitmapram{}; - int m_bm_plane = 0; - int m_pixcolor = 0; - int m_scroll[4]{}; - int m_lastflip = 0; - int m_lastpixcolor = 0; - - /* sound-related */ - int m_soundlatch = 0; - int m_last_snd_ctrl = 0; - - void subirqtrigger_w(uint8_t data); - void sub_irqack_w(uint8_t data); - void soundlatch_w(uint8_t data); - void soundcontrol_w(uint8_t data); - void plane_select_w(uint8_t data); - uint8_t bitmapram_r(offs_t offset); - void internal_bitmapram_w(offs_t offset, uint8_t data); - void bitmapram_w(offs_t offset, uint8_t data); - void bgvideoram_w(offs_t offset, uint8_t data); - void scroll_w(offs_t offset, uint8_t data); - void _1800_w(uint8_t data); - - - TILE_GET_INFO_MEMBER(get_tile_info); - void dogfgt_palette(palette_device &palette) const; - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); - - void main_map(address_map &map); - void sub_map(address_map &map); -}; - -#endif // MAME_INCLUDES_DOGFGT_H diff --git a/src/mame/technos/dogfgt_v.cpp b/src/mame/technos/dogfgt_v.cpp deleted file mode 100644 index 6046644283d..00000000000 --- a/src/mame/technos/dogfgt_v.cpp +++ /dev/null @@ -1,218 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nicola Salmoria -#include "emu.h" -#include "dogfgt.h" - - -/*************************************************************************** - - Convert the color PROMs into a more useable format. - - Dog-Fight has both palette RAM and PROMs. The PROMs are used for tiles & - pixmap, RAM for sprites. - -***************************************************************************/ - -void dogfgt_state::dogfgt_palette(palette_device &palette) const -{ - uint8_t const *const color_prom = memregion("proms")->base(); - - // first 16 colors are RAM - for (int i = 0; i < 64; 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_pen_color(i + 16, rgb_t(r, g, b)); - } -} - - -/*************************************************************************** - - Callbacks for the TileMap code - -***************************************************************************/ - -TILE_GET_INFO_MEMBER(dogfgt_state::get_tile_info) -{ - tileinfo.set(0, - m_bgvideoram[tile_index], - m_bgvideoram[tile_index + 0x400] & 0x03, - 0); -} - - -/*************************************************************************** - - Start the video hardware emulation. - -***************************************************************************/ - -void dogfgt_state::video_start() -{ - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(dogfgt_state::get_tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 32, 32); - - m_bitmapram = std::make_unique(BITMAPRAM_SIZE); - save_pointer(NAME(m_bitmapram), BITMAPRAM_SIZE); - - m_screen->register_screen_bitmap(m_pixbitmap); - save_item(NAME(m_pixbitmap)); -} - - -/*************************************************************************** - - Memory handlers - -***************************************************************************/ - -void dogfgt_state::plane_select_w(uint8_t data) -{ - m_bm_plane = data; -} - -uint8_t dogfgt_state::bitmapram_r(offs_t offset) -{ - if (m_bm_plane > 2) - { - popmessage("bitmapram_r offs %04x plane %d\n", offset, m_bm_plane); - return 0; - } - - return m_bitmapram[offset + BITMAPRAM_SIZE / 3 * m_bm_plane]; -} - -void dogfgt_state::internal_bitmapram_w(offs_t offset, uint8_t data) -{ - m_bitmapram[offset] = data; - - offset &= (BITMAPRAM_SIZE / 3 - 1); - int x = 8 * (offset / 256); - int y = offset % 256; - - for (int subx = 0; subx < 8; subx++) - { - int color = 0; - - for (int i = 0; i < 3; i++) - color |= ((m_bitmapram[offset + BITMAPRAM_SIZE / 3 * i] >> subx) & 1) << i; - - if (flip_screen()) - m_pixbitmap.pix(y ^ 0xff, (x + subx) ^ 0xff) = PIXMAP_COLOR_BASE + 8 * m_pixcolor + color; - else - m_pixbitmap.pix(y, x + subx) = PIXMAP_COLOR_BASE + 8 * m_pixcolor + color; - } -} - -void dogfgt_state::bitmapram_w(offs_t offset, uint8_t data) -{ - if (m_bm_plane > 2) - { - popmessage("bitmapram_w offs %04x plane %d\n", offset, m_bm_plane); - return; - } - - internal_bitmapram_w(offset + BITMAPRAM_SIZE / 3 * m_bm_plane, data); -} - -void dogfgt_state::bgvideoram_w(offs_t offset, uint8_t data) -{ - m_bgvideoram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset & 0x3ff); -} - -void dogfgt_state::scroll_w(offs_t offset, uint8_t data) -{ - m_scroll[offset] = data; - m_bg_tilemap->set_scrollx(0, m_scroll[0] + 256 * m_scroll[1] + 256); - m_bg_tilemap->set_scrolly(0, m_scroll[2] + 256 * m_scroll[3]); -} - -void dogfgt_state::_1800_w(uint8_t data) -{ - /* bits 0 and 1 are probably text color (not verified because PROM is missing) */ - m_pixcolor = ((data & 0x01) << 1) | ((data & 0x02) >> 1); - - /* bits 4 and 5 are coin counters */ - machine().bookkeeping().coin_counter_w(0, data & 0x10); - machine().bookkeeping().coin_counter_w(1, data & 0x20); - - /* bit 7 is screen flip */ - flip_screen_set(data & 0x80); - - /* other bits unused? */ - logerror("PC %04x: 1800 = %02x\n", m_maincpu->pc(), data); -} - - -/*************************************************************************** - - Display refresh - -***************************************************************************/ - -void dogfgt_state::draw_sprites( bitmap_ind16 &bitmap,const rectangle &cliprect ) -{ - for (int offs = 0; offs < m_spriteram.bytes(); offs += 4) - { - if (m_spriteram[offs] & 0x01) - { - int sx = m_spriteram[offs + 3]; - int sy = (240 - m_spriteram[offs + 2]) & 0xff; - int flipx = m_spriteram[offs] & 0x04; - int flipy = m_spriteram[offs] & 0x02; - if (flip_screen()) - { - sx = 240 - sx; - sy = 240 - sy; - flipx = !flipx; - flipy = !flipy; - } - - m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, - m_spriteram[offs + 1] + ((m_spriteram[offs] & 0x30) << 4), - (m_spriteram[offs] & 0x08) >> 3, - flipx,flipy, - sx,sy,0); - } - } -} - - -uint32_t dogfgt_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - if (m_lastflip != flip_screen() || m_lastpixcolor != m_pixcolor) - { - m_lastflip = flip_screen(); - m_lastpixcolor = m_pixcolor; - - for (int offs = 0; offs < BITMAPRAM_SIZE; offs++) - internal_bitmapram_w(offs, m_bitmapram[offs]); - } - - - m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - - draw_sprites(bitmap, cliprect); - - copybitmap_trans(bitmap, m_pixbitmap, 0, 0, 0, 0, cliprect, PIXMAP_COLOR_BASE + 8 * m_pixcolor); - return 0; -} diff --git a/src/mame/technos/matmania.cpp b/src/mame/technos/matmania.cpp index 4bb134abb10..10d1ccd63ff 100644 --- a/src/mame/technos/matmania.cpp +++ b/src/mame/technos/matmania.cpp @@ -32,103 +32,416 @@ The driver has been updated accordingly. ***************************************************************************/ #include "emu.h" -#include "matmania.h" + +#include "taito68705.h" #include "cpu/m6502/m6502.h" #include "cpu/m6809/m6809.h" +#include "machine/gen_latch.h" #include "sound/ay8910.h" #include "sound/dac.h" #include "sound/ymopl.h" + +#include "emupal.h" +#include "screen.h" #include "speaker.h" +namespace { + +class matmania_state : public driver_device +{ +public: + matmania_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_videoram(*this, "videoram%u", 1U), + m_colorram(*this, "colorram%u", 1U), + m_scroll(*this, "scroll"), + m_pageselect(*this, "pageselect"), + m_spriteram(*this, "spriteram"), + m_paletteram(*this, "paletteram"), + m_maincpu(*this, "maincpu"), + m_audiocpu(*this, "audiocpu"), + m_gfxdecode(*this, "gfxdecode"), + m_screen(*this, "screen"), + m_palette(*this, "palette") + { } + + void matmania(machine_config &config); + +protected: + virtual void video_start() override; + + // memory pointers + required_shared_ptr_array m_videoram; + required_shared_ptr_array m_colorram; + required_shared_ptr m_scroll; + required_shared_ptr m_pageselect; + required_shared_ptr m_spriteram; + required_shared_ptr m_paletteram; + + // devices + required_device m_maincpu; + required_device m_audiocpu; + required_device m_gfxdecode; + required_device m_screen; + required_device m_palette; + + // video-related + std::unique_ptr m_tmpbitmap[2]; + + void paletteram_w(offs_t offset, uint8_t data); + void palette(palette_device &palette) const; + + void main_map(address_map &map); + +private: + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void sound_map(address_map &map); +}; + +class maniach_state : public matmania_state +{ +public: + maniach_state(const machine_config &mconfig, device_type type, const char *tag) : + matmania_state(mconfig, type, tag), + m_mcu(*this, "mcu") + { } + + void maniach(machine_config &config); + +private: + required_device m_mcu; + + uint8_t mcu_status_r(); + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void main_map(address_map &map); + void sound_map(address_map &map); +}; + +// video + +/*************************************************************************** + + There are only a few differences between the video hardware of Mysterious + Stones and Mat Mania. The tile bank select bit is different and the sprite + selection seems to be different as well. Additionally, the palette is stored + differently. I'm also not sure that the 2nd tile page is really used in + Mysterious Stones. + +***************************************************************************/ + +/*************************************************************************** + + Convert the color PROMs into a more useable format. + + Mat Mania is unusual in that it has both PROMs and RAM to control the + palette. PROMs are used for characters and background tiles, RAM for + sprites. + I don't know for sure how the PROMs are connected to the RGB output, + but it's probably the usual: + + bit 7 -- 220 ohm resistor -- GREEN + -- 470 ohm resistor -- GREEN + -- 1 kohm resistor -- GREEN + -- 2.2kohm resistor -- GREEN + -- 220 ohm resistor -- RED + -- 470 ohm resistor -- RED + -- 1 kohm resistor -- RED + bit 0 -- 2.2kohm resistor -- RED + + bit 3 -- 220 ohm resistor -- BLUE + -- 470 ohm resistor -- BLUE + -- 1 kohm resistor -- BLUE + bit 0 -- 2.2kohm resistor -- BLUE + +***************************************************************************/ + +void matmania_state::palette(palette_device &palette) const +{ + uint8_t const *color_prom = memregion("proms")->base(); + + for (int i = 0; i < 64; i++) + { + int bit0, bit1, bit2, bit3; + + bit0 = BIT(color_prom[0], 0); + bit1 = BIT(color_prom[0], 1); + bit2 = BIT(color_prom[0], 2); + bit3 = BIT(color_prom[0], 3); + int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + bit0 = BIT(color_prom[0], 4); + bit1 = BIT(color_prom[0], 5); + bit2 = BIT(color_prom[0], 6); + bit3 = BIT(color_prom[0], 7); + int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + bit0 = BIT(color_prom[64], 0); + bit1 = BIT(color_prom[64], 1); + bit2 = BIT(color_prom[64], 2); + bit3 = BIT(color_prom[64], 3); + int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + palette.set_pen_color(i, rgb_t(r, g, b)); + color_prom++; + } +} + + + +void matmania_state::paletteram_w(offs_t offset, uint8_t data) +{ + int bit0, bit1, bit2, bit3, val; + + m_paletteram[offset] = data; + offset &= 0x0f; + + val = m_paletteram[offset]; + bit0 = BIT(val, 0); + bit1 = BIT(val, 1); + bit2 = BIT(val, 2); + bit3 = BIT(val, 3); + int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + val = m_paletteram[offset | 0x10]; + bit0 = BIT(val, 0); + bit1 = BIT(val, 1); + bit2 = BIT(val, 2); + bit3 = BIT(val, 3); + int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + val = m_paletteram[offset | 0x20]; + bit0 = BIT(val, 0); + bit1 = BIT(val, 1); + bit2 = BIT(val, 2); + bit3 = BIT(val, 3); + int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + m_palette->set_pen_color(offset + 64, rgb_t(r, g, b)); +} + + +/*************************************************************************** + + Start the video hardware emulation. + +***************************************************************************/ + +void matmania_state::video_start() +{ + int width = m_screen->width(); + int height = m_screen->height(); + + // Mat Mania has a virtual screen twice as large as the visible screen + m_tmpbitmap[0] = std::make_unique(width, 2 * height); + m_tmpbitmap[1] = std::make_unique(width, 2 * height); +} + + + +uint32_t matmania_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + // Update the tiles in the left tile RAM bank + for (int offs = m_videoram[0].bytes() - 1; offs >= 0; offs--) + { + int const sx = 15 - offs / 32; + int const sy = offs % 32; + + m_gfxdecode->gfx(1)->opaque(*m_tmpbitmap[0], m_tmpbitmap[0]->cliprect(), + m_videoram[0][offs] + ((m_colorram[0][offs] & 0x08) << 5), + (m_colorram[0][offs] & 0x30) >> 4, + 0, sy >= 16, // flip horizontally tiles on the right half of the bitmap + 16 * sx, 16 * sy); + } + + // Update the tiles in the right tile RAM bank + for (int offs = m_videoram[2].bytes() - 1; offs >= 0; offs--) + { + int const sx = 15 - offs / 32; + int const sy = offs % 32; + + m_gfxdecode->gfx(1)->opaque(*m_tmpbitmap[1], m_tmpbitmap[1]->cliprect(), + m_videoram[2][offs] + ((m_colorram[2][offs] & 0x08) << 5), + (m_colorram[2][offs] & 0x30) >> 4, + 0, sy >= 16, // flip horizontally tiles on the right half of the bitmap + 16 * sx, 16 * sy); + } + + // copy the temporary bitmap to the screen + { + int const scrolly = -*m_scroll; + if (m_pageselect[0] & 0x01) // maniach sets 0x20 sometimes, which must have a different meaning + copyscrollbitmap(bitmap, *m_tmpbitmap[1], 0, nullptr, 1, &scrolly, cliprect); + else + copyscrollbitmap(bitmap, *m_tmpbitmap[0], 0, nullptr, 1, &scrolly, cliprect); + } + + + // Draw the sprites + for (int offs = 0; offs < m_spriteram.bytes(); offs += 4) + { + if (m_spriteram[offs] & 0x01) + { + m_gfxdecode->gfx(2)->transpen(bitmap, cliprect, + m_spriteram[offs + 1] + ((m_spriteram[offs] & 0xf0) << 4), + (m_spriteram[offs] & 0x08) >> 3, + m_spriteram[offs] & 0x04, m_spriteram[offs] & 0x02, + 239 - m_spriteram[offs + 3], (240 - m_spriteram[offs + 2]) & 0xff, 0); + } + } + + + // draw the frontmost playfield. They are characters, but draw them as sprites + for (int offs = m_videoram[1].bytes() - 1; offs >= 0; offs--) + { + int const sx = 31 - offs / 32; + int const sy = offs % 32; + + m_gfxdecode->gfx(0)->transpen(bitmap, cliprect, + m_videoram[1][offs] + 256 * (m_colorram[1][offs] & 0x07), + (m_colorram[1][offs] & 0x30) >> 4, + 0, 0, + 8 * sx, 8 * sy, 0); + } + return 0; +} + +uint32_t maniach_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + // Update the tiles in the left tile RAM bank + for (int offs = m_videoram[0].bytes() - 1; offs >= 0; offs--) + { + int const sx = 15 - offs / 32; + int const sy = offs % 32; + + m_gfxdecode->gfx(1)->opaque(*m_tmpbitmap[0], m_tmpbitmap[0]->cliprect(), + m_videoram[0][offs] + ((m_colorram[0][offs] & 0x03) << 8), + (m_colorram[0][offs] & 0x30) >> 4, + 0, sy >= 16, // flip horizontally tiles on the right half of the bitmap + 16 * sx, 16 * sy); + } + + // Update the tiles in the right tile RAM bank + for (int offs = m_videoram[2].bytes() - 1; offs >= 0; offs--) + { + int const sx = 15 - offs / 32; + int const sy = offs % 32; + + m_gfxdecode->gfx(1)->opaque(*m_tmpbitmap[1], m_tmpbitmap[1]->cliprect(), + m_videoram[2][offs] + ((m_colorram[2][offs] & 0x03) << 8), + (m_colorram[2][offs] & 0x30) >> 4, + 0, sy >= 16, // flip horizontally tiles on the right half of the bitmap + 16 * sx, 16 * sy); + } + + + // copy the temporary bitmap to the screen + { + int const scrolly = -*m_scroll; + + if (m_pageselect[0] & 0x01) // this sets 0x20 sometimes, which must have a different meaning + copyscrollbitmap(bitmap, *m_tmpbitmap[1], 0, nullptr, 1, &scrolly, cliprect); + else + copyscrollbitmap(bitmap, *m_tmpbitmap[0], 0, nullptr, 1, &scrolly, cliprect); + } + + + // Draw the sprites + for (int offs = 0; offs < m_spriteram.bytes(); offs += 4) + { + if (m_spriteram[offs] & 0x01) + { + m_gfxdecode->gfx(2)->transpen(bitmap, cliprect, + m_spriteram[offs + 1] + ((m_spriteram[offs] & 0xf0) << 4), + (m_spriteram[offs] & 0x08) >> 3, + m_spriteram[offs] & 0x04, m_spriteram[offs] & 0x02, + 239 - m_spriteram[offs + 3], (240 - m_spriteram[offs + 2]) & 0xff, 0); + } + } + + + // draw the frontmost playfield. They are characters, but draw them as sprites + for (int offs = m_videoram[1].bytes() - 1; offs >= 0; offs--) + { + int const sx = 31 - offs / 32; + int const sy = offs % 32; + + m_gfxdecode->gfx(0)->transpen(bitmap, cliprect, + m_videoram[1][offs] + 256 * (m_colorram[1][offs] & 0x07), + (m_colorram[1][offs] & 0x30) >> 4, + 0, 0, + 8 * sx, 8 * sy, 0); + } + return 0; +} + + +// machine + /************************************* * * Misc Memory handlers * *************************************/ -uint8_t matmania_state::maniach_mcu_status_r() +uint8_t maniach_state::mcu_status_r() { return ((CLEAR_LINE == m_mcu->mcu_semaphore_r()) ? 0x01 : 0x00) | ((CLEAR_LINE == m_mcu->host_semaphore_r()) ? 0x02 : 0x00); } -void matmania_state::matmania_sh_command_w(uint8_t data) -{ - m_soundlatch->write(data); - m_audiocpu->set_input_line(M6502_IRQ_LINE, HOLD_LINE); -} - -void matmania_state::maniach_sh_command_w(uint8_t data) -{ - m_soundlatch->write(data); - m_audiocpu->set_input_line(M6809_IRQ_LINE, HOLD_LINE); -} - - /************************************* * * Address maps * *************************************/ -void matmania_state::matmania_map(address_map &map) +void matmania_state::main_map(address_map &map) { map(0x0000, 0x077f).ram(); - map(0x0780, 0x07df).writeonly().share("spriteram"); - map(0x1000, 0x13ff).ram().share("videoram2"); - map(0x1400, 0x17ff).ram().share("colorram2"); - map(0x2000, 0x21ff).ram().share("videoram"); - map(0x2200, 0x23ff).ram().share("colorram"); - map(0x2400, 0x25ff).ram().share("videoram3"); - map(0x2600, 0x27ff).ram().share("colorram3"); - map(0x3000, 0x3000).portr("IN0").writeonly().share("pageselect"); - map(0x3010, 0x3010).portr("IN1").w(FUNC(matmania_state::matmania_sh_command_w)); - map(0x3020, 0x3020).portr("DSW2").writeonly().share("scroll"); - map(0x3030, 0x3030).portr("DSW1").nopw(); /* ?? */ - map(0x3050, 0x307f).w(FUNC(matmania_state::matmania_paletteram_w)).share("paletteram"); + map(0x0780, 0x07df).writeonly().share(m_spriteram); + map(0x1000, 0x13ff).ram().share(m_videoram[1]); + map(0x1400, 0x17ff).ram().share(m_colorram[1]); + map(0x2000, 0x21ff).ram().share(m_videoram[0]); + map(0x2200, 0x23ff).ram().share(m_colorram[0]); + map(0x2400, 0x25ff).ram().share(m_videoram[2]); + map(0x2600, 0x27ff).ram().share(m_colorram[2]); + map(0x3000, 0x3000).portr("IN0").writeonly().share(m_pageselect); + map(0x3010, 0x3010).portr("IN1").w("soundlatch", FUNC(generic_latch_8_device::write)); + map(0x3020, 0x3020).portr("DSW2").writeonly().share(m_scroll); + map(0x3030, 0x3030).portr("DSW1").nopw(); // ?? + map(0x3050, 0x307f).w(FUNC(matmania_state::paletteram_w)).share(m_paletteram); map(0x4000, 0xffff).rom(); } -void matmania_state::maniach_map(address_map &map) +void maniach_state::main_map(address_map &map) { - map(0x0000, 0x077f).ram(); - map(0x0780, 0x07df).ram().share("spriteram"); - map(0x1000, 0x13ff).ram().share("videoram2"); - map(0x1400, 0x17ff).ram().share("colorram2"); - map(0x2000, 0x21ff).ram().share("videoram"); - map(0x2200, 0x23ff).ram().share("colorram"); - map(0x2400, 0x25ff).ram().share("videoram3"); - map(0x2600, 0x27ff).ram().share("colorram3"); - map(0x3000, 0x3000).portr("IN0").writeonly().share("pageselect"); - map(0x3010, 0x3010).portr("IN1").w(FUNC(matmania_state::maniach_sh_command_w)); - map(0x3020, 0x3020).portr("DSW2").writeonly().share("scroll"); - map(0x3030, 0x3030).portr("DSW1").nopw(); /* ?? */ + matmania_state::main_map(map); + + map(0x0780, 0x07df).ram().share(m_spriteram); map(0x3040, 0x3040).rw(m_mcu, FUNC(taito68705_mcu_device::data_r), FUNC(taito68705_mcu_device::data_w)); - map(0x3041, 0x3041).r(FUNC(matmania_state::maniach_mcu_status_r)); - map(0x3050, 0x307f).w(FUNC(matmania_state::matmania_paletteram_w)).share("paletteram"); - map(0x4000, 0xffff).rom(); + map(0x3041, 0x3041).r(FUNC(maniach_state::mcu_status_r)); } -void matmania_state::matmania_sound_map(address_map &map) +void matmania_state::sound_map(address_map &map) { map(0x0000, 0x01ff).ram(); map(0x2000, 0x2001).w("ay1", FUNC(ay8910_device::data_address_w)); map(0x2002, 0x2003).w("ay2", FUNC(ay8910_device::data_address_w)); map(0x2004, 0x2004).w("dac", FUNC(dac_byte_interface::data_w)); - map(0x2007, 0x2007).r(m_soundlatch, FUNC(generic_latch_8_device::read)); + map(0x2007, 0x2007).r("soundlatch", FUNC(generic_latch_8_device::read)); map(0x8000, 0xffff).rom(); } -void matmania_state::maniach_sound_map(address_map &map) +void maniach_state::sound_map(address_map &map) { map(0x0000, 0x0fff).ram(); map(0x2000, 0x2001).w("ymsnd", FUNC(ym3526_device::write)); map(0x2002, 0x2002).w("dac", FUNC(dac_byte_interface::data_w)); - map(0x2004, 0x2004).r(m_soundlatch, FUNC(generic_latch_8_device::read)); + map(0x2004, 0x2004).r("soundlatch", FUNC(generic_latch_8_device::read)); map(0x4000, 0xffff).rom(); } @@ -175,26 +488,26 @@ static INPUT_PORTS_START( matmania ) PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x10, DEF_STR( On ) ) PORT_DIPNAME(0x20, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW1:6") - PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) /* The default setting should be cocktail. */ + PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) // The default setting should be cocktail. PORT_DIPSETTING( 0x20, DEF_STR( Cocktail ) ) PORT_SERVICE_DIPLOC( 0x40, IP_ACTIVE_LOW, "SW1:7" ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen") /* Listed as always ON among DIPs in the manual */ + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen") // Listed as always ON among DIPs in the manual PORT_START("DSW2") PORT_DIPNAME(0x03, 0x02, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:1,2") PORT_DIPSETTING( 0x03, DEF_STR( Easy ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Medium ) ) /* According to the manual, default is Medium */ + PORT_DIPSETTING( 0x02, DEF_STR( Medium ) ) // According to the manual, default is Medium PORT_DIPSETTING( 0x01, DEF_STR( Hard ) ) PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) PORT_DIPNAME(0x0c, 0x0c, "Tournament Time" ) PORT_DIPLOCATION("SW2:3,4") - PORT_DIPSETTING( 0x00, "2:12" ) /* Tournament time is always 3:00, but time per 1 second is shorter. */ + PORT_DIPSETTING( 0x00, "2:12" ) // Tournament time is always 3:00, but time per 1 second is shorter. PORT_DIPSETTING( 0x04, "2:24" ) PORT_DIPSETTING( 0x08, "2:30" ) PORT_DIPSETTING( 0x0c, "2:36" ) - PORT_DIPUNUSED_DIPLOC(0x10, IP_ACTIVE_LOW, "SW2:5") /* Listed as Unused */ - PORT_DIPUNUSED_DIPLOC(0x20, IP_ACTIVE_LOW, "SW2:6") /* Listed as Unused */ - PORT_DIPUNUSED_DIPLOC(0x40, IP_ACTIVE_LOW, "SW2:7") /* Listed as Unused */ - PORT_DIPUNUSED_DIPLOC(0x80, IP_ACTIVE_LOW, "SW2:8") /* Listed as Unused */ + PORT_DIPUNUSED_DIPLOC(0x10, IP_ACTIVE_LOW, "SW2:5") // Listed as Unused + PORT_DIPUNUSED_DIPLOC(0x20, IP_ACTIVE_LOW, "SW2:6") // Listed as Unused + PORT_DIPUNUSED_DIPLOC(0x40, IP_ACTIVE_LOW, "SW2:7") // Listed as Unused + PORT_DIPUNUSED_DIPLOC(0x80, IP_ACTIVE_LOW, "SW2:8") // Listed as Unused INPUT_PORTS_END static INPUT_PORTS_START( maniach ) @@ -202,7 +515,7 @@ static INPUT_PORTS_START( maniach ) PORT_MODIFY("DSW2") PORT_DIPNAME(0x03, 0x03, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:1,2") - PORT_DIPSETTING( 0x03, DEF_STR( Easy ) ) /* According to the manual, default for this game is Easy */ + PORT_DIPSETTING( 0x03, DEF_STR( Easy ) ) // According to the manual, default for this game is Easy PORT_DIPSETTING( 0x02, DEF_STR( Medium ) ) PORT_DIPSETTING( 0x01, DEF_STR( Hard ) ) PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) @@ -217,81 +530,80 @@ INPUT_PORTS_END static const gfx_layout charlayout = { - 8,8, /* 8*8 characters */ - 1024, /* 1024 characters */ - 3, /* 3 bits per pixel */ - { 2*1024*8*8, 1024*8*8, 0 }, /* the bitplanes are separated */ + 8,8, // 8*8 characters + 1024, // 1024 characters + 3, // 3 bits per pixel + { 2*1024*8*8, 1024*8*8, 0 }, // the bitplanes are separated { 0, 1, 2, 3, 4, 5, 6, 7 }, { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 consecutive bytes */ + 8*8 // every char takes 8 consecutive bytes }; static const gfx_layout tilelayout = { - 16,16, /* 16*16 tiles */ - 512, /* 512 tiles */ - 3, /* 3 bits per pixel */ - { 2*512*16*16, 512*16*16, 0 }, /* the bitplanes are separated */ + 16,16, // 16*16 tiles + 512, // 512 tiles + 3, // 3 bits per pixel + { 2*512*16*16, 512*16*16, 0 }, // the bitplanes are separated { 16*8+0, 16*8+1, 16*8+2, 16*8+3, 16*8+4, 16*8+5, 16*8+6, 16*8+7, 0, 1, 2, 3, 4, 5, 6, 7 }, { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 32*8 /* every tile takes 16 consecutive bytes */ + 32*8 // every tile takes 16 consecutive bytes }; static const gfx_layout matmania_spritelayout = { - 16,16, /* 16*16 sprites */ - 3584, /* 3584 sprites */ - 3, /* 3 bits per pixel */ - { 2*3584*16*16, 3584*16*16, 0 }, /* the bitplanes are separated */ + 16,16, // 16*16 sprites + 3584, // 3584 sprites + 3, // 3 bits per pixel + { 2*3584*16*16, 3584*16*16, 0 }, // the bitplanes are separated { 16*8+0, 16*8+1, 16*8+2, 16*8+3, 16*8+4, 16*8+5, 16*8+6, 16*8+7, 0, 1, 2, 3, 4, 5, 6, 7 }, { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 32*8 /* every sprite takes 16 consecutive bytes */ + 32*8 // every sprite takes 16 consecutive bytes }; static const gfx_layout maniach_spritelayout = { - 16,16, /* 16*16 sprites */ - 3584, /* 3584 sprites */ - 3, /* 3 bits per pixel */ - { 0, 3584*16*16, 2*3584*16*16 }, /* the bitplanes are separated */ + 16,16, // 16*16 sprites + 3584, // 3584 sprites + 3, // 3 bits per pixel + { 0, 3584*16*16, 2*3584*16*16 }, // the bitplanes are separated { 16*8+0, 16*8+1, 16*8+2, 16*8+3, 16*8+4, 16*8+5, 16*8+6, 16*8+7, 0, 1, 2, 3, 4, 5, 6, 7 }, { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 32*8 /* every sprite takes 16 consecutive bytes */ + 32*8 // every sprite takes 16 consecutive bytes }; static const gfx_layout maniach_tilelayout = { - 16,16, /* 16*16 tiles */ + 16,16, // 16*16 tiles 1024, /* 1024 tiles */ - 3, /* 3 bits per pixel */ - { 2*1024*16*16, 1024*16*16, 0 }, /* the bitplanes are separated */ + 3, // 3 bits per pixel + { 2*1024*16*16, 1024*16*16, 0 }, // the bitplanes are separated { 16*8+0, 16*8+1, 16*8+2, 16*8+3, 16*8+4, 16*8+5, 16*8+6, 16*8+7, 0, 1, 2, 3, 4, 5, 6, 7 }, { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 32*8 /* every tile takes 16 consecutive bytes */ + 32*8 // every tile takes 16 consecutive bytes }; static GFXDECODE_START( gfx_matmania ) - GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 4 ) - GFXDECODE_ENTRY( "gfx2", 0, tilelayout, 4*8, 4 ) - GFXDECODE_ENTRY( "gfx3", 0, matmania_spritelayout, 8*8, 2 ) + GFXDECODE_ENTRY( "chars", 0, charlayout, 0, 4 ) + GFXDECODE_ENTRY( "tiles", 0, tilelayout, 4*8, 4 ) + GFXDECODE_ENTRY( "sprites", 0, matmania_spritelayout, 8*8, 2 ) GFXDECODE_END static GFXDECODE_START( gfx_maniach ) - GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 4 ) - GFXDECODE_ENTRY( "gfx2", 0, maniach_tilelayout, 4*8, 4 ) - GFXDECODE_ENTRY( "gfx3", 0, maniach_spritelayout, 8*8, 2 ) + GFXDECODE_ENTRY( "chars", 0, charlayout, 0, 4 ) + GFXDECODE_ENTRY( "tiles", 0, maniach_tilelayout, 4*8, 4 ) + GFXDECODE_ENTRY( "sprites", 0, maniach_spritelayout, 8*8, 2 ) GFXDECODE_END - /************************************* * * Machine driver @@ -300,72 +612,72 @@ GFXDECODE_END void matmania_state::matmania(machine_config &config) { - /* basic machine hardware */ - M6502(config, m_maincpu, 1500000); /* 1.5 MHz ???? */ - m_maincpu->set_addrmap(AS_PROGRAM, &matmania_state::matmania_map); + // basic machine hardware + M6502(config, m_maincpu, 1'500'000); // 1.5 MHz ???? + m_maincpu->set_addrmap(AS_PROGRAM, &matmania_state::main_map); m_maincpu->set_vblank_int("screen", FUNC(matmania_state::irq0_line_hold)); - M6502(config, m_audiocpu, 1200000); /* 1.2 MHz ???? */ - m_audiocpu->set_addrmap(AS_PROGRAM, &matmania_state::matmania_sound_map); - m_audiocpu->set_periodic_int(FUNC(matmania_state::nmi_line_pulse), attotime::from_hz(15*60)); /* ???? */ + M6502(config, m_audiocpu, 1'200'000); // 1.2 MHz ???? + m_audiocpu->set_addrmap(AS_PROGRAM, &matmania_state::sound_map); + m_audiocpu->set_periodic_int(FUNC(matmania_state::nmi_line_pulse), attotime::from_hz(15 * 60)); // ???? config.set_maximum_quantum(attotime::from_hz(6000)); - /* video hardware */ + // video hardware SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_refresh_hz(60); - m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(2500)); /* not accurate */ + m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(2500)); // not accurate m_screen->set_size(32*8, 32*8); m_screen->set_visarea(0*8, 32*8-1, 1*8, 31*8-1); - m_screen->set_screen_update(FUNC(matmania_state::screen_update_matmania)); + m_screen->set_screen_update(FUNC(matmania_state::screen_update)); m_screen->set_palette(m_palette); GFXDECODE(config, m_gfxdecode, m_palette, gfx_matmania); - PALETTE(config, m_palette, FUNC(matmania_state::matmania_palette), 64 + 16); + PALETTE(config, m_palette, FUNC(matmania_state::palette), 64 + 16); - /* sound hardware */ + // sound hardware SPEAKER(config, "speaker").front_center(); - GENERIC_LATCH_8(config, m_soundlatch); + GENERIC_LATCH_8(config, "soundlatch").data_pending_callback().set_inputline(m_audiocpu, M6502_IRQ_LINE); - AY8910(config, "ay1", 1500000).add_route(ALL_OUTPUTS, "speaker", 0.3); - AY8910(config, "ay2", 1500000).add_route(ALL_OUTPUTS, "speaker", 0.3); + AY8910(config, "ay1", 1'500'000).add_route(ALL_OUTPUTS, "speaker", 0.3); + AY8910(config, "ay2", 1'500'000).add_route(ALL_OUTPUTS, "speaker", 0.3); DAC_8BIT_R2R(config, "dac", 0).add_route(ALL_OUTPUTS, "speaker", 0.4); // unknown DAC } -void matmania_state::maniach(machine_config &config) +void maniach_state::maniach(machine_config &config) { - /* basic machine hardware */ - M6502(config, m_maincpu, 1500000); /* 1.5 MHz ???? */ - m_maincpu->set_addrmap(AS_PROGRAM, &matmania_state::maniach_map); - m_maincpu->set_vblank_int("screen", FUNC(matmania_state::irq0_line_hold)); + // basic machine hardware + M6502(config, m_maincpu, 1'500'000); // 1.5 MHz ???? + m_maincpu->set_addrmap(AS_PROGRAM, &maniach_state::main_map); + m_maincpu->set_vblank_int("screen", FUNC(maniach_state::irq0_line_hold)); - MC6809E(config, m_audiocpu, 1500000); /* 1.5 MHz ???? (HD68A09EP) */ - m_audiocpu->set_addrmap(AS_PROGRAM, &matmania_state::maniach_sound_map); + MC6809E(config, m_audiocpu, 1'500'000); // 1.5 MHz ???? (HD68A09EP) + m_audiocpu->set_addrmap(AS_PROGRAM, &maniach_state::sound_map); - TAITO68705_MCU(config, m_mcu, 1500000*2); /* (don't know really how fast, but it doesn't need to even be this fast) */ + TAITO68705_MCU(config, m_mcu, 1'500'000 * 2); // (don't know really how fast, but it doesn't need to even be this fast) - config.set_maximum_quantum(attotime::from_hz(6000)); /* 100 CPU slice per frame - high interleaving to sync main and mcu */ + config.set_maximum_quantum(attotime::from_hz(6000)); // 100 CPU slice per frame - high interleaving to sync main and MCU - /* video hardware */ + // video hardware SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_refresh_hz(60); - m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(2500)); /* not accurate */ + m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(2500)); // not accurate m_screen->set_size(32*8, 32*8); m_screen->set_visarea(0*8, 32*8-1, 1*8, 31*8-1); - m_screen->set_screen_update(FUNC(matmania_state::screen_update_maniach)); + m_screen->set_screen_update(FUNC(maniach_state::screen_update)); m_screen->set_palette(m_palette); GFXDECODE(config, m_gfxdecode, m_palette, gfx_maniach); - PALETTE(config, m_palette, FUNC(matmania_state::matmania_palette), 64 + 16); + PALETTE(config, m_palette, FUNC(maniach_state::palette), 64 + 16); - /* sound hardware */ + // sound hardware SPEAKER(config, "speaker").front_center(); - GENERIC_LATCH_8(config, m_soundlatch); + GENERIC_LATCH_8(config, "soundlatch").data_pending_callback().set_inputline(m_audiocpu, M6809_IRQ_LINE); - ym3526_device &ymsnd(YM3526(config, "ymsnd", 3600000)); + ym3526_device &ymsnd(YM3526(config, "ymsnd", 3'600'000)); ymsnd.irq_handler().set_inputline(m_audiocpu, M6809_FIRQ_LINE); ymsnd.add_route(ALL_OUTPUTS, "speaker", 1.0); @@ -385,22 +697,22 @@ ROM_START( matmania ) ROM_LOAD( "k1-03", 0x8000, 0x4000, CRC(3b3c3f08) SHA1(65f0c5dba0b8eeb5c2d42b050cac37c475e6a398) ) ROM_LOAD( "k2-03", 0xc000, 0x4000, CRC(286c0917) SHA1(50d6133406e7db0694b02858c7d06725744cf243) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for audio code */ + ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "k4-0", 0x8000, 0x4000, CRC(86dab489) SHA1(27f6eea29b0287e461e0e321fd7bfaada52c39dc) ) ROM_LOAD( "k5-0", 0xc000, 0x4000, CRC(4c41cdba) SHA1(a0af0c019bd6d9456cbbe83ecdeee689bc5f1bea) ) - ROM_REGION( 0x06000, "gfx1", 0 ) - ROM_LOAD( "ku-02", 0x00000, 0x2000, CRC(613c8698) SHA1(07acb2fe150a64029fd15d177c8b6481fcd9eb0b) ) /* Character ROMs - 1024 chars, 3 bpp */ + ROM_REGION( 0x06000, "chars", 0 ) // 1024 chars, 3 bpp + ROM_LOAD( "ku-02", 0x00000, 0x2000, CRC(613c8698) SHA1(07acb2fe150a64029fd15d177c8b6481fcd9eb0b) ) ROM_LOAD( "kv-02", 0x02000, 0x2000, CRC(274ce14b) SHA1(58ed8c8fe0cc157d642aae596e41f2099c1ea6b1) ) ROM_LOAD( "kw-02", 0x04000, 0x2000, CRC(7588a9c4) SHA1(0c197a8fea1acb6c9a99071845be54c949ec83b1) ) - ROM_REGION( 0x0c000, "gfx2", 0 ) - ROM_LOAD( "kt-02", 0x00000, 0x4000, CRC(5d817c70) SHA1(f7759be40a8850d325440d336241ecd05b80c0bd) ) /* tile set */ + ROM_REGION( 0x0c000, "tiles", 0 ) + ROM_LOAD( "kt-02", 0x00000, 0x4000, CRC(5d817c70) SHA1(f7759be40a8850d325440d336241ecd05b80c0bd) ) ROM_LOAD( "ks-02", 0x04000, 0x4000, CRC(2e9f3ba0) SHA1(21d6686580de6ecfe57e458821fa92e966a42d95) ) ROM_LOAD( "kr-02", 0x08000, 0x4000, CRC(b057d3e3) SHA1(24216b22a69c1ecc7eabd7ae10de381e1ff0afc1) ) - ROM_REGION( 0x54000, "gfx3", 0 ) - ROM_LOAD( "k6-00", 0x00000, 0x4000, CRC(294d0878) SHA1(0aaae97e35d504dbf6c479ddf04b981847a23ea6) ) /* sprites */ + ROM_REGION( 0x54000, "sprites", 0 ) + ROM_LOAD( "k6-00", 0x00000, 0x4000, CRC(294d0878) SHA1(0aaae97e35d504dbf6c479ddf04b981847a23ea6) ) ROM_LOAD( "k7-00", 0x04000, 0x4000, CRC(0908c2f5) SHA1(acc34c578f9a3521855ad4dd8fbd554e05c3f63c) ) ROM_LOAD( "k8-00", 0x08000, 0x4000, CRC(ae8341e1) SHA1(ca198087b3aec320543a19921015861324ace8a2) ) ROM_LOAD( "k9-00", 0x0c000, 0x4000, CRC(752ac2c6) SHA1(309fe4e396616b569b9b25654e3dc2751d7b1605) ) @@ -423,10 +735,10 @@ ROM_START( matmania ) ROM_LOAD( "kq-00", 0x50000, 0x4000, CRC(fa2f0003) SHA1(7327ce822be8aea360210bbd466a8129788a65c3) ) ROM_REGION( 0x0080, "proms", 0 ) - ROM_LOAD( "matmania.1", 0x0000, 0x0020, CRC(1b58f01f) SHA1(ffc098d85413777740a25c767096ba5b2aeaf5a8) ) /* char palette red and green components */ - ROM_LOAD( "matmania.5", 0x0020, 0x0020, CRC(2029f85f) SHA1(7825d42eed284ea0fe7fd60304b8a27a1b5a4075) ) /* tile palette red and green components */ - ROM_LOAD( "matmania.2", 0x0040, 0x0020, CRC(b6ac1fd5) SHA1(e312a8ff7317eb21320308400539a733c27e8fca) ) /* char palette blue component */ - ROM_LOAD( "matmania.16", 0x0060, 0x0020, CRC(09325dc2) SHA1(3d9ebdf73840a9603af2acc4bcc4339f3029d284) ) /* tile palette blue component */ + ROM_LOAD( "matmania.1", 0x0000, 0x0020, CRC(1b58f01f) SHA1(ffc098d85413777740a25c767096ba5b2aeaf5a8) ) // char palette red and green components + ROM_LOAD( "matmania.5", 0x0020, 0x0020, CRC(2029f85f) SHA1(7825d42eed284ea0fe7fd60304b8a27a1b5a4075) ) // tile palette red and green components + ROM_LOAD( "matmania.2", 0x0040, 0x0020, CRC(b6ac1fd5) SHA1(e312a8ff7317eb21320308400539a733c27e8fca) ) // char palette blue component + ROM_LOAD( "matmania.16", 0x0060, 0x0020, CRC(09325dc2) SHA1(3d9ebdf73840a9603af2acc4bcc4339f3029d284) ) // tile palette blue component ROM_END ROM_START( excthour ) @@ -435,22 +747,22 @@ ROM_START( excthour ) ROM_LOAD( "e28", 0x08000, 0x4000, CRC(17b63708) SHA1(01c868b7ea32c4857f7187ce73a4cab5b4def246) ) ROM_LOAD( "e27", 0x0c000, 0x4000, CRC(269ab3bc) SHA1(f2f307c5fc6d50167be8904bef8c7ef21209be50) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for audio code */ + ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "k4-0", 0x8000, 0x4000, CRC(86dab489) SHA1(27f6eea29b0287e461e0e321fd7bfaada52c39dc) ) ROM_LOAD( "k5-0", 0xc000, 0x4000, CRC(4c41cdba) SHA1(a0af0c019bd6d9456cbbe83ecdeee689bc5f1bea) ) - ROM_REGION( 0x06000, "gfx1", 0 ) - ROM_LOAD( "e30", 0x00000, 0x2000, CRC(b2875329) SHA1(b37a8b95eb09f1ddc422cc981184b3ea40a5730d) ) /* Character ROMs - 1024 chars, 3 bpp */ + ROM_REGION( 0x06000, "chars", 0 ) // 1024 chars, 3 bpp + ROM_LOAD( "e30", 0x00000, 0x2000, CRC(b2875329) SHA1(b37a8b95eb09f1ddc422cc981184b3ea40a5730d) ) ROM_LOAD( "e31", 0x02000, 0x2000, CRC(c9506de8) SHA1(1036f9acd8b391c03e6408fe1db3406e105373d9) ) ROM_LOAD( "e32", 0x04000, 0x2000, CRC(00d1635f) SHA1(3a7a20ff949d333ec4d3c0287d73e15dcfefdc71) ) - ROM_REGION( 0x0c000, "gfx2", 0 ) - ROM_LOAD( "e5", 0x00000, 0x4000, CRC(0604dc55) SHA1(dc4e36dac1a820d4e649132206a8b16603d08192) ) /* tile set */ + ROM_REGION( 0x0c000, "tiles", 0 ) + ROM_LOAD( "e5", 0x00000, 0x4000, CRC(0604dc55) SHA1(dc4e36dac1a820d4e649132206a8b16603d08192) ) ROM_LOAD( "ks-02", 0x04000, 0x4000, CRC(2e9f3ba0) SHA1(21d6686580de6ecfe57e458821fa92e966a42d95) ) ROM_LOAD( "e3", 0x08000, 0x4000, CRC(ebd273c6) SHA1(415f68ee10499583f5557aae6a41b5499013b5d2) ) - ROM_REGION( 0x54000, "gfx3", 0 ) - ROM_LOAD( "k6-00", 0x00000, 0x4000, CRC(294d0878) SHA1(0aaae97e35d504dbf6c479ddf04b981847a23ea6) ) /* sprites */ + ROM_REGION( 0x54000, "sprites", 0 ) + ROM_LOAD( "k6-00", 0x00000, 0x4000, CRC(294d0878) SHA1(0aaae97e35d504dbf6c479ddf04b981847a23ea6) ) ROM_LOAD( "k7-00", 0x04000, 0x4000, CRC(0908c2f5) SHA1(acc34c578f9a3521855ad4dd8fbd554e05c3f63c) ) ROM_LOAD( "k8-00", 0x08000, 0x4000, CRC(ae8341e1) SHA1(ca198087b3aec320543a19921015861324ace8a2) ) ROM_LOAD( "k9-00", 0x0c000, 0x4000, CRC(752ac2c6) SHA1(309fe4e396616b569b9b25654e3dc2751d7b1605) ) @@ -473,10 +785,10 @@ ROM_START( excthour ) ROM_LOAD( "kq-00", 0x50000, 0x4000, CRC(fa2f0003) SHA1(7327ce822be8aea360210bbd466a8129788a65c3) ) ROM_REGION( 0x0080, "proms", 0 ) - ROM_LOAD( "matmania.1", 0x0000, 0x0020, CRC(1b58f01f) SHA1(ffc098d85413777740a25c767096ba5b2aeaf5a8) ) /* char palette red and green components */ - ROM_LOAD( "matmania.5", 0x0020, 0x0020, CRC(2029f85f) SHA1(7825d42eed284ea0fe7fd60304b8a27a1b5a4075) ) /* tile palette red and green components */ - ROM_LOAD( "matmania.2", 0x0040, 0x0020, CRC(b6ac1fd5) SHA1(e312a8ff7317eb21320308400539a733c27e8fca) ) /* char palette blue component */ - ROM_LOAD( "matmania.16", 0x0060, 0x0020, CRC(09325dc2) SHA1(3d9ebdf73840a9603af2acc4bcc4339f3029d284) ) /* tile palette blue component */ + ROM_LOAD( "matmania.1", 0x0000, 0x0020, CRC(1b58f01f) SHA1(ffc098d85413777740a25c767096ba5b2aeaf5a8) ) // char palette red and green components + ROM_LOAD( "matmania.5", 0x0020, 0x0020, CRC(2029f85f) SHA1(7825d42eed284ea0fe7fd60304b8a27a1b5a4075) ) // tile palette red and green components + ROM_LOAD( "matmania.2", 0x0040, 0x0020, CRC(b6ac1fd5) SHA1(e312a8ff7317eb21320308400539a733c27e8fca) ) // char palette blue component + ROM_LOAD( "matmania.16", 0x0060, 0x0020, CRC(09325dc2) SHA1(3d9ebdf73840a9603af2acc4bcc4339f3029d284) ) // tile palette blue component ROM_END ROM_START( maniach ) @@ -485,26 +797,26 @@ ROM_START( maniach ) ROM_LOAD( "mc-ma2.bin", 0x08000, 0x4000, CRC(84583323) SHA1(f1512fec6f3e03dc633a96917a114b0b6369c577) ) ROM_LOAD( "mc-m92.bin", 0x0c000, 0x4000, CRC(e209a500) SHA1(d1a3ab91ffbc321a51c99a2170aca3e217b22576) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for audio code */ + ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "mc-m50.bin", 0x4000, 0x4000, CRC(ba415d68) SHA1(484af7a1f109cc9546f17d19b53d284c934705db) ) ROM_LOAD( "mc-m40.bin", 0x8000, 0x4000, CRC(2a217ed0) SHA1(b06f7c9a2c96ffe78a7065e5edadfdbf985305a5) ) ROM_LOAD( "mc-m30.bin", 0xc000, 0x4000, CRC(95af1723) SHA1(691ca3f7400d10897e805ff691c904fb2d5bb53a) ) - ROM_REGION( 0x0800, "mcu:mcu", 0 ) /* 2k for the microcontroller */ + ROM_REGION( 0x0800, "mcu:mcu", 0 ) ROM_LOAD( "01", 0x0000, 0x0800, CRC(00c7f80c) SHA1(d2216f660eb8310b1530fa5dc844d26ba90c5e9c) ) - ROM_REGION( 0x06000, "gfx1", 0 ) - ROM_LOAD( "mc-m60.bin", 0x00000, 0x2000, CRC(1cdbb117) SHA1(cce99c7380fa2a7ae070c7e2d64866866c976085) ) /* Character ROMs - 1024 chars, 3 bpp */ + ROM_REGION( 0x06000, "chars", 0 ) // 1024 chars, 3 bpp + ROM_LOAD( "mc-m60.bin", 0x00000, 0x2000, CRC(1cdbb117) SHA1(cce99c7380fa2a7ae070c7e2d64866866c976085) ) ROM_LOAD( "mc-m70.bin", 0x02000, 0x2000, CRC(553f0780) SHA1(eacce92ae7b872a35f289f79b33383f5442082d5) ) ROM_LOAD( "mc-m80.bin", 0x04000, 0x2000, CRC(9392ecb7) SHA1(fb4be39fc2f1c826b146bb5b4dd10eb56b23c300) ) - ROM_REGION( 0x18000, "gfx2", 0 ) - ROM_LOAD( "mc-m01.bin", 0x00000, 0x8000, CRC(da558e4d) SHA1(0635f4cded061b0b3649ed1497f087ecd53d54a3) ) /* tile set */ + ROM_REGION( 0x18000, "tiles", 0 ) + ROM_LOAD( "mc-m01.bin", 0x00000, 0x8000, CRC(da558e4d) SHA1(0635f4cded061b0b3649ed1497f087ecd53d54a3) ) ROM_LOAD( "mc-m10.bin", 0x08000, 0x8000, CRC(619a02f8) SHA1(18de76277c263c76b8d8d9093b3c1aebbf2b7ae4) ) ROM_LOAD( "mc-m20.bin", 0x10000, 0x8000, CRC(a617c6c1) SHA1(dccae543daa9987f2778327145fc785472f41228) ) - ROM_REGION( 0x54000, "gfx3", 0 ) - ROM_LOAD( "mc-mc0.bin", 0x00000, 0x4000, CRC(133d644f) SHA1(5378e0cb665c0aa65d7ad76c3f7c04a3bc301f64) ) /* sprites */ + ROM_REGION( 0x54000, "sprites", 0 ) + ROM_LOAD( "mc-mc0.bin", 0x00000, 0x4000, CRC(133d644f) SHA1(5378e0cb665c0aa65d7ad76c3f7c04a3bc301f64) ) ROM_LOAD( "mc-md0.bin", 0x04000, 0x4000, CRC(e387b036) SHA1(828a42789d9ced9f9fcdfd08a43530008dcbbf2f) ) ROM_LOAD( "mc-me0.bin", 0x08000, 0x4000, CRC(b36b1283) SHA1(9d12ea9f7a0f12aad532c0f2d3608cf4a86933a6) ) ROM_LOAD( "mc-mf0.bin", 0x0c000, 0x4000, CRC(2584d8a9) SHA1(f24b4cb827421cd51cb35b581622c41646f3f4d8) ) @@ -527,10 +839,10 @@ ROM_START( maniach ) ROM_LOAD( "mc-mw0.bin", 0x50000, 0x4000, CRC(135dce4c) SHA1(3e64a52400137d87b60adf9c307656eadbfe709c) ) ROM_REGION( 0x0080, "proms", 0 ) - ROM_LOAD( "prom.2", 0x0000, 0x0020, CRC(32db2cf4) SHA1(854b3226a4843a6db94c01c6571294f17a469acf) ) /* char palette red and green components */ - ROM_LOAD( "prom.16", 0x0020, 0x0020, CRC(18836d26) SHA1(950e1ea5184355501b41548d40732b96c5516fd7) ) /* tile palette red and green components */ - ROM_LOAD( "prom.3", 0x0040, 0x0020, CRC(c7925311) SHA1(6b997803eb630b79886cebbe3bc49db1c1ab3fd9) ) /* char palette blue component */ - ROM_LOAD( "prom.17", 0x0060, 0x0020, CRC(41f51d49) SHA1(7cfaf308752cbfddf5a37a31140119afc3febaa7) ) /* tile palette blue component */ + ROM_LOAD( "prom.2", 0x0000, 0x0020, CRC(32db2cf4) SHA1(854b3226a4843a6db94c01c6571294f17a469acf) ) // char palette red and green components + ROM_LOAD( "prom.16", 0x0020, 0x0020, CRC(18836d26) SHA1(950e1ea5184355501b41548d40732b96c5516fd7) ) // tile palette red and green components + ROM_LOAD( "prom.3", 0x0040, 0x0020, CRC(c7925311) SHA1(6b997803eb630b79886cebbe3bc49db1c1ab3fd9) ) // char palette blue component + ROM_LOAD( "prom.17", 0x0060, 0x0020, CRC(41f51d49) SHA1(7cfaf308752cbfddf5a37a31140119afc3febaa7) ) // tile palette blue component ROM_REGION( 0x0600, "plds", 0 ) ROM_LOAD( "pal10l8.51", 0x0000, 0x002c, CRC(424547af) SHA1(d5e57729906ae0caa8606c52284622e26509e025) ) @@ -545,26 +857,26 @@ ROM_START( maniach2 ) ROM_LOAD( "ic41-ma1", 0x08000, 0x4000, CRC(85ec8279) SHA1(dada5fa6981573a1fbb235becbc647e1e2d497e1) ) ROM_LOAD( "ic42-m91", 0x0c000, 0x4000, CRC(a14b86dd) SHA1(73172dfeb34846beaa713c8886d56ed691139d06) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for audio code */ + ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "mc-m50.bin", 0x4000, 0x4000, CRC(ba415d68) SHA1(484af7a1f109cc9546f17d19b53d284c934705db) ) ROM_LOAD( "mc-m40.bin", 0x8000, 0x4000, CRC(2a217ed0) SHA1(b06f7c9a2c96ffe78a7065e5edadfdbf985305a5) ) ROM_LOAD( "mc-m30.bin", 0xc000, 0x4000, CRC(95af1723) SHA1(691ca3f7400d10897e805ff691c904fb2d5bb53a) ) - ROM_REGION( 0x0800, "mcu:mcu", 0 ) /* 2k for the microcontroller */ + ROM_REGION( 0x0800, "mcu:mcu", 0 ) ROM_LOAD( "01", 0x0000, 0x0800, CRC(00c7f80c) SHA1(d2216f660eb8310b1530fa5dc844d26ba90c5e9c) ) - ROM_REGION( 0x06000, "gfx1", 0 ) - ROM_LOAD( "mc-m60.bin", 0x00000, 0x2000, CRC(1cdbb117) SHA1(cce99c7380fa2a7ae070c7e2d64866866c976085) ) /* Character ROMs - 1024 chars, 3 bpp */ + ROM_REGION( 0x06000, "chars", 0 ) // 1024 chars, 3 bpp + ROM_LOAD( "mc-m60.bin", 0x00000, 0x2000, CRC(1cdbb117) SHA1(cce99c7380fa2a7ae070c7e2d64866866c976085) ) ROM_LOAD( "mc-m70.bin", 0x02000, 0x2000, CRC(553f0780) SHA1(eacce92ae7b872a35f289f79b33383f5442082d5) ) ROM_LOAD( "mc-m80.bin", 0x04000, 0x2000, CRC(9392ecb7) SHA1(fb4be39fc2f1c826b146bb5b4dd10eb56b23c300) ) - ROM_REGION( 0x18000, "gfx2", 0 ) - ROM_LOAD( "mc-m01.bin", 0x00000, 0x8000, CRC(da558e4d) SHA1(0635f4cded061b0b3649ed1497f087ecd53d54a3) ) /* tile set */ + ROM_REGION( 0x18000, "tiles", 0 ) + ROM_LOAD( "mc-m01.bin", 0x00000, 0x8000, CRC(da558e4d) SHA1(0635f4cded061b0b3649ed1497f087ecd53d54a3) ) ROM_LOAD( "mc-m10.bin", 0x08000, 0x8000, CRC(619a02f8) SHA1(18de76277c263c76b8d8d9093b3c1aebbf2b7ae4) ) ROM_LOAD( "mc-m20.bin", 0x10000, 0x8000, CRC(a617c6c1) SHA1(dccae543daa9987f2778327145fc785472f41228) ) - ROM_REGION( 0x54000, "gfx3", 0 ) - ROM_LOAD( "mc-mc0.bin", 0x00000, 0x4000, CRC(133d644f) SHA1(5378e0cb665c0aa65d7ad76c3f7c04a3bc301f64) ) /* sprites */ + ROM_REGION( 0x54000, "sprites", 0 ) + ROM_LOAD( "mc-mc0.bin", 0x00000, 0x4000, CRC(133d644f) SHA1(5378e0cb665c0aa65d7ad76c3f7c04a3bc301f64) ) ROM_LOAD( "mc-md0.bin", 0x04000, 0x4000, CRC(e387b036) SHA1(828a42789d9ced9f9fcdfd08a43530008dcbbf2f) ) ROM_LOAD( "mc-me0.bin", 0x08000, 0x4000, CRC(b36b1283) SHA1(9d12ea9f7a0f12aad532c0f2d3608cf4a86933a6) ) ROM_LOAD( "mc-mf0.bin", 0x0c000, 0x4000, CRC(2584d8a9) SHA1(f24b4cb827421cd51cb35b581622c41646f3f4d8) ) @@ -587,10 +899,10 @@ ROM_START( maniach2 ) ROM_LOAD( "mc-mw0.bin", 0x50000, 0x4000, CRC(135dce4c) SHA1(3e64a52400137d87b60adf9c307656eadbfe709c) ) ROM_REGION( 0x0080, "proms", 0 ) - ROM_LOAD( "prom.2", 0x0000, 0x0020, CRC(32db2cf4) SHA1(854b3226a4843a6db94c01c6571294f17a469acf) ) /* char palette red and green components */ - ROM_LOAD( "prom.16", 0x0020, 0x0020, CRC(18836d26) SHA1(950e1ea5184355501b41548d40732b96c5516fd7) ) /* tile palette red and green components */ - ROM_LOAD( "prom.3", 0x0040, 0x0020, CRC(c7925311) SHA1(6b997803eb630b79886cebbe3bc49db1c1ab3fd9) ) /* char palette blue component */ - ROM_LOAD( "prom.17", 0x0060, 0x0020, CRC(41f51d49) SHA1(7cfaf308752cbfddf5a37a31140119afc3febaa7) ) /* tile palette blue component */ + ROM_LOAD( "prom.2", 0x0000, 0x0020, CRC(32db2cf4) SHA1(854b3226a4843a6db94c01c6571294f17a469acf) ) // char palette red and green components + ROM_LOAD( "prom.16", 0x0020, 0x0020, CRC(18836d26) SHA1(950e1ea5184355501b41548d40732b96c5516fd7) ) // tile palette red and green components + ROM_LOAD( "prom.3", 0x0040, 0x0020, CRC(c7925311) SHA1(6b997803eb630b79886cebbe3bc49db1c1ab3fd9) ) // char palette blue component + ROM_LOAD( "prom.17", 0x0060, 0x0020, CRC(41f51d49) SHA1(7cfaf308752cbfddf5a37a31140119afc3febaa7) ) // tile palette blue component ROM_REGION( 0x0600, "plds", 0 ) ROM_LOAD( "pal10l8.51", 0x0000, 0x002c, CRC(424547af) SHA1(d5e57729906ae0caa8606c52284622e26509e025) ) @@ -599,6 +911,7 @@ ROM_START( maniach2 ) ROM_LOAD( "pal16r4a.118", 0x0400, 0x0104, CRC(bca7cae2) SHA1(5fad37626a166371c8dd59e55f7f98064621ec1b) ) ROM_END +} // anonymous namespace /************************************* @@ -609,5 +922,5 @@ ROM_END GAME( 1985, matmania, 0, matmania, matmania, matmania_state, empty_init, ROT270, "Technos Japan (Taito America license)", "Mat Mania", MACHINE_SUPPORTS_SAVE ) GAME( 1985, excthour, matmania, matmania, maniach, matmania_state, empty_init, ROT270, "Technos Japan (Taito license)", "Exciting Hour", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, maniach, 0, maniach, maniach, matmania_state, empty_init, ROT270, "Technos Japan (Taito America license)", "Mania Challenge (set 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, maniach2, maniach, maniach, maniach, matmania_state, empty_init, ROT270, "Technos Japan (Taito America license)", "Mania Challenge (set 2)", MACHINE_SUPPORTS_SAVE ) // earlier version? +GAME( 1986, maniach, 0, maniach, maniach, maniach_state, empty_init, ROT270, "Technos Japan (Taito America license)", "Mania Challenge (set 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, maniach2, maniach, maniach, maniach, maniach_state, empty_init, ROT270, "Technos Japan (Taito America license)", "Mania Challenge (set 2)", MACHINE_SUPPORTS_SAVE ) // earlier version? diff --git a/src/mame/technos/matmania.h b/src/mame/technos/matmania.h deleted file mode 100644 index 7c5ebfed2b8..00000000000 --- a/src/mame/technos/matmania.h +++ /dev/null @@ -1,84 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Brad Oliver -#ifndef MAME_TECHNOS_MATMANIA_H -#define MAME_TECHNOS_MATMANIA_H - -#pragma once - -#include "taito68705.h" - -#include "machine/gen_latch.h" - -#include "emupal.h" -#include "screen.h" - -class matmania_state : public driver_device -{ -public: - matmania_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_videoram(*this, "videoram"), - m_videoram2(*this, "videoram2"), - m_videoram3(*this, "videoram3"), - m_colorram(*this, "colorram"), - m_colorram2(*this, "colorram2"), - m_colorram3(*this, "colorram3"), - m_scroll(*this, "scroll"), - m_pageselect(*this, "pageselect"), - m_spriteram(*this, "spriteram"), - m_paletteram(*this, "paletteram"), - m_maincpu(*this, "maincpu"), - m_audiocpu(*this, "audiocpu"), - m_mcu(*this, "mcu"), - m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen"), - m_palette(*this, "palette"), - m_soundlatch(*this, "soundlatch") - { } - - void matmania(machine_config &config); - void maniach(machine_config &config); - -protected: - virtual void video_start() override; - -private: - /* memory pointers */ - required_shared_ptr m_videoram; - required_shared_ptr m_videoram2; - required_shared_ptr m_videoram3; - required_shared_ptr m_colorram; - required_shared_ptr m_colorram2; - required_shared_ptr m_colorram3; - required_shared_ptr m_scroll; - required_shared_ptr m_pageselect; - required_shared_ptr m_spriteram; - required_shared_ptr m_paletteram; - - /* devices */ - required_device m_maincpu; - required_device m_audiocpu; - optional_device m_mcu; - required_device m_gfxdecode; - required_device m_screen; - required_device m_palette; - required_device m_soundlatch; - - /* video-related */ - std::unique_ptr m_tmpbitmap; - std::unique_ptr m_tmpbitmap2; - - uint8_t maniach_mcu_status_r(); - void matmania_sh_command_w(uint8_t data); - void maniach_sh_command_w(uint8_t data); - void matmania_paletteram_w(offs_t offset, uint8_t data); - void matmania_palette(palette_device &palette) const; - uint32_t screen_update_matmania(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_maniach(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void maniach_map(address_map &map); - void maniach_sound_map(address_map &map); - void matmania_map(address_map &map); - void matmania_sound_map(address_map &map); -}; - -#endif // MAME_TECHNOS_MATMANIA_H diff --git a/src/mame/technos/matmania_v.cpp b/src/mame/technos/matmania_v.cpp deleted file mode 100644 index df9cc2a5d6f..00000000000 --- a/src/mame/technos/matmania_v.cpp +++ /dev/null @@ -1,273 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Brad Oliver -/*************************************************************************** - - video.c - - Functions to emulate the video hardware of the machine. - - There are only a few differences between the video hardware of Mysterious - Stones and Mat Mania. The tile bank select bit is different and the sprite - selection seems to be different as well. Additionally, the palette is stored - differently. I'm also not sure that the 2nd tile page is really used in - Mysterious Stones. - -***************************************************************************/ - -#include "emu.h" -#include "matmania.h" - - -/*************************************************************************** - - Convert the color PROMs into a more useable format. - - Mat Mania is unusual in that it has both PROMs and RAM to control the - palette. PROMs are used for characters and background tiles, RAM for - sprites. - I don't know for sure how the PROMs are connected to the RGB output, - but it's probably the usual: - - bit 7 -- 220 ohm resistor -- GREEN - -- 470 ohm resistor -- GREEN - -- 1 kohm resistor -- GREEN - -- 2.2kohm resistor -- GREEN - -- 220 ohm resistor -- RED - -- 470 ohm resistor -- RED - -- 1 kohm resistor -- RED - bit 0 -- 2.2kohm resistor -- RED - - bit 3 -- 220 ohm resistor -- BLUE - -- 470 ohm resistor -- BLUE - -- 1 kohm resistor -- BLUE - bit 0 -- 2.2kohm resistor -- BLUE - -***************************************************************************/ - -void matmania_state::matmania_palette(palette_device &palette) const -{ - uint8_t const *color_prom = memregion("proms")->base(); - - for (int i = 0; i < 64; i++) - { - int bit0, bit1, bit2, bit3; - - bit0 = BIT(color_prom[0], 0); - bit1 = BIT(color_prom[0], 1); - bit2 = BIT(color_prom[0], 2); - bit3 = BIT(color_prom[0], 3); - int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - bit0 = BIT(color_prom[0], 4); - bit1 = BIT(color_prom[0], 5); - bit2 = BIT(color_prom[0], 6); - bit3 = BIT(color_prom[0], 7); - int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - bit0 = BIT(color_prom[64], 0); - bit1 = BIT(color_prom[64], 1); - bit2 = BIT(color_prom[64], 2); - bit3 = BIT(color_prom[64], 3); - int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - palette.set_pen_color(i, rgb_t(r, g, b)); - color_prom++; - } -} - - - -void matmania_state::matmania_paletteram_w(offs_t offset, uint8_t data) -{ - int bit0, bit1, bit2, bit3, val; - int r, g, b; - - m_paletteram[offset] = data; - offset &= 0x0f; - - val = m_paletteram[offset]; - bit0 = BIT(val, 0); - bit1 = BIT(val, 1); - bit2 = BIT(val, 2); - bit3 = BIT(val, 3); - r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - val = m_paletteram[offset | 0x10]; - bit0 = BIT(val, 0); - bit1 = BIT(val, 1); - bit2 = BIT(val, 2); - bit3 = BIT(val, 3); - g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - val = m_paletteram[offset | 0x20]; - bit0 = BIT(val, 0); - bit1 = BIT(val, 1); - bit2 = BIT(val, 2); - bit3 = BIT(val, 3); - b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - m_palette->set_pen_color(offset + 64, rgb_t(r,g,b)); -} - - -/*************************************************************************** - - Start the video hardware emulation. - -***************************************************************************/ - -void matmania_state::video_start() -{ - int width = m_screen->width(); - int height = m_screen->height(); - - /* Mat Mania has a virtual screen twice as large as the visible screen */ - m_tmpbitmap = std::make_unique(width, 2 * height); - m_tmpbitmap2 = std::make_unique(width, 2 * height); -} - - - -uint32_t matmania_state::screen_update_matmania(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - uint8_t *spriteram = m_spriteram; - int offs; - - - /* Update the tiles in the left tile ram bank */ - for (offs = m_videoram.bytes() - 1; offs >= 0; offs--) - { - int sx = 15 - offs / 32; - int sy = offs % 32; - - m_gfxdecode->gfx(1)->opaque(*m_tmpbitmap,m_tmpbitmap->cliprect(), - m_videoram[offs] + ((m_colorram[offs] & 0x08) << 5), - (m_colorram[offs] & 0x30) >> 4, - 0,sy >= 16, /* flip horizontally tiles on the right half of the bitmap */ - 16 * sx, 16 * sy); - } - - /* Update the tiles in the right tile ram bank */ - for (offs = m_videoram3.bytes() - 1; offs >= 0; offs--) - { - int sx = 15 - offs / 32; - int sy = offs % 32; - - m_gfxdecode->gfx(1)->opaque(*m_tmpbitmap2,m_tmpbitmap2->cliprect(), - m_videoram3[offs] + ((m_colorram3[offs] & 0x08) << 5), - (m_colorram3[offs] & 0x30) >> 4, - 0,sy >= 16, /* flip horizontally tiles on the right half of the bitmap */ - 16*sx,16*sy); - } - - /* copy the temporary bitmap to the screen */ - { - int scrolly = -*m_scroll; - if (m_pageselect[0] & 0x01) // maniach sets 0x20 sometimes, which must have a different meaning - copyscrollbitmap(bitmap, *m_tmpbitmap2, 0, nullptr, 1, &scrolly, cliprect); - else - copyscrollbitmap(bitmap, *m_tmpbitmap, 0, nullptr, 1, &scrolly, cliprect); - } - - - /* Draw the sprites */ - for (offs = 0; offs < m_spriteram.bytes(); offs += 4) - { - if (spriteram[offs] & 0x01) - { - m_gfxdecode->gfx(2)->transpen(bitmap,cliprect, - spriteram[offs + 1] + ((spriteram[offs] & 0xf0) << 4), - (spriteram[offs] & 0x08) >> 3, - spriteram[offs] & 0x04, spriteram[offs] & 0x02, - 239 - spriteram[offs + 3],(240 - spriteram[offs + 2]) & 0xff,0); - } - } - - - /* draw the frontmost playfield. They are characters, but draw them as sprites */ - for (offs = m_videoram2.bytes() - 1; offs >= 0; offs--) - { - int sx = 31 - offs / 32; - int sy = offs % 32; - - m_gfxdecode->gfx(0)->transpen(bitmap,cliprect, - m_videoram2[offs] + 256 * (m_colorram2[offs] & 0x07), - (m_colorram2[offs] & 0x30) >> 4, - 0,0, - 8*sx,8*sy,0); - } - return 0; -} - -uint32_t matmania_state::screen_update_maniach(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - uint8_t *spriteram = m_spriteram; - int offs; - - - /* Update the tiles in the left tile ram bank */ - for (offs = m_videoram.bytes() - 1; offs >= 0; offs--) - { - int sx = 15 - offs / 32; - int sy = offs % 32; - - m_gfxdecode->gfx(1)->opaque(*m_tmpbitmap,m_tmpbitmap->cliprect(), - m_videoram[offs] + ((m_colorram[offs] & 0x03) << 8), - (m_colorram[offs] & 0x30) >> 4, - 0,sy >= 16, /* flip horizontally tiles on the right half of the bitmap */ - 16*sx,16*sy); - } - - /* Update the tiles in the right tile ram bank */ - for (offs = m_videoram3.bytes() - 1; offs >= 0; offs--) - { - int sx = 15 - offs / 32; - int sy = offs % 32; - - m_gfxdecode->gfx(1)->opaque(*m_tmpbitmap2,m_tmpbitmap2->cliprect(), - m_videoram3[offs] + ((m_colorram3[offs] & 0x03) << 8), - (m_colorram3[offs] & 0x30) >> 4, - 0,sy >= 16, /* flip horizontally tiles on the right half of the bitmap */ - 16*sx,16*sy); - } - - - /* copy the temporary bitmap to the screen */ - { - int scrolly = -*m_scroll; - - if (m_pageselect[0] & 0x01) // this sets 0x20 sometimes, which must have a different meaning - copyscrollbitmap(bitmap, *m_tmpbitmap2, 0, nullptr, 1, &scrolly, cliprect); - else - copyscrollbitmap(bitmap, *m_tmpbitmap, 0, nullptr, 1, &scrolly, cliprect); - } - - - /* Draw the sprites */ - for (offs = 0; offs < m_spriteram.bytes(); offs += 4) - { - if (spriteram[offs] & 0x01) - { - m_gfxdecode->gfx(2)->transpen(bitmap,cliprect, - spriteram[offs+1] + ((spriteram[offs] & 0xf0) << 4), - (spriteram[offs] & 0x08) >> 3, - spriteram[offs] & 0x04,spriteram[offs] & 0x02, - 239 - spriteram[offs+3],(240 - spriteram[offs+2]) & 0xff,0); - } - } - - - /* draw the frontmost playfield. They are characters, but draw them as sprites */ - for (offs = m_videoram2.bytes() - 1; offs >= 0; offs--) - { - int sx = 31 - offs / 32; - int sy = offs % 32; - - m_gfxdecode->gfx(0)->transpen(bitmap,cliprect, - m_videoram2[offs] + 256 * (m_colorram2[offs] & 0x07), - (m_colorram2[offs] & 0x30) >> 4, - 0,0, - 8*sx,8*sy,0); - } - return 0; -}