diff --git a/src/mame/drivers/rgum.cpp b/src/mame/drivers/rgum.cpp index bdc3839667d..eb93f600e25 100644 --- a/src/mame/drivers/rgum.cpp +++ b/src/mame/drivers/rgum.cpp @@ -4,26 +4,37 @@ Royal Gum -Unknown CPU (either Z80 or Z180) - or at least rgum.u47 looks z80 related -rgum.u5 is for a 6502? +Main components +- Big Black Box in the middle of the PCB. Contains the main CPU (some kind of M6502) and maybe the 6845 (not seen anywhere on PCB) +- 24.000000 Mhz osc +- 2 x M82C55A +- AY38910A/P +- NEC UPD7759 +- MK48Z08B-10 +- 1 8-dip bank +- 1 4-dip bank -Big Black Box in the middle of the PCB (for encryption, or containing roms?) - -The ppi at 3000-3003 seems to be a dual port communication thing with the z80. +TODO: +- stuck at the play screen with 'attendere' (wait) message; +- some devices aren't mapped and others may be mapped wrong +- currently hacked to display something (see ay port A read) */ #include "emu.h" #include "cpu/m6502/m65c02.h" -#include "cpu/z80/z80.h" #include "machine/i8255.h" +#include "machine/nvram.h" #include "sound/ay8910.h" +#include "sound/upd7759.h" #include "video/mc6845.h" #include "emupal.h" #include "screen.h" #include "speaker.h" +namespace { + class rgum_state : public driver_device { public: @@ -39,37 +50,42 @@ public: DECLARE_READ_LINE_MEMBER(heartbeat_r); +protected: + virtual void video_start() override; + private: required_shared_ptr m_vram; required_shared_ptr m_cram; - uint8_t m_hbeat; - virtual void video_start() override; - uint32_t screen_update_royalgum(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); required_device m_maincpu; required_device m_gfxdecode; required_device m_palette; - void rgum_map(address_map &map); + uint8_t m_hbeat; + + uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + void main_map(address_map &map); }; void rgum_state::video_start() { + m_hbeat = 0; + + save_item(NAME(m_hbeat)); } -uint32_t rgum_state::screen_update_royalgum(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +uint32_t rgum_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y,count; gfx_element *gfx = m_gfxdecode->gfx(0); - count = 0; + int count = 0; - for(y=0;y<32;y++) + for (int y = 0; y < 32; y++) { - for(x=0;x<66;x++) + for (int x = 0;x < 66; x++) { - int tile = m_vram[count] | ((m_cram[count] & 0xf) <<8); + int tile = m_vram[count] | ((m_cram[count] & 0xf) << 8); - gfx->opaque(bitmap,cliprect,tile,0,0,0,x*8,y*8); + gfx->opaque(bitmap, cliprect, tile, 0, 0, 0, x * 8, y * 8); count++; } @@ -78,9 +94,9 @@ uint32_t rgum_state::screen_update_royalgum(screen_device &screen, bitmap_rgb32 return 0; } -void rgum_state::rgum_map(address_map &map) +void rgum_state::main_map(address_map &map) // TODO: map MK48Z08B-10, second 8255, UPD7759 { - map(0x0000, 0x07ff).ram(); //not all of it? + map(0x0000, 0x07ff).ram(); // not all of it? map(0x0800, 0x0800).w("crtc", FUNC(mc6845_device::address_w)); map(0x0801, 0x0801).rw("crtc", FUNC(mc6845_device::register_r), FUNC(mc6845_device::register_w)); @@ -88,13 +104,16 @@ void rgum_state::rgum_map(address_map &map) map(0x2000, 0x2000).w("aysnd", FUNC(ay8910_device::data_w)); map(0x2002, 0x2002).rw("aysnd", FUNC(ay8910_device::data_r), FUNC(ay8910_device::address_w)); - map(0x2801, 0x2801).nopr(); //read but value discarded? + map(0x2801, 0x2801).nopr(); // read but value discarded? + map(0x2802, 0x2802).nopr(); map(0x2803, 0x2803).nopr(); - map(0x3000, 0x3003).rw("ppi8255", FUNC(i8255_device::read), FUNC(i8255_device::write)); + // map(0x2c00, 0x2c03).w(); // ? - map(0x4000, 0x47ff).ram().share("vram"); - map(0x5000, 0x57ff).ram().share("cram"); + map(0x3000, 0x3003).rw("ppi8255_0", FUNC(i8255_device::read), FUNC(i8255_device::write)); + + map(0x4000, 0x47ff).ram().share(m_vram); + map(0x5000, 0x57ff).ram().share(m_cram); map(0x8000, 0xffff).rom(); } @@ -172,8 +191,21 @@ static INPUT_PORTS_START( rgum ) PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNKNOWN ) //communication port with the z80? + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + // TODO: should be 1 8-dip bank and 1 4-dip bank PORT_START("DSW1") PORT_DIPNAME( 0x01, 0x01, "DSW1" ) PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) @@ -181,7 +213,7 @@ static INPUT_PORTS_START( rgum ) PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) // changes some words from Italian to French and back PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) @@ -213,7 +245,7 @@ static INPUT_PORTS_START( rgum ) PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) // SW2 dip 1 PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) @@ -241,64 +273,81 @@ static const gfx_layout tiles8x8_layout = }; static GFXDECODE_START( gfx_rgum ) - GFXDECODE_ENTRY( "gfx1", 0, tiles8x8_layout, 0, 16 ) + GFXDECODE_ENTRY( "tiles", 0, tiles8x8_layout, 0, 16 ) GFXDECODE_END void rgum_state::rgum(machine_config &config) { - /* basic machine hardware */ - M65C02(config, m_maincpu, 24000000/16); /* ? MHz */ - m_maincpu->set_addrmap(AS_PROGRAM, &rgum_state::rgum_map); + // basic machine hardware + M65C02(config, m_maincpu, 24_MHz_XTAL / 16); // divisor not verified + m_maincpu->set_addrmap(AS_PROGRAM, &rgum_state::main_map); - /* video hardware */ + // NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); // MK48Z08 + + i8255_device &ppi(I8255A(config, "ppi8255_0")); + ppi.in_pa_callback().set_ioport("IN0"); + ppi.in_pb_callback().set_ioport("DSW1"); + ppi.in_pc_callback().set_ioport("DSW2"); + + I8255A(config, "ppi8255_1"); + + // 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, 0, 256-1); - screen.set_screen_update(FUNC(rgum_state::screen_update_royalgum)); + screen.set_screen_update(FUNC(rgum_state::screen_update)); - mc6845_device &crtc(MC6845(config, "crtc", 24000000/16)); /* unknown clock & type, hand tuned to get ~50 fps (?) */ + mc6845_device &crtc(MC6845(config, "crtc", 24_MHz_XTAL / 16)); // unknown clock & type, hand tuned to get ~50 fps (?) crtc.set_screen("screen"); crtc.set_show_border_area(false); crtc.set_char_width(8); crtc.out_vsync_callback().set_inputline(m_maincpu, INPUT_LINE_NMI); - i8255_device &ppi(I8255A(config, "ppi8255")); - ppi.in_pa_callback().set_ioport("IN0"); - ppi.in_pb_callback().set_ioport("IN1"); - ppi.in_pc_callback().set_ioport("IN2"); - GFXDECODE(config, m_gfxdecode, m_palette, gfx_rgum); PALETTE(config, m_palette).set_entries(0x100); SPEAKER(config, "mono").front_center(); - AY8910(config, "aysnd", 24000000/16).add_route(ALL_OUTPUTS, "mono", 0.50); /* guessed to use the same xtal as the crtc */ + ay8910_device &aysnd(AY8910(config, "aysnd", 24_MHz_XTAL / 16)); + aysnd.add_route(ALL_OUTPUTS, "mono", 0.50); // guessed to use the same xtal as the crtc + aysnd.port_a_read_callback().set([this](){ return machine().rand() & 0x01; }); // TODO: hack! Otherwise it flashes 'RAM ERROR 0', then black screen + aysnd.port_b_read_callback().set([this](){ return 0x00; }); // 'micro palline err.' (microballs err.) if bit 0 is set + + UPD7759(config, "upd").add_route(ALL_OUTPUTS, "mono", 0.50); } -ROM_START( rgum ) - ROM_REGION( 0x20000, "z80cpu", 0 ) - ROM_LOAD( "rgum.u47", 0x00000, 0x20000, CRC(fe410eb9) SHA1(25180ba336269279f251be5483c210a581d27197) ) // encrypted.. 2nd half empty - +ROM_START( rgum ) // PCB SL65 V2 ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "rgum.u5", 0x00000, 0x10000, CRC(9d2d1681) SHA1(1c1da0d970ea2cf58f7961417ab6986cc667da5c) ) // plaintext in here, but firt half is empty + ROM_LOAD( "rgum.u5", 0x00000, 0x10000, CRC(9d2d1681) SHA1(1c1da0d970ea2cf58f7961417ab6986cc667da5c) ) // first half is empty - ROM_REGION( 0x10000, "unk", 0 ) - ROM_LOAD( "rgum.u6", 0x00000, 0x2000, CRC(15a34117) SHA1(c7e0aef4007abfaaa533feb026148ba03230b79f) ) // near the data rom, mostly empty + ROM_REGION( 0x2000, "nvram", 0 ) // MK48Z08B-10 + ROM_LOAD( "rgum.u6", 0x0000, 0x2000, CRC(15a34117) SHA1(c7e0aef4007abfaaa533feb026148ba03230b79f) ) // near the data ROM, mostly empty - ROM_REGION( 0x18000, "gfx1", 0 ) + ROM_REGION( 0x18000, "tiles", 0 ) ROM_LOAD( "rgum.u16", 0x00000, 0x8000, CRC(2a2c8d78) SHA1(2ce335b900dccbc34ad8ae7ae02ec7c75ffcd559) ) // first half empty ROM_CONTINUE(0x00000,0x8000) ROM_LOAD( "rgum.u17", 0x08000, 0x8000, CRC(fae4e41a) SHA1(421aac2b567040c3a56e01aa70880c94450eaf76) ) // first half empty ROM_CONTINUE(0x08000,0x8000) ROM_LOAD( "rgum.u18", 0x10000, 0x8000, CRC(79b17da7) SHA1(31e1845261b0152df56135c212e55c4048b7496f) ) // first half empty ROM_CONTINUE(0x10000,0x8000) + + ROM_REGION( 0x20000, "upd", 0 ) + ROM_LOAD( "rgum.u47", 0x00000, 0x20000, CRC(fe410eb9) SHA1(25180ba336269279f251be5483c210a581d27197) ) // 2nd half empty, almost identical to the one of ladygum in videosaa.cpp + + ROM_REGION( 0x200, "proms", 0 ) + ROM_LOAD( "n82s147n", 0x000, 0x200, NO_DUMP ) + + ROM_REGION( 0x200, "plds", 0 ) + ROM_LOAD( "gal16v8b-25lp", 0x000, 0x117, NO_DUMP ) ROM_END +} // Anonymous namespace + GAME( 199?, rgum, 0, rgum, rgum, rgum_state, empty_init, ROT0, "", "Royal Gum (Italy)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND )