tia_video_device: added save_state support (nw)

bus/vcs/dcp.c: added save_state support (nw)
a2600.c and tourtabl.c; added save state support (nw)
This commit is contained in:
Osso13 2015-01-16 18:17:05 +01:00
parent 8fc526c463
commit cf8eb6fe0c
5 changed files with 123 additions and 12 deletions

View File

@ -26,6 +26,23 @@ void dpc_device::device_start()
{
m_oscillator = timer_alloc(TIMER_OSC);
m_oscillator->reset();
for (int i = 0; i < 8; i++)
{
save_item(NAME(m_df[i].top), i);
save_item(NAME(m_df[i].bottom), i);
save_item(NAME(m_df[i].low), i);
save_item(NAME(m_df[i].high), i);
save_item(NAME(m_df[i].flag), i);
save_item(NAME(m_df[i].music_mode), i);
save_item(NAME(m_df[i].osc_clk), i);
}
save_item(NAME(m_movamt));
save_item(NAME(m_latch_62));
save_item(NAME(m_latch_64));
save_item(NAME(m_dlc));
save_item(NAME(m_shift_reg));
}
void dpc_device::device_reset()

View File

@ -20,11 +20,12 @@ public:
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu") { }
required_device<cpu_device> m_maincpu;
DECLARE_WRITE8_MEMBER(tourtabl_led_w);
DECLARE_READ16_MEMBER(tourtabl_read_input_port);
DECLARE_READ8_MEMBER(tourtabl_get_databus_contents);
DECLARE_WRITE8_MEMBER(watchdog_w);
required_device<cpu_device> m_maincpu;
};
@ -201,5 +202,5 @@ ROM_START( tourtab2 )
ROM_END
GAME( 1978, tourtabl, 0, tourtabl, tourtabl, driver_device, 0, ROT0, "Atari", "Tournament Table (set 1)", 0 )
GAME( 1978, tourtab2, tourtabl, tourtabl, tourtabl, driver_device, 0, ROT0, "Atari", "Tournament Table (set 2)", 0 )
GAME( 1978, tourtabl, 0, tourtabl, tourtabl, driver_device, 0, ROT0, "Atari", "Tournament Table (set 1)", GAME_SUPPORTS_SAVE )
GAME( 1978, tourtab2, tourtabl, tourtabl, tourtabl, driver_device, 0, ROT0, "Atari", "Tournament Table (set 2)", GAME_SUPPORTS_SAVE )

View File

