Skip to content

Commit dea2d67

Browse files
committed
fmtowns: start save states
1 parent 41a7b0e commit dea2d67

File tree

3 files changed

+126
-12
lines changed

3 files changed

+126
-12
lines changed

Diff for: src/devices/machine/fm_scsi.cpp

+11-7
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,17 @@ fmscsi_device::fmscsi_device(const machine_config &mconfig, const char *tag, dev
6767

6868
void fmscsi_device::device_start()
6969
{
70-
m_input_lines = 0;
71-
m_output_lines = 0;
72-
m_data = 0;
73-
m_command_index = 0;
74-
m_last_id = 0;
75-
m_target = 0;
76-
m_phase = SCSI_PHASE_BUS_FREE;
70+
save_item(NAME(m_command));
71+
save_item(NAME(m_command_index));
72+
save_item(NAME(m_result_length));
73+
save_item(NAME(m_result_index));
74+
save_item(NAME(m_input_lines));
75+
save_item(NAME(m_output_lines));
76+
save_item(NAME(m_data));
77+
save_item(NAME(m_last_id));
78+
save_item(NAME(m_phase));
79+
save_item(NAME(m_target));
80+
save_item(NAME(m_buffer));
7781

7882
// allocate read timer
7983
m_transfer_timer = timer_alloc(FUNC(fmscsi_device::update_transfer), this);

Diff for: src/mame/fujitsu/fmtowns.cpp

+113-5
Original file line numberDiff line numberDiff line change
@@ -1353,9 +1353,16 @@ TIMER_CALLBACK_MEMBER(towns_state::towns_delay_cdda)
13531353
towns_cdrom_play_cdda(m_cdrom.target());
13541354
}
13551355

1356+
TIMER_CALLBACK_MEMBER(towns_state::towns_delay_seek)
1357+
{
1358+
m_towns_cd.extra_status = 0;
1359+
towns_cd_set_status(0x04,0x00,0x00,0x00);
1360+
}
1361+
13561362
void towns_state::towns_cdrom_execute_command(cdrom_image_device* device)
13571363
{
13581364
towns_cdrom_set_irq(TOWNS_CD_IRQ_MPU,0); // TODO: this isn't sufficiently tested
1365+
m_towns_seek_timer->adjust(attotime::never);
13591366
if(!device->exists() && (m_towns_cd.command != 0xa0))
13601367
{ // No CD in drive
13611368
if(m_towns_cd.command & 0x20)
@@ -1372,8 +1379,9 @@ void towns_state::towns_cdrom_execute_command(cdrom_image_device* device)
13721379
case 0x00: // Seek
13731380
if(m_towns_cd.command & 0x20)
13741381
{
1375-
m_towns_cd.extra_status = 1;
1382+
m_towns_cd.extra_status = 0;
13761383
towns_cd_set_status(0x00,0x00,0x00,0x00);
1384+
m_towns_seek_timer->adjust(attotime::from_msec(500));
13771385
}
13781386
LOGMASKED(LOG_CD, "CD: Command 0x00: SEEK\n");
13791387
break;
@@ -1500,10 +1508,6 @@ uint8_t towns_state::towns_cdrom_r(offs_t offset)
15001508
{
15011509
switch(m_towns_cd.command & 0x9f)
15021510
{
1503-
case 0x00: // seek
1504-
towns_cd_set_status(0x04,0x00,0x00,0x00);
1505-
m_towns_cd.extra_status = 0;
1506-
break;
15071511
case 0x02: // read
15081512
if(m_towns_cd.extra_status == 2)
15091513
towns_cd_set_status(0x22,0x00,0x00,0x00);
@@ -2356,13 +2360,117 @@ void towns_state::driver_start()
23562360
m_towns_intervaltimer2 = timer_alloc(FUNC(towns_state::intervaltimer2_timeout), this);
23572361
m_towns_status_timer = timer_alloc(FUNC(towns_state::towns_cd_status_ready), this);
23582362
m_towns_cdda_timer = timer_alloc(FUNC(towns_state::towns_delay_cdda), this);
2363+
m_towns_seek_timer = timer_alloc(FUNC(towns_state::towns_delay_seek), this);
23592364

23602365
m_video = towns_video_controller();
23612366
m_towns_cd = towns_cdrom_controller();
23622367
m_towns_cd.status = 0x01; // CDROM controller ready
23632368
m_towns_cd.buffer_ptr = -1;
23642369
m_towns_cd.read_timer = timer_alloc(FUNC(towns_state::towns_cdrom_read_byte), this);
23652370

2371+
save_item(NAME(m_ftimer));
2372+
save_item(NAME(m_freerun_timer));
2373+
save_item(NAME(m_intervaltimer2_period));
2374+
save_item(NAME(m_intervaltimer2_irqmask));
2375+
save_item(NAME(m_intervaltimer2_timeout_flag));
2376+
save_item(NAME(m_intervaltimer2_timeout_flag2));
2377+
save_item(NAME(m_nmi_mask));
2378+
save_item(NAME(m_compat_mode));
2379+
save_item(NAME(m_towns_system_port));
2380+
save_item(NAME(m_towns_ankcg_enable));
2381+
save_item(NAME(m_towns_mainmem_enable));
2382+
save_item(NAME(m_towns_ram_enable));
2383+
save_pointer(NAME(m_towns_vram), 0x20000);
2384+
save_pointer(NAME(m_towns_gfxvram), 0x80000);
2385+
save_pointer(NAME(m_towns_txtvram), 0x20000);;
2386+
save_item(NAME(m_towns_selected_drive));
2387+
save_item(NAME(m_towns_fdc_irq6mask));
2388+
save_pointer(NAME(m_towns_serial_rom), 256/8);
2389+
save_item(NAME(m_towns_srom_position));
2390+
save_item(NAME(m_towns_srom_clk));
2391+
save_item(NAME(m_towns_srom_reset));
2392+
save_item(NAME(m_towns_rtc_select));
2393+
save_item(NAME(m_towns_rtc_data));
2394+
save_item(NAME(m_towns_timer_mask));
2395+
save_item(NAME(m_towns_kb_status));
2396+
save_item(NAME(m_towns_kb_irq1_enable));
2397+
save_item(NAME(m_towns_kb_output)); // key output
2398+
save_item(NAME(m_towns_kb_extend)); // extended key output
2399+
save_item(NAME(m_towns_fm_irq_flag));
2400+
save_item(NAME(m_towns_pcm_irq_flag));
2401+
save_item(NAME(m_towns_pcm_channel_flag));
2402+
save_item(NAME(m_towns_pcm_channel_mask));
2403+
save_item(NAME(m_towns_pad_mask));
2404+
save_item(NAME(m_towns_volume)); // volume ports
2405+
save_item(NAME(m_towns_volume_select));
2406+
save_item(NAME(m_towns_scsi_control));
2407+
save_item(NAME(m_towns_scsi_status));
2408+
save_item(NAME(m_towns_spkrdata));
2409+
save_item(NAME(m_pit_out0));
2410+
save_item(NAME(m_pit_out1));
2411+
save_item(NAME(m_pit_out2));
2412+
save_item(NAME(m_serial_irq_source));
2413+
2414+
save_item(NAME(m_kb_prev));
2415+
save_item(NAME(m_prev_pad_mask));
2416+
save_item(NAME(m_prev_x));
2417+
save_item(NAME(m_prev_y));
2418+
save_item(NAME(m_rtc_d));
2419+
save_item(NAME(m_rtc_busy));
2420+
save_item(NAME(m_vram_mask));
2421+
save_item(NAME(m_vram_mask_addr));
2422+
2423+
save_item(STRUCT_MEMBER(m_towns_cd, command));
2424+
save_item(STRUCT_MEMBER(m_towns_cd, status));
2425+
save_item(STRUCT_MEMBER(m_towns_cd, cmd_status));
2426+
save_item(STRUCT_MEMBER(m_towns_cd, cmd_status_ptr));
2427+
save_item(STRUCT_MEMBER(m_towns_cd, extra_status));
2428+
save_item(STRUCT_MEMBER(m_towns_cd, parameter));
2429+
save_item(STRUCT_MEMBER(m_towns_cd, mpu_irq_enable));
2430+
save_item(STRUCT_MEMBER(m_towns_cd, dma_irq_enable));
2431+
save_item(STRUCT_MEMBER(m_towns_cd, buffer));
2432+
save_item(STRUCT_MEMBER(m_towns_cd, buffer_ptr));
2433+
save_item(STRUCT_MEMBER(m_towns_cd, lba_current));
2434+
save_item(STRUCT_MEMBER(m_towns_cd, lba_last));
2435+
save_item(STRUCT_MEMBER(m_towns_cd, cdda_current));
2436+
save_item(STRUCT_MEMBER(m_towns_cd, cdda_length));
2437+
save_item(STRUCT_MEMBER(m_towns_cd, software_tx));
2438+
2439+
save_item(STRUCT_MEMBER(m_video, towns_vram_wplane));
2440+
save_item(STRUCT_MEMBER(m_video, towns_vram_rplane));
2441+
save_item(STRUCT_MEMBER(m_video, towns_vram_page_sel));
2442+
save_item(STRUCT_MEMBER(m_video, towns_palette_select));
2443+
save_item(STRUCT_MEMBER(m_video, towns_palette_r));
2444+
save_item(STRUCT_MEMBER(m_video, towns_palette_g));
2445+
save_item(STRUCT_MEMBER(m_video, towns_palette_b));
2446+
save_item(STRUCT_MEMBER(m_video, towns_degipal));
2447+
save_item(STRUCT_MEMBER(m_video, towns_dpmd_flag));
2448+
save_item(STRUCT_MEMBER(m_video, towns_crtc_mix));
2449+
save_item(STRUCT_MEMBER(m_video, towns_crtc_sel));
2450+
save_item(STRUCT_MEMBER(m_video, towns_crtc_reg));
2451+
save_item(STRUCT_MEMBER(m_video, towns_video_sel));
2452+
save_item(STRUCT_MEMBER(m_video, towns_video_reg));
2453+
save_item(STRUCT_MEMBER(m_video, towns_sprite_sel));
2454+
save_item(STRUCT_MEMBER(m_video, towns_sprite_reg));
2455+
save_item(STRUCT_MEMBER(m_video, towns_sprite_flag));
2456+
save_item(STRUCT_MEMBER(m_video, towns_sprite_page));
2457+
save_item(STRUCT_MEMBER(m_video, towns_tvram_enable));
2458+
save_item(STRUCT_MEMBER(m_video, towns_kanji_offset));
2459+
save_item(STRUCT_MEMBER(m_video, towns_kanji_code_h));
2460+
save_item(STRUCT_MEMBER(m_video, towns_kanji_code_l));
2461+
save_item(STRUCT_MEMBER(m_video, towns_display_plane));
2462+
save_item(STRUCT_MEMBER(m_video, towns_display_page_sel));
2463+
save_item(STRUCT_MEMBER(m_video, towns_vblank_flag));
2464+
save_item(STRUCT_MEMBER(m_video, towns_layer_ctrl));
2465+
save_item(NAME(m_video.towns_crtc_layerscr[0].min_x));
2466+
save_item(NAME(m_video.towns_crtc_layerscr[0].max_x));
2467+
save_item(NAME(m_video.towns_crtc_layerscr[0].min_y));
2468+
save_item(NAME(m_video.towns_crtc_layerscr[0].max_y));
2469+
save_item(NAME(m_video.towns_crtc_layerscr[1].min_x));
2470+
save_item(NAME(m_video.towns_crtc_layerscr[1].max_x));
2471+
save_item(NAME(m_video.towns_crtc_layerscr[1].min_y));
2472+
save_item(NAME(m_video.towns_crtc_layerscr[1].max_y));
2473+
23662474
save_pointer(m_video.towns_crtc_reg,"CRTC registers",32);
23672475
save_pointer(m_video.towns_video_reg,"Video registers",2);
23682476

Diff for: src/mame/fujitsu/fmtowns.h

+2
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ class towns_state : public driver_device
259259
emu_timer* m_towns_wait_timer = nullptr;
260260
emu_timer* m_towns_status_timer = nullptr;
261261
emu_timer* m_towns_cdda_timer = nullptr;
262+
emu_timer* m_towns_seek_timer = nullptr;
262263
struct towns_cdrom_controller m_towns_cd;
263264
struct towns_video_controller m_video;
264265

@@ -375,6 +376,7 @@ class towns_state : public driver_device
375376
void towns_cdrom_read(cdrom_image_device* device);
376377
TIMER_CALLBACK_MEMBER(towns_cd_status_ready);
377378
TIMER_CALLBACK_MEMBER(towns_delay_cdda);
379+
TIMER_CALLBACK_MEMBER(towns_delay_seek);
378380

379381
u8 m_rtc_d = 0;
380382
bool m_rtc_busy = false;

0 commit comments

Comments
 (0)