mirror of
https://github.com/holub/mame
synced 2025-04-24 09:20:02 +03:00
Merge pull request #4092 from cam900/targeth_clean
targeth.cpp : Minor cleanups
This commit is contained in:
commit
b9840f6db4
@ -74,19 +74,19 @@ DS5002FP Box contains:
|
||||
#include "speaker.h"
|
||||
|
||||
|
||||
static const gfx_layout tilelayout16_0x080000 =
|
||||
static const gfx_layout tilelayout =
|
||||
{
|
||||
16,16, /* 16x16 tiles */
|
||||
RGN_FRAC(1,4), /* number of tiles */
|
||||
4, /* bitplanes */
|
||||
{ RGN_FRAC(3,4), RGN_FRAC(2,4), RGN_FRAC(1,4), RGN_FRAC(0,4) }, /* plane offsets */
|
||||
{ 0,1,2,3,4,5,6,7, 16*8+0,16*8+1,16*8+2,16*8+3,16*8+4,16*8+5,16*8+6,16*8+7 },
|
||||
{ 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 },
|
||||
{ STEP8(0,1), STEP8(16*8,1) },
|
||||
{ STEP16(0,8) },
|
||||
32*8
|
||||
};
|
||||
|
||||
static GFXDECODE_START( gfx_0x080000 )
|
||||
GFXDECODE_ENTRY( "gfx1", 0x000000, tilelayout16_0x080000, 0, 64 )
|
||||
static GFXDECODE_START( gfx_targeth )
|
||||
GFXDECODE_ENTRY( "gfx1", 0x000000, tilelayout, 0, 64 )
|
||||
GFXDECODE_END
|
||||
|
||||
TIMER_CALLBACK_MEMBER(targeth_state::gun1_irq)
|
||||
@ -103,11 +103,9 @@ TIMER_CALLBACK_MEMBER(targeth_state::gun2_irq)
|
||||
m_gun_irq_timer[1]->adjust( m_screen->time_until_pos(160, 0 ) );
|
||||
}
|
||||
|
||||
WRITE16_MEMBER(targeth_state::OKIM6295_bankswitch_w)
|
||||
WRITE8_MEMBER(targeth_state::oki_bankswitch_w)
|
||||
{
|
||||
if (ACCESSING_BITS_0_7){
|
||||
membank("okibank")->set_entry(data & 0x0f);
|
||||
}
|
||||
m_okibank->set_entry(data & 0x0f);
|
||||
}
|
||||
|
||||
WRITE16_MEMBER(targeth_state::output_latch_w)
|
||||
@ -147,7 +145,6 @@ void targeth_state::main_map(address_map &map)
|
||||
{
|
||||
map(0x000000, 0x0fffff).rom();
|
||||
map(0x100000, 0x103fff).ram().w(FUNC(targeth_state::vram_w)).share("videoram"); /* Video RAM */
|
||||
map(0x108000, 0x108007).writeonly().share("vregs"); /* Video Registers */
|
||||
map(0x108000, 0x108001).portr("GUNX1");
|
||||
map(0x108002, 0x108003).portr("GUNY1");
|
||||
map(0x108004, 0x108005).portr("GUNX2");
|
||||
@ -161,7 +158,7 @@ void targeth_state::main_map(address_map &map)
|
||||
map(0x700006, 0x700007).portr("SYSTEM"); /* Coins, Start & Fire buttons */
|
||||
map(0x700008, 0x700009).portr("SERVICE"); /* Service & Guns Reload? */
|
||||
map(0x70000a, 0x70000b).select(0x000070).w(FUNC(targeth_state::output_latch_w));
|
||||
map(0x70000c, 0x70000d).w(FUNC(targeth_state::OKIM6295_bankswitch_w)); /* OKI6295 bankswitch */
|
||||
map(0x70000d, 0x70000d).w(FUNC(targeth_state::oki_bankswitch_w)); /* OKI6295 bankswitch */
|
||||
map(0x70000f, 0x70000f).rw("oki", FUNC(okim6295_device::read), FUNC(okim6295_device::write)); /* OKI6295 status register */
|
||||
map(0x700010, 0x700011).nopw(); /* ??? Guns reload related? */
|
||||
map(0xfe0000, 0xfe7fff).ram(); /* Work RAM */
|
||||
@ -177,7 +174,7 @@ void targeth_state::oki_map(address_map &map)
|
||||
|
||||
void targeth_state::machine_start()
|
||||
{
|
||||
membank("okibank")->configure_entries(0, 16, memregion("oki")->base(), 0x10000);
|
||||
m_okibank->configure_entries(0, 16, memregion("oki")->base(), 0x10000);
|
||||
|
||||
m_gun_irq_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(targeth_state::gun1_irq), this));
|
||||
m_gun_irq_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(targeth_state::gun2_irq), this));
|
||||
@ -294,7 +291,7 @@ MACHINE_CONFIG_START(targeth_state::targeth)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(targeth_state, screen_update)
|
||||
MCFG_SCREEN_PALETTE("palette")
|
||||
|
||||
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_0x080000)
|
||||
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_targeth)
|
||||
MCFG_PALETTE_ADD("palette", 1024)
|
||||
MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
|
||||
|
||||
|
@ -12,8 +12,8 @@
|
||||
class targeth_state : public driver_device
|
||||
{
|
||||
public:
|
||||
targeth_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag),
|
||||
targeth_state(const machine_config &mconfig, device_type type, const char *tag) :
|
||||
driver_device(mconfig, type, tag),
|
||||
m_maincpu(*this,"maincpu"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_screen(*this, "screen"),
|
||||
@ -22,13 +22,14 @@ public:
|
||||
m_videoram(*this, "videoram"),
|
||||
m_vregs(*this, "vregs"),
|
||||
m_spriteram(*this, "spriteram"),
|
||||
m_shareram(*this, "shareram")
|
||||
m_shareram(*this, "shareram"),
|
||||
m_okibank(*this, "okibank")
|
||||
{ }
|
||||
|
||||
void targeth(machine_config &config);
|
||||
|
||||
private:
|
||||
DECLARE_WRITE16_MEMBER(OKIM6295_bankswitch_w);
|
||||
DECLARE_WRITE8_MEMBER(oki_bankswitch_w);
|
||||
DECLARE_WRITE16_MEMBER(output_latch_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(coin1_counter_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(coin2_counter_w);
|
||||
@ -37,8 +38,7 @@ private:
|
||||
|
||||
DECLARE_WRITE16_MEMBER(vram_w);
|
||||
|
||||
TILE_GET_INFO_MEMBER(get_tile_info_screen0);
|
||||
TILE_GET_INFO_MEMBER(get_tile_info_screen1);
|
||||
template<int Layer> TILE_GET_INFO_MEMBER(get_tile_info);
|
||||
|
||||
TIMER_CALLBACK_MEMBER(gun1_irq);
|
||||
TIMER_CALLBACK_MEMBER(gun2_irq);
|
||||
@ -63,7 +63,9 @@ private:
|
||||
required_shared_ptr<uint16_t> m_videoram;
|
||||
required_shared_ptr<uint16_t> m_vregs;
|
||||
required_shared_ptr<uint16_t> m_spriteram;
|
||||
optional_shared_ptr<uint16_t> m_shareram;
|
||||
required_shared_ptr<uint16_t> m_shareram;
|
||||
|
||||
required_memory_bank m_okibank;
|
||||
|
||||
emu_timer *m_gun_irq_timer[2];
|
||||
|
||||
|
@ -34,19 +34,11 @@
|
||||
1 | xxxxxxxx x------- | not used?
|
||||
*/
|
||||
|
||||
TILE_GET_INFO_MEMBER(targeth_state::get_tile_info_screen0)
|
||||
template<int Layer>
|
||||
TILE_GET_INFO_MEMBER(targeth_state::get_tile_info)
|
||||
{
|
||||
int data = m_videoram[tile_index << 1];
|
||||
int data2 = m_videoram[(tile_index << 1) + 1];
|
||||
int code = data & 0x3fff;
|
||||
|
||||
SET_TILE_INFO_MEMBER(0, code, data2 & 0x1f, TILE_FLIPXY((data2 >> 5) & 0x03));
|
||||
}
|
||||
|
||||
TILE_GET_INFO_MEMBER(targeth_state::get_tile_info_screen1)
|
||||
{
|
||||
int data = m_videoram[(0x2000/2) + (tile_index << 1)];
|
||||
int data2 = m_videoram[(0x2000/2) + (tile_index << 1) + 1];
|
||||
int data = m_videoram[(Layer * 0x2000/2) + (tile_index << 1)];
|
||||
int data2 = m_videoram[(Layer * 0x2000/2) + (tile_index << 1) + 1];
|
||||
int code = data & 0x3fff;
|
||||
|
||||
SET_TILE_INFO_MEMBER(0, code, data2 & 0x1f, TILE_FLIPXY((data2 >> 5) & 0x03));
|
||||
@ -73,8 +65,8 @@ WRITE16_MEMBER(targeth_state::vram_w)
|
||||
|
||||
void targeth_state::video_start()
|
||||
{
|
||||
m_pant[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(targeth_state::get_tile_info_screen0),this),TILEMAP_SCAN_ROWS,16,16,64,32);
|
||||
m_pant[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(targeth_state::get_tile_info_screen1),this),TILEMAP_SCAN_ROWS,16,16,64,32);
|
||||
m_pant[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(targeth_state::get_tile_info<0>),this),TILEMAP_SCAN_ROWS,16,16,64,32);
|
||||
m_pant[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(targeth_state::get_tile_info<1>),this),TILEMAP_SCAN_ROWS,16,16,64,32);
|
||||
|
||||
m_pant[0]->set_transparent_pen(0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user