checkpoint (nw)

This commit is contained in:
MetalliC 2016-09-30 02:22:50 +03:00
parent b63d86dae0
commit 78d4e6db5b

View File

@ -16,17 +16,16 @@ class istrebiteli_state : public driver_device
{ {
public: public:
istrebiteli_state(const machine_config &mconfig, device_type type, const char *tag) istrebiteli_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag), : driver_device(mconfig, type, tag)
m_maincpu(*this, I8080_TAG), , m_maincpu(*this, I8080_TAG)
m_ppi0(*this, "ppi0"), , m_ppi0(*this, "ppi0")
m_ppi1(*this, "ppi1"), , m_ppi1(*this, "ppi1")
m_gfxdecode(*this, "gfxdecode"), , m_tileram(*this, "tileram")
m_tileram(*this, "tileram") , m_gfxdecode(*this, "gfxdecode")
{ {
} }
DECLARE_PALETTE_INIT(istrebiteli); DECLARE_PALETTE_INIT(istrebiteli);
DECLARE_VIDEO_START(istrebiteli);
DECLARE_READ8_MEMBER(ppi0_r); DECLARE_READ8_MEMBER(ppi0_r);
DECLARE_WRITE8_MEMBER(ppi0_w); DECLARE_WRITE8_MEMBER(ppi0_w);
DECLARE_READ8_MEMBER(ppi1_r); DECLARE_READ8_MEMBER(ppi1_r);
@ -39,11 +38,12 @@ public:
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
required_device<i8255_device> m_ppi0; required_device<i8255_device> m_ppi0;
required_device<i8255_device> m_ppi1; required_device<i8255_device> m_ppi1;
required_device<gfxdecode_device> m_gfxdecode;
required_shared_ptr<UINT8> m_tileram; required_shared_ptr<UINT8> m_tileram;
required_device<gfxdecode_device> m_gfxdecode;
virtual void machine_start() override { } virtual void machine_start() override { }
virtual void machine_reset() override { } virtual void machine_reset() override { }
virtual void video_start() override;
TILE_GET_INFO_MEMBER(get_tile_info); TILE_GET_INFO_MEMBER(get_tile_info);
tilemap_t *m_tilemap; tilemap_t *m_tilemap;
@ -55,10 +55,10 @@ public:
}; };
static const rgb_t istreb_palette[4] = { static const rgb_t istreb_palette[4] = {
rgb_t(0x00, 0x00, 0xff),
rgb_t(0x00, 0x00, 0x00), rgb_t(0x00, 0x00, 0x00),
rgb_t(0x00, 0x00, 0xff),
rgb_t(0xff, 0xff, 0xff), rgb_t(0xff, 0xff, 0xff),
rgb_t(0xff, 0x00, 0x00) rgb_t(0x00, 0x00, 0xff)
}; };
PALETTE_INIT_MEMBER(istrebiteli_state,istrebiteli) PALETTE_INIT_MEMBER(istrebiteli_state,istrebiteli)
@ -71,33 +71,73 @@ TILE_GET_INFO_MEMBER(istrebiteli_state::get_tile_info)
SET_TILE_INFO_MEMBER(0, m_tileram[tile_index], 0, 0); SET_TILE_INFO_MEMBER(0, m_tileram[tile_index], 0, 0);
} }
VIDEO_START_MEMBER(istrebiteli_state, istrebiteli) void istrebiteli_state::video_start()
{ {
UINT8 *gfx = memregion("sprite")->base();
UINT8 temp[64];
for (int offs = 0; offs < 0x200; offs += 0x40)
{
memset(&temp[0], 0, 64);
for (int spnum = 0; spnum < 8; spnum++)
for (int dot = 0; dot < 64; dot++)
temp[(dot >> 3) + spnum * 8] |= ((gfx[offs + dot] >> spnum) & 1) << (dot & 7);
memcpy(&gfx[offs], &temp[0], 64);
}
m_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(istrebiteli_state::get_tile_info), this), TILEMAP_SCAN_ROWS, m_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(istrebiteli_state::get_tile_info), this), TILEMAP_SCAN_ROWS,
16, 8, 1, 16); 16, 8, 1, 16);
} }
UINT32 istrebiteli_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) UINT32 istrebiteli_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
//m_tilemap->draw(screen, bitmap, cliprect, 0, 0); bitmap.fill(1);
m_tilemap->mark_all_dirty();
rectangle myrect;
myrect.set_size(16, 16*8);
m_tilemap->draw(screen, bitmap, myrect, 0, 0);
int sx, sy, spritecode;
sx = m_spr_xy[6];
sy = m_spr_xy[7] ^ 0xff;
spritecode = (m_spr0_ctrl & 0x1f) + ((m_spr0_ctrl & 0x80) >> 2);
m_gfxdecode->gfx(1)->transpen(bitmap, cliprect,
spritecode,
0,
0, 0,
sx, sy, 1);
sx = m_spr_xy[4];
sy = m_spr_xy[5] ^ 0xff;
spritecode = (m_spr1_ctrl & 0x1f) + ((m_spr1_ctrl & 0x80) >> 2);
m_gfxdecode->gfx(2)->transpen(bitmap, cliprect,
spritecode,
0,
0, 0,
sx, sy, 1);
return 0; return 0;
} }
READ8_MEMBER(istrebiteli_state::ppi0_r) READ8_MEMBER(istrebiteli_state::ppi0_r)
{ {
return m_ppi0->read(space, offset ^ 3); return m_ppi0->read(space, offset ^ 3) ^ 0xff;
} }
WRITE8_MEMBER(istrebiteli_state::ppi0_w) WRITE8_MEMBER(istrebiteli_state::ppi0_w)
{ {
m_ppi0->write(space, offset ^ 3, data); m_ppi0->write(space, offset ^ 3, data ^ 0xff);
} }
READ8_MEMBER(istrebiteli_state::ppi1_r) READ8_MEMBER(istrebiteli_state::ppi1_r)
{ {
return m_ppi1->read(space, offset ^ 3); return m_ppi1->read(space, offset ^ 3) ^ 0xff;
} }
WRITE8_MEMBER(istrebiteli_state::ppi1_w) WRITE8_MEMBER(istrebiteli_state::ppi1_w)
{ {
m_ppi1->write(space, offset ^ 3, data); m_ppi1->write(space, offset ^ 3, data ^ 0xff);
} }
WRITE8_MEMBER(istrebiteli_state::sound_w) WRITE8_MEMBER(istrebiteli_state::sound_w)
@ -136,31 +176,32 @@ ADDRESS_MAP_END
static INPUT_PORTS_START( istreb ) static INPUT_PORTS_START( istreb )
PORT_START("IN0") PORT_START("IN0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(1)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(1)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(1)
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(1)
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) // sprite collision flag ? PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) // sprite collision flag
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
PORT_START("IN1") PORT_START("IN1")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(2)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(2)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(2)
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(2)
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) // sprite collision flag ? PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) // sprite collision flag
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
PORT_START("IN2") PORT_START("IN2")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_START1)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 ) PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_START2)
PORT_BIT( 0x3c, IP_ACTIVE_LOW, IPT_UNKNOWN ) // TODO read coin counter PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN1)
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_HBLANK("screen") PORT_BIT(0x38, IP_ACTIVE_HIGH, IPT_UNKNOWN) // TODO read coin counter
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen") PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_CUSTOM) PORT_HBLANK("screen")
PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_CUSTOM) PORT_VBLANK("screen")
INPUT_PORTS_END INPUT_PORTS_END
static const gfx_layout char_layout = static const gfx_layout char_layout =
@ -169,13 +210,26 @@ static const gfx_layout char_layout =
32, 32,
1, 1,
{ 0 }, { 0 },
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8 , 11*8, 12*8 , 13*8, 14*8, 15*8 }, { 0*8,1*8,2*8,3*8,4*8,5*8,6*8,7*8,8*8,9*8,10*8,11*8,12*8,13*8,14*8,15*8 },
{ 0, 1, 2, 3, 4, 5, 6, 7 }, { 0,1,2,3,4,5,6,7 },
16 * 8 16*8
};
static const gfx_layout sprite_layout =
{
8,8,
64,
1,
{ 0 },
{ 7*8, 6*8, 5*8, 4*8, 3*8, 2*8, 1*8, 0*8 },
{ 7,6,5,4,3,2,1,0 },
8*8
}; };
static GFXDECODE_START( istrebiteli ) static GFXDECODE_START( istrebiteli )
GFXDECODE_ENTRY( "chars", 0x0000, char_layout, 0, 2 ) GFXDECODE_ENTRY( "chars", 0x0000, char_layout, 0, 2 )
GFXDECODE_ENTRY( "sprite", 0x0000, sprite_layout, 2, 2 )
GFXDECODE_ENTRY( "sprite", 0x0000, sprite_layout, 0, 2 )
GFXDECODE_END GFXDECODE_END
static MACHINE_CONFIG_START( istreb, istrebiteli_state) static MACHINE_CONFIG_START( istreb, istrebiteli_state)
@ -196,7 +250,7 @@ static MACHINE_CONFIG_START( istreb, istrebiteli_state)
/* video hardware */ /* video hardware */
MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(4000000, 256, 0, 256, 312, 0, 256) MCFG_SCREEN_RAW_PARAMS(4000000, 256, 0, 256, 312, 0, 192)
MCFG_SCREEN_UPDATE_DRIVER(istrebiteli_state, screen_update) MCFG_SCREEN_UPDATE_DRIVER(istrebiteli_state, screen_update)
MCFG_SCREEN_PALETTE("palette") MCFG_SCREEN_PALETTE("palette")
@ -213,10 +267,10 @@ ROM_START( istreb )
ROM_LOAD("003-g8.bin", 0x000, 0x200, CRC(5cd7ad47) SHA1(2142711c8a3640b7aa258a2059cfb0f14297a5ac) ) ROM_LOAD("003-g8.bin", 0x000, 0x200, CRC(5cd7ad47) SHA1(2142711c8a3640b7aa258a2059cfb0f14297a5ac) )
ROM_REGION(0x1000, "sprite", 0) ROM_REGION(0x1000, "sprite", 0)
ROM_LOAD("001-a11.bin", 0x000, 0x100, CRC(4e05b7dd) SHA1(335e975ae9e8f775c1ac07f60420680ad878c3ae) ) ROM_LOAD("001-g4.bin", 0x000, 0x200, CRC(ca3c531b) SHA1(8295167895d51e626b6d5946b565d5e8b8466ac0) )
ROM_LOAD("001-b11.bin", 0x100, 0x100, CRC(4e05b7dd) SHA1(335e975ae9e8f775c1ac07f60420680ad878c3ae) ) ROM_LOAD("001-g9.bin", 0x000, 0x200, CRC(ca3c531b) SHA1(8295167895d51e626b6d5946b565d5e8b8466ac0) )
ROM_LOAD("001-g4.bin", 0x200, 0x200, CRC(ca3c531b) SHA1(8295167895d51e626b6d5946b565d5e8b8466ac0) ) ROM_LOAD("001-a11.bin", 0x200, 0x100, CRC(4e05b7dd) SHA1(335e975ae9e8f775c1ac07f60420680ad878c3ae) )
ROM_LOAD("001-g9.bin", 0x400, 0x200, CRC(ca3c531b) SHA1(8295167895d51e626b6d5946b565d5e8b8466ac0) ) ROM_LOAD("001-b11.bin", 0x200, 0x100, CRC(4e05b7dd) SHA1(335e975ae9e8f775c1ac07f60420680ad878c3ae) )
ROM_REGION(0x200, "soundrom", 0) ROM_REGION(0x200, "soundrom", 0)
ROM_LOAD("003-w3.bin", 0x000, 0x200, CRC(54eb4893) SHA1(c7a4724045c645ab728074ed7fef1882d9776005) ) ROM_LOAD("003-w3.bin", 0x000, 0x200, CRC(54eb4893) SHA1(c7a4724045c645ab728074ed7fef1882d9776005) )