mirror of
https://github.com/holub/mame
synced 2025-04-22 16:31:49 +03:00
videopin.c: added save state support (nw)
This commit is contained in:
parent
938b279ad6
commit
bfcec3ecc6
@ -69,18 +69,29 @@ TIMER_CALLBACK_MEMBER(videopin_state::interrupt_callback)
|
||||
if (scanline >= 263)
|
||||
scanline = 32;
|
||||
|
||||
timer_set(m_screen->time_until_pos(scanline), TIMER_INTERRUPT, scanline);
|
||||
m_interrupt_timer->adjust(m_screen->time_until_pos(scanline), scanline);
|
||||
}
|
||||
|
||||
|
||||
void videopin_state::machine_start()
|
||||
{
|
||||
m_interrupt_timer = timer_alloc(TIMER_INTERRUPT);
|
||||
|
||||
save_item(NAME(m_time_pushed));
|
||||
save_item(NAME(m_time_released));
|
||||
save_item(NAME(m_prev));
|
||||
save_item(NAME(m_mask));
|
||||
}
|
||||
|
||||
|
||||
void videopin_state::machine_reset()
|
||||
{
|
||||
timer_set(m_screen->time_until_pos(32), TIMER_INTERRUPT, 32);
|
||||
m_interrupt_timer->adjust(m_screen->time_until_pos(32), 32);
|
||||
|
||||
/* both output latches are cleared on reset */
|
||||
|
||||
videopin_out1_w(machine().driver_data()->generic_space(), 0, 0);
|
||||
videopin_out2_w(machine().driver_data()->generic_space(), 0, 0);
|
||||
out1_w(machine().driver_data()->generic_space(), 0, 0);
|
||||
out2_w(machine().driver_data()->generic_space(), 0, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -90,7 +101,7 @@ double videopin_state::calc_plunger_pos()
|
||||
}
|
||||
|
||||
|
||||
READ8_MEMBER(videopin_state::videopin_misc_r)
|
||||
READ8_MEMBER(videopin_state::misc_r)
|
||||
{
|
||||
double plunger = calc_plunger_pos();
|
||||
|
||||
@ -118,7 +129,7 @@ READ8_MEMBER(videopin_state::videopin_misc_r)
|
||||
}
|
||||
|
||||
|
||||
WRITE8_MEMBER(videopin_state::videopin_led_w)
|
||||
WRITE8_MEMBER(videopin_state::led_w)
|
||||
{
|
||||
int i = (m_screen->vpos() >> 5) & 7;
|
||||
static const char *const matrix[8][4] =
|
||||
@ -145,7 +156,7 @@ WRITE8_MEMBER(videopin_state::videopin_led_w)
|
||||
}
|
||||
|
||||
|
||||
WRITE8_MEMBER(videopin_state::videopin_out1_w)
|
||||
WRITE8_MEMBER(videopin_state::out1_w)
|
||||
{
|
||||
/* D0 => OCTAVE0 */
|
||||
/* D1 => OCTACE1 */
|
||||
@ -168,7 +179,7 @@ WRITE8_MEMBER(videopin_state::videopin_out1_w)
|
||||
}
|
||||
|
||||
|
||||
WRITE8_MEMBER(videopin_state::videopin_out2_w)
|
||||
WRITE8_MEMBER(videopin_state::out2_w)
|
||||
{
|
||||
/* D0 => VOL0 */
|
||||
/* D1 => VOL1 */
|
||||
@ -188,7 +199,7 @@ WRITE8_MEMBER(videopin_state::videopin_out2_w)
|
||||
}
|
||||
|
||||
|
||||
WRITE8_MEMBER(videopin_state::videopin_note_dvsr_w)
|
||||
WRITE8_MEMBER(videopin_state::note_dvsr_w)
|
||||
{
|
||||
/* note data */
|
||||
m_discrete->write(space, VIDEOPIN_NOTE_DATA, ~data &0xff);
|
||||
@ -203,13 +214,13 @@ WRITE8_MEMBER(videopin_state::videopin_note_dvsr_w)
|
||||
|
||||
static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, videopin_state )
|
||||
AM_RANGE(0x0000, 0x01ff) AM_RAM
|
||||
AM_RANGE(0x0200, 0x07ff) AM_RAM_WRITE(videopin_video_ram_w) AM_SHARE("video_ram")
|
||||
AM_RANGE(0x0800, 0x0800) AM_READ(videopin_misc_r) AM_WRITE(videopin_note_dvsr_w)
|
||||
AM_RANGE(0x0801, 0x0801) AM_WRITE(videopin_led_w)
|
||||
AM_RANGE(0x0200, 0x07ff) AM_RAM_WRITE(video_ram_w) AM_SHARE("video_ram")
|
||||
AM_RANGE(0x0800, 0x0800) AM_READ(misc_r) AM_WRITE(note_dvsr_w)
|
||||
AM_RANGE(0x0801, 0x0801) AM_WRITE(led_w)
|
||||
AM_RANGE(0x0802, 0x0802) AM_WRITE(watchdog_reset_w)
|
||||
AM_RANGE(0x0804, 0x0804) AM_WRITE(videopin_ball_w)
|
||||
AM_RANGE(0x0805, 0x0805) AM_WRITE(videopin_out1_w)
|
||||
AM_RANGE(0x0806, 0x0806) AM_WRITE(videopin_out2_w)
|
||||
AM_RANGE(0x0804, 0x0804) AM_WRITE(ball_w)
|
||||
AM_RANGE(0x0805, 0x0805) AM_WRITE(out1_w)
|
||||
AM_RANGE(0x0806, 0x0806) AM_WRITE(out2_w)
|
||||
AM_RANGE(0x1000, 0x1000) AM_READ_PORT("IN0")
|
||||
AM_RANGE(0x1800, 0x1800) AM_READ_PORT("DSW")
|
||||
AM_RANGE(0x2000, 0x3fff) AM_ROM
|
||||
@ -353,7 +364,7 @@ static MACHINE_CONFIG_START( videopin, videopin_state )
|
||||
MCFG_SCREEN_REFRESH_RATE(60)
|
||||
MCFG_SCREEN_SIZE(304, 263)
|
||||
MCFG_SCREEN_VISIBLE_AREA(0, 303, 0, 255)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(videopin_state, screen_update_videopin)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(videopin_state, screen_update)
|
||||
MCFG_SCREEN_PALETTE("palette")
|
||||
|
||||
MCFG_GFXDECODE_ADD("gfxdecode", "palette", videopin)
|
||||
@ -447,5 +458,5 @@ ROM_END
|
||||
*
|
||||
*************************************/
|
||||
|
||||
GAMEL( 1979, videopin, 0, videopin, videopin, driver_device, 0, ROT270, "Atari", "Video Pinball", 0, layout_videopin )
|
||||
GAMEL( 1979, solarwar, 0, videopin, solarwar, driver_device, 0, ROT270, "Atari", "Solar War", 0, layout_videopin )
|
||||
GAMEL( 1979, videopin, 0, videopin, videopin, driver_device, 0, ROT270, "Atari", "Video Pinball", GAME_SUPPORTS_SAVE, layout_videopin )
|
||||
GAMEL( 1979, solarwar, 0, videopin, solarwar, driver_device, 0, ROT270, "Atari", "Solar War", GAME_SUPPORTS_SAVE, layout_videopin )
|
||||
|
@ -25,42 +25,51 @@ public:
|
||||
|
||||
videopin_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_discrete(*this, "discrete"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_screen(*this, "screen"),
|
||||
m_palette(*this, "palette") { }
|
||||
m_palette(*this, "palette"),
|
||||
m_video_ram(*this, "video_ram") { }
|
||||
|
||||
attotime m_time_pushed;
|
||||
attotime m_time_released;
|
||||
UINT8 m_prev;
|
||||
UINT8 m_mask;
|
||||
required_shared_ptr<UINT8> m_video_ram;
|
||||
int m_ball_x;
|
||||
int m_ball_y;
|
||||
tilemap_t* m_bg_tilemap;
|
||||
DECLARE_READ8_MEMBER(videopin_misc_r);
|
||||
DECLARE_WRITE8_MEMBER(videopin_led_w);
|
||||
DECLARE_WRITE8_MEMBER(videopin_ball_w);
|
||||
DECLARE_WRITE8_MEMBER(videopin_video_ram_w);
|
||||
DECLARE_WRITE8_MEMBER(videopin_out1_w);
|
||||
DECLARE_WRITE8_MEMBER(videopin_out2_w);
|
||||
DECLARE_WRITE8_MEMBER(videopin_note_dvsr_w);
|
||||
TILEMAP_MAPPER_MEMBER(get_memory_offset);
|
||||
TILE_GET_INFO_MEMBER(get_tile_info);
|
||||
virtual void machine_reset();
|
||||
virtual void video_start();
|
||||
UINT32 screen_update_videopin(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
TIMER_CALLBACK_MEMBER(interrupt_callback);
|
||||
void update_plunger();
|
||||
double calc_plunger_pos();
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<discrete_device> m_discrete;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<screen_device> m_screen;
|
||||
required_device<palette_device> m_palette;
|
||||
|
||||
required_shared_ptr<UINT8> m_video_ram;
|
||||
|
||||
attotime m_time_pushed;
|
||||
attotime m_time_released;
|
||||
UINT8 m_prev;
|
||||
UINT8 m_mask;
|
||||
int m_ball_x;
|
||||
int m_ball_y;
|
||||
tilemap_t* m_bg_tilemap;
|
||||
emu_timer *m_interrupt_timer;
|
||||
|
||||
DECLARE_READ8_MEMBER(misc_r);
|
||||
DECLARE_WRITE8_MEMBER(led_w);
|
||||
DECLARE_WRITE8_MEMBER(ball_w);
|
||||
DECLARE_WRITE8_MEMBER(video_ram_w);
|
||||
DECLARE_WRITE8_MEMBER(out1_w);
|
||||
DECLARE_WRITE8_MEMBER(out2_w);
|
||||
DECLARE_WRITE8_MEMBER(note_dvsr_w);
|
||||
|
||||
TILEMAP_MAPPER_MEMBER(get_memory_offset);
|
||||
TILE_GET_INFO_MEMBER(get_tile_info);
|
||||
|
||||
virtual void machine_start();
|
||||
virtual void machine_reset();
|
||||
virtual void video_start();
|
||||
|
||||
UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
|
||||
TIMER_CALLBACK_MEMBER(interrupt_callback);
|
||||
void update_plunger();
|
||||
double calc_plunger_pos();
|
||||
|
||||
protected:
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
|
||||
};
|
||||
|
@ -28,10 +28,13 @@ TILE_GET_INFO_MEMBER(videopin_state::get_tile_info)
|
||||
void videopin_state::video_start()
|
||||
{
|
||||
m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(videopin_state::get_tile_info),this), tilemap_mapper_delegate(FUNC(videopin_state::get_memory_offset),this), 8, 8, 48, 32);
|
||||
|
||||
save_item(NAME(m_ball_x));
|
||||
save_item(NAME(m_ball_y));
|
||||
}
|
||||
|
||||
|
||||
UINT32 videopin_state::screen_update_videopin(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
UINT32 videopin_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
int col;
|
||||
int row;
|
||||
@ -84,14 +87,14 @@ UINT32 videopin_state::screen_update_videopin(screen_device &screen, bitmap_ind1
|
||||
}
|
||||
|
||||
|
||||
WRITE8_MEMBER(videopin_state::videopin_ball_w)
|
||||
WRITE8_MEMBER(videopin_state::ball_w)
|
||||
{
|
||||
m_ball_x = data & 15;
|
||||
m_ball_y = data >> 4;
|
||||
}
|
||||
|
||||
|
||||
WRITE8_MEMBER(videopin_state::videopin_video_ram_w)
|
||||
WRITE8_MEMBER(videopin_state::video_ram_w)
|
||||
{
|
||||
m_video_ram[offset] = data;
|
||||
m_bg_tilemap->mark_tile_dirty(offset);
|
||||
|
Loading…
Reference in New Issue
Block a user