diff options
author | 2022-08-12 21:45:45 +0200 | |
---|---|---|
committer | 2022-08-12 21:45:45 +0200 | |
commit | 573c3224b9a02734de79afa1a7c4b5e0b3c55880 (patch) | |
tree | 03ba59384957dc85db6a618d401d3a625242a828 | |
parent | ddf01d0148cd5d51fe25d6e8efd80118a88387cf (diff) |
- misc/goldnpkr.cpp: identified falcnwldc's encryption device, seems to run now but needs more work
- misc/gumbo.cpp, misc/mosaic.cpp, misc/news.cpp: consolidated drivers in single files, minor cleanups
-rw-r--r-- | src/devices/machine/segacrpt_device.cpp | 2 | ||||
-rw-r--r-- | src/mame/misc/goldnpkr.cpp | 66 | ||||
-rw-r--r-- | src/mame/misc/gumbo.cpp | 226 | ||||
-rw-r--r-- | src/mame/misc/gumbo.h | 56 | ||||
-rw-r--r-- | src/mame/misc/gumbo_v.cpp | 47 | ||||
-rw-r--r-- | src/mame/misc/mosaic.cpp | 244 | ||||
-rw-r--r-- | src/mame/misc/mosaic.h | 67 | ||||
-rw-r--r-- | src/mame/misc/mosaic_v.cpp | 80 | ||||
-rw-r--r-- | src/mame/misc/news.cpp | 205 | ||||
-rw-r--r-- | src/mame/misc/news.h | 50 | ||||
-rw-r--r-- | src/mame/misc/news_v.cpp | 95 |
11 files changed, 538 insertions, 600 deletions
diff --git a/src/devices/machine/segacrpt_device.cpp b/src/devices/machine/segacrpt_device.cpp index 2ba57904e60..330193aa2b9 100644 --- a/src/devices/machine/segacrpt_device.cpp +++ b/src/devices/machine/segacrpt_device.cpp @@ -109,7 +109,7 @@ 315-5013 Super Zaxxon used Zaxxon for known plaintext attack 315-5014 Buck Rogers / Zoom 909 unencrypted version available 315-5015 Super Locomotive - 315-5018 Yamato + 315-5018 Yamato seems to have been copied by Falcon for Falcons Wild - World Wide Poker ???-???? Top Roller same key as Yamato 315-5028 Sindbad Mystery 315-5030 Up'n Down unencrypted version available diff --git a/src/mame/misc/goldnpkr.cpp b/src/mame/misc/goldnpkr.cpp index 7cef1c0ce42..44cf8d1b226 100644 --- a/src/mame/misc/goldnpkr.cpp +++ b/src/mame/misc/goldnpkr.cpp @@ -513,8 +513,8 @@ Program is currently not working because seems to fill some zeropage registers and - check for existent values and changes... Maybe an external device is writting them. - This is NVRAM zone, so some values could be previously harcoded. + check for existent values and changes... Maybe an external device is writing them. + This is NVRAM zone, so some values could be previously hardcoded. Also seems to manipulate the stack pointer expecting different values, and some inputs combination entered to boot. @@ -783,7 +783,7 @@ the same places... Need to be traced from the scratch. Also CPU lines A14 & A15 should be traced to know the addressing - system accuratelly. + system accurately. CPU R6502AP (U6) @@ -983,6 +983,7 @@ #include "machine/6821pia.h" #include "machine/bankdev.h" #include "machine/nvram.h" +#include "machine/segacrpt_device.h" #include "machine/timekpr.h" #include "sound/ay8910.h" #include "sound/discrete.h" @@ -1042,7 +1043,6 @@ public: void init_vkdlswwh(); void init_icp1db(); - void init_flcnw(); void init_vkdlswwp(); void init_vkdlsww(); void init_vkdlsb(); @@ -1124,6 +1124,7 @@ private: void wildcrdb_map(address_map &map); void wildcrdb_mcu_io_map(address_map &map); void wildcrdb_mcu_map(address_map &map); + void wildcrdb_mcu_decrypted_opcodes_map(address_map &map); void witchcrd_falcon_map(address_map &map); void witchcrd_map(address_map &map); void super21p_map(address_map &map); @@ -1772,20 +1773,27 @@ void goldnpkr_state::wildcrdb_map(address_map &map) map(0x2000, 0x2000).portr("SW2"); map(0x2100, 0x2100).w("crtc", FUNC(mc6845_device::address_w)); map(0x2101, 0x2101).rw("crtc", FUNC(mc6845_device::register_r), FUNC(mc6845_device::register_w)); - map(0x2800, 0x2fff).ram(); + map(0x2800, 0x2fff).ram().share("main_mcu_shared"); // TODO: verify it's the correct range map(0x3000, 0x7fff).rom(); } void goldnpkr_state::wildcrdb_mcu_map(address_map &map) { -// map.global_mask(0x3fff); map(0x0000, 0x0fff).rom(); - map(0x1000, 0x2fff).ram(); + map(0x2000, 0x27ff).ram(); + map(0x8000, 0x87ff).ram().share("main_mcu_shared"); // TODO: verify it's the correct range +} + +void goldnpkr_state::wildcrdb_mcu_decrypted_opcodes_map(address_map &map) +{ + map(0x0000, 0x0fff).rom().share("decrypted_opcodes"); } void goldnpkr_state::wildcrdb_mcu_io_map(address_map &map) { map.global_mask(0xff); + + // map(0x00, 0x00).w() // TODO: what's this? alternates between 0x00 and 0x01 } /* @@ -4630,9 +4638,13 @@ void goldnpkr_state::wildcrdb(machine_config &config) // basic machine hardware m_maincpu->set_addrmap(AS_PROGRAM, &goldnpkr_state::wildcrdb_map); - z80_device &mcu(Z80(config, "mcu", MASTER_CLOCK/4)); // guess + sega_315_5018_device &mcu(SEGA_315_5018(config, "mcu", MASTER_CLOCK / 8)); // guess mcu.set_addrmap(AS_PROGRAM, &goldnpkr_state::wildcrdb_mcu_map); mcu.set_addrmap(AS_IO, &goldnpkr_state::wildcrdb_mcu_io_map); + mcu.set_addrmap(AS_OPCODES, &goldnpkr_state::wildcrdb_mcu_decrypted_opcodes_map); + mcu.set_decrypted_tag(":decrypted_opcodes"); + mcu.set_size(0x1000); + mcu.set_vblank_int("screen", FUNC(goldnpkr_state::irq0_line_hold)); m_pia[0]->writepa_handler().set(FUNC(goldnpkr_state::mux_port_w)); m_pia[0]->writepb_handler().set(FUNC(goldnpkr_state::ay8910_control_w)); @@ -10681,7 +10693,8 @@ ROM_END extra RAM + ROM + encrypted 2nd CPU + AY8910. The encrypted 40-pin CPU is scratched, - and seems based on a Z80. + and seems a copy of Sega's 315-5018 Z80 based + encryption device. ***********************************************/ ROM_START( falcnwldc ) @@ -11840,39 +11853,6 @@ ROM_END */ -/*********************************************** - - Falcon's Wild - World Wide Poker. - Encryption Notes... - - - MCU seems to be Z80 family (see routines at 0x38). - - - Bits involved: [x-x- x---] - - - Some lines seems XOR'ed with a pair of values (0xA0 0x80) - (see offset 0020) - - - From a XOR'ed program with 0xA0, - seems close to a bitswap (--x- x---) - (see strings at 0EE0 onward) - -***********************************************/ - -void goldnpkr_state::init_flcnw() -{ - // Attempt to decrypt the MCU program (we're sooo close!) - - uint8_t *ROM = memregion("mcu")->base(); - int size = memregion("mcu")->bytes(); - int start = 0x0000; - - for (int i = start; i < size; i++) - { - ROM[i] = ROM[i] ^ 0xa0; - ROM[i] = bitswap<8>(ROM[i], 7, 6, 3, 4, 5, 2, 1, 0); - } -} - void goldnpkr_state::init_vkdlsa() { @@ -12376,7 +12356,7 @@ GAMEL( 1991, goodluck, bsuerte, witchcrd, goodluck, goldnpkr_state, empty_init GAMEL( 1991, falcnwld, 0, wildcard, wildcard, goldnpkr_state, empty_init, ROT0, "TVG", "Falcons Wild - Wild Card 1991 (TVG)", 0, layout_goldnpkr ) GAMEL( 1990, falcnwlda, falcnwld, wildcard, wildcard, goldnpkr_state, empty_init, ROT0, "Video Klein", "Falcons Wild - World Wide Poker (Video Klein, set 1)", 0, layout_goldnpkr ) GAMEL( 1990, falcnwldb, falcnwld, wildcard, wildcard, goldnpkr_state, empty_init, ROT0, "Video Klein", "Falcons Wild - World Wide Poker (Video Klein, set 2)", 0, layout_goldnpkr ) -GAME( 1983, falcnwldc, falcnwld, wildcrdb, wildcard, goldnpkr_state, init_flcnw, ROT0, "Falcon", "Falcons Wild - World Wide Poker (Falcon original)", MACHINE_NOT_WORKING ) +GAME( 1983, falcnwldc, falcnwld, wildcrdb, wildcard, goldnpkr_state, empty_init, ROT0, "Falcon", "Falcons Wild - World Wide Poker (Falcon original)", MACHINE_NOT_WORKING ) // MCU hook up incomplete, currently game runs only after a soft reset. Then you can coin up but bet doesn't work GAME( 1987, super21p, 0, super21p, super21p, goldnpkr_state, empty_init, ROT0, "Public MNG", "Super 21", MACHINE_IMPERFECT_COLORS ) diff --git a/src/mame/misc/gumbo.cpp b/src/mame/misc/gumbo.cpp index 5d41bba219c..fde499bb3e6 100644 --- a/src/mame/misc/gumbo.cpp +++ b/src/mame/misc/gumbo.cpp @@ -6,7 +6,7 @@ Gumbo (c)1994 Min Corp (Main Corp written on PCB) Miss Bingo (c)1994 Min Corp Miss Puzzle (c)1994 Min Corp -argh they have the same music as news (news.c) +argh they have the same music as news (misc/news.cpp) */ @@ -44,14 +44,105 @@ PCB Layout */ #include "emu.h" -#include "gumbo.h" #include "cpu/m68000/m68000.h" #include "sound/okim6295.h" + #include "emupal.h" #include "screen.h" #include "speaker.h" +#include "tilemap.h" + + +namespace { + +class gumbo_state : public driver_device +{ +public: + gumbo_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_bg_videoram(*this, "bg_videoram"), + m_fg_videoram(*this, "fg_videoram"), + m_maincpu(*this, "maincpu"), + m_gfxdecode(*this, "gfxdecode") + { } + + void mspuzzle(machine_config &config); + void dblpoint(machine_config &config); + void gumbo(machine_config &config); + +protected: + virtual void video_start() override; + +private: + // memory pointers + required_shared_ptr<uint16_t> m_bg_videoram; + required_shared_ptr<uint16_t> m_fg_videoram; + + // video-related + tilemap_t *m_bg_tilemap = nullptr; + tilemap_t *m_fg_tilemap = nullptr; + + required_device<cpu_device> m_maincpu; + required_device<gfxdecode_device> m_gfxdecode; + + void bg_videoram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + void fg_videoram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + TILE_GET_INFO_MEMBER(get_bg_tile_info); + TILE_GET_INFO_MEMBER(get_fg_tile_info); + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + void dblpoint_map(address_map &map); + void gumbo_map(address_map &map); + void mspuzzle_map(address_map &map); +}; + + +// video + + +void gumbo_state::bg_videoram_w(offs_t offset, uint16_t data, uint16_t mem_mask) +{ + COMBINE_DATA(&m_bg_videoram[offset]); + m_bg_tilemap->mark_tile_dirty(offset); +} + +TILE_GET_INFO_MEMBER(gumbo_state::get_bg_tile_info) +{ + int tileno = m_bg_videoram[tile_index]; + tileinfo.set(0, tileno, 0, 0); +} + +void gumbo_state::fg_videoram_w(offs_t offset, uint16_t data, uint16_t mem_mask) +{ + COMBINE_DATA(&m_fg_videoram[offset]); + m_fg_tilemap->mark_tile_dirty(offset); +} + +TILE_GET_INFO_MEMBER(gumbo_state::get_fg_tile_info) +{ + int tileno = m_fg_videoram[tile_index]; + tileinfo.set(1, tileno, 1, 0); +} + + +void gumbo_state::video_start() +{ + m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(gumbo_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); + m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(gumbo_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 4, 4, 128, 64); + m_fg_tilemap->set_transparent_pen(0xff); +} + +uint32_t gumbo_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + return 0; +} + + +// machine void gumbo_state::gumbo_map(address_map &map) { @@ -61,22 +152,22 @@ void gumbo_state::gumbo_map(address_map &map) map(0x1c0100, 0x1c0101).portr("P1_P2"); map(0x1c0200, 0x1c0201).portr("DSW"); map(0x1c0301, 0x1c0301).rw("oki", FUNC(okim6295_device::read), FUNC(okim6295_device::write)); - map(0x1e0000, 0x1e0fff).ram().w(FUNC(gumbo_state::gumbo_bg_videoram_w)).share("bg_videoram"); // bg tilemap - map(0x1f0000, 0x1f3fff).ram().w(FUNC(gumbo_state::gumbo_fg_videoram_w)).share("fg_videoram"); // fg tilemap + map(0x1e0000, 0x1e0fff).ram().w(FUNC(gumbo_state::bg_videoram_w)).share(m_bg_videoram); // bg tilemap + map(0x1f0000, 0x1f3fff).ram().w(FUNC(gumbo_state::fg_videoram_w)).share(m_fg_videoram); // fg tilemap } -/* Miss Puzzle has a different memory map */ +// Miss Puzzle has a different memory map void gumbo_state::mspuzzle_map(address_map &map) { map(0x000000, 0x07ffff).rom(); map(0x100000, 0x103fff).ram(); // main ram - map(0x190000, 0x197fff).ram().w(FUNC(gumbo_state::gumbo_fg_videoram_w)).share("fg_videoram"); // fg tilemap + map(0x190000, 0x197fff).ram().w(FUNC(gumbo_state::fg_videoram_w)).share(m_fg_videoram); // fg tilemap map(0x1a0000, 0x1a03ff).ram().w("palette", FUNC(palette_device::write16)).share("palette"); map(0x1b0100, 0x1b0101).portr("P1_P2"); map(0x1b0200, 0x1b0201).portr("DSW"); map(0x1b0301, 0x1b0301).rw("oki", FUNC(okim6295_device::read), FUNC(okim6295_device::write)); - map(0x1c0000, 0x1c1fff).ram().w(FUNC(gumbo_state::gumbo_bg_videoram_w)).share("bg_videoram"); // bg tilemap + map(0x1c0000, 0x1c1fff).ram().w(FUNC(gumbo_state::bg_videoram_w)).share(m_bg_videoram); // bg tilemap } void gumbo_state::dblpoint_map(address_map &map) @@ -87,8 +178,8 @@ void gumbo_state::dblpoint_map(address_map &map) map(0x1c0100, 0x1c0101).portr("P1_P2"); map(0x1c0200, 0x1c0201).portr("DSW"); map(0x1c0301, 0x1c0301).rw("oki", FUNC(okim6295_device::read), FUNC(okim6295_device::write)); - map(0x1e0000, 0x1e3fff).ram().w(FUNC(gumbo_state::gumbo_fg_videoram_w)).share("fg_videoram"); // fg tilemap - map(0x1f0000, 0x1f0fff).ram().w(FUNC(gumbo_state::gumbo_bg_videoram_w)).share("bg_videoram"); // bg tilemap + map(0x1e0000, 0x1e3fff).ram().w(FUNC(gumbo_state::fg_videoram_w)).share(m_fg_videoram); // fg tilemap + map(0x1f0000, 0x1f0fff).ram().w(FUNC(gumbo_state::bg_videoram_w)).share(m_bg_videoram); // bg tilemap } static INPUT_PORTS_START( gumbo ) @@ -160,7 +251,7 @@ static INPUT_PORTS_START( mspuzzle ) PORT_MODIFY("DSW") PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_DIPNAME( 0x0300, 0x0200, "Time Mode" ) PORT_DIPLOCATION("SW1:1,2") /* Manual list this as "Game Level" with Levels 1 through 4 */ + PORT_DIPNAME( 0x0300, 0x0200, "Time Mode" ) PORT_DIPLOCATION("SW1:1,2") // Manual lists this as "Game Level" with Levels 1 through 4 PORT_DIPSETTING( 0x0300, "0" ) PORT_DIPSETTING( 0x0200, "1" ) PORT_DIPSETTING( 0x0100, "2" ) @@ -232,14 +323,14 @@ static const gfx_layout gumbo2_layout = }; static GFXDECODE_START( gfx_gumbo ) - GFXDECODE_ENTRY( "gfx1", 0, gumbo_layout, 0x0, 2 ) /* bg tiles */ - GFXDECODE_ENTRY( "gfx2", 0, gumbo2_layout, 0x0, 2 ) /* fg tiles */ + GFXDECODE_ENTRY( "bgtiles", 0, gumbo_layout, 0x0, 2 ) + GFXDECODE_ENTRY( "fgtiles", 0, gumbo2_layout, 0x0, 2 ) GFXDECODE_END void gumbo_state::gumbo(machine_config &config) { - M68000(config, m_maincpu, XTAL(14'318'181)/2); + M68000(config, m_maincpu, XTAL(14'318'181) / 2); m_maincpu->set_addrmap(AS_PROGRAM, &gumbo_state::gumbo_map); m_maincpu->set_vblank_int("screen", FUNC(gumbo_state::irq1_line_hold)); // all the same @@ -250,7 +341,7 @@ void gumbo_state::gumbo(machine_config &config) 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(gumbo_state::screen_update_gumbo)); + screen.set_screen_update(FUNC(gumbo_state::screen_update)); screen.set_palette("palette"); PALETTE(config, "palette").set_format(palette_device::xRGB_555, 0x200); @@ -258,7 +349,7 @@ void gumbo_state::gumbo(machine_config &config) SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); - okim6295_device &oki(OKIM6295(config, "oki", XTAL(14'318'181)/16, okim6295_device::PIN7_HIGH)); // clock frequency & pin 7 not verified + okim6295_device &oki(OKIM6295(config, "oki", XTAL(14'318'181) / 16, okim6295_device::PIN7_HIGH)); // clock frequency & pin 7 not verified oki.add_route(ALL_OUTPUTS, "lspeaker", 0.47); oki.add_route(ALL_OUTPUTS, "rspeaker", 0.47); } @@ -278,152 +369,155 @@ void gumbo_state::dblpoint(machine_config &config) } ROM_START( gumbo ) - ROM_REGION( 0x40000, "maincpu", 0 ) /* 68000 Code */ + ROM_REGION( 0x40000, "maincpu", 0 ) // 68000 Code ROM_LOAD16_BYTE( "u1.bin", 0x00001, 0x20000, CRC(e09899e4) SHA1(b62876dc3ada8509b766a80f496f1227b6af0ced) ) ROM_LOAD16_BYTE( "u2.bin", 0x00000, 0x20000, CRC(60e59acb) SHA1(dd11329374c8f63851ddf5af54c91f78fad4fd3d) ) - ROM_REGION( 0x040000, "oki", 0 ) /* Samples */ + ROM_REGION( 0x040000, "oki", 0 ) ROM_LOAD( "u210.bin", 0x00000, 0x40000, CRC(16fbe06b) SHA1(4e40e62341dc886fcabdb07f64217dc086f43c67) ) - ROM_REGION( 0x100000, "gfx1", 0 ) - ROM_LOAD( "u421.bin", 0x00000, 0x80000, CRC(42445132) SHA1(f29d09d040644c8ef12a1cfdfc0d066e8ed9b82d) ) /* Nude & semi-nude girls, both real pictures & hand drawn */ + ROM_REGION( 0x100000, "bgtiles", 0 ) + ROM_LOAD( "u421.bin", 0x00000, 0x80000, CRC(42445132) SHA1(f29d09d040644c8ef12a1cfdfc0d066e8ed9b82d) ) // Nude & semi-nude girls, both real pictures & hand drawn ROM_LOAD( "u420.bin", 0x80000, 0x80000, CRC(de1f0e2f) SHA1(3f46d19af48392794838a4b54f8c45b809c67d49) ) - ROM_REGION( 0x40000, "gfx2", 0 ) /* BG Tiles */ + ROM_REGION( 0x40000, "fgtiles", 0 ) ROM_LOAD( "u512.bin", 0x00000, 0x20000, CRC(97741798) SHA1(3603e14511817da19f6819d5612728d333695e99) ) ROM_LOAD( "u511.bin", 0x20000, 0x20000, CRC(1411451b) SHA1(941d5f311f727e3a8d41ecbbe35b687d48cc2cef) ) ROM_END -ROM_START( mspuzzleg ) /* This version is a clone of Gumbo... NOT the other Miss Puzzle sets */ - ROM_REGION( 0x80000, "maincpu", 0 ) /* 68000 Code */ - ROM_LOAD16_BYTE( "u1", 0x00001, 0x20000, CRC(95218ff1) SHA1(9617d979d026872dbe68eaae21c3ab1f5f9f4bfd) ) /* Korean bootleg / clone / hack??? */ +ROM_START( mspuzzleg ) // This version is a clone of Gumbo... NOT the other Miss Puzzle sets + ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 Code + ROM_LOAD16_BYTE( "u1", 0x00001, 0x20000, CRC(95218ff1) SHA1(9617d979d026872dbe68eaae21c3ab1f5f9f4bfd) ) // Korean bootleg / clone / hack??? ROM_LOAD16_BYTE( "u2", 0x00000, 0x20000, CRC(7ea7d96c) SHA1(17b9afb3214a07b1af5913f1926c7aeac27ea0e8) ) - ROM_REGION( 0x040000, "oki", 0 ) /* Samples */ + ROM_REGION( 0x040000, "oki", 0 ) ROM_LOAD( "u210.bin", 0x00000, 0x40000, CRC(16fbe06b) SHA1(4e40e62341dc886fcabdb07f64217dc086f43c67) ) - ROM_REGION( 0x200000, "gfx1", 0 ) - ROM_LOAD( "u421", 0x100000, 0x80000, CRC(afa06a93) SHA1(5c77b7aafd07d19a1eedf22858a00766a3e37389) ) /* Non-nude graphics, hand drawn girls & animals */ + ROM_REGION( 0x200000, "bgtiles", 0 ) + ROM_LOAD( "u421", 0x100000, 0x80000, CRC(afa06a93) SHA1(5c77b7aafd07d19a1eedf22858a00766a3e37389) ) // Non-nude graphics, hand drawn girls & animals ROM_LOAD( "u420", 0x000000, 0x80000, CRC(2b387153) SHA1(c36f93d4f3a7ea8af58babeb33250d726067a35d) ) - ROM_REGION( 0x40000, "gfx2", 0 ) /* BG Tiles */ + ROM_REGION( 0x40000, "fgtiles", 0 ) ROM_LOAD( "u512.bin", 0x00000, 0x20000, CRC(97741798) SHA1(3603e14511817da19f6819d5612728d333695e99) ) ROM_LOAD( "u511.bin", 0x20000, 0x20000, CRC(1411451b) SHA1(941d5f311f727e3a8d41ecbbe35b687d48cc2cef) ) ROM_END ROM_START( msbingo ) - ROM_REGION( 0x80000, "maincpu", 0 ) /* 68000 Code */ + ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 Code ROM_LOAD16_BYTE( "u1.bin", 0x00001, 0x20000, CRC(6eeb6d89) SHA1(d3e8870a2e95a1ee1c0ce80995c902a97b25a85c) ) ROM_LOAD16_BYTE( "u2.bin", 0x00000, 0x20000, CRC(f15dd4b5) SHA1(b49713e92f11f8c603f561e071df9ffb838c8795) ) - ROM_REGION( 0x040000, "oki", 0 ) /* Samples */ + ROM_REGION( 0x040000, "oki", 0 ) ROM_LOAD( "u210.bin", 0x00000, 0x40000, CRC(55011f69) SHA1(47a27151e6f9ecbc49a95cd8fb4bc627c3efde46) ) - ROM_REGION( 0x200000, "gfx1", 0 ) + ROM_REGION( 0x200000, "bgtiles", 0 ) ROM_LOAD( "u421.bin", 0x000000, 0x80000, CRC(b73f21ab) SHA1(9abb940c0b489fb59f5377516f8d3552cb286c73) ) ROM_LOAD( "u420.bin", 0x100000, 0x80000, CRC(c2fe9175) SHA1(1cd3afd77325721e45362cf4b7d992538e427c24) ) - ROM_REGION( 0x80000, "gfx2", 0 ) /* BG Tiles */ + ROM_REGION( 0x80000, "fgtiles", 0 ) ROM_LOAD( "u512.bin", 0x00000, 0x40000, CRC(8a46d467) SHA1(23ef7a6c25bb30a993bd796ed9b60da0f6f0d443) ) ROM_LOAD( "u511.bin", 0x40000, 0x40000, CRC(d5fd3e2e) SHA1(9f805bff62f884b2b35c88c2da016bf6264d2ab6) ) ROM_END ROM_START( mspuzzle ) - ROM_REGION( 0x80000, "maincpu", 0 ) /* 68000 Code */ - ROM_LOAD16_BYTE( "u1.bin", 0x00001, 0x40000, CRC(d9e63f12) SHA1(c826c604f101d68057fdebf1b231293e4b2811f0) ) /* identical halves */ - ROM_LOAD16_BYTE( "u2.bin", 0x00000, 0x40000, CRC(9c3fc677) SHA1(193606fe739dbf5f26962f91be968ca371b7fd74) ) /* identical halves */ + ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 Code + ROM_LOAD16_BYTE( "u1.bin", 0x00001, 0x40000, CRC(d9e63f12) SHA1(c826c604f101d68057fdebf1b231293e4b2811f0) ) // identical halves + ROM_LOAD16_BYTE( "u2.bin", 0x00000, 0x40000, CRC(9c3fc677) SHA1(193606fe739dbf5f26962f91be968ca371b7fd74) ) // identical halves - ROM_REGION( 0x040000, "oki", 0 ) /* Samples */ + ROM_REGION( 0x040000, "oki", 0 ) ROM_LOAD( "u210.bin", 0x00000, 0x40000, CRC(0a223a38) SHA1(e5aefbdbb09c18cc230bc852df3ea1defb1a21a8) ) - ROM_REGION( 0x200000, "gfx1", 0 ) + ROM_REGION( 0x200000, "bgtiles", 0 ) ROM_LOAD( "u421.bin", 0x000000, 0x80000, CRC(5387ab3a) SHA1(69913fde1a323ab1356ef52bb4efbf12caed594c) ) ROM_LOAD( "u420.bin", 0x100000, 0x80000, CRC(c3f892e6) SHA1(5e8e4ae45a0eebaf2bbad00b1208b68f3e81df0c) ) ROM_LOAD( "u425.bin", 0x080000, 0x80000, CRC(f53a9042) SHA1(70fcc3aaef46282a888466454714dc59daeb174d) ) ROM_LOAD( "u426.bin", 0x180000, 0x80000, CRC(c927e8da) SHA1(2219f99bce6b2b9a827177c83952813df1a32c72) ) - ROM_REGION( 0x80000, "gfx2", 0 ) /* BG Tiles */ + ROM_REGION( 0x80000, "fgtiles", 0 ) ROM_LOAD( "u512.bin", 0x00000, 0x40000, CRC(505ee3c2) SHA1(a719958c34d9c54445ad207bca1f49df3aff938b) ) ROM_LOAD( "u511.bin", 0x40000, 0x40000, CRC(3d6b6c78) SHA1(3016423102b4d47c0f1296471cf1670258acc856) ) ROM_END -ROM_START( mspuzzlea ) /* sticker on PCB stated: MISS PUZZLE V ..8 */ - ROM_REGION( 0x80000, "maincpu", 0 ) /* 68000 Code */ - ROM_LOAD16_BYTE( "u1.u1", 0x00001, 0x40000, CRC(5e96ea17) SHA1(9b4cfa32e386eacca4e65190d29978cf9cf08fbc) ) /* identical halves */ - ROM_LOAD16_BYTE( "u2.u2", 0x00000, 0x40000, CRC(8f161b0c) SHA1(783dbb34ae5fb7603558c17a39abbe0a93e3a01f) ) /* identical halves */ +ROM_START( mspuzzlea ) // sticker on PCB stated: MISS PUZZLE V ..8 + ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 Code + ROM_LOAD16_BYTE( "u1.u1", 0x00001, 0x40000, CRC(5e96ea17) SHA1(9b4cfa32e386eacca4e65190d29978cf9cf08fbc) ) // identical halves + ROM_LOAD16_BYTE( "u2.u2", 0x00000, 0x40000, CRC(8f161b0c) SHA1(783dbb34ae5fb7603558c17a39abbe0a93e3a01f) ) // identical halves - ROM_REGION( 0x040000, "oki", 0 ) /* Samples */ + ROM_REGION( 0x040000, "oki", 0 ) ROM_LOAD( "u210.bin", 0x00000, 0x40000, CRC(0a223a38) SHA1(e5aefbdbb09c18cc230bc852df3ea1defb1a21a8) ) - ROM_REGION( 0x200000, "gfx1", 0 ) - ROM_LOAD( "u421.u421", 0x000000, 0x80000, CRC(52b67ee5) SHA1(209fdf845c5ef2e65fbc0de8aeb26562b6d033ab) ) /* several more explicit pictures have been replaced compared to the set below */ - ROM_LOAD( "u420.u420", 0x100000, 0x80000, CRC(3565696e) SHA1(5234dc25f73e6245b199071fa3a9c0d2367cae9f) ) /* Starting with 204 & 205, as well as many in 300 range */ + ROM_REGION( 0x200000, "bgtiles", 0 ) + ROM_LOAD( "u421.u421", 0x000000, 0x80000, CRC(52b67ee5) SHA1(209fdf845c5ef2e65fbc0de8aeb26562b6d033ab) ) // several more explicit pictures have been replaced compared to the set below + ROM_LOAD( "u420.u420", 0x100000, 0x80000, CRC(3565696e) SHA1(5234dc25f73e6245b199071fa3a9c0d2367cae9f) ) // Starting with 204 & 205, as well as many in 300 range ROM_LOAD( "u425.u425", 0x080000, 0x80000, CRC(933544e3) SHA1(d77b1050c4b56d0fd3be703bec961863d5188484) ) ROM_LOAD( "u426.u426", 0x180000, 0x80000, CRC(e458eb9d) SHA1(bead05ec57d97c86ed727b2c4b95f8ffdbd7ef4c) ) - ROM_REGION( 0x80000, "gfx2", 0 ) /* BG Tiles */ + ROM_REGION( 0x80000, "fgtiles", 0 ) ROM_LOAD( "u512.bin", 0x00000, 0x40000, CRC(505ee3c2) SHA1(a719958c34d9c54445ad207bca1f49df3aff938b) ) ROM_LOAD( "u511.bin", 0x40000, 0x40000, CRC(3d6b6c78) SHA1(3016423102b4d47c0f1296471cf1670258acc856) ) ROM_END ROM_START( mspuzzleb ) - /* all the roms for this set needs a full redump, the PCB was in pretty bad condition and data reads were not consistent */ - ROM_REGION( 0x80000, "maincpu", 0 ) /* 68000 Code */ + // all the ROMs for this set needs a full redump, the PCB was in pretty bad condition and data reads were not consistent + ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 Code // ROM_LOAD16_BYTE( "u1.rom", 0x00001, 0x20000, BAD_DUMP CRC(ec940df4) SHA1(20bb6e2757868cf8fbbb11e05adf8c1d625ee172) ) // ROM_LOAD16_BYTE( "u2.rom", 0x00000, 0x20000, BAD_DUMP CRC(7b9cac82) SHA1(c5edfb3fbdf43219ba317c18222e671ebed94469) ) - ROM_LOAD16_BYTE( "u1.u1", 0x00001, 0x40000, CRC(5e96ea17) SHA1(9b4cfa32e386eacca4e65190d29978cf9cf08fbc) ) /* identical halves - use program ROMs from mspuzzlea for now */ - ROM_LOAD16_BYTE( "u2.u2", 0x00000, 0x40000, CRC(8f161b0c) SHA1(783dbb34ae5fb7603558c17a39abbe0a93e3a01f) ) /* identical halves - use program ROMs from mspuzzlea for now */ + ROM_LOAD16_BYTE( "u1.u1", 0x00001, 0x40000, CRC(5e96ea17) SHA1(9b4cfa32e386eacca4e65190d29978cf9cf08fbc) ) // identical halves - use program ROMs from mspuzzlea for now + ROM_LOAD16_BYTE( "u2.u2", 0x00000, 0x40000, CRC(8f161b0c) SHA1(783dbb34ae5fb7603558c17a39abbe0a93e3a01f) ) // identical halves - use program ROMs from mspuzzlea for now - ROM_REGION( 0x040000, "oki", 0 ) /* Samples */ + ROM_REGION( 0x040000, "oki", 0 ) ROM_LOAD( "u210.rom", 0x00000, 0x40000, CRC(8826b018) SHA1(075e5cef114146c6c72c0331dd3434b27fed180d) ) - ROM_REGION( 0x200000, "gfx1", 0 ) + ROM_REGION( 0x200000, "bgtiles", 0 ) ROM_LOAD( "u421.rom", 0x000000, 0x80000, BAD_DUMP CRC(3c567c55) SHA1(100e0c9535bf07f3ca8537b3a172486b65e5f24a) ) - /* 0x000000-0x3FFFF of u421.rom == 0x000000-0x3FFFF of u421 in mspuzzlea, all other data is corrupt to some degree */ - ROM_LOAD( "u420.rom", 0x100000, 0x80000, BAD_DUMP CRC(f52ab7fd) SHA1(e5b8905cae3e15a8a379c4c149441d849931cbde) ) /* pictures 204 & 205 are corrupt (as shown in score box as 002040 & 002050) */ - ROM_LOAD( "u425.rom", 0x080000, 0x80000, BAD_DUMP CRC(1c4c8fc1) SHA1(90e3f297db68a44cba0966b599bb7c593eced16e) ) /* Title screen and Course Select graphics & girls */ - ROM_LOAD( "u426.rom", 0x180000, 0x80000, BAD_DUMP CRC(c28b2743) SHA1(df4bf998ae17ddebf1b4047564eb296c69bc9071) ) /* Every other line of girls matched with U425 */ + // 0x000000-0x3FFFF of u421.rom == 0x000000-0x3FFFF of u421 in mspuzzlea, all other data is corrupt to some degree + ROM_LOAD( "u420.rom", 0x100000, 0x80000, BAD_DUMP CRC(f52ab7fd) SHA1(e5b8905cae3e15a8a379c4c149441d849931cbde) ) // pictures 204 & 205 are corrupt (as shown in score box as 002040 & 002050) + ROM_LOAD( "u425.rom", 0x080000, 0x80000, BAD_DUMP CRC(1c4c8fc1) SHA1(90e3f297db68a44cba0966b599bb7c593eced16e) ) // Title screen and Course Select graphics & girls + ROM_LOAD( "u426.rom", 0x180000, 0x80000, BAD_DUMP CRC(c28b2743) SHA1(df4bf998ae17ddebf1b4047564eb296c69bc9071) ) // Every other line of girls matched with U425 - ROM_REGION( 0x80000, "gfx2", 0 ) /* BG Tiles */ + ROM_REGION( 0x80000, "fgtiles", 0 ) ROM_LOAD( "u512.bin", 0x00000, 0x40000, CRC(505ee3c2) SHA1(a719958c34d9c54445ad207bca1f49df3aff938b) ) ROM_LOAD( "u511.bin", 0x40000, 0x40000, CRC(3d6b6c78) SHA1(3016423102b4d47c0f1296471cf1670258acc856) ) ROM_END ROM_START( dblpoint ) - ROM_REGION( 0x80000, "maincpu", 0 ) /* 68000 Code */ + ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 Code ROM_LOAD16_BYTE( "u1.bin", 0x00001, 0x20000, CRC(b05c9e02) SHA1(40ae2926cc4a77e8f871e3a4845314384a15c3e0) ) ROM_LOAD16_BYTE( "u2.bin", 0x00000, 0x20000, CRC(cab35cbe) SHA1(63a35a880c962a9c9560bf779bf9edec18c3878d) ) - ROM_REGION( 0x040000, "oki", 0 ) /* Samples */ + ROM_REGION( 0x040000, "oki", 0 ) ROM_LOAD( "u210.rom", 0x00000, 0x40000, CRC(d35f975c) SHA1(03490c92afadbd24c5b75f0ab114a2681b65c10e) ) - ROM_REGION( 0x200000, "gfx1", 0 ) + ROM_REGION( 0x200000, "bgtiles", 0 ) ROM_LOAD( "u421.bin", 0x000000, 0x80000, CRC(b0e9271f) SHA1(4873e4dda177f5116164b2a47dabd82bc75e9bdf) ) ROM_LOAD( "u420.bin", 0x100000, 0x80000, CRC(252789e8) SHA1(7b365035a4c4f6aae0d4075db70d59973569b12b) ) - ROM_REGION( 0x80000, "gfx2", 0 ) + ROM_REGION( 0x80000, "fgtiles", 0 ) ROM_LOAD( "u512.bin", 0x00000, 0x40000, CRC(b57b8534) SHA1(1d96dc93111e56a7982c3602864a71a785a4782a) ) ROM_LOAD( "u511.bin", 0x40000, 0x40000, CRC(74ed13ff) SHA1(2522bd5fe40123a5b07e955252ae96b913a3ac0d) ) ROM_END -/* based on the labels this doesn't seem to be an original Min Corp. board */ +// based on the labels this doesn't seem to be an original Min Corp. board ROM_START( dblpointd ) - ROM_REGION( 0x80000, "maincpu", 0 ) /* 68000 Code */ + ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 Code ROM_LOAD16_BYTE( "d12.bin", 0x00001, 0x20000, CRC(44bc1bd9) SHA1(8b72909c53b09b9287bf90bcd8970bdf9c1b8798) ) ROM_LOAD16_BYTE( "d13.bin", 0x00000, 0x20000, CRC(625a311b) SHA1(38fa0d240b253fcc8dc89438582a9c446410b636) ) - ROM_REGION( 0x040000, "oki", 0 ) /* Samples */ + ROM_REGION( 0x040000, "oki", 0 ) ROM_LOAD( "d11.bin", 0x00000, 0x40000, CRC(d35f975c) SHA1(03490c92afadbd24c5b75f0ab114a2681b65c10e) ) - ROM_REGION( 0x100000, "gfx1", 0 ) + ROM_REGION( 0x100000, "bgtiles", 0 ) ROM_LOAD( "d16.bin", 0x00000, 0x80000, CRC(afea0158) SHA1(dc97f9268533048690715f377fb35d70e7e5a53f) ) ROM_LOAD( "d17.bin", 0x80000, 0x80000, CRC(c971dcb5) SHA1(40f15b3d61ea0325883f19f24f2b61e24bb12a98) ) - ROM_REGION( 0x80000, "gfx2", 0 ) + ROM_REGION( 0x80000, "fgtiles", 0 ) ROM_LOAD( "d14.bin", 0x00000, 0x40000, CRC(41943db5) SHA1(2f245402f7bbaeca7e50161397ee45e7c7c90cfc) ) ROM_LOAD( "d15.bin", 0x40000, 0x40000, CRC(6b899a51) SHA1(04114ec9695caaac722800ac1a4ffb563ec433c9) ) ROM_END +} // anonymous namespace + + GAME( 1994, gumbo, 0, gumbo, gumbo, gumbo_state, empty_init, ROT0, "Min Corp.", "Gumbo", MACHINE_SUPPORTS_SAVE ) GAME( 1994, mspuzzleg, gumbo, gumbo, gumbo, gumbo_state, empty_init, ROT0, "Min Corp.", "Miss Puzzle (Clone of Gumbo)", MACHINE_SUPPORTS_SAVE ) GAME( 1994, msbingo, 0, mspuzzle, msbingo, gumbo_state, empty_init, ROT0, "Min Corp.", "Miss Bingo", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/misc/gumbo.h b/src/mame/misc/gumbo.h deleted file mode 100644 index e2d2cbba7e8..00000000000 --- a/src/mame/misc/gumbo.h +++ /dev/null @@ -1,56 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:David Haywood -/************************************************************************* - - Gumbo - Miss Bingo - Miss Puzzle - -*************************************************************************/ -#ifndef MAME_INCLUDES_GUMBO_H -#define MAME_INCLUDES_GUMBO_H - -#pragma once - -#include "tilemap.h" - -class gumbo_state : public driver_device -{ -public: - gumbo_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_bg_videoram(*this, "bg_videoram"), - m_fg_videoram(*this, "fg_videoram"), - m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode") - { } - - void mspuzzle(machine_config &config); - void dblpoint(machine_config &config); - void gumbo(machine_config &config); - -protected: - virtual void video_start() override; - -private: - /* memory pointers */ - required_shared_ptr<uint16_t> m_bg_videoram; - required_shared_ptr<uint16_t> m_fg_videoram; - - /* video-related */ - tilemap_t *m_bg_tilemap = nullptr; - tilemap_t *m_fg_tilemap = nullptr; - - required_device<cpu_device> m_maincpu; - required_device<gfxdecode_device> m_gfxdecode; - - void gumbo_bg_videoram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - void gumbo_fg_videoram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - TILE_GET_INFO_MEMBER(get_gumbo_bg_tile_info); - TILE_GET_INFO_MEMBER(get_gumbo_fg_tile_info); - uint32_t screen_update_gumbo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - void dblpoint_map(address_map &map); - void gumbo_map(address_map &map); - void mspuzzle_map(address_map &map); -}; - -#endif // MAME_INCLUDES_GUMBO_H diff --git a/src/mame/misc/gumbo_v.cpp b/src/mame/misc/gumbo_v.cpp deleted file mode 100644 index c85b3c410ea..00000000000 --- a/src/mame/misc/gumbo_v.cpp +++ /dev/null @@ -1,47 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:David Haywood -/* Gumbo video */ - -#include "emu.h" -#include "gumbo.h" - - -void gumbo_state::gumbo_bg_videoram_w(offs_t offset, uint16_t data, uint16_t mem_mask) -{ - COMBINE_DATA(&m_bg_videoram[offset]); - m_bg_tilemap->mark_tile_dirty(offset); -} - -TILE_GET_INFO_MEMBER(gumbo_state::get_gumbo_bg_tile_info) -{ - int tileno = m_bg_videoram[tile_index]; - tileinfo.set(0, tileno, 0, 0); -} - - -void gumbo_state::gumbo_fg_videoram_w(offs_t offset, uint16_t data, uint16_t mem_mask) -{ - COMBINE_DATA(&m_fg_videoram[offset]); - m_fg_tilemap->mark_tile_dirty(offset); -} - -TILE_GET_INFO_MEMBER(gumbo_state::get_gumbo_fg_tile_info) -{ - int tileno = m_fg_videoram[tile_index]; - tileinfo.set(1, tileno, 1, 0); -} - - -void gumbo_state::video_start() -{ - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(gumbo_state::get_gumbo_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); - m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(gumbo_state::get_gumbo_fg_tile_info)), TILEMAP_SCAN_ROWS, 4, 4, 128, 64); - m_fg_tilemap->set_transparent_pen(0xff); -} - -uint32_t gumbo_state::screen_update_gumbo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - return 0; -} diff --git a/src/mame/misc/mosaic.cpp b/src/mame/misc/mosaic.cpp index 7f4bef1575a..bed929e769a 100644 --- a/src/mame/misc/mosaic.cpp +++ b/src/mame/misc/mosaic.cpp @@ -42,21 +42,160 @@ NOTE: PIC16C5x protection chip at 5A (UC02 as silkscreened on PCB) ***************************************************************************/ #include "emu.h" -#include "mosaic.h" #include "cpu/pic16c5x/pic16c5x.h" #include "cpu/z180/z180.h" #include "sound/ymopn.h" + #include "emupal.h" #include "screen.h" #include "speaker.h" +#include "tilemap.h" + + +// configurable logging +#define LOG_PICSIM (1U << 1) + +//#define VERBOSE (LOG_GENERAL | LOG_PICSIM) + +#include "logmacro.h" + +#define LOGPICSIM(...) LOGMASKED(LOG_PICSIM, __VA_ARGS__) + + +namespace { + +class mosaic_state : public driver_device +{ +public: + mosaic_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_fgvideoram(*this, "fgvideoram"), + m_bgvideoram(*this, "bgvideoram") + { } + + void mosaic(machine_config &config); + void gfire2(machine_config &config); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + +private: + // devices + required_device<cpu_device> m_maincpu; + required_device<gfxdecode_device> m_gfxdecode; + + // memory pointers + required_shared_ptr<uint8_t> m_fgvideoram; + required_shared_ptr<uint8_t> m_bgvideoram; + + // video-related + tilemap_t *m_bg_tilemap = nullptr; + tilemap_t *m_fg_tilemap = nullptr; + + // misc + uint16_t m_prot_val = 0; + + void protection_w(uint8_t data); + uint8_t protection_r(); + void gfire2_protection_w(uint8_t data); + uint8_t gfire2_protection_r(); + void fgvideoram_w(offs_t offset, uint8_t data); + void bgvideoram_w(offs_t offset, uint8_t data); + + TILE_GET_INFO_MEMBER(get_fg_tile_info); + TILE_GET_INFO_MEMBER(get_bg_tile_info); + + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void gfire2_io_map(address_map &map); + void gfire2_map(address_map &map); + void mosaic_io_map(address_map &map); + void mosaic_map(address_map &map); +}; + + +// video + +/*************************************************************************** + + Callbacks for the TileMap code + +***************************************************************************/ + +TILE_GET_INFO_MEMBER(mosaic_state::get_fg_tile_info) +{ + tile_index *= 2; + tileinfo.set(0, + m_fgvideoram[tile_index] + (m_fgvideoram[tile_index + 1] << 8), + 0, + 0); +} + +TILE_GET_INFO_MEMBER(mosaic_state::get_bg_tile_info) +{ + tile_index *= 2; + tileinfo.set(1, + m_bgvideoram[tile_index] + (m_bgvideoram[tile_index + 1] << 8), + 0, + 0); +} + + + +/*************************************************************************** + + Start the video hardware emulation. + +***************************************************************************/ + +void mosaic_state::video_start() +{ + m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(mosaic_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); + m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(mosaic_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); + + m_fg_tilemap->set_transparent_pen(0xff); +} + + +/*************************************************************************** + + Memory handlers + +***************************************************************************/ + +void mosaic_state::fgvideoram_w(offs_t offset, uint8_t data) +{ + m_fgvideoram[offset] = data; + m_fg_tilemap->mark_tile_dirty(offset / 2); +} + +void mosaic_state::bgvideoram_w(offs_t offset, uint8_t data) +{ + m_bgvideoram[offset] = data; + m_bg_tilemap->mark_tile_dirty(offset / 2); +} + + + +uint32_t mosaic_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + return 0; +} + +// machine void mosaic_state::protection_w(uint8_t data) // TODO: hook up PIC dump and remove this simulation (PIC dump contains the exact values in this jumptable) { if (!BIT(data, 7)) { - /* simply increment given value */ + // simply increment given value m_prot_val = (data + 1) << 8; } else @@ -78,9 +217,9 @@ void mosaic_state::protection_w(uint8_t data) // TODO: hook up PIC dump and remo uint8_t mosaic_state::protection_r() { - int res = (m_prot_val >> 8) & 0xff; + int const res = (m_prot_val >> 8) & 0xff; - logerror("%06x: protection_r %02x\n", m_maincpu->pc(), res); + LOGPICSIM("%06x: protection_r %02x\n", m_maincpu->pc(), res); m_prot_val <<= 8; @@ -89,12 +228,12 @@ uint8_t mosaic_state::protection_r() void mosaic_state::gfire2_protection_w(uint8_t data) { - logerror("%06x: protection_w %02x\n", m_maincpu->pc(), data); + LOGPICSIM("%06x: protection_w %02x\n", m_maincpu->pc(), data); switch(data) { case 0x01: - /* written repeatedly; no effect?? */ + // written repeatedly; no effect?? break; case 0x02: m_prot_val = 0x0a10; @@ -116,7 +255,7 @@ void mosaic_state::gfire2_protection_w(uint8_t data) uint8_t mosaic_state::gfire2_protection_r() { - int res = m_prot_val & 0xff; + int const res = m_prot_val & 0xff; m_prot_val >>= 8; @@ -129,8 +268,8 @@ void mosaic_state::mosaic_map(address_map &map) { map(0x00000, 0x0ffff).rom(); map(0x20000, 0x21fff).ram(); - map(0x22000, 0x22fff).ram().w(FUNC(mosaic_state::bgvideoram_w)).share("bgvideoram"); - map(0x23000, 0x23fff).ram().w(FUNC(mosaic_state::fgvideoram_w)).share("fgvideoram"); + map(0x22000, 0x22fff).ram().w(FUNC(mosaic_state::bgvideoram_w)).share(m_bgvideoram); + map(0x23000, 0x23fff).ram().w(FUNC(mosaic_state::fgvideoram_w)).share(m_fgvideoram); map(0x24000, 0x241ff).ram().w("palette", FUNC(palette_device::write8)).share("palette"); } @@ -138,16 +277,16 @@ void mosaic_state::gfire2_map(address_map &map) { map(0x00000, 0x0ffff).rom(); map(0x10000, 0x17fff).ram(); - map(0x22000, 0x22fff).ram().w(FUNC(mosaic_state::bgvideoram_w)).share("bgvideoram"); - map(0x23000, 0x23fff).ram().w(FUNC(mosaic_state::fgvideoram_w)).share("fgvideoram"); + map(0x22000, 0x22fff).ram().w(FUNC(mosaic_state::bgvideoram_w)).share(m_bgvideoram); + map(0x23000, 0x23fff).ram().w(FUNC(mosaic_state::fgvideoram_w)).share(m_fgvideoram); map(0x24000, 0x241ff).ram().w("palette", FUNC(palette_device::write8)).share("palette"); } void mosaic_state::mosaic_io_map(address_map &map) { map.global_mask(0xff); - map(0x00, 0x3f).nopw(); /* Z180 internal registers */ - map(0x30, 0x30).nopr(); /* Z180 internal registers */ + map(0x00, 0x3f).nopw(); // Z180 internal registers + map(0x30, 0x30).nopr(); // Z180 internal registers map(0x70, 0x71).rw("ymsnd", FUNC(ym2203_device::read), FUNC(ym2203_device::write)); map(0x72, 0x72).rw(FUNC(mosaic_state::protection_r), FUNC(mosaic_state::protection_w)); map(0x74, 0x74).portr("P1"); @@ -157,8 +296,8 @@ void mosaic_state::mosaic_io_map(address_map &map) void mosaic_state::gfire2_io_map(address_map &map) { map.global_mask(0xff); - map(0x00, 0x3f).nopw(); /* Z180 internal registers */ - map(0x30, 0x30).nopr(); /* Z180 internal registers */ + map(0x00, 0x3f).nopw(); // Z180 internal registers + map(0x30, 0x30).nopr(); // Z180 internal registers map(0x70, 0x71).rw("ymsnd", FUNC(ym2203_device::read), FUNC(ym2203_device::write)); map(0x72, 0x72).rw(FUNC(mosaic_state::gfire2_protection_r), FUNC(mosaic_state::gfire2_protection_w)); map(0x74, 0x74).portr("P1"); @@ -270,8 +409,8 @@ static const gfx_layout charlayout = }; static GFXDECODE_START( gfx_mosaic ) - GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 1 ) - GFXDECODE_ENTRY( "gfx2", 0, charlayout, 0, 1 ) + GFXDECODE_ENTRY( "fgtiles", 0, charlayout, 0, 1 ) + GFXDECODE_ENTRY( "bgtiles", 0, charlayout, 0, 1 ) GFXDECODE_END void mosaic_state::machine_start() @@ -286,13 +425,13 @@ void mosaic_state::machine_reset() void mosaic_state::mosaic(machine_config &config) { - /* basic machine hardware */ - HD64180RP(config, m_maincpu, XTAL(12'288'000)); /* 6.144MHz - Verified */ + // basic machine hardware + HD64180RP(config, m_maincpu, XTAL(12'288'000)); // 6.144MHz - Verified m_maincpu->set_addrmap(AS_PROGRAM, &mosaic_state::mosaic_map); m_maincpu->set_addrmap(AS_IO, &mosaic_state::mosaic_io_map); m_maincpu->set_vblank_int("screen", FUNC(mosaic_state::irq0_line_hold)); - PIC16C55(config, "pic", XTAL(12'288'000)/4); /* 3.072MHz - Verified */ + PIC16C55(config, "pic", XTAL(12'288'000) / 4); // 3.072MHz - Verified //read_a().set(FUNC(mosaic_state::)); //write_a().set(FUNC(mosaic_state::)); //read_b().set(FUNC(mosaic_state::)); @@ -300,7 +439,7 @@ void mosaic_state::mosaic(machine_config &config) //read_c().set(FUNC(mosaic_state::)); //write_c().set(FUNC(mosaic_state::)); - /* video hardware */ + // video hardware screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_refresh_hz(60); screen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); @@ -313,10 +452,10 @@ void mosaic_state::mosaic(machine_config &config) PALETTE(config, "palette").set_format(palette_device::xRGB_555, 256); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); - ym2203_device &ymsnd(YM2203(config, "ymsnd", XTAL(14'318'181)/4)); /* 3.579545MHz - Verified */ + ym2203_device &ymsnd(YM2203(config, "ymsnd", XTAL(14'318'181) / 4)); // 3.579545MHz - Verified ymsnd.port_a_read_callback().set_ioport("DSW"); ymsnd.add_route(ALL_OUTPUTS, "mono", 0.50); } @@ -340,65 +479,66 @@ void mosaic_state::gfire2(machine_config &config) ***************************************************************************/ ROM_START( mosaic ) - ROM_REGION( 0x100000, "maincpu", 0 ) /* 1024k for Z180 address space */ - ROM_LOAD( "9.ua02", 0x00000, 0x10000, CRC(5794dd39) SHA1(28784371f4ca561e3c0fb74d1f0a204f58ccdd3a) ) /* at PCB location 7F */ + ROM_REGION( 0x100000, "maincpu", 0 ) // 1024k for Z180 address space + ROM_LOAD( "9.ua02", 0x00000, 0x10000, CRC(5794dd39) SHA1(28784371f4ca561e3c0fb74d1f0a204f58ccdd3a) ) // at PCB location 7F ROM_REGION( 0x400, "pic", 0 ) ROM_LOAD( "pic16c55.uc02", 0x000, 0x400, CRC(62d1d85d) SHA1(167e1f39e85f0bbecc4374f3975aa0c41173f070) ) // decapped, presumed to be 16C55 - ROM_REGION( 0x40000, "gfx1", 0 ) - ROM_LOAD( "1.u505", 0x00000, 0x10000, CRC(05f4cc70) SHA1(367cfa716b5d24663efcd98a4a80bf02ef28f2f8) ) /* at PCB location 1L */ - ROM_LOAD( "2.u506", 0x10000, 0x10000, CRC(78907875) SHA1(073b90e0303f7812e7e8f66bb798a7734cb36bb9) ) /* at PCB location 1K */ - ROM_LOAD( "3.u507", 0x20000, 0x10000, CRC(f81294cd) SHA1(9bce627bbe3940769776121fb4296f92ac4c7d1a) ) /* at PCB location 1I */ - ROM_LOAD( "4.u508", 0x30000, 0x10000, CRC(fff72536) SHA1(4fc5d0a79128dd49275bc4c4cc2dd7c587096fd8) ) /* at PCB location 1G */ - - ROM_REGION( 0x40000, "gfx2", 0 ) - ROM_LOAD( "5.u305", 0x00000, 0x10000, CRC(28513fbf) SHA1(e69051206cc3df470e7b2358c51cbbed294795f5) ) /* at PCB location 1F */ - ROM_LOAD( "6.u306", 0x10000, 0x10000, CRC(1b8854c4) SHA1(d49df2565d9ccda403fafb9e219d3603776e3d34) ) /* at PCB location 1D */ - ROM_LOAD( "7.u307", 0x20000, 0x10000, CRC(35674ac2) SHA1(6422a81034b6d34aefc8ca5d2926d3d3c3d7ff77) ) /* at PCB location 1C */ - ROM_LOAD( "8.u308", 0x30000, 0x10000, CRC(6299c376) SHA1(eb64b20268c06c97c4201c8004a759b6de42fab6) ) /* at PCB location 1A */ + ROM_REGION( 0x40000, "fgtiles", 0 ) + ROM_LOAD( "1.u505", 0x00000, 0x10000, CRC(05f4cc70) SHA1(367cfa716b5d24663efcd98a4a80bf02ef28f2f8) ) // at PCB location 1L + ROM_LOAD( "2.u506", 0x10000, 0x10000, CRC(78907875) SHA1(073b90e0303f7812e7e8f66bb798a7734cb36bb9) ) // at PCB location 1K + ROM_LOAD( "3.u507", 0x20000, 0x10000, CRC(f81294cd) SHA1(9bce627bbe3940769776121fb4296f92ac4c7d1a) ) // at PCB location 1I + ROM_LOAD( "4.u508", 0x30000, 0x10000, CRC(fff72536) SHA1(4fc5d0a79128dd49275bc4c4cc2dd7c587096fd8) ) // at PCB location 1G + + ROM_REGION( 0x40000, "bgtiles", 0 ) + ROM_LOAD( "5.u305", 0x00000, 0x10000, CRC(28513fbf) SHA1(e69051206cc3df470e7b2358c51cbbed294795f5) ) // at PCB location 1F + ROM_LOAD( "6.u306", 0x10000, 0x10000, CRC(1b8854c4) SHA1(d49df2565d9ccda403fafb9e219d3603776e3d34) ) // at PCB location 1D + ROM_LOAD( "7.u307", 0x20000, 0x10000, CRC(35674ac2) SHA1(6422a81034b6d34aefc8ca5d2926d3d3c3d7ff77) ) // at PCB location 1C + ROM_LOAD( "8.u308", 0x30000, 0x10000, CRC(6299c376) SHA1(eb64b20268c06c97c4201c8004a759b6de42fab6) ) // at PCB location 1A ROM_END ROM_START( mosaica ) - ROM_REGION( 0x100000, "maincpu", 0 ) /* 1024k for Z180 address space */ - ROM_LOAD( "mosaic_9.a02", 0x00000, 0x10000, CRC(ecb4f8aa) SHA1(e45c074bac92d1d079cf1bcc0a6a081beb3dbb8e) ) /* at PCB location 7F */ + ROM_REGION( 0x100000, "maincpu", 0 ) // 1024k for Z180 address space + ROM_LOAD( "mosaic_9.a02", 0x00000, 0x10000, CRC(ecb4f8aa) SHA1(e45c074bac92d1d079cf1bcc0a6a081beb3dbb8e) ) // at PCB location 7F ROM_REGION( 0x400, "pic", 0 ) ROM_LOAD( "pic16c55.uc02", 0x000, 0x400, CRC(62d1d85d) SHA1(167e1f39e85f0bbecc4374f3975aa0c41173f070) ) // decapped, presumed to be 16C55 - ROM_REGION( 0x40000, "gfx1", 0 ) - ROM_LOAD( "1.u505", 0x00000, 0x10000, CRC(05f4cc70) SHA1(367cfa716b5d24663efcd98a4a80bf02ef28f2f8) ) /* at PCB location 1L */ - ROM_LOAD( "2.u506", 0x10000, 0x10000, CRC(78907875) SHA1(073b90e0303f7812e7e8f66bb798a7734cb36bb9) ) /* at PCB location 1K */ - ROM_LOAD( "3.u507", 0x20000, 0x10000, CRC(f81294cd) SHA1(9bce627bbe3940769776121fb4296f92ac4c7d1a) ) /* at PCB location 1I */ - ROM_LOAD( "4.u508", 0x30000, 0x10000, CRC(fff72536) SHA1(4fc5d0a79128dd49275bc4c4cc2dd7c587096fd8) ) /* at PCB location 1G */ - - ROM_REGION( 0x40000, "gfx2", 0 ) - ROM_LOAD( "5.u305", 0x00000, 0x10000, CRC(28513fbf) SHA1(e69051206cc3df470e7b2358c51cbbed294795f5) ) /* at PCB location 1F */ - ROM_LOAD( "6.u306", 0x10000, 0x10000, CRC(1b8854c4) SHA1(d49df2565d9ccda403fafb9e219d3603776e3d34) ) /* at PCB location 1D */ - ROM_LOAD( "7.u307", 0x20000, 0x10000, CRC(35674ac2) SHA1(6422a81034b6d34aefc8ca5d2926d3d3c3d7ff77) ) /* at PCB location 1C */ - ROM_LOAD( "8.u308", 0x30000, 0x10000, CRC(6299c376) SHA1(eb64b20268c06c97c4201c8004a759b6de42fab6) ) /* at PCB location 1A */ + ROM_REGION( 0x40000, "fgtiles", 0 ) + ROM_LOAD( "1.u505", 0x00000, 0x10000, CRC(05f4cc70) SHA1(367cfa716b5d24663efcd98a4a80bf02ef28f2f8) ) // at PCB location 1L + ROM_LOAD( "2.u506", 0x10000, 0x10000, CRC(78907875) SHA1(073b90e0303f7812e7e8f66bb798a7734cb36bb9) ) // at PCB location 1K + ROM_LOAD( "3.u507", 0x20000, 0x10000, CRC(f81294cd) SHA1(9bce627bbe3940769776121fb4296f92ac4c7d1a) ) // at PCB location 1I + ROM_LOAD( "4.u508", 0x30000, 0x10000, CRC(fff72536) SHA1(4fc5d0a79128dd49275bc4c4cc2dd7c587096fd8) ) // at PCB location 1G + + ROM_REGION( 0x40000, "bgtiles", 0 ) + ROM_LOAD( "5.u305", 0x00000, 0x10000, CRC(28513fbf) SHA1(e69051206cc3df470e7b2358c51cbbed294795f5) ) // at PCB location 1F + ROM_LOAD( "6.u306", 0x10000, 0x10000, CRC(1b8854c4) SHA1(d49df2565d9ccda403fafb9e219d3603776e3d34) ) // at PCB location 1D + ROM_LOAD( "7.u307", 0x20000, 0x10000, CRC(35674ac2) SHA1(6422a81034b6d34aefc8ca5d2926d3d3c3d7ff77) ) // at PCB location 1C + ROM_LOAD( "8.u308", 0x30000, 0x10000, CRC(6299c376) SHA1(eb64b20268c06c97c4201c8004a759b6de42fab6) ) // at PCB location 1A ROM_END ROM_START( gfire2 ) - ROM_REGION( 0x100000, "maincpu", 0 ) /* 1024k for Z180 address space */ + ROM_REGION( 0x100000, "maincpu", 0 ) // 1024k for Z180 address space ROM_LOAD( "goldf2_i.7e", 0x00000, 0x10000, CRC(a102f7d0) SHA1(cfde51d0e9e69e9653fdfd70d4e4f4649b662005) ) ROM_REGION( 0x400, "pic", 0 ) ROM_LOAD( "pic16c55.uc02", 0x000, 0x400, NO_DUMP ) // same sanded off chip as mosaic, verified on PCB pic - ROM_REGION( 0x100000, "gfx1", 0 ) + ROM_REGION( 0x100000, "fgtiles", 0 ) ROM_LOAD( "goldf2_a.1k", 0x00000, 0x40000, CRC(1f086472) SHA1(c776a734869b6bab317627bd15457a9fb18e1159) ) ROM_LOAD( "goldf2_b.1j", 0x40000, 0x40000, CRC(edb0d40c) SHA1(624a71b42a2e6c7c55cf455395aa0ad9b3eaeb9e) ) ROM_LOAD( "goldf2_c.1i", 0x80000, 0x40000, CRC(d0ebd486) SHA1(ff2bfc84bc622b437913e1861f7acb373c7844c8) ) ROM_LOAD( "goldf2_d.1h", 0xc0000, 0x40000, CRC(2b56ae2c) SHA1(667f9093ed28ba1804583fb201c7e3b37f1a9927) ) - ROM_REGION( 0x80000, "gfx2", 0 ) + ROM_REGION( 0x80000, "bgtiles", 0 ) ROM_LOAD( "goldf2_e.1e", 0x00000, 0x20000, CRC(61b8accd) SHA1(d6317b8b7ab33a2a78d388b87ddb8946e6c6df29) ) ROM_LOAD( "goldf2_f.1d", 0x20000, 0x20000, CRC(49f77e53) SHA1(6e7c8f86cb368bf1a32f02f72e7b418684c847dc) ) ROM_LOAD( "goldf2_g.1b", 0x40000, 0x20000, CRC(aa79f3bf) SHA1(c0b62f5de7e36ce1ef1de92ee6f63d8286815566) ) ROM_LOAD( "goldf2_h.1a", 0x60000, 0x20000, CRC(a3519259) SHA1(9e1edb50ade4a4ddcd628a897f6fa712075a888b) ) ROM_END +} // anonymous namespace GAME( 1990, mosaic, 0, mosaic, mosaic, mosaic_state, empty_init, ROT0, "Space", "Mosaic", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/misc/mosaic.h b/src/mame/misc/mosaic.h deleted file mode 100644 index c4748f936db..00000000000 --- a/src/mame/misc/mosaic.h +++ /dev/null @@ -1,67 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nicola Salmoria -/************************************************************************* - - Mosaic - -*************************************************************************/ -#ifndef MAME_INCLUDES_MOSAIC_H -#define MAME_INCLUDES_MOSAIC_H - -#pragma once - -#include "tilemap.h" - -class mosaic_state : public driver_device -{ -public: - mosaic_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_fgvideoram(*this, "fgvideoram"), - m_bgvideoram(*this, "bgvideoram") - { } - - void mosaic(machine_config &config); - void gfire2(machine_config &config); - -protected: - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; - -private: - /* devices */ - required_device<cpu_device> m_maincpu; - required_device<gfxdecode_device> m_gfxdecode; - - /* memory pointers */ - required_shared_ptr<uint8_t> m_fgvideoram; - required_shared_ptr<uint8_t> m_bgvideoram; - - /* video-related */ - tilemap_t *m_bg_tilemap = nullptr; - tilemap_t *m_fg_tilemap = nullptr; - - /* misc */ - int m_prot_val = 0; - - void protection_w(uint8_t data); - uint8_t protection_r(); - void gfire2_protection_w(uint8_t data); - uint8_t gfire2_protection_r(); - void fgvideoram_w(offs_t offset, uint8_t data); - void bgvideoram_w(offs_t offset, uint8_t data); - - TILE_GET_INFO_MEMBER(get_fg_tile_info); - TILE_GET_INFO_MEMBER(get_bg_tile_info); - - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void gfire2_io_map(address_map &map); - void gfire2_map(address_map &map); - void mosaic_io_map(address_map &map); - void mosaic_map(address_map &map); -}; - -#endif // MAME_INCLUDES_MOSAIC_H diff --git a/src/mame/misc/mosaic_v.cpp b/src/mame/misc/mosaic_v.cpp deleted file mode 100644 index c1a6808b489..00000000000 --- a/src/mame/misc/mosaic_v.cpp +++ /dev/null @@ -1,80 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nicola Salmoria -/*************************************************************************** - - mosaic.c - - Functions to emulate the video hardware of the machine. - -***************************************************************************/ - -#include "emu.h" -#include "mosaic.h" - -/*************************************************************************** - - Callbacks for the TileMap code - -***************************************************************************/ - -TILE_GET_INFO_MEMBER(mosaic_state::get_fg_tile_info) -{ - tile_index *= 2; - tileinfo.set(0, - m_fgvideoram[tile_index] + (m_fgvideoram[tile_index+1] << 8), - 0, - 0); -} - -TILE_GET_INFO_MEMBER(mosaic_state::get_bg_tile_info) -{ - tile_index *= 2; - tileinfo.set(1, - m_bgvideoram[tile_index] + (m_bgvideoram[tile_index+1] << 8), - 0, - 0); -} - - - -/*************************************************************************** - - Start the video hardware emulation. - -***************************************************************************/ - -void mosaic_state::video_start() -{ - m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(mosaic_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(mosaic_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); - - m_fg_tilemap->set_transparent_pen(0xff); -} - - -/*************************************************************************** - - Memory handlers - -***************************************************************************/ - -void mosaic_state::fgvideoram_w(offs_t offset, uint8_t data) -{ - m_fgvideoram[offset] = data; - m_fg_tilemap->mark_tile_dirty(offset / 2); -} - -void mosaic_state::bgvideoram_w(offs_t offset, uint8_t data) -{ - m_bgvideoram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset / 2); -} - - - -uint32_t mosaic_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - return 0; -} diff --git a/src/mame/misc/news.cpp b/src/mame/misc/news.cpp index 0e6ac5cb6bb..f5d59990834 100644 --- a/src/mame/misc/news.cpp +++ b/src/mame/misc/news.cpp @@ -16,25 +16,164 @@ driver by David Haywood */ #include "emu.h" -#include "news.h" #include "cpu/z80/z80.h" #include "sound/okim6295.h" + #include "emupal.h" #include "screen.h" #include "speaker.h" +#include "tilemap.h" + + +namespace { + +class news_state : public driver_device +{ +public: + news_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_bgram(*this, "bgram"), + m_fgram(*this, "fgram"), + m_maincpu(*this, "maincpu"), + m_gfxdecode(*this, "gfxdecode") + { } + + void news(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<uint8_t> m_bgram; + required_shared_ptr<uint8_t> m_fgram; + + // video-related + tilemap_t *m_fg_tilemap = nullptr; + tilemap_t *m_bg_tilemap = nullptr; + uint8_t m_bgpic = 0; + + required_device<cpu_device> m_maincpu; + required_device<gfxdecode_device> m_gfxdecode; + + void fgram_w(offs_t offset, uint8_t data); + void bgram_w(offs_t offset, uint8_t data); + void bgpic_w(uint8_t data); + TILE_GET_INFO_MEMBER(get_fg_tile_info); + TILE_GET_INFO_MEMBER(get_bg_tile_info); + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void prg_map(address_map &map); +}; + + +// video + +/*************************************************************************** + + Callbacks for the TileMap code + +***************************************************************************/ + +TILE_GET_INFO_MEMBER(news_state::get_fg_tile_info) +{ + int code = (m_fgram[tile_index * 2] << 8) | m_fgram[tile_index * 2 + 1]; + tileinfo.set(0, + code & 0x0fff, + (code & 0xf000) >> 12, + 0); +} + +TILE_GET_INFO_MEMBER(news_state::get_bg_tile_info) +{ + int code = (m_bgram[tile_index * 2] << 8) | m_bgram[tile_index * 2 + 1]; + int color = (code & 0xf000) >> 12; + + code &= 0x0fff; + if ((code & 0x0e00) == 0x0e00) + code = (code & 0x1ff) | (m_bgpic << 9); + tileinfo.set(0, + code, + color, + 0); +} + + + +/*************************************************************************** + + Start the video hardware emulation. + +***************************************************************************/ + +void news_state::video_start() +{ + m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(news_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); + m_fg_tilemap->set_transparent_pen(0); + + m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(news_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); +} + + + +/*************************************************************************** + + Memory handlers + +***************************************************************************/ + +void news_state::fgram_w(offs_t offset, uint8_t data) +{ + m_fgram[offset] = data; + m_fg_tilemap->mark_tile_dirty(offset / 2); +} + +void news_state::bgram_w(offs_t offset, uint8_t data) +{ + m_bgram[offset] = data; + m_bg_tilemap->mark_tile_dirty(offset / 2); +} -void news_state::news_map(address_map &map) +void news_state::bgpic_w(uint8_t data) { - map(0x0000, 0x7fff).rom(); /* 4000-7fff is written to during startup, probably leftover code */ - map(0x8000, 0x87ff).ram().w(FUNC(news_state::news_fgram_w)).share("fgram"); - map(0x8800, 0x8fff).ram().w(FUNC(news_state::news_bgram_w)).share("bgram"); + if (m_bgpic != data) + { + m_bgpic = data; + m_bg_tilemap->mark_all_dirty(); + } +} + + + +/*************************************************************************** + + Display refresh + +***************************************************************************/ + +uint32_t news_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + return 0; +} + + +// machine + +void news_state::prg_map(address_map &map) +{ + map(0x0000, 0x7fff).rom(); // 4000-7fff is written to during startup, probably leftover code + map(0x8000, 0x87ff).ram().w(FUNC(news_state::fgram_w)).share(m_fgram); + map(0x8800, 0x8fff).ram().w(FUNC(news_state::bgram_w)).share(m_bgram); map(0x9000, 0x91ff).ram().w("palette", FUNC(palette_device::write8)).share("palette"); map(0xc000, 0xc000).portr("DSW"); map(0xc001, 0xc001).portr("INPUTS"); map(0xc002, 0xc002).rw("oki", FUNC(okim6295_device::read), FUNC(okim6295_device::write)); - map(0xc003, 0xc003).w(FUNC(news_state::news_bgpic_w)); + map(0xc003, 0xc003).w(FUNC(news_state::bgpic_w)); map(0xe000, 0xffff).ram(); } @@ -72,39 +211,16 @@ static INPUT_PORTS_START( news ) INPUT_PORTS_END static INPUT_PORTS_START( newsa ) - PORT_START("DSW") - PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SWA:1,2") - PORT_DIPSETTING( 0x00, DEF_STR( 3C_1C ) ) - PORT_DIPSETTING( 0x01, DEF_STR( 2C_1C ) ) - PORT_DIPSETTING( 0x03, DEF_STR( 1C_1C ) ) - PORT_DIPSETTING( 0x02, DEF_STR( 1C_2C ) ) - PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SWA:3,4") - PORT_DIPSETTING( 0x0c, DEF_STR( Easy ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Medium ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Hard ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) - PORT_DIPNAME( 0x10, 0x10, "Helps" ) PORT_DIPLOCATION("SWA:5") - PORT_DIPSETTING( 0x10, "1" ) - PORT_DIPSETTING( 0x00, "2" ) + PORT_INCLUDE(news) + + PORT_MODIFY("DSW") PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SWA:6") PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPUNUSED_DIPLOC( 0x40, IP_ACTIVE_LOW, "SWA:7" ) - PORT_DIPUNUSED_DIPLOC( 0x80, IP_ACTIVE_LOW, "SWA:8" ) - - PORT_START("INPUTS") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1 ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) INPUT_PORTS_END static GFXDECODE_START( gfx_news ) - GFXDECODE_ENTRY( "gfx1", 0, gfx_8x8x4_packed_msb, 0, 16 ) + GFXDECODE_ENTRY( "tiles", 0, gfx_8x8x4_packed_msb, 0, 16 ) GFXDECODE_END @@ -121,37 +237,37 @@ void news_state::machine_reset() void news_state::news(machine_config &config) { - /* basic machine hardware */ - Z80(config, m_maincpu, 8000000); /* ? MHz */ - m_maincpu->set_addrmap(AS_PROGRAM, &news_state::news_map); + // basic machine hardware + Z80(config, m_maincpu, 8'000'000); // ? MHz + m_maincpu->set_addrmap(AS_PROGRAM, &news_state::prg_map); m_maincpu->set_vblank_int("screen", FUNC(news_state::irq0_line_hold)); - /* video hardware */ + // video hardware screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_refresh_hz(60); screen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); screen.set_size(256, 256); screen.set_visarea(0, 256-1, 16, 256-16-1); - screen.set_screen_update(FUNC(news_state::screen_update_news)); + screen.set_screen_update(FUNC(news_state::screen_update)); screen.set_palette("palette"); GFXDECODE(config, m_gfxdecode, "palette", gfx_news); PALETTE(config, "palette").set_format(palette_device::xRGB_444, 0x100).set_endianness(ENDIANNESS_BIG); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); - OKIM6295(config, "oki", 1056000, okim6295_device::PIN7_HIGH).add_route(ALL_OUTPUTS, "mono", 1.0); // clock frequency & pin 7 not verified + OKIM6295(config, "oki", 1'056'000, okim6295_device::PIN7_HIGH).add_route(ALL_OUTPUTS, "mono", 1.0); // clock frequency & pin 7 not verified } ROM_START( news ) ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "virus.4", 0x00000, 0x08000, BAD_DUMP CRC(aa005dfb) SHA1(52f4dd399a30568851d43d052b83cfaa6682665d) ) /* The Original was too short, I padded it with 0xFF */ + ROM_LOAD( "virus.4", 0x00000, 0x08000, BAD_DUMP CRC(aa005dfb) SHA1(52f4dd399a30568851d43d052b83cfaa6682665d) ) // The Original was too short, I padded it with 0xFF - ROM_REGION( 0x80000, "gfx1", 0 ) + ROM_REGION( 0x80000, "tiles", 0 ) ROM_LOAD16_BYTE( "virus.2", 0x00000, 0x40000, CRC(b5af58d8) SHA1(5dd8c6ab8b53df695463bd0c3620adf8c08daaec) ) ROM_LOAD16_BYTE( "virus.3", 0x00001, 0x40000, CRC(a4b1c175) SHA1(b1ac0da4d91bc3a3454ea80aa4cdbbc68bbdf7f1) ) @@ -163,7 +279,7 @@ ROM_START( newsa ) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "newsa_virus.4", 0x00000, 0x10000, CRC(74a257da) SHA1(f1f6db521312f152ec3b1e6efa45a514433b2ffc) ) - ROM_REGION( 0x80000, "gfx1", 0 ) + ROM_REGION( 0x80000, "tiles", 0 ) ROM_LOAD16_BYTE( "virus.2", 0x00000, 0x40000, CRC(b5af58d8) SHA1(5dd8c6ab8b53df695463bd0c3620adf8c08daaec) ) ROM_LOAD16_BYTE( "virus.3", 0x00001, 0x40000, CRC(a4b1c175) SHA1(b1ac0da4d91bc3a3454ea80aa4cdbbc68bbdf7f1) ) @@ -171,5 +287,8 @@ ROM_START( newsa ) ROM_LOAD( "virus.1", 0x00000, 0x40000, CRC(41f5935a) SHA1(1566d243f165019660cd4dd69df9f049e0130f15) ) ROM_END +} // anonymous namespace + + GAME( 1993, news, 0, news, news, news_state, empty_init, ROT0, "Poby / Virus", "News (set 1)", MACHINE_SUPPORTS_SAVE ) GAME( 1993, newsa, news, news, newsa, news_state, empty_init, ROT0, "Poby", "News (set 2)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/misc/news.h b/src/mame/misc/news.h deleted file mode 100644 index 26cf5b644be..00000000000 --- a/src/mame/misc/news.h +++ /dev/null @@ -1,50 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:David Haywood -#ifndef MAME_INCLUDES_NEWS_H -#define MAME_INCLUDES_NEWS_H - -#pragma once - -#include "tilemap.h" - -class news_state : public driver_device -{ -public: - news_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_bgram(*this, "bgram"), - m_fgram(*this, "fgram"), - m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode") - { } - - void news(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<uint8_t> m_bgram; - required_shared_ptr<uint8_t> m_fgram; - - /* video-related */ - tilemap_t *m_fg_tilemap = nullptr; - tilemap_t *m_bg_tilemap = nullptr; - int m_bgpic = 0; - - required_device<cpu_device> m_maincpu; - required_device<gfxdecode_device> m_gfxdecode; - - void news_fgram_w(offs_t offset, uint8_t data); - void news_bgram_w(offs_t offset, uint8_t data); - void news_bgpic_w(uint8_t data); - TILE_GET_INFO_MEMBER(get_fg_tile_info); - TILE_GET_INFO_MEMBER(get_bg_tile_info); - uint32_t screen_update_news(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void news_map(address_map &map); -}; - -#endif // MAME_INCLUDES_NEWS_H diff --git a/src/mame/misc/news_v.cpp b/src/mame/misc/news_v.cpp deleted file mode 100644 index a3c31b75cd1..00000000000 --- a/src/mame/misc/news_v.cpp +++ /dev/null @@ -1,95 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:David Haywood -#include "emu.h" -#include "news.h" - - -/*************************************************************************** - - Callbacks for the TileMap code - -***************************************************************************/ - -TILE_GET_INFO_MEMBER(news_state::get_fg_tile_info) -{ - int code = (m_fgram[tile_index * 2] << 8) | m_fgram[tile_index * 2 + 1]; - tileinfo.set(0, - code & 0x0fff, - (code & 0xf000) >> 12, - 0); -} - -TILE_GET_INFO_MEMBER(news_state::get_bg_tile_info) -{ - int code = (m_bgram[tile_index * 2] << 8) | m_bgram[tile_index * 2 + 1]; - int color = (code & 0xf000) >> 12; - - code &= 0x0fff; - if ((code & 0x0e00) == 0x0e00) - code = (code & 0x1ff) | (m_bgpic << 9); - - tileinfo.set(0, - code, - color, - 0); -} - - - -/*************************************************************************** - - Start the video hardware emulation. - -***************************************************************************/ - -void news_state::video_start() -{ - m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(news_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); - m_fg_tilemap->set_transparent_pen(0); - - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(news_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); -} - - - -/*************************************************************************** - - Memory handlers - -***************************************************************************/ - -void news_state::news_fgram_w(offs_t offset, uint8_t data) -{ - m_fgram[offset] = data; - m_fg_tilemap->mark_tile_dirty(offset / 2); -} - -void news_state::news_bgram_w(offs_t offset, uint8_t data) -{ - m_bgram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset / 2); -} - -void news_state::news_bgpic_w(uint8_t data) -{ - if (m_bgpic != data) - { - m_bgpic = data; - m_bg_tilemap->mark_all_dirty(); - } -} - - - -/*************************************************************************** - - Display refresh - -***************************************************************************/ - -uint32_t news_state::screen_update_news(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - return 0; -} |