From 2cdb53e220f556ece96052e037412e8bb210028d Mon Sep 17 00:00:00 2001 From: angelosa Date: Sat, 1 Jul 2023 22:15:41 +0200 Subject: misc/jackpot.cpp: fix gfxdecoding, add NMI, CRTC and basic input hooks * allows to enter in gameplay (assuming pre-initialized EEPROM) --- src/mame/misc/jackpot.cpp | 176 +++++++++++++++++++++++++++++++--------------- 1 file changed, 118 insertions(+), 58 deletions(-) diff --git a/src/mame/misc/jackpot.cpp b/src/mame/misc/jackpot.cpp index 5bd43cca3ea..072ac5479d6 100644 --- a/src/mame/misc/jackpot.cpp +++ b/src/mame/misc/jackpot.cpp @@ -1,11 +1,23 @@ // license:BSD-3-Clause -// copyright-holders: +// copyright-holders: Angelo Salese +/************************************************************************************************** -/* Jackpot by Electronic Projects +TODO: +- Missing master unit comms (for game override?) + cfr. loads of unused GFXs, irq and NMI in work RAM space +- Glitches in attract, service and D-Up screens (requires an NMI mask?) +- Palette, RAMDAC? +- Sound; +- Complete I/O, identify chip type(s); +- EEPROM defaults (needs to be initialized in service mode for proper operation); + +Notes: The title is wrongly spelt as 'Jeckpot' in the main CPU ROM +=================================================================================================== + PCB: GAME CPU MOD.02 1x TMPZ84C0010PEC or compatible 8-bit Microprocessor - main @@ -27,15 +39,15 @@ PCB: GAME CPU MOD.02 1x green LED 1x red LED -NOTE: the PCB from which Version 16 was dumped has the following components removed (cost cutting measure?): YM3256, 1 LM358N, Y3014B, 16 TTL74xx +NOTE: the PCB from which Version 16 was dumped has the following components removed +(cost cutting measure?): YM3256, 1 LM358N, Y3014B, 16 TTL74xx + and some resistors and caps. Strangely, the sound ROMs are unchanged. -In the same period Electronic Projects also released games on different platforms (see jackpool.cpp and spool99.cpp) +In the same period Electronic Projects also released games on different platforms +(see jackpool.cpp and spool99.cpp) -TODO: -- everything, there are only stubbed functions to see the text tilemap on screen -- boot stops at 'test collegamento......master' (link test......master). -*/ +**************************************************************************************************/ #include "emu.h" #include "cpu/z80/z80.h" @@ -57,8 +69,12 @@ class jackpot_state : public driver_device public: jackpot_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_io(*this, "IN%u", 0U) + , m_crtc(*this, "crtc") , m_gfxdecode(*this, "gfxdecode") - , m_tx_videoram(*this, "tx_videoram") + , m_vram(*this, "vram") + , m_attr(*this, "attr") { } @@ -68,13 +84,18 @@ protected: virtual void video_start() override; private: + required_device m_maincpu; + required_ioport_array<2> m_io; + required_device m_crtc; required_device m_gfxdecode; - required_shared_ptr m_tx_videoram; + required_shared_ptr m_vram; + required_shared_ptr m_attr; - tilemap_t *m_tx_tilemap = nullptr; + tilemap_t *m_tilemap = nullptr; - TILE_GET_INFO_MEMBER(get_tx_tile_info); - void tx_videoram_w(offs_t offset, uint8_t data); + TILE_GET_INFO_MEMBER(get_tile_info); + void vram_w(offs_t offset, uint8_t data); + void attr_w(offs_t offset, uint8_t data); uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void prg_map(address_map &map); @@ -85,25 +106,36 @@ private: void jackpot_state:: video_start() { - m_tx_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(jackpot_state::get_tx_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); + m_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(jackpot_state::get_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 48, 32); } -TILE_GET_INFO_MEMBER(jackpot_state::get_tx_tile_info) +TILE_GET_INFO_MEMBER(jackpot_state::get_tile_info) { - uint8_t code = m_tx_videoram[tile_index]; - tileinfo.set(0, code, 0, 0); + const u8 attr = m_attr[tile_index]; + const u16 code = m_vram[tile_index] | ((attr & 0x1f) << 8); + // TODO: pinpoint how it banks to the other ROM + // (definitely can mix in the scanline renderer) + //const u8 color = (attr & 0xe0) >> 6; + const u8 gfx_region = 0; + tileinfo.set(gfx_region, code, 0, 0); } -void jackpot_state::tx_videoram_w(offs_t offset, uint8_t data) +void jackpot_state::vram_w(offs_t offset, uint8_t data) { - m_tx_videoram[offset] = data; - m_tx_tilemap->mark_tile_dirty(offset); + m_vram[offset] = data; + m_tilemap->mark_tile_dirty(offset); } -uint32_t jackpot_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +void jackpot_state::attr_w(offs_t offset, uint8_t data) { - m_tx_tilemap->draw(screen, bitmap, cliprect); + m_attr[offset] = data; + m_tilemap->mark_tile_dirty(offset); +} + +uint32_t jackpot_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_tilemap->draw(screen, bitmap, cliprect); return 0; } @@ -111,10 +143,26 @@ uint32_t jackpot_state::screen_update(screen_device &screen, bitmap_ind16 &bitma void jackpot_state::prg_map(address_map &map) { map(0x0000, 0x7fff).rom(); // after this, ROM is 0xff filled but in the range 0x1e000 - 0x1efff. Where does it get mapped? - map(0xd702, 0xd702).lr8(NAME([] () -> uint8_t { return 0xff; })); // 'attendere prego test hardware' (please wait hardware test), returning this is enough to progress. TODO: what's actually being tested? + // 0xd514, 0xd516 triplets for a 1bpp RAMDAC (???) + map(0xd518, 0xd51f).lr8( + NAME([this] (offs_t offset) { return BIT(m_io[0]->read(), offset); }) + ); + map(0xd520, 0xd527).lr8( + NAME([this] (offs_t offset) { return BIT(m_io[1]->read(), offset); }) + ); + map(0xd600, 0xd600).w(m_crtc, FUNC(mc6845_device::address_w)); + map(0xd601, 0xd601).rw(m_crtc, FUNC(mc6845_device::register_r), FUNC(mc6845_device::register_w)); + + // 'attendere prego test hardware' (please wait hardware test), returning this is enough to progress. + // TODO: Serial comms with a master unit for game override? + map(0xd702, 0xd702).lr8(NAME([] () -> uint8_t { return 0xff; })); + map(0xd800, 0xdfff).ram().share("nvram"); // MK48Z02B? - map(0xe000, 0xe3ff).ram().share(m_tx_videoram).w(FUNC(jackpot_state::tx_videoram_w)); - map(0xe400, 0xffff).ram(); // 0xf000-0xf3ff seems to be color RAM for the text tilemap + // 384x256 needs 0x600 bytes, assume the rest unmapped + map(0xe000, 0xe5ff).ram().share(m_vram).w(FUNC(jackpot_state::vram_w)); + map(0xe600, 0xefff).ram(); + map(0xf000, 0xf5ff).ram().share(m_attr).w(FUNC(jackpot_state::attr_w)); + map(0xf600, 0xf7ff).ram(); } void jackpot_state::sound_prg_map(address_map &map) @@ -132,23 +180,23 @@ void jackpot_state::sound_io_map(address_map &map) static INPUT_PORTS_START( jackpot ) PORT_START("IN0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_GAMBLE_KEYIN ) // TODO: unconfirmed + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME("Start / Double Up") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 ) // literally labeled as such in service mode, unused? PORT_START("IN1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_POKER_HOLD1 ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_POKER_HOLD2 ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_POKER_HOLD3 ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_POKER_HOLD4 ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_POKER_HOLD5 ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_GAMBLE_BET ) PORT_NAME("Bet / Cancel") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // no dips on PCB @@ -167,14 +215,19 @@ static const gfx_layout jackpot_layout = // taken from jackpool.cpp, needs work }; static GFXDECODE_START( gfx_jackpot ) - GFXDECODE_ENTRY( "gfx", 0, jackpot_layout, 0x00, 0x20 ) + GFXDECODE_ENTRY( "gfx1", 0, jackpot_layout, 0x00, 1 ) + GFXDECODE_ENTRY( "gfx2", 0, jackpot_layout, 0x00, 1 ) GFXDECODE_END void jackpot_state::jackpot(machine_config &config) // clocks not verified { - z80_device &maincpu(Z80(config, "maincpu", 3.579545_MHz_XTAL)); - maincpu.set_addrmap(AS_PROGRAM, &jackpot_state::prg_map); + Z80(config, m_maincpu, 3.579545_MHz_XTAL); + m_maincpu->set_addrmap(AS_PROGRAM, &jackpot_state::prg_map); + // TODO: IM1, irq0 and NMI valid (vectors provided in work RAM space) + // irq0 used for serial connection with master unit + // NMI must be at least masked and tied to 6845 vsync + m_maincpu->set_vblank_int("screen", FUNC(jackpot_state::nmi_line_pulse)); z80_device &audiocpu(Z80(config, "audiocpu", 3.579545_MHz_XTAL)); audiocpu.set_addrmap(AS_PROGRAM, &jackpot_state::sound_prg_map); @@ -183,7 +236,7 @@ void jackpot_state::jackpot(machine_config &config) // clocks not verified EEPROM_93C66_8BIT(config, "eeprom"); NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); - // all wrong + // reset by the CRTC with 384x256, 55.93 Hz (tentative) screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_refresh_hz(60); screen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); @@ -195,10 +248,11 @@ void jackpot_state::jackpot(machine_config &config) // clocks not verified GFXDECODE(config, m_gfxdecode, "palette", gfx_jackpot); PALETTE(config, "palette").set_entries(0x100); - mc6845_device &crtc(MC6845(config, "crtc", 13_MHz_XTAL / 8)); // divisor guessed - crtc.set_screen("screen"); - crtc.set_show_border_area(false); - crtc.set_char_width(8); // to be verified + MC6845(config, m_crtc, 13_MHz_XTAL / 16); // divisor guessed + m_crtc->set_screen("screen"); + m_crtc->set_show_border_area(false); + m_crtc->set_char_width(8); +// m_crtc->out_vsync_callback().set_inputline(m_maincpu, INPUT_LINE_NMI); SPEAKER(config, "mono").front_center(); @@ -217,15 +271,17 @@ ROM_START( jackpot ) ROM_LOAD( "electronic_projects_ver_wav1.bin", 0x010000, 0x80000, CRC(83c8f52c) SHA1(216009aeceee7ed8883cde708895d06934d33092) ) ROM_LOAD( "electronic_projects_ver_wav2.bin", 0x090000, 0x80000, CRC(993a8a01) SHA1(91f9e61dd1844dba079886f97582f74d6191c645) ) - ROM_REGION(0xc0000, "gfx", 0) + ROM_REGION(0x40000, "gfx1", 0) + ROM_LOAD( "electronic_projects_ver_cm0116.bin", 0x00000, 0x10000, CRC(48828c6c) SHA1(45769616ca3d88b3fe36fd4c7cfad47478e26825) ) + ROM_LOAD( "electronic_projects_ver_cm0216.bin", 0x10000, 0x10000, CRC(29e37e9c) SHA1(cc6db27f0d6d45cdfd93c89cac0b8c975e96ea97) ) + ROM_LOAD( "electronic_projects_ver_cm0316.bin", 0x20000, 0x10000, CRC(ac70bfaf) SHA1(1b76110a90685c1a285f1ce2312890d630129515) ) + ROM_LOAD( "electronic_projects_ver_cm0416.bin", 0x30000, 0x10000, CRC(7a2490bd) SHA1(1ca35afb6231247f898310c088997e7645657bc8) ) + + ROM_REGION(0x80000, "gfx2", 0) ROM_LOAD( "electronic_projects_ver_cf0116.bin", 0x00000, 0x20000, CRC(a1c35934) SHA1(bad97a660b2f039c7274496cdf9c4d5dd38eeea4) ) ROM_LOAD( "electronic_projects_ver_cf0216.bin", 0x20000, 0x20000, CRC(00d66627) SHA1(67185474181b10b7a2fc1f7a43f0c8e2a9d8eee3) ) ROM_LOAD( "electronic_projects_ver_cf0316.bin", 0x40000, 0x20000, CRC(7d8c8781) SHA1(5085301332c4f642f8c6157eda1aaad1866da246) ) ROM_LOAD( "electronic_projects_ver_cf0416.bin", 0x60000, 0x20000, CRC(c266c470) SHA1(5042c6a2d554e1e2437d2d79c5aa7c9c3642e173) ) - ROM_LOAD( "electronic_projects_ver_cm0116.bin", 0x80000, 0x10000, CRC(48828c6c) SHA1(45769616ca3d88b3fe36fd4c7cfad47478e26825) ) - ROM_LOAD( "electronic_projects_ver_cm0216.bin", 0x90000, 0x10000, CRC(29e37e9c) SHA1(cc6db27f0d6d45cdfd93c89cac0b8c975e96ea97) ) - ROM_LOAD( "electronic_projects_ver_cm0316.bin", 0xa0000, 0x10000, CRC(ac70bfaf) SHA1(1b76110a90685c1a285f1ce2312890d630129515) ) - ROM_LOAD( "electronic_projects_ver_cm0416.bin", 0xb0000, 0x10000, CRC(7a2490bd) SHA1(1ca35afb6231247f898310c088997e7645657bc8) ) ROM_REGION(0x800, "nvram", 0) ROM_LOAD( "mk48z02b.bin", 0x000, 0x800, CRC(b182f4f3) SHA1(b6f04c343fefca2c506a99fb3293697e6e8522f6) ) @@ -248,15 +304,19 @@ ROM_START( jackpota ) ROM_LOAD( "jackpot_electronic_projects_eprom_n.12.bin", 0x010000, 0x80000, CRC(83c8f52c) SHA1(216009aeceee7ed8883cde708895d06934d33092) ) ROM_LOAD( "jackpot_electronic_projects_eprom_n.11.bin", 0x090000, 0x80000, CRC(993a8a01) SHA1(91f9e61dd1844dba079886f97582f74d6191c645) ) - ROM_REGION(0x180000, "gfx", 0) + // both gfx regions have duplicated GFXs with different bitplane info + // is it accessible by the game via a bank? + ROM_REGION(0x80000, "gfx1", 0) ROM_LOAD( "jackpot_electronic_projects_eprom_n.2.bin", 0x000000, 0x20000, CRC(c1fcc900) SHA1(7c2e8f3e59fa2af99a358127705e8b49d577d777) ) ROM_LOAD( "jackpot_electronic_projects_eprom_n.3.bin", 0x020000, 0x20000, CRC(6f9eac8e) SHA1(a775d23fb70b69e573a94f2cd33dfc7664f158c2) ) ROM_LOAD( "jackpot_electronic_projects_eprom_n.4.bin", 0x040000, 0x20000, CRC(6301c5ca) SHA1(6ca1d4c34ad5a25608ffd44e3e0ab40d546a3d7c) ) ROM_LOAD( "jackpot_electronic_projects_eprom_n.5.bin", 0x060000, 0x20000, CRC(b60fb8ef) SHA1(5597bdff871d5a80efe1f054d0a7bf9820d4f75f) ) - ROM_LOAD( "jackpot_electronic_projects_eprom_n.6.bin", 0x080000, 0x40000, CRC(1c6cde6c) SHA1(89d0274083e4b94b9c6715084b30b5ee5db1d96e) ) - ROM_LOAD( "jackpot_electronic_projects_eprom_n.7.bin", 0x0c0000, 0x40000, CRC(07f1f69e) SHA1(ff966f1b1da8ea81a06f909dae3fa57d88bbd496) ) - ROM_LOAD( "jackpot_electronic_projects_eprom_n.8.bin", 0x100000, 0x40000, CRC(e7090d10) SHA1(1a72b13d68b7e6c9182ec4786f6bb578e9fc8f0e) ) - ROM_LOAD( "jackpot_electronic_projects_eprom_n.9.bin", 0x140000, 0x40000, CRC(ee76110c) SHA1(5634f8de0cc8613b3f016abc7614a2abb0730060) ) + + ROM_REGION(0x100000, "gfx2", 0) + ROM_LOAD( "jackpot_electronic_projects_eprom_n.6.bin", 0x000000, 0x40000, CRC(1c6cde6c) SHA1(89d0274083e4b94b9c6715084b30b5ee5db1d96e) ) + ROM_LOAD( "jackpot_electronic_projects_eprom_n.7.bin", 0x040000, 0x40000, CRC(07f1f69e) SHA1(ff966f1b1da8ea81a06f909dae3fa57d88bbd496) ) + ROM_LOAD( "jackpot_electronic_projects_eprom_n.8.bin", 0x080000, 0x40000, CRC(e7090d10) SHA1(1a72b13d68b7e6c9182ec4786f6bb578e9fc8f0e) ) + ROM_LOAD( "jackpot_electronic_projects_eprom_n.9.bin", 0x0c0000, 0x40000, CRC(ee76110c) SHA1(5634f8de0cc8613b3f016abc7614a2abb0730060) ) ROM_REGION(0x800, "nvram", 0) ROM_LOAD( "mk48z02b.bin", 0x000, 0x800, CRC(005d9ae1) SHA1(cd738ed44c7f016948a42612d37d00b0a56658c3) ) @@ -273,5 +333,5 @@ ROM_END } // Anonymous namespace -GAME( 1988, jackpot, 0, jackpot, jackpot, jackpot_state, empty_init, ROT0, "Electronic Projects", "Jackpot (Ver 16.16L)", MACHINE_IS_SKELETON ) // 08.09.98 -GAME( 1988, jackpota, jackpot, jackpot, jackpot, jackpot_state, empty_init, ROT0, "Electronic Projects", "Jackpot (Ver 1.16L)", MACHINE_IS_SKELETON ) // 01.09.98 +GAME( 1998, jackpot, 0, jackpot, jackpot, jackpot_state, empty_init, ROT0, "Electronic Projects", "Jackpot (Ver 16.16L)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND | MACHINE_IMPERFECT_GRAPHICS ) // 08.09.98 +GAME( 1988, jackpota, jackpot, jackpot, jackpot, jackpot_state, empty_init, ROT0, "Electronic Projects", "Jackpot (Ver 1.16L)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND | MACHINE_IMPERFECT_GRAPHICS ) // 01.09.98 -- cgit v1.2.3