diff --git a/src/mame/drivers/himesiki.cpp b/src/mame/drivers/himesiki.cpp index 1e5efc65c92..856412c0250 100644 --- a/src/mame/drivers/himesiki.cpp +++ b/src/mame/drivers/himesiki.cpp @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Uki +// copyright-holders:Uki, David Haywood /***************************************************************************** Himeshikibu (C) 1989 Hi-Soft @@ -94,9 +94,10 @@ A 12.000MHz #include "cpu/z80/z80.h" #include "sound/2203intf.h" #include "includes/himesiki.h" +#include "machine/i8255.h" -#define MCLK XTAL_12MHz -// there is also an 8Mhz XTAL near the CPUs +#define MCLK XTAL_12MHz // this is on the video board +#define CLK2 XTAL_8MHz // near the CPUs WRITE8_MEMBER(himesiki_state::himesiki_rombank_w) { @@ -117,7 +118,8 @@ WRITE8_MEMBER(himesiki_state::himesiki_sound_w) static ADDRESS_MAP_START( himesiki_prm0, AS_PROGRAM, 8, himesiki_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0x9fff) AM_RAM - AM_RANGE(0xa000, 0xa7ff) AM_RAM AM_SHARE("spriteram") + AM_RANGE(0xa000, 0xa0ff) AM_RAM AM_SHARE("spriteram") + AM_RANGE(0xa100, 0xa7ff) AM_RAM AM_SHARE("sprram_p103a") // not on Android AM_RANGE(0xa800, 0xafff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0xb000, 0xbfff) AM_RAM_WRITE(himesiki_bg_ram_w) AM_SHARE("bg_ram") AM_RANGE(0xc000, 0xffff) AM_ROMBANK("bank1") @@ -125,19 +127,16 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( himesiki_iom0, AS_IO, 8, himesiki_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_READ_PORT("1P") - AM_RANGE(0x01, 0x01) AM_READ_PORT("2P") - AM_RANGE(0x02, 0x02) AM_READ_PORT("OTHERS") - AM_RANGE(0x03, 0x03) AM_WRITENOP // 8255 cw - AM_RANGE(0x04, 0x04) AM_READ_PORT("DSW1") - AM_RANGE(0x05, 0x05) AM_READ_PORT("DSW2") - AM_RANGE(0x06, 0x06) AM_WRITE(himesiki_rombank_w) - AM_RANGE(0x07, 0x07) AM_WRITENOP // 8255 cw + AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("ppi8255_0", i8255_device, read, write) // inputs + AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) // dips + rombank AM_RANGE(0x08, 0x08) AM_WRITE(himesiki_scrolly_w) AM_RANGE(0x09, 0x0a) AM_WRITE(himesiki_scrollx_w) AM_RANGE(0x0b, 0x0b) AM_WRITE(himesiki_sound_w) ADDRESS_MAP_END + + + static ADDRESS_MAP_START( himesiki_prm1, AS_PROGRAM, 8, himesiki_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0xf800, 0xffff) AM_RAM @@ -241,12 +240,11 @@ static INPUT_PORTS_START( androidp ) 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_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x0c, 0x08, DEF_STR( Lives ) ) + PORT_DIPSETTING( 0x0c, "1" ) + PORT_DIPSETTING( 0x04, "2" ) + PORT_DIPSETTING( 0x08, "3" ) + PORT_DIPSETTING( 0x00, "4" ) // first dragon scene only shows 3? PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) @@ -308,20 +306,20 @@ static INPUT_PORTS_START( androidp ) PORT_START("OTHERS") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_COIN1 ) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_BIT(0x04, IP_ACTIVE_HIGH, 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_SERVICE1 ) // coin? PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_COIN2 ) // service? PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_START1 ) PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_START2 ) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) INPUT_PORTS_END /****************************************************************************/ -static const gfx_layout layout1 = +static const gfx_layout layout_bg = { 8,8, RGN_FRAC(1,1), @@ -332,7 +330,7 @@ static const gfx_layout layout1 = 8*8*4 }; -static const gfx_layout layout2 = +static const gfx_layout layout_p103a = { 32,32, RGN_FRAC(1,1), @@ -343,7 +341,7 @@ static const gfx_layout layout2 = 32*32*4 }; -static const gfx_layout layout3 = +static const gfx_layout layout_spr = { 16,16, RGN_FRAC(1,1), @@ -355,17 +353,17 @@ static const gfx_layout layout3 = }; static GFXDECODE_START( himesiki ) - GFXDECODE_ENTRY( "bgtiles", 0, layout1, 0x000, 16 ) - GFXDECODE_ENTRY( "sprites_1", 0, layout2, 0x200, 16 ) - GFXDECODE_ENTRY( "sprites_2", 0, layout3, 0x200, 16 ) + GFXDECODE_ENTRY( "bgtiles", 0, layout_bg, 0x000, 16 ) + GFXDECODE_ENTRY( "sprites", 0, layout_spr, 0x200, 16 ) + GFXDECODE_ENTRY( "spr_p103a", 0, layout_p103a, 0x200, 16 ) GFXDECODE_END void himesiki_state::machine_start() { - UINT8 *ROM = memregion("maincpu")->base(); + UINT8 *ROM = memregion("banks")->base(); - membank("bank1")->configure_entries(0, 4, &ROM[0x10000], 0x4000); + membank("bank1")->configure_entries(0, 4, ROM, 0x4000); save_item(NAME(m_scrollx)); @@ -386,15 +384,24 @@ void himesiki_state::machine_reset() static MACHINE_CONFIG_START( himesiki, himesiki_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, MCLK/2) /* 6.000 MHz */ + MCFG_CPU_ADD("maincpu", Z80, CLK2) /* it's a 6.000 MHz rated part, but near the 8 Mhz XTAL?? - Android skips lots of frames at 6, crashes at 4 */ MCFG_CPU_PROGRAM_MAP(himesiki_prm0) MCFG_CPU_IO_MAP(himesiki_iom0) MCFG_CPU_VBLANK_INT_DRIVER("screen", himesiki_state, irq0_line_hold) - MCFG_CPU_ADD("sub", Z80, MCLK/3) /* 4.000 MHz */ + MCFG_CPU_ADD("sub", Z80, CLK2/2) /* 4.000 MHz (4Mhz rated part, near the 8 Mhz XTAL) */ MCFG_CPU_PROGRAM_MAP(himesiki_prm1) MCFG_CPU_IO_MAP(himesiki_iom1) + MCFG_DEVICE_ADD("ppi8255_0", I8255A, 0) + MCFG_I8255_IN_PORTA_CB(IOPORT("1P")) + MCFG_I8255_IN_PORTB_CB(IOPORT("2P")) + MCFG_I8255_IN_PORTC_CB(IOPORT("OTHERS")) + + MCFG_DEVICE_ADD("ppi8255_1", I8255A, 0) + MCFG_I8255_IN_PORTA_CB(IOPORT("DSW1")) + MCFG_I8255_IN_PORTB_CB(IOPORT("DSW2")) + MCFG_I8255_OUT_PORTC_CB(WRITE8(himesiki_state, himesiki_rombank_w)) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -424,11 +431,12 @@ MACHINE_CONFIG_END /****************************************************************************/ ROM_START( himesiki ) - ROM_REGION( 0x020000, "maincpu", 0 ) /* z80 */ + ROM_REGION( 0x08000, "maincpu", 0 ) /* z80 */ ROM_LOAD( "1.1k", 0x00000, 0x08000, CRC(fb4604b3) SHA1(e8155bbafb881125e1bf9a04808d6a6546887e90) ) - // banked data - ROM_LOAD( "2.1g", 0x10000, 0x04000, CRC(0c30ded1) SHA1(0ad67115fa15d0b6261a278a946a6d46c06430ef) ) - ROM_CONTINUE(0x18000, 0x4000) + + ROM_REGION( 0x10000, "banks", 0 ) + ROM_LOAD( "2.1g", 0x00000, 0x04000, CRC(0c30ded1) SHA1(0ad67115fa15d0b6261a278a946a6d46c06430ef) ) + ROM_CONTINUE( 0x08000, 0x04000) // 1j is unpopulated on this game ROM_REGION( 0x010000, "sub", 0 ) /* z80 */ @@ -438,7 +446,14 @@ ROM_START( himesiki ) ROM_LOAD( "3.5f", 0x000000, 0x010000, CRC(73843e60) SHA1(0d8a397d8798e15f3fa7bf7a83e4c2ee44f6fa86) ) ROM_LOAD( "4.5d", 0x010000, 0x010000, CRC(443a3164) SHA1(08aa002214251a870581a01d775f497dd390957c) ) - ROM_REGION( 0x060000, "sprites_1", 0 ) /* sprites */ + ROM_REGION( 0x040000, "sprites", 0 ) /* sprites */ + ROM_LOAD16_BYTE( "13.9e", 0x000000, 0x010000, CRC(43102682) SHA1(0d4bde8bece0cbc6c06071aa8ad210a0636d862f) ) + ROM_LOAD16_BYTE( "12.9c", 0x000001, 0x010000, CRC(19c8f9f4) SHA1(b14c8a6b94fd474be375e7a6a03d7f4517da2247) ) + ROM_LOAD16_BYTE( "15.8e", 0x020000, 0x010000, CRC(2630d394) SHA1(b2e9e836b1f053fce3212912c53d3cdca3372439) ) + ROM_LOAD16_BYTE( "14.8c", 0x020001, 0x010000, CRC(8103a207) SHA1(0dde8a0aaf2618d9c1589f35841db210439d0388) ) + + + ROM_REGION( 0x060000, "spr_p103a", 0 ) /* sprites */ ROM_LOAD16_BYTE( "6.1a", 0x000000, 0x010000, CRC(14989c22) SHA1(fe0c31df10237294ea8ef0ab8965ba5bb25113a2) ) ROM_LOAD16_BYTE( "7.1c", 0x000001, 0x010000, CRC(cec56e16) SHA1(836ff413301044313fdf7af5d304c145137b898a) ) ROM_LOAD16_BYTE( "8.2a", 0x020000, 0x010000, CRC(44ba127e) SHA1(d756b6c3075d75287f9c8be662c1eab02f4245a3) ) @@ -446,23 +461,19 @@ ROM_START( himesiki ) ROM_LOAD16_BYTE( "10.4a", 0x040000, 0x010000, CRC(0adda8d1) SHA1(dfee2c7921fdc972b4e95fdf89520f74a4e8b4ee) ) ROM_LOAD16_BYTE( "11.4c", 0x040001, 0x010000, CRC(aa032946) SHA1(bd8900e4a22580e3bfe33b8164909db19bb07a8f) ) - ROM_REGION( 0x040000, "sprites_2", 0 ) /* sprites */ - ROM_LOAD16_BYTE( "13.9e", 0x000000, 0x010000, CRC(43102682) SHA1(0d4bde8bece0cbc6c06071aa8ad210a0636d862f) ) - ROM_LOAD16_BYTE( "12.9c", 0x000001, 0x010000, CRC(19c8f9f4) SHA1(b14c8a6b94fd474be375e7a6a03d7f4517da2247) ) - ROM_LOAD16_BYTE( "15.8e", 0x020000, 0x010000, CRC(2630d394) SHA1(b2e9e836b1f053fce3212912c53d3cdca3372439) ) - ROM_LOAD16_BYTE( "14.8c", 0x020001, 0x010000, CRC(8103a207) SHA1(0dde8a0aaf2618d9c1589f35841db210439d0388) ) ROM_END ROM_START( androidp ) - ROM_REGION( 0x20000, "maincpu", 0 ) + ROM_REGION( 0x08000, "maincpu", 0 ) ROM_LOAD( "MITSUBISHI_A01.toppcb.m5l27256k.k1.BIN", 0x00000, 0x08000, CRC(25ab85eb) SHA1(e1fab149c83ff880b119258206d5818f3db641c5) ) - // banked data - ROM_LOAD( "MITSUBISHI_A03.toppcb.m5l27256k.G1.BIN", 0x10000, 0x04000, CRC(6cf5f48a) SHA1(b9b4e5e7bace0e8d98fbc9f4ad91bc56ef42099e) ) - ROM_CONTINUE(0x18000, 0x4000) - ROM_LOAD( "MITSUBISHI_A02.toppcb.m5l27256k.J1.BIN", 0x14000, 0x04000, CRC(e41426be) SHA1(e7e06ef3ff5160bb7d870e148ba2799da52cf24c) ) - ROM_CONTINUE(0x1c000, 0x4000) + + ROM_REGION( 0x10000, "banks", 0 ) + ROM_LOAD( "MITSUBISHI_A03.toppcb.m5l27256k.G1.BIN", 0x00000, 0x04000, CRC(6cf5f48a) SHA1(b9b4e5e7bace0e8d98fbc9f4ad91bc56ef42099e) ) + ROM_CONTINUE( 0x08000, 0x04000) + ROM_LOAD( "MITSUBISHI_A02.toppcb.m5l27256k.J1.BIN", 0x04000, 0x04000, CRC(e41426be) SHA1(e7e06ef3ff5160bb7d870e148ba2799da52cf24c) ) + ROM_CONTINUE( 0x0c000, 0x04000) ROM_REGION( 0x18000, "sub", 0 ) ROM_LOAD( "MITSUBISHI_A04.toppcb.m5l27256k.N6.BIN", 0x00000, 0x08000, CRC(13c38fe4) SHA1(34a35fa057159a5c83892a88b8c908faa39d5cb3) ) @@ -470,13 +481,13 @@ ROM_START( androidp ) ROM_REGION( 0x10000, "bgtiles", 0 ) ROM_LOAD( "MITSUBISHI_A05.toppcb.m5l27512k.F5.BIN", 0x00000, 0x10000, CRC(4c72a930) SHA1(f1542844391b55fe43293eef7ce48c09b7aca75a) ) - ROM_REGION( 0x20000, "sprites_1", ROMREGION_ERASEFF ) - - - ROM_REGION( 0x20000, "sprites_2", 0 ) + ROM_REGION( 0x20000, "sprites", 0 ) ROM_LOAD16_BYTE( "MITSUBISHI_A06.botpcb.m5l27512k.9E.BIN", 0x00000, 0x10000, CRC(5e42984e) SHA1(2a928960c740dfb94589e011cce093bed2fd7685) ) ROM_LOAD16_BYTE( "MITSUBISHI_A07.botpcb.m5l27512k.9B.BIN", 0x00001, 0x10000, CRC(611ff400) SHA1(1a9aed33d0e3f063811f92b9fee3ecbff0e965bf) ) + ROM_REGION( 0x20000, "spr_p103a", ROMREGION_ERASEFF ) + // there's no P103A PCB for this on Android + // + 2 undumped PLDs ROM_END @@ -484,4 +495,4 @@ ROM_END GAME( 1989, himesiki, 0, himesiki, himesiki, driver_device, 0, ROT90, "Hi-Soft", "Himeshikibu (Japan)", MACHINE_SUPPORTS_SAVE ) -GAME( 198?, androidp, 0, himesiki, androidp, driver_device, 0, ROT90, "Nasco", "Android (early build?)", MACHINE_NOT_WORKING ) +GAME( 198?, androidp, 0, himesiki, androidp, driver_device, 0, ROT90, "Nasco", "Android (early build?)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/includes/himesiki.h b/src/mame/includes/himesiki.h index eb5d112c862..dd2ece598a4 100644 --- a/src/mame/includes/himesiki.h +++ b/src/mame/includes/himesiki.h @@ -12,6 +12,7 @@ public: himesiki_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_bg_ram(*this, "bg_ram"), + m_spriteram_p103a(*this, "sprram_p103a"), m_spriteram(*this, "spriteram"), m_subcpu(*this, "sub"), m_maincpu(*this, "maincpu"), @@ -20,6 +21,7 @@ public: /* memory pointers */ required_shared_ptr m_bg_ram; + required_shared_ptr m_spriteram_p103a; required_shared_ptr m_spriteram; /* video-related */ diff --git a/src/mame/video/himesiki.cpp b/src/mame/video/himesiki.cpp index 2d2c8c795f7..4eec742f05e 100644 --- a/src/mame/video/himesiki.cpp +++ b/src/mame/video/himesiki.cpp @@ -56,11 +56,12 @@ WRITE8_MEMBER(himesiki_state::himesiki_flip_w) void himesiki_state::himesiki_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - UINT8 *spriteram = m_spriteram; + UINT8 *spriteram; int offs; // these sprites are from the ET-P103A board (himesiki only) - for (offs = 0x100; offs < 0x160; offs += 4) + spriteram = m_spriteram_p103a; + for (offs = 0x00; offs < 0x60; offs += 4) { int attr = spriteram[offs + 1]; int code = spriteram[offs + 0] | (attr & 3) << 8; @@ -88,12 +89,20 @@ void himesiki_state::himesiki_draw_sprites( bitmap_ind16 &bitmap, const rectangl y -= 0x100; } - m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, code, col, fx, fy, x, y, 15); + m_gfxdecode->gfx(2)->transpen(bitmap,cliprect, code, col, fx, fy, x, y, 15); } // 0xc0 - 0xff unused - for (offs = 0; offs < 0xc0; offs += 4) + spriteram = m_spriteram; + for (offs = 0; offs < 0x100; offs += 4) { + // not sure about this, but you sometimes get a garbage sprite in the corner otherwise. + if ((spriteram[offs + 0] == 0x00) && + (spriteram[offs + 1] == 0x00) && + (spriteram[offs + 2] == 0x00) && + (spriteram[offs + 3] == 0x00)) + continue; + int attr = spriteram[offs + 1]; int code = spriteram[offs + 0] | (attr & 7) << 8; int x = spriteram[offs + 3] | (attr & 8) << 5; @@ -118,7 +127,7 @@ void himesiki_state::himesiki_draw_sprites( bitmap_ind16 &bitmap, const rectangl if (y > 0xf0) y -= 0x100; - m_gfxdecode->gfx(2)->transpen(bitmap,cliprect, code, col, f, f, x, y, 15); + m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, code, col, f, f, x, y, 15); } }