diff --git a/src/mame/drivers/rbmk.cpp b/src/mame/drivers/rbmk.cpp index 8df929c1d6d..486a01a089c 100644 --- a/src/mame/drivers/rbmk.cpp +++ b/src/mame/drivers/rbmk.cpp @@ -66,19 +66,21 @@ Keep pressed 9 and press reset to enter service mode. #include "speaker.h" +namespace { + class rbmk_state : public driver_device { public: rbmk_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) - , m_vidram2(*this, "vidram2") - , m_vidram(*this, "vidram") + , m_vidram(*this, "vidram%u", 1U) , m_maincpu(*this, "maincpu") , m_mcu(*this, "mcu") , m_eeprom(*this, "eeprom") , m_gfxdecode(*this, "gfxdecode") , m_palette(*this, "palette") , m_ymsnd(*this, "ymsnd") + , m_dsw(*this, "DSW%u", 1U) { } @@ -91,8 +93,7 @@ protected: virtual void video_start() override; private: - required_shared_ptr m_vidram2; - required_shared_ptr m_vidram; + optional_shared_ptr_array m_vidram; required_device m_maincpu; optional_device m_mcu; @@ -100,6 +101,7 @@ private: required_device m_gfxdecode; required_device m_palette; required_device m_ymsnd; + required_ioport_array<3> m_dsw; uint16_t m_tilebank; uint8_t m_mux_data; @@ -139,12 +141,12 @@ definitely muxed dips. See switch test in test mode. This implementation doesn't uint16_t res = 0xffff; switch(m_dip_mux) { -case 0x1000: res = ioport("DSW1")->read(); break; -case 0x2000: res = ioport("DSW2")->read(); break; -case 0x4000: res = ioport("DSW3")->read(); break; +case 0x1000: res = m_dsw[0]->read(); break; +case 0x2000: res = m_dsw[1]->read(); break; +case 0x4000: res = m_dsw[2]->read(); break; } return res;*/ - return ioport("DSW1")->read(); + return m_dsw[0]->read(); } void rbmk_state::tilebank_w(uint16_t data) @@ -179,10 +181,10 @@ void rbmk_state::rbmk_mem(address_map &map) map(0x000000, 0x07ffff).rom().nopw(); map(0x100000, 0x10ffff).ram(); map(0x500000, 0x50ffff).ram(); - map(0x940000, 0x940fff).ram().share("vidram2"); + map(0x940000, 0x940fff).ram().share(m_vidram[1]); map(0x980300, 0x983fff).ram(); // 0x2048 words ???, byte access map(0x900000, 0x900fff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); - map(0x9c0000, 0x9c0fff).ram().share("vidram"); + map(0x9c0000, 0x9c0fff).ram().share(m_vidram[0]); map(0xb00000, 0xb00001).w(FUNC(rbmk_state::eeprom_w)); map(0xc00000, 0xc00001).rw(FUNC(rbmk_state::dip_mux_r), FUNC(rbmk_state::dip_mux_w)); map(0xc08000, 0xc08001).portr("IN1").w(FUNC(rbmk_state::tilebank_w)); @@ -204,9 +206,9 @@ void rbmk_state::rbspm_mem(address_map &map) map(0x328000, 0x328001).w(FUNC(rbmk_state::unk_w)); map(0x500000, 0x50ffff).ram(); map(0x900000, 0x900fff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); // if removed fails gfx test? - map(0x940000, 0x940fff).ram().share("vidram2"); // if removed fails palette test? + map(0x940000, 0x940fff).ram().share(m_vidram[1]); // if removed fails palette test? map(0x980300, 0x983fff).ram(); // 0x2048 words ???, byte access, u25 and u26 according to test mode - map(0x9c0000, 0x9c0fff).ram().share("vidram"); + map(0x9c0000, 0x9c0fff).ram().share(m_vidram[0]); } void rbmk_state::magslot_mem(address_map &map) @@ -220,10 +222,10 @@ void rbmk_state::magslot_mem(address_map &map) map(0x620000, 0x620001).portr("IN3"); map(0x628000, 0x628001).w(FUNC(rbmk_state::unk_w)); map(0x900000, 0x900fff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); - map(0x940000, 0x940fff).ram().share("vidram2"); + map(0x940000, 0x940fff).ram().share(m_vidram[1]); map(0x980000, 0x983fff).ram(); - map(0x9c0000, 0x9c0fff).ram().share("vidram"); - map(0x9e0000, 0x9e0fff).ram().share("vidram3"); + map(0x9c0000, 0x9c0fff).ram().share(m_vidram[0]); + map(0x9e0000, 0x9e0fff).ram().share(m_vidram[2]); //map(0xf00000, 0xf00001).w(FUNC(rbmk_state::eeprom_w)); // wrong? } @@ -234,32 +236,32 @@ void rbmk_state::mcu_mem(address_map &map) uint8_t rbmk_state::mcu_io_r(offs_t offset) { - if(m_mux_data & 8) + if (m_mux_data & 8) { return m_ymsnd->read(offset & 1); } - else if(m_mux_data & 4) + else if (m_mux_data & 4) { //printf("%02x R\n",offset); // ... return 0xff; } else - printf("Warning: mux data R = %02x",m_mux_data); + printf("Warning: mux data R = %02x", m_mux_data); return 0xff; } void rbmk_state::mcu_io_w(offs_t offset, uint8_t data) { - if(m_mux_data & 8) { m_ymsnd->write(offset & 1, data); } - else if(m_mux_data & 4) + if (m_mux_data & 8) { m_ymsnd->write(offset & 1, data); } + else if (m_mux_data & 4) { - //printf("%02x %02x W\n",offset,data); + //printf("%02x %02x W\n", offset, data); // ... } else - printf("Warning: mux data W = %02x",m_mux_data); + printf("Warning: mux data W = %02x", m_mux_data); } void rbmk_state::mcu_io_mux_w(uint8_t data) @@ -273,7 +275,7 @@ void rbmk_state::mcu_io(address_map &map) } static INPUT_PORTS_START( rbmk ) - PORT_START("IN1") /* 16bit */ + PORT_START("IN1") // 16bit PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN1 ) @@ -291,7 +293,7 @@ static INPUT_PORTS_START( rbmk ) PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_START("IN2") /* 16bit */ + PORT_START("IN2") // 16bit PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_GAMBLE_BOOK ) PORT_TOGGLE PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MEMORY_RESET ) PORT_TOGGLE PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN2 ) @@ -310,7 +312,7 @@ static INPUT_PORTS_START( rbmk ) PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, do_read) - PORT_START("DSW1") /* 16bit, in test mode first 8 are recognised as dsw1, second 8 as dsw4*/ + PORT_START("DSW1") // 16bit, in test mode first 8 are recognised as dsw1, second 8 as dsw4 PORT_DIPNAME( 0x0001, 0x0001, "DSW1" ) PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) @@ -361,7 +363,7 @@ static INPUT_PORTS_START( rbmk ) PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_START("DSW2") /* 16bit, in test mode first 8 are recognised as dsw2, second 8 as dsw5*/ + PORT_START("DSW2") // 16bit, in test mode first 8 are recognised as dsw2, second 8 as dsw5 PORT_DIPNAME( 0x0001, 0x0001, "DSW2" ) // 1,2,3 should be coinage PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) @@ -411,7 +413,7 @@ static INPUT_PORTS_START( rbmk ) PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_START("DSW3") /* 16bit, in test mode first 8 are recognised as dsw3, second 8 as dsw6*/ + PORT_START("DSW3") // 16bit, in test mode first 8 are recognised as dsw3, second 8 as dsw6 PORT_DIPNAME( 0x0001, 0x0001, "DSW3" ) PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) @@ -461,7 +463,7 @@ static INPUT_PORTS_START( rbmk ) PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_START("IN3") /* 16bit, not verified in test mode? */ + PORT_START("IN3") // 16bit, not verified in test mode? PORT_DIPNAME( 0x0001, 0x0001, "IN3" ) PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) @@ -787,6 +789,19 @@ static const gfx_layout rbmk8_layout = 8*32 }; +static const gfx_layout magslot16_layout = // TODO: not correct +{ + 16,16, + RGN_FRAC(1,1), + 8, + {8, 9,10, 11, 0, 1, 2, 3 }, + { 0, 4, 16, 20, 32, 36, 48, 52, + 512+0,512+4,512+16,512+20,512+32,512+36,512+48,512+52}, + { 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64, + 1024+0*16,1024+1*64,1024+2*64,1024+3*64,1024+4*64,1024+5*64,1024+6*64,1024+7*64}, + 32*64 +}; + static GFXDECODE_START( gfx_rbmk ) GFXDECODE_ENTRY( "gfx1", 0, rbmk32_layout, 0x0, 16 ) @@ -794,9 +809,9 @@ static GFXDECODE_START( gfx_rbmk ) GFXDECODE_END static GFXDECODE_START( gfx_magslot ) - GFXDECODE_ENTRY( "gfx1", 0, rbmk32_layout, 0x0, 16 ) // wrong - GFXDECODE_ENTRY( "gfx2", 0, rbmk8_layout, 0x100, 16 ) - GFXDECODE_ENTRY( "gfx3", 0, rbmk8_layout, 0x100, 16 ) // wrong colors + GFXDECODE_ENTRY( "gfx1", 0, magslot16_layout, 0x000, 16 ) + GFXDECODE_ENTRY( "gfx2", 0, rbmk8_layout, 0x100, 16 ) + GFXDECODE_ENTRY( "gfx3", 0, rbmk8_layout, 0x100, 16 ) // wrong colors GFXDECODE_END void rbmk_state::video_start() @@ -808,27 +823,26 @@ void rbmk_state::video_start() uint32_t rbmk_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x,y; int count = 0; - for (y=0;y<8;y++) + for (int y = 0; y < 8; y++) { - for (x=0;x<64;x++) + for (int x = 0; x < 64; x++) { - int tile = m_vidram2[count+0x600]; - m_gfxdecode->gfx(0)->opaque(bitmap,cliprect,(tile&0xfff)+((m_tilebank&0x10)>>4)*0x1000,tile>>12,0,0,x*8,y*32); + int tile = m_vidram[1][count + 0x600]; + m_gfxdecode->gfx(0)->opaque(bitmap, cliprect, (tile & 0xfff) + ((m_tilebank & 0x10) >> 4) * 0x1000, tile >> 12, 0, 0, x * 8, y * 32); count++; } } count=0; - for (y=0;y<32;y++) + for (int y = 0; y < 32; y++) { - for (x=0;x<64;x++) + for (int x = 0; x < 64; x++) { - int tile = m_vidram[count]; - m_gfxdecode->gfx(1)->transpen(bitmap,cliprect,(tile&0xfff)+((m_tilebank>>1)&3)*0x1000,tile>>12,0,0,x*8,y*8,0); + int tile = m_vidram[0][count]; + m_gfxdecode->gfx(1)->transpen(bitmap, cliprect, (tile & 0xfff) + ((m_tilebank >> 1) & 3) * 0x1000, tile >> 12, 0, 0, x * 8, y * 8, 0); count++; } } @@ -837,11 +851,11 @@ uint32_t rbmk_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, void rbmk_state::rbmk(machine_config &config) { - M68000(config, m_maincpu, 22000000 /2); + M68000(config, m_maincpu, 22_MHz_XTAL / 2); m_maincpu->set_addrmap(AS_PROGRAM, &rbmk_state::rbmk_mem); m_maincpu->set_vblank_int("screen", FUNC(rbmk_state::irq1_line_hold)); - AT89C4051(config, m_mcu, 22000000 / 4); // frequency isn't right + AT89C4051(config, m_mcu, 22_MHz_XTAL / 4); // frequency isn't right m_mcu->set_addrmap(AS_PROGRAM, &rbmk_state::mcu_mem); m_mcu->set_addrmap(AS_IO, &rbmk_state::mcu_io); m_mcu->port_out_cb<3>().set(FUNC(rbmk_state::mcu_io_mux_w)); @@ -863,11 +877,11 @@ void rbmk_state::rbmk(machine_config &config) SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); - okim6295_device &oki(OKIM6295(config, "oki", 1122000, okim6295_device::PIN7_HIGH)); // clock frequency & pin 7 not verified + okim6295_device &oki(OKIM6295(config, "oki", 22_MHz_XTAL / 20, okim6295_device::PIN7_HIGH)); // pin 7 not verified oki.add_route(ALL_OUTPUTS, "lspeaker", 0.47); oki.add_route(ALL_OUTPUTS, "rspeaker", 0.47); - YM2151(config, m_ymsnd, 22000000 / 8); + YM2151(config, m_ymsnd, 22_MHz_XTAL / 8); m_ymsnd->add_route(0, "lspeaker", 0.60); m_ymsnd->add_route(1, "rspeaker", 0.60); } @@ -887,33 +901,31 @@ void rbmk_state::magslot(machine_config &config) config.device_remove("mcu"); - // PIC16F84 but no CPU core available - m_gfxdecode->set_info(gfx_magslot); } // 实战麻将王 (Shízhàn Májiàng Wáng) ROM_START( rbmk ) - ROM_REGION( 0x80000, "maincpu", 0 ) /* 68000 Code */ + ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 Code ROM_LOAD( "p1.u64", 0x00000, 0x80000, CRC(83b3c505) SHA1(b943d7312dacdf46d4a55f9dc3cf92e291c40ce7) ) - ROM_REGION( 0x1000, "mcu", 0 ) /* protected MCU? */ + ROM_REGION( 0x1000, "mcu", 0 ) // protected MCU? ROM_LOAD( "89c51.bin", 0x0, 0x1000, CRC(c6d58031) SHA1(5c61ce4eef1ef29bd870d0678bdba24e5aa43eae) ) - ROM_REGION( 0x20000, "user1", 0 ) /* ??? mcu data / code */ + ROM_REGION( 0x20000, "user1", 0 ) // ??? MCU data / code ROM_LOAD( "b1.u72", 0x00000, 0x20000, CRC(1a4991ac) SHA1(523b58caa21b4a073c664c076d2d7bb07a4253cd) ) - ROM_REGION( 0x040000, "oki", 0 ) /* Samples */ + ROM_REGION( 0x040000, "oki", 0 ) ROM_LOAD( "s1.u83", 0x00000, 0x40000, CRC(44b20e47) SHA1(54691af73aa5d20f9a9afe145447ef1cf34c9a0c) ) - ROM_REGION( 0x100000, "gfx1", 0 ) /* 8x32 tiles, lots of girls etc. */ + ROM_REGION( 0x100000, "gfx1", 0 ) // 8x32 tiles, lots of girls etc. ROM_LOAD( "a1.u41", 0x00000, 0x100000, CRC(1924de6b) SHA1(1a72ee2fd0abca51893f0985a591573bfd429389) ) - ROM_REGION( 0x80000, "gfx2", 0 ) /* 8x8 tiles? cards etc */ + ROM_REGION( 0x80000, "gfx2", 0 ) // 8x8 tiles? cards etc ROM_LOAD( "t1.u39", 0x00000, 0x80000, CRC(adf67429) SHA1(ab03c7f68403545f9e86a069581dc3fc3fa6b9c4) ) - ROM_REGION16_BE( 0x80, "eeprom", 0 ) /* eeprom */ + ROM_REGION16_BE( 0x80, "eeprom", 0 ) ROM_LOAD16_WORD_SWAP( "93c46.u51", 0x00, 0x080, CRC(4ca6ff01) SHA1(66c456eac5b0d1176ef9130baf2e746efdf30152) ) ROM_END @@ -925,42 +937,38 @@ http://youtu.be/VGbrR7GfDck */ ROM_START( rbspm ) - ROM_REGION( 0x80000, "maincpu", 0 ) /* 68000 Code */ + ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 Code ROM_LOAD( "mj-dfmj-p1.bin", 0x00000, 0x80000, CRC(8f81f154) SHA1(50a9a373dec96b0265907f053d068d636bdabd61) ) - ROM_REGION( 0x1000, "mcu", 0 ) /* protected MCU */ + ROM_REGION( 0x1000, "mcu", 0 ) // protected MCU ROM_LOAD( "mj-dfmj_at89c51.bin", 0x0000, 0x1000, CRC(c6c48161) SHA1(c3ecf998820d758286b18896ff7860221dd0cf43) ) // decapped - ROM_REGION( 0x880, "pic", 0 ) /* pic was populated on this board */ + ROM_REGION( 0x880, "pic", 0 ) // pic was populated on this board ROM_LOAD( "c016_pic16f84_code.bin", 0x000, 0x800, CRC(1eb5cd2b) SHA1(9e747235e39eaea337f9325fa55fbfec1c03168d) ) ROM_LOAD( "c016_pic16f84_data.bin", 0x800, 0x080, CRC(ee882e11) SHA1(aa5852a95a89b17270bb6f315dfa036f9f8155cf) ) - ROM_REGION( 0x20000, "user1", 0 ) /* ??? mcu data / code */ + ROM_REGION( 0x20000, "user1", 0 ) // ??? MCU data / code ROM_LOAD( "mj-dfmj-2.2-xx.bin", 0x00000, 0x20000, CRC(58a9eea2) SHA1(1a251e9b049bc8dafbc0728b3d876fdd5a1c8dd9) ) - ROM_REGION( 0x080000, "oki", 0 ) /* Samples */ + ROM_REGION( 0x080000, "oki", 0 ) ROM_LOAD( "mj-dfmj-2.2-s1.bin", 0x00000, 0x80000, CRC(2410bb61) SHA1(54e258e4af089841a63e45f25aad70310a28d76b) ) // 1st and 2nd half identical - ROM_REGION( 0x80000, "gfx1", 0 ) /* 8x32 tiles, lots of girls etc. */ + ROM_REGION( 0x80000, "gfx1", 0 ) // 8x32 tiles, lots of girls etc. ROM_LOAD( "mj-dfmj-4.2-a1.bin", 0x00000, 0x80000, CRC(b0a3a866) SHA1(cc950532160a066fc6ce427f6df9d58ee4589821) ) - ROM_REGION( 0x80000, "gfx2", 0 ) /* 8x8 tiles? cards etc */ + ROM_REGION( 0x80000, "gfx2", 0 ) // 8x8 tiles? cards etc ROM_LOAD( "mj-dfmj-4.8-t1.bin", 0x00000, 0x80000, CRC(2b8b689d) SHA1(65ab643fac1e734af8b3a86caa06b532baafa0fe) ) - ROM_REGION16_BE( 0x80, "eeprom", 0 ) /* eeprom */ + ROM_REGION16_BE( 0x80, "eeprom", 0 ) ROM_LOAD16_WORD_SWAP( "93c46.u51", 0x00, 0x080, NO_DUMP ) ROM_END -// the PCB is slightly different from the others, both layout-wise and component-wyse, but it's mostly compatible. It seems to use one more GFX layer and not to have the 89C51. +// the PCB is slightly different from the others, both layout-wise and component-wise, but it's mostly compatible. It seems to use one more GFX layer and not to have the 89C51. ROM_START( magslot ) // All labels have SLOT canceled with a black pen. No sum matches the one on label. ROM_REGION( 0x80000, "maincpu", 0 ) /* 68000 Code */ ROM_LOAD( "magic 1.0c _ _ _ _.u64", 0x00000, 0x80000, CRC(84544dd7) SHA1(cf10ad3373c2f35f5fa7986be0865f760a454c28) ) // no sum on label, 1xxxxxxxxxxxxxxxxxx = 0x00 - ROM_REGION( 0x880, "pic", 0 ) // pic is assumed populated under the plastic cover - ROM_LOAD( "pic16f84_code.bin", 0x000, 0x800, NO_DUMP ) - ROM_LOAD( "pic16f84_data.bin", 0x800, 0x080, NO_DUMP ) - ROM_REGION( 0x080000, "oki", 0 ) ROM_LOAD( "magic s1.0c ba8d.u83", 0x00000, 0x80000, CRC(46df3564) SHA1(6b740ca1fd839f7e7e35f097457e87d1260a6aaf) ) @@ -974,13 +982,15 @@ ROM_START( magslot ) // All labels have SLOT canceled with a black pen. No sum m ROM_LOAD( "magic u1.0c f7f6.u169", 0x00000, 0x40000, CRC(582631d3) SHA1(92d1b767bc7ef15eed6dad599392c17620210678) ) ROM_REGION16_BE( 0x80, "eeprom", 0 ) - ROM_LOAD16_WORD_SWAP( "93c46.u136", 0x00, 0x080, NO_DUMP ) + ROM_LOAD16_WORD_SWAP( "is93c46.u136", 0x00, 0x080, CRC(47ef702d) SHA1(269f3aff70cbf5144795b77953eb582d8c4da22a) ) ROM_END +} // anonymous namespace + // mahjong GAME( 1998, rbmk, 0, rbmk, rbmk, rbmk_state, empty_init, ROT0, "GMS", "Shizhan Majiang Wang (Version 8.8)", MACHINE_NOT_WORKING ) GAME( 1998, rbspm, 0, rbspm, rbspm, rbmk_state, empty_init, ROT0, "GMS", "Shizhan Ding Huang Maque (Version 4.1)", MACHINE_NOT_WORKING ) // slot, on slightly different PCB -GAME( 2003, magslot, 0, magslot, magslot, rbmk_state, empty_init, ROT0, "GMS", "Magic Slot (normal 1.0C)", MACHINE_NOT_WORKING ) // needs implementing of 3rd GFX layer, correct GFX decode, PIC dump and core, inputs +GAME( 2003, magslot, 0, magslot, magslot, rbmk_state, empty_init, ROT0, "GMS", "Magic Slot (normal 1.0C)", MACHINE_NOT_WORKING ) // needs implementing of 3rd GFX layer, correct GFX decode for 1st layer, inputs