@ -430,6 +430,8 @@ void tia_video_device::device_start()
helper[0] = auto_bitmap_ind16_alloc(machine(), cx, TIA_MAX_SCREEN_HEIGHT);
helper[1] = auto_bitmap_ind16_alloc(machine(), cx, TIA_MAX_SCREEN_HEIGHT);
helper[2] = auto_bitmap_ind16_alloc(machine(), cx, TIA_MAX_SCREEN_HEIGHT);
register_save_state();
}
@ -665,13 +667,13 @@ int tia_video_device::collision_check(UINT8* p1, UINT8* p2, int x1, int x2)
int tia_video_device::current_x()
{
return 3 * ((machine().firstcpu->total_cycles() - frame_cycles) % 76) - 68;
return 3 * ((machine().device<cpu_device>("maincpu")->total_cycles() - frame_cycles) % 76) - 68;
}
int tia_video_device::current_y()
{
return (machine().firstcpu->total_cycles() - frame_cycles) / 76;
return (machine().device<cpu_device>("maincpu")->total_cycles() - frame_cycles) / 76;
}
@ -1010,7 +1012,7 @@ void tia_video_device::update_bitmap(int next_x, int next_y)
WRITE8_MEMBER( tia_video_device::WSYNC_w )
{
int cycles = machine().firstcpu->total_cycles() - frame_cycles;
int cycles = machine().device<cpu_device>("maincpu")->total_cycles() - frame_cycles;
if (cycles % 76)
{
@ -1051,7 +1053,7 @@ WRITE8_MEMBER( tia_video_device::VBLANK_w )
{
if (data & 0x80)
{
paddle_start = machine().firstcpu->total_cycles();
paddle_start = machine().device<cpu_device>("maincpu")->total_cycles();
}
if ( ! ( VBLANK & 0x40 ) ) {
INPT4 = 0x80;
@ -1804,7 +1806,7 @@ WRITE8_MEMBER( tia_video_device::GRP1_w )
READ8_MEMBER( tia_video_device::INPT_r )
{
UINT64 elapsed = machine().firstcpu->total_cycles() - paddle_start;
UINT64 elapsed = machine().device<cpu_device>("maincpu")->total_cycles() - paddle_start;
UINT16 input = TIA_INPUT_PORT_ALWAYS_ON;
if ( !m_read_input_port_cb.isnull() )
{
@ -2177,3 +2179,90 @@ void tia_video_device::device_reset()
COLUBK = 0;
COLUPF = 0;
}
void tia_video_device::register_save_state()
{
save_item(NAME(p0gfx.start_pixel));
save_item(NAME(p0gfx.start_drawing));
save_item(NAME(p0gfx.size));
save_item(NAME(p0gfx.skipclip));
save_item(NAME(p1gfx.start_pixel));
save_item(NAME(p1gfx.start_drawing));
save_item(NAME(p1gfx.size));
save_item(NAME(p1gfx.skipclip));
save_item(NAME(frame_cycles));
save_item(NAME(paddle_start));
save_item(NAME(horzP0));
save_item(NAME(horzP1));
save_item(NAME(horzM0));
save_item(NAME(horzM1));
save_item(NAME(horzBL));
save_item(NAME(motclkP0));
save_item(NAME(motclkP1));
save_item(NAME(motclkM0));
save_item(NAME(motclkM1));
save_item(NAME(motclkBL));
save_item(NAME(startP0));
save_item(NAME(startP1));
save_item(NAME(startM0));
save_item(NAME(startM1));
save_item(NAME(skipclipP0));
save_item(NAME(skipclipP1));
save_item(NAME(skipM0delay));
save_item(NAME(skipM1delay));
save_item(NAME(current_bitmap));
save_item(NAME(prev_x));
save_item(NAME(prev_y));
save_item(NAME(VSYNC));
save_item(NAME(VBLANK));
save_item(NAME(COLUP0));
save_item(NAME(COLUP1));
save_item(NAME(COLUBK));
save_item(NAME(COLUPF));
save_item(NAME(CTRLPF));
save_item(NAME(GRP0));
save_item(NAME(GRP1));
save_item(NAME(REFP0));
save_item(NAME(REFP1));
save_item(NAME(HMP0));
save_item(NAME(HMP1));
save_item(NAME(HMM0));
save_item(NAME(HMM1));
save_item(NAME(HMBL));
save_item(NAME(VDELP0));
save_item(NAME(VDELP1));
save_item(NAME(VDELBL));
save_item(NAME(NUSIZ0));
save_item(NAME(NUSIZ1));
save_item(NAME(ENAM0));
save_item(NAME(ENAM1));
save_item(NAME(ENABL));
save_item(NAME(CXM0P));
save_item(NAME(CXM1P));
save_item(NAME(CXP0FB));
save_item(NAME(CXP1FB));
save_item(NAME(CXM0FB));
save_item(NAME(CXM1FB));
save_item(NAME(CXBLPF));
save_item(NAME(CXPPMM));
save_item(NAME(RESMP0));
save_item(NAME(RESMP1));
save_item(NAME(PF0));
save_item(NAME(PF1));
save_item(NAME(PF2));
save_item(NAME(INPT4));
save_item(NAME(INPT5));
save_item(NAME(prevGRP0));
save_item(NAME(prevGRP1));
save_item(NAME(prevENABL));
save_item(NAME(HMOVE_started));
save_item(NAME(HMOVE_started_previous));
save_item(NAME(HMP0_latch));
save_item(NAME(HMP1_latch));
save_item(NAME(HMM0_latch));
save_item(NAME(HMM1_latch));
save_item(NAME(HMBL_latch));
save_item(NAME(REFLECT));
save_item(NAME(NUSIZx_changed));
}

View File

@ -199,6 +199,8 @@ private:
bitmap_ind16 *helper[3];
UINT16 screen_height;
void register_save_state();
};
class tia_pal_video_device : public tia_video_device

View File

@ -209,7 +209,7 @@ WRITE16_MEMBER(a2600_state::a2600_tia_vsync_callback)
if ( supported_screen_heights[i] != m_current_screen_height )
{
m_current_screen_height = supported_screen_heights[i];
// machine.first_screen()->configure(228, m_current_screen_height, &visarea[i], HZ_TO_ATTOSECONDS( MASTER_CLOCK_NTSC ) * 228 * m_current_screen_height );
// m_screen->configure(228, m_current_screen_height, &visarea[i], HZ_TO_ATTOSECONDS( MASTER_CLOCK_NTSC ) * 228 * m_current_screen_height );
}
}
}
@ -226,7 +226,7 @@ WRITE16_MEMBER(a2600_state::a2600_tia_vsync_callback_pal)
if ( supported_screen_heights[i] != m_current_screen_height )
{
m_current_screen_height = supported_screen_heights[i];
// machine.first_screen()->configure(228, m_current_screen_height, &visarea[i], HZ_TO_ATTOSECONDS( MASTER_CLOCK_PAL ) * 228 * m_current_screen_height );
// m_screen->configure(228, m_current_screen_height, &visarea[i], HZ_TO_ATTOSECONDS( MASTER_CLOCK_PAL ) * 228 * m_current_screen_height );
}
}
}
@ -316,6 +316,8 @@ MACHINE_START_MEMBER(a2600_state,a2600)
/* Banks may have changed, reset the cpu so it uses the correct reset vector */
m_maincpu->reset();
save_item(NAME(m_current_screen_height));
}
@ -541,5 +543,5 @@ ROM_END
#define rom_a2600p rom_a2600
/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */
CONS( 1977, a2600, 0, 0, a2600, a2600, driver_device, 0, "Atari", "Atari 2600 (NTSC)" , 0)
CONS( 1978, a2600p, a2600, 0, a2600p, a2600, driver_device, 0, "Atari", "Atari 2600 (PAL)", 0)
CONS( 1977, a2600, 0, 0, a2600, a2600, driver_device, 0, "Atari", "Atari 2600 (NTSC)" , GAME_SUPPORTS_SAVE )
CONS( 1978, a2600p, a2600, 0, a2600p, a2600, driver_device, 0, "Atari", "Atari 2600 (PAL)", GAME_SUPPORTS_SAVE )