mirror of
https://github.com/holub/mame
synced 2025-04-30 11:50:30 +03:00
tankbatt.c, tankbust.c: added save state support (nw)
This commit is contained in:
parent
7eda97ae0a
commit
a0b4e2865a
@ -62,12 +62,18 @@ Known issues:
|
||||
#include "includes/tankbatt.h"
|
||||
|
||||
|
||||
WRITE8_MEMBER(tankbatt_state::tankbatt_led_w)
|
||||
void tankbatt_state::machine_start()
|
||||
{
|
||||
save_item(NAME(m_nmi_enable));
|
||||
save_item(NAME(m_sound_enable));
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(tankbatt_state::led_w)
|
||||
{
|
||||
set_led_status(machine(), offset,data & 1);
|
||||
}
|
||||
|
||||
READ8_MEMBER(tankbatt_state::tankbatt_in0_r)
|
||||
READ8_MEMBER(tankbatt_state::in0_r)
|
||||
{
|
||||
int val;
|
||||
|
||||
@ -75,7 +81,7 @@ READ8_MEMBER(tankbatt_state::tankbatt_in0_r)
|
||||
return ((val << (7 - offset)) & 0x80);
|
||||
}
|
||||
|
||||
READ8_MEMBER(tankbatt_state::tankbatt_in1_r)
|
||||
READ8_MEMBER(tankbatt_state::in1_r)
|
||||
{
|
||||
int val;
|
||||
|
||||
@ -83,7 +89,7 @@ READ8_MEMBER(tankbatt_state::tankbatt_in1_r)
|
||||
return ((val << (7 - offset)) & 0x80);
|
||||
}
|
||||
|
||||
READ8_MEMBER(tankbatt_state::tankbatt_dsw_r)
|
||||
READ8_MEMBER(tankbatt_state::dsw_r)
|
||||
{
|
||||
int val;
|
||||
|
||||
@ -91,7 +97,7 @@ READ8_MEMBER(tankbatt_state::tankbatt_dsw_r)
|
||||
return ((val << (7 - offset)) & 0x80);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(tankbatt_state::tankbatt_interrupt_enable_w)
|
||||
WRITE8_MEMBER(tankbatt_state::interrupt_enable_w)
|
||||
{
|
||||
m_nmi_enable = !data;
|
||||
m_sound_enable = !data;
|
||||
@ -100,12 +106,12 @@ WRITE8_MEMBER(tankbatt_state::tankbatt_interrupt_enable_w)
|
||||
if (data) m_samples->stop(2);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(tankbatt_state::tankbatt_demo_interrupt_enable_w)
|
||||
WRITE8_MEMBER(tankbatt_state::demo_interrupt_enable_w)
|
||||
{
|
||||
m_nmi_enable = data;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(tankbatt_state::tankbatt_sh_expl_w)
|
||||
WRITE8_MEMBER(tankbatt_state::sh_expl_w)
|
||||
{
|
||||
if (m_sound_enable)
|
||||
{
|
||||
@ -113,7 +119,7 @@ WRITE8_MEMBER(tankbatt_state::tankbatt_sh_expl_w)
|
||||
}
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(tankbatt_state::tankbatt_sh_engine_w)
|
||||
WRITE8_MEMBER(tankbatt_state::sh_engine_w)
|
||||
{
|
||||
if (m_sound_enable)
|
||||
{
|
||||
@ -125,7 +131,7 @@ WRITE8_MEMBER(tankbatt_state::tankbatt_sh_engine_w)
|
||||
else m_samples->stop(2);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(tankbatt_state::tankbatt_sh_fire_w)
|
||||
WRITE8_MEMBER(tankbatt_state::sh_fire_w)
|
||||
{
|
||||
if (m_sound_enable)
|
||||
{
|
||||
@ -133,19 +139,19 @@ WRITE8_MEMBER(tankbatt_state::tankbatt_sh_fire_w)
|
||||
}
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(tankbatt_state::tankbatt_irq_ack_w)
|
||||
WRITE8_MEMBER(tankbatt_state::irq_ack_w)
|
||||
{
|
||||
/* 0x6e written at the end of the irq routine, could be either irq ack or a coin sample */
|
||||
m_maincpu->set_input_line(0, CLEAR_LINE);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(tankbatt_state::tankbatt_coin_counter_w)
|
||||
WRITE8_MEMBER(tankbatt_state::coincounter_w)
|
||||
{
|
||||
coin_counter_w(machine(), 0,data & 1);
|
||||
coin_counter_w(machine(), 1,data & 1);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(tankbatt_state::tankbatt_coin_lockout_w)
|
||||
WRITE8_MEMBER(tankbatt_state::coinlockout_w)
|
||||
{
|
||||
coin_lockout_w(machine(), 0,data & 1);
|
||||
coin_lockout_w(machine(), 1,data & 1);
|
||||
@ -155,28 +161,28 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, tankbatt_state )
|
||||
AM_RANGE(0x0000, 0x000f) AM_RAM AM_SHARE("bulletsram")
|
||||
AM_RANGE(0x0010, 0x01ff) AM_RAM
|
||||
AM_RANGE(0x0200, 0x07ff) AM_RAM
|
||||
AM_RANGE(0x0800, 0x0bff) AM_RAM_WRITE(tankbatt_videoram_w) AM_SHARE("videoram")
|
||||
AM_RANGE(0x0c00, 0x0c07) AM_READ(tankbatt_in0_r)
|
||||
AM_RANGE(0x0c00, 0x0c01) AM_WRITE(tankbatt_led_w)
|
||||
AM_RANGE(0x0c02, 0x0c02) AM_WRITE(tankbatt_coin_counter_w)
|
||||
AM_RANGE(0x0c03, 0x0c03) AM_WRITE(tankbatt_coin_lockout_w)
|
||||
AM_RANGE(0x0c08, 0x0c0f) AM_READ(tankbatt_in1_r)
|
||||
AM_RANGE(0x0800, 0x0bff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram")
|
||||
AM_RANGE(0x0c00, 0x0c07) AM_READ(in0_r)
|
||||
AM_RANGE(0x0c00, 0x0c01) AM_WRITE(led_w)
|
||||
AM_RANGE(0x0c02, 0x0c02) AM_WRITE(coincounter_w)
|
||||
AM_RANGE(0x0c03, 0x0c03) AM_WRITE(coinlockout_w)
|
||||
AM_RANGE(0x0c08, 0x0c0f) AM_READ(in1_r)
|
||||
AM_RANGE(0x0c08, 0x0c08) AM_WRITENOP //coin counter mirror?
|
||||
AM_RANGE(0x0c0a, 0x0c0a) AM_WRITE(tankbatt_interrupt_enable_w)
|
||||
AM_RANGE(0x0c0b, 0x0c0b) AM_WRITE(tankbatt_sh_engine_w)
|
||||
AM_RANGE(0x0c0c, 0x0c0c) AM_WRITE(tankbatt_sh_fire_w)
|
||||
AM_RANGE(0x0c0d, 0x0c0d) AM_WRITE(tankbatt_sh_expl_w) // bit 7 == led for the start 2 button
|
||||
AM_RANGE(0x0c0a, 0x0c0a) AM_WRITE(interrupt_enable_w)
|
||||
AM_RANGE(0x0c0b, 0x0c0b) AM_WRITE(sh_engine_w)
|
||||
AM_RANGE(0x0c0c, 0x0c0c) AM_WRITE(sh_fire_w)
|
||||
AM_RANGE(0x0c0d, 0x0c0d) AM_WRITE(sh_expl_w) // bit 7 == led for the start 2 button
|
||||
AM_RANGE(0x0c0e, 0x0c0e) AM_WRITENOP //bit 7 == led for the start 1 button
|
||||
AM_RANGE(0x0c0f, 0x0c0f) AM_WRITE(tankbatt_demo_interrupt_enable_w)
|
||||
AM_RANGE(0x0c10, 0x0c10) AM_WRITE(tankbatt_irq_ack_w)
|
||||
AM_RANGE(0x0c18, 0x0c1f) AM_READ(tankbatt_dsw_r)
|
||||
AM_RANGE(0x0c0f, 0x0c0f) AM_WRITE(demo_interrupt_enable_w)
|
||||
AM_RANGE(0x0c10, 0x0c10) AM_WRITE(irq_ack_w)
|
||||
AM_RANGE(0x0c18, 0x0c1f) AM_READ(dsw_r)
|
||||
AM_RANGE(0x0c18, 0x0c18) AM_WRITENOP /* watchdog ?? */
|
||||
AM_RANGE(0x6000, 0x7fff) AM_ROM AM_REGION("maincpu",0)
|
||||
AM_RANGE(0xe000, 0xffff) AM_ROM AM_REGION("maincpu",0) //mirror for the reset/irq vectors
|
||||
AM_RANGE(0x2000, 0xffff) AM_READNOP //anything else might be left-over for a diagnostic ROM or something related to the discrete sound HW
|
||||
ADDRESS_MAP_END
|
||||
|
||||
INTERRUPT_GEN_MEMBER(tankbatt_state::tankbatt_interrupt)
|
||||
INTERRUPT_GEN_MEMBER(tankbatt_state::interrupt)
|
||||
{
|
||||
if (m_nmi_enable) device.execute().set_input_line(INPUT_LINE_NMI,PULSE_LINE);
|
||||
}
|
||||
@ -276,7 +282,7 @@ static MACHINE_CONFIG_START( tankbatt, tankbatt_state )
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", M6502, 1000000) /* 1 MHz ???? */
|
||||
MCFG_CPU_PROGRAM_MAP(main_map)
|
||||
MCFG_CPU_VBLANK_INT_DRIVER("screen", tankbatt_state, tankbatt_interrupt)
|
||||
MCFG_CPU_VBLANK_INT_DRIVER("screen", tankbatt_state, interrupt)
|
||||
|
||||
/* video hardware */
|
||||
MCFG_SCREEN_ADD("screen", RASTER)
|
||||
@ -284,7 +290,7 @@ static MACHINE_CONFIG_START( tankbatt, tankbatt_state )
|
||||
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
|
||||
MCFG_SCREEN_SIZE(32*8, 32*8)
|
||||
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(tankbatt_state, screen_update_tankbatt)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(tankbatt_state, screen_update)
|
||||
MCFG_SCREEN_PALETTE("palette")
|
||||
|
||||
MCFG_GFXDECODE_ADD("gfxdecode", "palette", tankbatt)
|
||||
@ -337,5 +343,5 @@ ROM_START( tankbattb ) /* board with "NAMCO" removed from gfx1 rom, otherwise id
|
||||
ROM_LOAD( "bct1-1.l3", 0x0000, 0x0100, CRC(d17518bc) SHA1(f3b0deffa586808bc59e9a24ec1699c54ebe84cc) ) // dm74s287n.3l
|
||||
ROM_END
|
||||
|
||||
GAME( 1980, tankbatt, 0, tankbatt, tankbatt, driver_device, 0, ROT90, "Namco", "Tank Battalion", GAME_IMPERFECT_SOUND )
|
||||
GAME( 1980, tankbattb, tankbatt, tankbatt, tankbatt, driver_device, 0, ROT90, "bootleg", "Tank Battalion (bootleg)", GAME_IMPERFECT_SOUND )
|
||||
GAME( 1980, tankbatt, 0, tankbatt, tankbatt, driver_device, 0, ROT90, "Namco", "Tank Battalion", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
|
||||
GAME( 1980, tankbattb, tankbatt, tankbatt, tankbatt, driver_device, 0, ROT90, "bootleg", "Tank Battalion (bootleg)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
|
||||
|
@ -26,6 +26,12 @@ void tankbust_state::machine_start()
|
||||
{
|
||||
membank("bank1")->configure_entries(0, 2, memregion("maincpu")->base() + 0x10000, 0x4000);
|
||||
membank("bank2")->configure_entries(0, 2, memregion("maincpu")->base() + 0x18000, 0x2000);
|
||||
|
||||
save_item(NAME(m_latch));
|
||||
save_item(NAME(m_timer1));
|
||||
save_item(NAME(m_e0xx_data));
|
||||
save_item(NAME(m_variable_data));
|
||||
save_item(NAME(m_irq_mask));
|
||||
}
|
||||
|
||||
//port A of ay8910#0
|
||||
@ -35,18 +41,18 @@ TIMER_CALLBACK_MEMBER(tankbust_state::soundlatch_callback)
|
||||
m_latch = param;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(tankbust_state::tankbust_soundlatch_w)
|
||||
WRITE8_MEMBER(tankbust_state::soundlatch_w)
|
||||
{
|
||||
machine().scheduler().synchronize(timer_expired_delegate(FUNC(tankbust_state::soundlatch_callback),this), data);
|
||||
}
|
||||
|
||||
READ8_MEMBER(tankbust_state::tankbust_soundlatch_r)
|
||||
READ8_MEMBER(tankbust_state::soundlatch_r)
|
||||
{
|
||||
return m_latch;
|
||||
}
|
||||
|
||||
//port B of ay8910#0
|
||||
READ8_MEMBER(tankbust_state::tankbust_soundtimer_r)
|
||||
READ8_MEMBER(tankbust_state::soundtimer_r)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@ -65,7 +71,7 @@ TIMER_CALLBACK_MEMBER(tankbust_state::soundirqline_callback)
|
||||
|
||||
|
||||
|
||||
WRITE8_MEMBER(tankbust_state::tankbust_e0xx_w)
|
||||
WRITE8_MEMBER(tankbust_state::e0xx_w)
|
||||
{
|
||||
m_e0xx_data[offset] = data;
|
||||
|
||||
@ -183,16 +189,16 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, tankbust_state )
|
||||
AM_RANGE(0x0000, 0x5fff) AM_ROM
|
||||
AM_RANGE(0x6000, 0x9fff) AM_ROMBANK("bank1")
|
||||
AM_RANGE(0xa000, 0xbfff) AM_ROMBANK("bank2")
|
||||
AM_RANGE(0xc000, 0xc7ff) AM_READWRITE(tankbust_background_videoram_r, tankbust_background_videoram_w) AM_SHARE("videoram")
|
||||
AM_RANGE(0xc800, 0xcfff) AM_READWRITE(tankbust_background_colorram_r, tankbust_background_colorram_w) AM_SHARE("colorram")
|
||||
AM_RANGE(0xd000, 0xd7ff) AM_READWRITE(tankbust_txtram_r, tankbust_txtram_w) AM_SHARE("txtram")
|
||||
AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(background_videoram_w) AM_SHARE("videoram")
|
||||
AM_RANGE(0xc800, 0xcfff) AM_RAM_WRITE(background_colorram_w) AM_SHARE("colorram")
|
||||
AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(txtram_w) AM_SHARE("txtram")
|
||||
AM_RANGE(0xd800, 0xd8ff) AM_RAM AM_SHARE("spriteram")
|
||||
AM_RANGE(0xe000, 0xe007) AM_READWRITE(debug_output_area_r, tankbust_e0xx_w)
|
||||
AM_RANGE(0xe800, 0xe800) AM_READ_PORT("INPUTS") AM_WRITE(tankbust_yscroll_w)
|
||||
AM_RANGE(0xe000, 0xe007) AM_READWRITE(debug_output_area_r, e0xx_w)
|
||||
AM_RANGE(0xe800, 0xe800) AM_READ_PORT("INPUTS") AM_WRITE(yscroll_w)
|
||||
AM_RANGE(0xe801, 0xe801) AM_READ_PORT("SYSTEM")
|
||||
AM_RANGE(0xe802, 0xe802) AM_READ_PORT("DSW")
|
||||
AM_RANGE(0xe801, 0xe802) AM_WRITE(tankbust_xscroll_w)
|
||||
AM_RANGE(0xe803, 0xe803) AM_READWRITE(some_changing_input, tankbust_soundlatch_w) /*unknown. Game expects this to change so this is not player input */
|
||||
AM_RANGE(0xe801, 0xe802) AM_WRITE(xscroll_w)
|
||||
AM_RANGE(0xe803, 0xe803) AM_READWRITE(some_changing_input, soundlatch_w) /*unknown. Game expects this to change so this is not player input */
|
||||
AM_RANGE(0xe804, 0xe804) AM_WRITENOP /* watchdog ? ; written in long-lasting loops */
|
||||
AM_RANGE(0xf000, 0xf7ff) AM_RAM
|
||||
//AM_RANGE(0xf800, 0xffff) AM_READ(read_from_unmapped_memory) /* a bug in game code ? */
|
||||
@ -341,7 +347,7 @@ static MACHINE_CONFIG_START( tankbust, tankbust_state )
|
||||
MCFG_SCREEN_SIZE ( 64*8, 32*8 )
|
||||
MCFG_SCREEN_VISIBLE_AREA ( 16*8, 56*8-1, 1*8, 31*8-1 )
|
||||
// MCFG_SCREEN_VISIBLE_AREA ( 0*8, 64*8-1, 1*8, 31*8-1 )
|
||||
MCFG_SCREEN_UPDATE_DRIVER(tankbust_state, screen_update_tankbust)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(tankbust_state, screen_update)
|
||||
MCFG_SCREEN_PALETTE("palette")
|
||||
|
||||
MCFG_GFXDECODE_ADD("gfxdecode", "palette", tankbust )
|
||||
@ -353,8 +359,8 @@ static MACHINE_CONFIG_START( tankbust, tankbust_state )
|
||||
MCFG_SPEAKER_STANDARD_MONO("mono")
|
||||
|
||||
MCFG_SOUND_ADD("ay1", AY8910, XTAL_14_31818MHz/16) /* Verified on PCB */
|
||||
MCFG_AY8910_PORT_A_READ_CB(READ8(tankbust_state, tankbust_soundlatch_r))
|
||||
MCFG_AY8910_PORT_B_READ_CB(READ8(tankbust_state, tankbust_soundtimer_r))
|
||||
MCFG_AY8910_PORT_A_READ_CB(READ8(tankbust_state, soundlatch_r))
|
||||
MCFG_AY8910_PORT_B_READ_CB(READ8(tankbust_state, soundtimer_r))
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10)
|
||||
|
||||
MCFG_SOUND_ADD("ay2", AY8910, XTAL_14_31818MHz/16) /* Verified on PCB */
|
||||
@ -409,4 +415,4 @@ ROM_START( tankbust )
|
||||
ROM_END
|
||||
|
||||
|
||||
GAME( 1985, tankbust, 0, tankbust, tankbust, driver_device, 0, ROT90, "Valadon Automation", "Tank Busters", 0 )
|
||||
GAME( 1985, tankbust, 0, tankbust, tankbust, driver_device, 0, ROT90, "Valadon Automation", "Tank Busters", GAME_SUPPORTS_SAVE )
|
||||
|
@ -4,41 +4,49 @@ class tankbatt_state : public driver_device
|
||||
public:
|
||||
tankbatt_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_bulletsram(*this, "bulletsram"),
|
||||
m_videoram(*this, "videoram"),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_samples(*this, "samples"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_palette(*this, "palette") { }
|
||||
m_palette(*this, "palette"),
|
||||
m_bulletsram(*this, "bulletsram"),
|
||||
m_videoram(*this, "videoram") { }
|
||||
|
||||
required_shared_ptr<UINT8> m_bulletsram;
|
||||
required_shared_ptr<UINT8> m_videoram;
|
||||
int m_nmi_enable;
|
||||
int m_sound_enable;
|
||||
|
||||
tilemap_t *m_bg_tilemap;
|
||||
DECLARE_WRITE8_MEMBER(tankbatt_led_w);
|
||||
DECLARE_READ8_MEMBER(tankbatt_in0_r);
|
||||
DECLARE_READ8_MEMBER(tankbatt_in1_r);
|
||||
DECLARE_READ8_MEMBER(tankbatt_dsw_r);
|
||||
DECLARE_WRITE8_MEMBER(tankbatt_interrupt_enable_w);
|
||||
DECLARE_WRITE8_MEMBER(tankbatt_demo_interrupt_enable_w);
|
||||
DECLARE_WRITE8_MEMBER(tankbatt_sh_expl_w);
|
||||
DECLARE_WRITE8_MEMBER(tankbatt_sh_engine_w);
|
||||
DECLARE_WRITE8_MEMBER(tankbatt_sh_fire_w);
|
||||
DECLARE_WRITE8_MEMBER(tankbatt_irq_ack_w);
|
||||
DECLARE_WRITE8_MEMBER(tankbatt_coin_counter_w);
|
||||
DECLARE_WRITE8_MEMBER(tankbatt_coin_lockout_w);
|
||||
DECLARE_WRITE8_MEMBER(tankbatt_videoram_w);
|
||||
DECLARE_INPUT_CHANGED_MEMBER(coin_inserted);
|
||||
TILE_GET_INFO_MEMBER(get_bg_tile_info);
|
||||
virtual void video_start();
|
||||
DECLARE_PALETTE_INIT(tankbatt);
|
||||
UINT32 screen_update_tankbatt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
INTERRUPT_GEN_MEMBER(tankbatt_interrupt);
|
||||
void draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<samples_device> m_samples;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<palette_device> m_palette;
|
||||
|
||||
required_shared_ptr<UINT8> m_bulletsram;
|
||||
required_shared_ptr<UINT8> m_videoram;
|
||||
|
||||
int m_nmi_enable;
|
||||
int m_sound_enable;
|
||||
tilemap_t *m_bg_tilemap;
|
||||
|
||||
DECLARE_WRITE8_MEMBER(led_w);
|
||||
DECLARE_READ8_MEMBER(in0_r);
|
||||
DECLARE_READ8_MEMBER(in1_r);
|
||||
DECLARE_READ8_MEMBER(dsw_r);
|
||||
DECLARE_WRITE8_MEMBER(interrupt_enable_w);
|
||||
DECLARE_WRITE8_MEMBER(demo_interrupt_enable_w);
|
||||
DECLARE_WRITE8_MEMBER(sh_expl_w);
|
||||
DECLARE_WRITE8_MEMBER(sh_engine_w);
|
||||
DECLARE_WRITE8_MEMBER(sh_fire_w);
|
||||
DECLARE_WRITE8_MEMBER(irq_ack_w);
|
||||
DECLARE_WRITE8_MEMBER(coincounter_w);
|
||||
DECLARE_WRITE8_MEMBER(coinlockout_w);
|
||||
DECLARE_WRITE8_MEMBER(videoram_w);
|
||||
|
||||
|
||||
INTERRUPT_GEN_MEMBER(interrupt);
|
||||
DECLARE_INPUT_CHANGED_MEMBER(coin_inserted);
|
||||
|
||||
TILE_GET_INFO_MEMBER(get_bg_tile_info);
|
||||
|
||||
virtual void machine_start();
|
||||
virtual void video_start();
|
||||
DECLARE_PALETTE_INIT(tankbatt);
|
||||
|
||||
UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
};
|
||||
|
@ -3,57 +3,60 @@ class tankbust_state : public driver_device
|
||||
public:
|
||||
tankbust_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_txtram(*this, "txtram"),
|
||||
m_videoram(*this, "videoram"),
|
||||
m_colorram(*this, "colorram"),
|
||||
m_spriteram(*this, "spriteram"),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_subcpu(*this, "sub"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_palette(*this, "palette") { }
|
||||
m_palette(*this, "palette"),
|
||||
m_txtram(*this, "txtram"),
|
||||
m_videoram(*this, "videoram"),
|
||||
m_colorram(*this, "colorram"),
|
||||
m_spriteram(*this, "spriteram") { }
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<cpu_device> m_subcpu;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<palette_device> m_palette;
|
||||
|
||||
required_shared_ptr<UINT8> m_txtram;
|
||||
required_shared_ptr<UINT8> m_videoram;
|
||||
required_shared_ptr<UINT8> m_colorram;
|
||||
required_shared_ptr<UINT8> m_spriteram;
|
||||
|
||||
int m_latch;
|
||||
UINT32 m_timer1;
|
||||
int m_e0xx_data[8];
|
||||
UINT8 m_variable_data;
|
||||
required_shared_ptr<UINT8> m_txtram;
|
||||
required_shared_ptr<UINT8> m_videoram;
|
||||
required_shared_ptr<UINT8> m_colorram;
|
||||
tilemap_t *m_bg_tilemap;
|
||||
tilemap_t *m_txt_tilemap;
|
||||
UINT8 m_xscroll[2];
|
||||
UINT8 m_yscroll[2];
|
||||
required_shared_ptr<UINT8> m_spriteram;
|
||||
|
||||
UINT8 m_irq_mask;
|
||||
DECLARE_WRITE8_MEMBER(tankbust_soundlatch_w);
|
||||
DECLARE_WRITE8_MEMBER(tankbust_e0xx_w);
|
||||
|
||||
DECLARE_WRITE8_MEMBER(soundlatch_w);
|
||||
DECLARE_WRITE8_MEMBER(e0xx_w);
|
||||
DECLARE_READ8_MEMBER(debug_output_area_r);
|
||||
DECLARE_READ8_MEMBER(read_from_unmapped_memory);
|
||||
DECLARE_READ8_MEMBER(some_changing_input);
|
||||
DECLARE_WRITE8_MEMBER(tankbust_background_videoram_w);
|
||||
DECLARE_READ8_MEMBER(tankbust_background_videoram_r);
|
||||
DECLARE_WRITE8_MEMBER(tankbust_background_colorram_w);
|
||||
DECLARE_READ8_MEMBER(tankbust_background_colorram_r);
|
||||
DECLARE_WRITE8_MEMBER(tankbust_txtram_w);
|
||||
DECLARE_READ8_MEMBER(tankbust_txtram_r);
|
||||
DECLARE_WRITE8_MEMBER(tankbust_xscroll_w);
|
||||
DECLARE_WRITE8_MEMBER(tankbust_yscroll_w);
|
||||
DECLARE_READ8_MEMBER(tankbust_soundlatch_r);
|
||||
DECLARE_READ8_MEMBER(tankbust_soundtimer_r);
|
||||
DECLARE_WRITE8_MEMBER(background_videoram_w);
|
||||
DECLARE_WRITE8_MEMBER(background_colorram_w);
|
||||
DECLARE_WRITE8_MEMBER(txtram_w);
|
||||
DECLARE_WRITE8_MEMBER(xscroll_w);
|
||||
DECLARE_WRITE8_MEMBER(yscroll_w);
|
||||
DECLARE_READ8_MEMBER(soundlatch_r);
|
||||
DECLARE_READ8_MEMBER(soundtimer_r);
|
||||
|
||||
TILE_GET_INFO_MEMBER(get_bg_tile_info);
|
||||
TILE_GET_INFO_MEMBER(get_txt_tile_info);
|
||||
|
||||
virtual void machine_start();
|
||||
virtual void machine_reset();
|
||||
virtual void video_start();
|
||||
DECLARE_PALETTE_INIT(tankbust);
|
||||
UINT32 screen_update_tankbust(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
|
||||
UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
|
||||
INTERRUPT_GEN_MEMBER(vblank_irq);
|
||||
TIMER_CALLBACK_MEMBER(soundlatch_callback);
|
||||
TIMER_CALLBACK_MEMBER(soundirqline_callback);
|
||||
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<cpu_device> m_subcpu;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<palette_device> m_palette;
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
/***************************************************************************
|
||||
|
||||
video.c
|
||||
tankbatt.c
|
||||
|
||||
Functions to emulate the video hardware of the machine.
|
||||
|
||||
@ -56,18 +56,16 @@ PALETTE_INIT_MEMBER(tankbatt_state, tankbatt)
|
||||
}
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(tankbatt_state::tankbatt_videoram_w)
|
||||
WRITE8_MEMBER(tankbatt_state::videoram_w)
|
||||
{
|
||||
UINT8 *videoram = m_videoram;
|
||||
videoram[offset] = data;
|
||||
m_videoram[offset] = data;
|
||||
m_bg_tilemap->mark_tile_dirty(offset);
|
||||
}
|
||||
|
||||
TILE_GET_INFO_MEMBER(tankbatt_state::get_bg_tile_info)
|
||||
{
|
||||
UINT8 *videoram = m_videoram;
|
||||
int code = videoram[tile_index];
|
||||
int color = videoram[tile_index] | 0x01;
|
||||
int code = m_videoram[tile_index];
|
||||
int color = m_videoram[tile_index] | 0x01;
|
||||
|
||||
SET_TILE_INFO_MEMBER(0, code, color, 0);
|
||||
}
|
||||
@ -79,9 +77,7 @@ void tankbatt_state::video_start()
|
||||
|
||||
void tankbatt_state::draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
int offs;
|
||||
|
||||
for (offs = 0;offs < m_bulletsram.bytes();offs += 2)
|
||||
for (int offs = 0;offs < m_bulletsram.bytes();offs += 2)
|
||||
{
|
||||
int color = 0xff; /* cyan, same color as the tanks */
|
||||
int x = m_bulletsram[offs + 1];
|
||||
@ -95,7 +91,7 @@ void tankbatt_state::draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprec
|
||||
}
|
||||
}
|
||||
|
||||
UINT32 tankbatt_state::screen_update_tankbatt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
UINT32 tankbatt_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
|
||||
draw_bullets(bitmap, cliprect);
|
||||
|
@ -41,7 +41,7 @@ TILE_GET_INFO_MEMBER(tankbust_state::get_bg_tile_info)
|
||||
{
|
||||
color = ((int)rand()) & 0x0f;
|
||||
}
|
||||
if (attr&0x80) //al the roofs of all buildings have this bit set. What's this ???
|
||||
if (attr&0x80) //all the roofs of all buildings have this bit set. What's this ???
|
||||
{
|
||||
color = ((int)rand()) & 0x0f;
|
||||
}
|
||||
@ -82,8 +82,10 @@ void tankbust_state::video_start()
|
||||
/* scrollable */
|
||||
m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(tankbust_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
|
||||
|
||||
|
||||
m_txt_tilemap->set_transparent_pen(0);
|
||||
|
||||
save_item(NAME(m_xscroll));
|
||||
save_item(NAME(m_yscroll));
|
||||
}
|
||||
|
||||
|
||||
@ -93,39 +95,25 @@ void tankbust_state::video_start()
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
WRITE8_MEMBER(tankbust_state::tankbust_background_videoram_w)
|
||||
WRITE8_MEMBER(tankbust_state::background_videoram_w)
|
||||
{
|
||||
m_videoram[offset] = data;
|
||||
m_bg_tilemap->mark_tile_dirty(offset);
|
||||
}
|
||||
READ8_MEMBER(tankbust_state::tankbust_background_videoram_r)
|
||||
{
|
||||
return m_videoram[offset];
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(tankbust_state::tankbust_background_colorram_w)
|
||||
WRITE8_MEMBER(tankbust_state::background_colorram_w)
|
||||
{
|
||||
m_colorram[offset] = data;
|
||||
m_bg_tilemap->mark_tile_dirty(offset);
|
||||
}
|
||||
READ8_MEMBER(tankbust_state::tankbust_background_colorram_r)
|
||||
{
|
||||
return m_colorram[offset];
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(tankbust_state::tankbust_txtram_w)
|
||||
WRITE8_MEMBER(tankbust_state::txtram_w)
|
||||
{
|
||||
m_txtram[offset] = data;
|
||||
m_txt_tilemap->mark_tile_dirty(offset);
|
||||
}
|
||||
READ8_MEMBER(tankbust_state::tankbust_txtram_r)
|
||||
{
|
||||
return m_txtram[offset];
|
||||
}
|
||||
|
||||
|
||||
|
||||
WRITE8_MEMBER(tankbust_state::tankbust_xscroll_w)
|
||||
WRITE8_MEMBER(tankbust_state::xscroll_w)
|
||||
{
|
||||
if( m_xscroll[offset] != data )
|
||||
{
|
||||
@ -141,7 +129,7 @@ WRITE8_MEMBER(tankbust_state::tankbust_xscroll_w)
|
||||
}
|
||||
|
||||
|
||||
WRITE8_MEMBER(tankbust_state::tankbust_yscroll_w)
|
||||
WRITE8_MEMBER(tankbust_state::yscroll_w)
|
||||
{
|
||||
if( m_yscroll[offset] != data )
|
||||
{
|
||||
@ -178,19 +166,16 @@ spriteram format (4 bytes per sprite):
|
||||
|
||||
void tankbust_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
UINT8 *spriteram = m_spriteram;
|
||||
int offs;
|
||||
|
||||
for (offs = 0; offs < m_spriteram.bytes(); offs += 4)
|
||||
for (int offs = 0; offs < m_spriteram.bytes(); offs += 4)
|
||||
{
|
||||
int code,color,sx,sy,flipx,flipy;
|
||||
|
||||
code = spriteram[offs+0] & 0x3f;
|
||||
flipy = spriteram[offs+0] & 0x40;
|
||||
flipx = spriteram[offs+0] & 0x80;
|
||||
code = m_spriteram[offs+0] & 0x3f;
|
||||
flipy = m_spriteram[offs+0] & 0x40;
|
||||
flipx = m_spriteram[offs+0] & 0x80;
|
||||
|
||||
sy = (240- spriteram[offs+1]) - 14;
|
||||
sx = (spriteram[offs+2] & 0x01) * 256 + spriteram[offs+3] - 7;
|
||||
sy = (240- m_spriteram[offs+1]) - 14;
|
||||
sx = (m_spriteram[offs+2] & 0x01) * 256 + m_spriteram[offs+3] - 7;
|
||||
|
||||
color = 0;
|
||||
|
||||
@ -202,13 +187,13 @@ void tankbust_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprec
|
||||
//0x40 - not used
|
||||
//0x80 - not used
|
||||
#if 0
|
||||
if ((spriteram[offs+2] & 0x02))
|
||||
if ((m_spriteram[offs+2] & 0x02))
|
||||
{
|
||||
code = ((int)rand()) & 63;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((spriteram[offs+1]!=4)) //otherwise - ghost sprites
|
||||
if ((m_spriteram[offs+1]!=4)) //otherwise - ghost sprites
|
||||
{
|
||||
m_gfxdecode->gfx(0)->transpen(bitmap,cliprect,
|
||||
code, color,
|
||||
@ -219,12 +204,10 @@ void tankbust_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprec
|
||||
}
|
||||
|
||||
|
||||
UINT32 tankbust_state::screen_update_tankbust(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
UINT32 tankbust_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
#if 0
|
||||
int i;
|
||||
|
||||
for (i=0; i<0x800; i++)
|
||||
for (int i=0; i<0x800; i++)
|
||||
{
|
||||
int tile_attrib = m_colorram[i];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user