diff --git a/src/mame/drivers/metlfrzr.cpp b/src/mame/drivers/metlfrzr.cpp index 71ad6a9931b..0e4159acd14 100644 --- a/src/mame/drivers/metlfrzr.cpp +++ b/src/mame/drivers/metlfrzr.cpp @@ -16,17 +16,25 @@ public: metlfrzr_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), - m_decrypted_opcodes(*this, "decrypted_opcodes") + m_decrypted_opcodes(*this, "decrypted_opcodes"), + m_vram(*this, "vram"), + m_palette(*this, "palette"), + m_gfxdecode(*this, "gfxdecode") { } virtual void machine_start() override; virtual void machine_reset() override; virtual void video_start() override; + void legacy_fg_draw(bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_metlfrzr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); required_device m_maincpu; required_shared_ptr m_decrypted_opcodes; + required_shared_ptr m_vram; + required_device m_palette; + required_device m_gfxdecode; DECLARE_DRIVER_INIT(metlfrzr); + DECLARE_WRITE8_MEMBER(output_w); }; @@ -34,14 +42,56 @@ void metlfrzr_state::video_start() { } +void metlfrzr_state::legacy_fg_draw(bitmap_ind16 &bitmap,const rectangle &cliprect) +{ + gfx_element *gfx_0 = m_gfxdecode->gfx(0); + int count; + + for (count=0;count<32*32;count++) + { + int y = (count % 32); + int x = count / 32; + + UINT16 tile = m_vram[count*2+0]; + UINT8 color = 0;//(m_fgattr[count] & 0x3f) + (m_pal_bank<<6); + + gfx_0->transpen(bitmap,cliprect,tile,color,0,0,x*8,y*8,0xf); + } + +} + UINT32 metlfrzr_state::screen_update_metlfrzr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { + bitmap.fill(m_palette->black_pen(), cliprect); + + legacy_fg_draw(bitmap,cliprect); return 0; } +WRITE8_MEMBER(metlfrzr_state::output_w) +{ + // bit 7: flip screen + if(data & 0x7f) + printf("%02x\n",data); +} static ADDRESS_MAP_START( metlfrzr_map, AS_PROGRAM, 8, metlfrzr_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") + AM_RANGE(0xc000, 0xc7ff) AM_RAM AM_SHARE("vram") + AM_RANGE(0xd000, 0xd1ff) AM_RAM_DEVWRITE("palette", palette_device, write_indirect) AM_SHARE("palette") + AM_RANGE(0xd200, 0xd3ff) AM_RAM_DEVWRITE("palette", palette_device, write_indirect_ext) AM_SHARE("palette_ext") + + AM_RANGE(0xd600, 0xd600) AM_READ_PORT("P1") + AM_RANGE(0xd601, 0xd601) AM_READ_PORT("P2") + AM_RANGE(0xd602, 0xd602) AM_READ_PORT("START") + AM_RANGE(0xd603, 0xd603) AM_READ_PORT("DSW1") + AM_RANGE(0xd604, 0xd604) AM_READ_PORT("DSW2") + + AM_RANGE(0xd700, 0xd700) AM_WRITE(output_w) + AM_RANGE(0xd800, 0xdfff) AM_RAM + AM_RANGE(0xe000, 0xefff) AM_RAM + AM_RANGE(0xf000, 0xffff) AM_RAM ADDRESS_MAP_END static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, metlfrzr_state ) @@ -50,16 +100,109 @@ ADDRESS_MAP_END static INPUT_PORTS_START( metlfrzr ) + PORT_START("P1") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) + PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNKNOWN ) + + PORT_START("P2") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_COCKTAIL + PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNKNOWN ) + + PORT_START("START") + PORT_DIPNAME( 0x01, 0x01, "2-0" ) + PORT_DIPSETTING( 0x01, DEF_STR( No ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x02, 0x02, "2-1" ) + PORT_DIPSETTING( 0x02, DEF_STR( No ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x04, 0x04, "2-2" ) + PORT_DIPSETTING( 0x04, DEF_STR( No ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x08, 0x08, "2-2" ) + PORT_DIPSETTING( 0x08, DEF_STR( No ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_START1 ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_START2 ) + PORT_DIPNAME( 0x40, 0x40, "2-6" ) + PORT_DIPSETTING( 0x40, DEF_STR( No ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x80, 0x80, "2-7" ) + PORT_DIPSETTING( 0x80, DEF_STR( No ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) + + PORT_START("DSW1") + PORT_DIPNAME( 0x01, 0x00, "SYSA" ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x01, DEF_STR( On ) ) + PORT_SERVICE_DIPLOC( 0x02, IP_ACTIVE_LOW, "SW1:2" ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Flip_Screen ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x08, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x10, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x20, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x40, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x80, DEF_STR( On ) ) + + + PORT_START("DSW2") + PORT_DIPNAME( 0x01, 0x00, "SYSB" ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x01, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x02, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x04, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x08, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x10, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x20, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x40, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x80, DEF_STR( On ) ) INPUT_PORTS_END void metlfrzr_state::machine_start() { + membank("bank1")->configure_entries(0, 4, memregion("maincpu")->base() + 0x10000, 0x4000); } void metlfrzr_state::machine_reset() { + membank("bank1")->set_entry(0); + } @@ -69,10 +212,10 @@ static const gfx_layout tiles8x8_layout = RGN_FRAC(1,1), 4, { 0, 4, 8, 12 }, - { 0, 1, 2, 3, 16, 17, 18, 19 }, + { 19, 18,17,16,3,2,1,0 }, // { 19, 18, 17, 16, 3, 2, 1, 0 }, // maybe display is flipped? // { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 }, - { 7*32, 6*32, 5*32, 4*32, 3*32, 2*32, 1*32, 0*32 }, + { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 }, 32*8 }; @@ -107,9 +250,9 @@ static MACHINE_CONFIG_START(metlfrzr, metlfrzr_state) MCFG_DEVICE_ADD("t5182", T5182, 0) - MCFG_PALETTE_ADD("palette", 0x100) + MCFG_PALETTE_ADD("palette", 0x200) + MCFG_PALETTE_INDIRECT_ENTRIES(256*2) MCFG_PALETTE_FORMAT(xxxxRRRRGGGGBBBB) - MCFG_PALETTE_ENDIANNESS(ENDIANNESS_BIG) MCFG_GFXDECODE_ADD("gfxdecode", "palette", metlfrzr) @@ -202,4 +345,4 @@ DRIVER_INIT_MEMBER(metlfrzr_state, metlfrzr) -GAME( 1989, metlfrzr, 0, metlfrzr, metlfrzr, metlfrzr_state, metlfrzr, ROT90, "Seibu", "Metal Freezer", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +GAME( 1989, metlfrzr, 0, metlfrzr, metlfrzr, metlfrzr_state, metlfrzr, ROT270, "Seibu", "Metal Freezer", MACHINE_NOT_WORKING | MACHINE_NO_SOUND )