mirror of
https://github.com/holub/mame
synced 2025-04-22 08:22:15 +03:00
alinvade.c, cball.c: added / enabled save state support (nw)
This commit is contained in:
parent
ef8195b650
commit
77d115b778
@ -39,11 +39,11 @@ public:
|
||||
DECLARE_WRITE8_MEMBER(sound_w);
|
||||
DECLARE_WRITE8_MEMBER(sounden_w);
|
||||
INTERRUPT_GEN_MEMBER(vblank_irq);
|
||||
UINT32 screen_update_alinvade(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||
UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||
|
||||
private:
|
||||
UINT8 irqmask;
|
||||
UINT8 irqff;
|
||||
UINT8 m_irqmask;
|
||||
UINT8 m_irqff;
|
||||
virtual void machine_start();
|
||||
virtual void machine_reset();
|
||||
required_device<cpu_device> m_maincpu;
|
||||
@ -90,10 +90,10 @@ READ8_MEMBER(alinvade_state::irqmask_r)
|
||||
|
||||
WRITE8_MEMBER(alinvade_state::irqmask_w)
|
||||
{
|
||||
if((!(irqff & 1)) && (data & 1)) // f/f, active high? If the above actually returns 0xff this could be active low ...
|
||||
irqmask^= 1;
|
||||
if((!(m_irqff & 1)) && (data & 1)) // f/f, active high? If the above actually returns 0xff this could be active low ...
|
||||
m_irqmask^= 1;
|
||||
|
||||
irqff = data;
|
||||
m_irqff = data;
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START( alinvade_map, AS_PROGRAM, 8, alinvade_state )
|
||||
@ -157,14 +157,16 @@ INPUT_PORTS_END
|
||||
|
||||
void alinvade_state::machine_start()
|
||||
{
|
||||
save_item(NAME(m_irqff));
|
||||
save_item(NAME(m_irqmask));
|
||||
}
|
||||
|
||||
void alinvade_state::machine_reset()
|
||||
{
|
||||
irqmask = 1;
|
||||
m_irqmask = 1;
|
||||
}
|
||||
|
||||
UINT32 alinvade_state::screen_update_alinvade(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
|
||||
UINT32 alinvade_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
offs_t offs;
|
||||
|
||||
@ -192,7 +194,7 @@ UINT32 alinvade_state::screen_update_alinvade(screen_device &screen, bitmap_rgb3
|
||||
|
||||
INTERRUPT_GEN_MEMBER(alinvade_state::vblank_irq)
|
||||
{
|
||||
if(irqmask & 1)
|
||||
if(m_irqmask & 1)
|
||||
m_maincpu->set_input_line(0,HOLD_LINE);
|
||||
}
|
||||
|
||||
@ -209,7 +211,7 @@ static MACHINE_CONFIG_START( alinvade, alinvade_state )
|
||||
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
|
||||
MCFG_SCREEN_SIZE(128, 128)
|
||||
MCFG_SCREEN_VISIBLE_AREA(0, 128-1, 0, 128-1)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(alinvade_state, screen_update_alinvade)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(alinvade_state, screen_update)
|
||||
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_MONO("mono")
|
||||
@ -235,4 +237,4 @@ ROM_START( alinvade )
|
||||
ROM_END
|
||||
|
||||
|
||||
GAMEL( 198?, alinvade, 0, alinvade, alinvade, driver_device, 0, ROT90, "Forbes?", "Alien Invaders", GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_SOUND, layout_alinvade )
|
||||
GAMEL( 198?, alinvade, 0, alinvade, alinvade, driver_device, 0, ROT90, "Forbes?", "Alien Invaders", GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE, layout_alinvade )
|
||||
|
@ -20,18 +20,11 @@ public:
|
||||
|
||||
cball_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_video_ram(*this, "video_ram"),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_screen(*this, "screen"),
|
||||
m_palette(*this, "palette")
|
||||
{ }
|
||||
|
||||
/* memory pointers */
|
||||
required_shared_ptr<UINT8> m_video_ram;
|
||||
|
||||
/* video-related */
|
||||
tilemap_t* m_bg_tilemap;
|
||||
m_palette(*this, "palette"),
|
||||
m_video_ram(*this, "video_ram") { }
|
||||
|
||||
/* devices */
|
||||
required_device<cpu_device> m_maincpu;
|
||||
@ -39,16 +32,27 @@ public:
|
||||
required_device<screen_device> m_screen;
|
||||
required_device<palette_device> m_palette;
|
||||
|
||||
DECLARE_WRITE8_MEMBER(cball_vram_w);
|
||||
DECLARE_READ8_MEMBER(cball_wram_r);
|
||||
DECLARE_WRITE8_MEMBER(cball_wram_w);
|
||||
/* memory pointers */
|
||||
required_shared_ptr<UINT8> m_video_ram;
|
||||
|
||||
/* video-related */
|
||||
tilemap_t* m_bg_tilemap;
|
||||
|
||||
emu_timer *m_int_timer;
|
||||
TIMER_CALLBACK_MEMBER(interrupt_callback);
|
||||
|
||||
DECLARE_WRITE8_MEMBER(vram_w);
|
||||
DECLARE_READ8_MEMBER(wram_r);
|
||||
DECLARE_WRITE8_MEMBER(wram_w);
|
||||
|
||||
TILE_GET_INFO_MEMBER(get_tile_info);
|
||||
|
||||
virtual void machine_start();
|
||||
virtual void machine_reset();
|
||||
virtual void video_start();
|
||||
DECLARE_PALETTE_INIT(cball);
|
||||
UINT32 screen_update_cball(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
TIMER_CALLBACK_MEMBER(interrupt_callback);
|
||||
|
||||
UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
|
||||
protected:
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
|
||||
@ -63,7 +67,7 @@ TILE_GET_INFO_MEMBER(cball_state::get_tile_info)
|
||||
}
|
||||
|
||||
|
||||
WRITE8_MEMBER(cball_state::cball_vram_w)
|
||||
WRITE8_MEMBER(cball_state::vram_w)
|
||||
{
|
||||
m_video_ram[offset] = data;
|
||||
m_bg_tilemap->mark_tile_dirty(offset);
|
||||
@ -76,7 +80,7 @@ void cball_state::video_start()
|
||||
}
|
||||
|
||||
|
||||
UINT32 cball_state::screen_update_cball(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
UINT32 cball_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
/* draw playfield */
|
||||
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
|
||||
@ -116,17 +120,18 @@ TIMER_CALLBACK_MEMBER(cball_state::interrupt_callback)
|
||||
if (scanline >= 262)
|
||||
scanline = 16;
|
||||
|
||||
timer_set(m_screen->time_until_pos(scanline), TIMER_INTERRUPT, scanline);
|
||||
m_int_timer->adjust(m_screen->time_until_pos(scanline), scanline);
|
||||
}
|
||||
|
||||
|
||||
void cball_state::machine_start()
|
||||
{
|
||||
m_int_timer = timer_alloc(TIMER_INTERRUPT);
|
||||
}
|
||||
|
||||
void cball_state::machine_reset()
|
||||
{
|
||||
timer_set(m_screen->time_until_pos(16), TIMER_INTERRUPT, 16);
|
||||
m_int_timer->adjust(m_screen->time_until_pos(16), 16);
|
||||
}
|
||||
|
||||
|
||||
@ -141,13 +146,13 @@ PALETTE_INIT_MEMBER(cball_state, cball)
|
||||
}
|
||||
|
||||
|
||||
READ8_MEMBER(cball_state::cball_wram_r)
|
||||
READ8_MEMBER(cball_state::wram_r)
|
||||
{
|
||||
return m_video_ram[0x380 + offset];
|
||||
}
|
||||
|
||||
|
||||
WRITE8_MEMBER(cball_state::cball_wram_w)
|
||||
WRITE8_MEMBER(cball_state::wram_w)
|
||||
{
|
||||
m_video_ram[0x380 + offset] = data;
|
||||
}
|
||||
@ -157,7 +162,7 @@ WRITE8_MEMBER(cball_state::cball_wram_w)
|
||||
static ADDRESS_MAP_START( cpu_map, AS_PROGRAM, 8, cball_state )
|
||||
ADDRESS_MAP_GLOBAL_MASK(0x7fff)
|
||||
|
||||
AM_RANGE(0x0000, 0x03ff) AM_READ(cball_wram_r) AM_MASK(0x7f)
|
||||
AM_RANGE(0x0000, 0x03ff) AM_READ(wram_r) AM_MASK(0x7f)
|
||||
AM_RANGE(0x0400, 0x07ff) AM_READONLY
|
||||
AM_RANGE(0x1001, 0x1001) AM_READ_PORT("1001")
|
||||
AM_RANGE(0x1003, 0x1003) AM_READ_PORT("1003")
|
||||
@ -167,8 +172,8 @@ static ADDRESS_MAP_START( cpu_map, AS_PROGRAM, 8, cball_state )
|
||||
AM_RANGE(0x2000, 0x2001) AM_NOP
|
||||
AM_RANGE(0x2800, 0x2800) AM_READ_PORT("2800")
|
||||
|
||||
AM_RANGE(0x0000, 0x03ff) AM_WRITE(cball_wram_w) AM_MASK(0x7f)
|
||||
AM_RANGE(0x0400, 0x07ff) AM_WRITE(cball_vram_w) AM_SHARE("video_ram")
|
||||
AM_RANGE(0x0000, 0x03ff) AM_WRITE(wram_w) AM_MASK(0x7f)
|
||||
AM_RANGE(0x0400, 0x07ff) AM_WRITE(vram_w) AM_SHARE("video_ram")
|
||||
AM_RANGE(0x1800, 0x1800) AM_NOP /* watchdog? */
|
||||
AM_RANGE(0x1810, 0x1811) AM_NOP
|
||||
AM_RANGE(0x1820, 0x1821) AM_NOP
|
||||
@ -265,7 +270,7 @@ static MACHINE_CONFIG_START( cball, cball_state )
|
||||
MCFG_SCREEN_REFRESH_RATE(60)
|
||||
MCFG_SCREEN_SIZE(256, 262)
|
||||
MCFG_SCREEN_VISIBLE_AREA(0, 255, 0, 223)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(cball_state, screen_update_cball)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(cball_state, screen_update)
|
||||
MCFG_SCREEN_PALETTE("palette")
|
||||
|
||||
MCFG_GFXDECODE_ADD("gfxdecode", "palette", cball)
|
||||
@ -298,4 +303,4 @@ ROM_START( cball )
|
||||
ROM_END
|
||||
|
||||
|
||||
GAME( 1976, cball, 0, cball, cball, driver_device, 0, ROT0, "Atari", "Cannonball (Atari, prototype)", GAME_NO_SOUND | GAME_WRONG_COLORS | GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1976, cball, 0, cball, cball, driver_device, 0, ROT0, "Atari", "Cannonball (Atari, prototype)", GAME_NO_SOUND | GAME_WRONG_COLORS | GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
|
||||
|
Loading…
Reference in New Issue
Block a user