if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- state_fio->StateBuffer(_apu_stack, sizeof(_apu_stack), 1);
- state_fio->StateInt32(_apu_tos);
- state_fio->StateUint8(_apu_status);
- state_fio->StateInt32(register_id);
+ state_fio->StateArray(_apu_stack, sizeof(_apu_stack), 1);
+ state_fio->StateValue(_apu_tos);
+ state_fio->StateValue(_apu_status);
+ state_fio->StateValue(register_id);
return true;
}
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- state_fio->StateUint32(bits_mask);
- state_fio->StateUint32(bits_in);
- state_fio->StateBool(prev);
- state_fio->StateBool(first);
+ state_fio->StateValue(bits_mask);
+ state_fio->StateValue(bits_in);
+ state_fio->StateValue(prev);
+ state_fio->StateValue(first);
return true;
}
if(!opn->ProcessState((void *)state_fio, loading)) {
return false;
}
- state_fio->StateUint8(ch);
- state_fio->StateUint8(fnum2);
+ state_fio->StateValue(ch);
+ state_fio->StateValue(fnum2);
#ifdef SUPPORT_AY_3_891X_PORT
for(int i = 0; i < 2; i++) {
- state_fio->StateUint8(port[i].wreg);
- state_fio->StateUint8(port[i].rreg);
- state_fio->StateBool(port[i].first);
+ state_fio->StateValue(port[i].wreg);
+ state_fio->StateValue(port[i].rreg);
+ state_fio->StateValue(port[i].first);
}
- state_fio->StateUint8(mode);
+ state_fio->StateValue(mode);
#endif
- state_fio->StateInt32(chip_clock);
- state_fio->StateBool(irq_prev);
- state_fio->StateBool(mute);
- state_fio->StateUint32(clock_prev);
- state_fio->StateUint32(clock_accum);
- state_fio->StateUint32(clock_const);
- state_fio->StateUint32(clock_busy);
- state_fio->StateInt32(timer_event_id);
- state_fio->StateBool(busy);
+ state_fio->StateValue(chip_clock);
+ state_fio->StateValue(irq_prev);
+ state_fio->StateValue(mute);
+ state_fio->StateValue(clock_prev);
+ state_fio->StateValue(clock_accum);
+ state_fio->StateValue(clock_const);
+ state_fio->StateValue(clock_busy);
+ state_fio->StateValue(timer_event_id);
+ state_fio->StateValue(busy);
return true;
}
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- state_fio->StateBool(signal);
- state_fio->StateInt32(count);
- state_fio->StateBool(on);
- state_fio->StateBool(mute);
+ state_fio->StateValue(signal);
+ state_fio->StateValue(count);
+ state_fio->StateValue(on);
+ state_fio->StateValue(mute);
return true;
}
state_fio->FputInt32_LE(0);
}
}
- state_fio->StateInt32(ff_rew);
- state_fio->StateBool(in_signal);
- state_fio->StateBool(out_signal);
- state_fio->StateUint32(prev_clock);
- state_fio->StateInt32(positive_clocks);
- state_fio->StateInt32(negative_clocks);
- state_fio->StateInt32(signal_changed);
- state_fio->StateInt32(register_id);
- state_fio->StateBool(realtime);
- state_fio->StateInt32(sample_rate);
- state_fio->StateDouble(sample_usec);
- state_fio->StateInt32(buffer_ptr);
+ state_fio->StateValue(ff_rew);
+ state_fio->StateValue(in_signal);
+ state_fio->StateValue(out_signal);
+ state_fio->StateValue(prev_clock);
+ state_fio->StateValue(positive_clocks);
+ state_fio->StateValue(negative_clocks);
+ state_fio->StateValue(signal_changed);
+ state_fio->StateValue(register_id);
+ state_fio->StateValue(realtime);
+ state_fio->StateValue(sample_rate);
+ state_fio->StateValue(sample_usec);
+ state_fio->StateValue(buffer_ptr);
if(loading) {
if((buffer_length = state_fio->FgetInt32_LE()) != 0) {
buffer = (uint8_t *)malloc(buffer_length);
}
}
if(__DATAREC_SOUND) {
- state_fio->StateInt16(sound_sample);
+ state_fio->StateValue(sound_sample);
}
- state_fio->StateBool(is_wav);
- state_fio->StateBool(is_tap);
- state_fio->StateBool(is_t77);
+ state_fio->StateValue(is_wav);
+ state_fio->StateValue(is_tap);
+ state_fio->StateValue(is_t77);
if(loading) {
if((apss_buffer_length = state_fio->FgetInt32_LE()) != 0) {
apss_buffer = (bool *)malloc(apss_buffer_length);
state_fio->FputInt32_LE(0);
}
}
- state_fio->StateInt32(apss_ptr);
- state_fio->StateInt32(apss_count);
- state_fio->StateInt32(apss_remain);
- state_fio->StateBool(apss_signals);
- state_fio->StateInt32(pcm_changed);
- state_fio->StateUint32(pcm_prev_clock);
- state_fio->StateInt32(pcm_positive_clocks);
- state_fio->StateInt32(pcm_negative_clocks);
+ state_fio->StateValue(apss_ptr);
+ state_fio->StateValue(apss_count);
+ state_fio->StateValue(apss_remain);
+ state_fio->StateValue(apss_signals);
+ state_fio->StateValue(pcm_changed);
+ state_fio->StateValue(pcm_prev_clock);
+ state_fio->StateValue(pcm_positive_clocks);
+ state_fio->StateValue(pcm_negative_clocks);
// post process
if(loading) {
if(!state_fio->StateCheckUint32(STATE_VERSION)) {
return false;
}
- state_fio->StateBuffer(buffer, sizeof(buffer), 1);
- state_fio->StateBuffer(orig_path, sizeof(orig_path), 1);
- state_fio->StateBuffer(dest_path, sizeof(dest_path), 1);
- state_fio->StateUint32(file_size.d);
- state_fio->StateInt32(file_bank);
- state_fio->StateUint32(orig_file_size);
- state_fio->StateUint32(orig_crc32);
- state_fio->StateBool(trim_required);
- state_fio->StateBool(is_1dd_image);
- state_fio->StateBool(is_solid_image);
- state_fio->StateBool(is_fdi_image);
- state_fio->StateBuffer(fdi_header, sizeof(fdi_header), 1);
- state_fio->StateInt32(solid_ncyl);
- state_fio->StateInt32(solid_nside);
- state_fio->StateInt32(solid_nsec);
- state_fio->StateInt32(solid_size);
- state_fio->StateBool(solid_mfm);
- state_fio->StateBool(inserted);
- state_fio->StateBool(ejected);
- state_fio->StateBool(write_protected);
- state_fio->StateBool(changed);
- state_fio->StateUint8(media_type);
- state_fio->StateInt32(is_special_disk);
- state_fio->StateBuffer(track, sizeof(track), 1);
- state_fio->StateInt32(sector_num.sd);
- state_fio->StateBool(track_mfm);
- state_fio->StateBool(invalid_format);
-// state_fio->StateBool(no_skew);
-
-// state_fio->StateBuffer(sync_position, sizeof(sync_position), 1);
-// state_fio->StateBuffer(am1_position, sizeof(am1_position), 1);
-// state_fio->StateBuffer(id_position, sizeof(id_position), 1);
-// state_fio->StateBuffer(data_position, sizeof(data_position), 1);
- for(int i = 0; i < (sizeof(sync_position) / sizeof(int)); i++) {
- state_fio->StateInt32(sync_position[i]);
- }
- for(int i = 0; i < (sizeof(am1_position) / sizeof(int)); i++) {
- state_fio->StateInt32(am1_position[i]);
- }
- for(int i = 0; i < (sizeof(id_position) / sizeof(int)); i++) {
- state_fio->StateInt32(id_position[i]);
- }
- for(int i = 0; i < (sizeof(data_position) / sizeof(int)); i++) {
- state_fio->StateInt32(data_position[i]);
- }
-
-// state_fio->StateInt32(gap3_size);
+ state_fio->StateArray(buffer, sizeof(buffer), 1);
+ state_fio->StateArray(orig_path, sizeof(orig_path), 1);
+ state_fio->StateArray(dest_path, sizeof(dest_path), 1);
+ state_fio->StateValue(file_size.d);
+ state_fio->StateValue(file_bank);
+ state_fio->StateValue(orig_file_size);
+ state_fio->StateValue(orig_crc32);
+ state_fio->StateValue(trim_required);
+ state_fio->StateValue(is_1dd_image);
+ state_fio->StateValue(is_solid_image);
+ state_fio->StateValue(is_fdi_image);
+ state_fio->StateArray(fdi_header, sizeof(fdi_header), 1);
+ state_fio->StateValue(solid_ncyl);
+ state_fio->StateValue(solid_nside);
+ state_fio->StateValue(solid_nsec);
+ state_fio->StateValue(solid_size);
+ state_fio->StateValue(solid_mfm);
+ state_fio->StateValue(inserted);
+ state_fio->StateValue(ejected);
+ state_fio->StateValue(write_protected);
+ state_fio->StateValue(changed);
+ state_fio->StateValue(media_type);
+ state_fio->StateValue(is_special_disk);
+ state_fio->StateArray(track, sizeof(track), 1);
+ state_fio->StateValue(sector_num.sd);
+ state_fio->StateValue(track_mfm);
+ state_fio->StateValue(invalid_format);
+// state_fio->StateValue(no_skew);
+ state_fio->StateArray(sync_position, sizeof(sync_position), 1);
+ state_fio->StateArray(am1_position, sizeof(am1_position), 1);
+ state_fio->StateArray(id_position, sizeof(id_position), 1);
+ state_fio->StateArray(data_position, sizeof(data_position), 1);
+// state_fio->StateValue(gap3_size);
if(loading) {
int offset = state_fio->FgetInt32_LE();
sector = (offset != -1) ? buffer + offset : NULL;
} else {
state_fio->FputInt32_LE(sector ? (int)(sector - buffer) : -1);
}
- state_fio->StateInt32(sector_size.sd);
- state_fio->StateBuffer(id, sizeof(id), 1);
- state_fio->StateUint8(density);
- state_fio->StateBool(deleted);
- state_fio->StateBool(addr_crc_error);
- state_fio->StateBool(data_crc_error);
- state_fio->StateUint8(drive_type);
- state_fio->StateInt32(drive_rpm);
- state_fio->StateBool(drive_mfm);
+ state_fio->StateValue(sector_size.sd);
+ state_fio->StateArray(id, sizeof(id), 1);
+ state_fio->StateValue(density);
+ state_fio->StateValue(deleted);
+ state_fio->StateValue(addr_crc_error);
+ state_fio->StateValue(data_crc_error);
+ state_fio->StateValue(drive_type);
+ state_fio->StateValue(drive_rpm);
+ state_fio->StateValue(drive_mfm);
return true;
}
return false;
}
for(int i = 0; i < dcount_cpu; i++) {
- state_fio->StateUint32(d_cpu[i].cpu_clocks);
- state_fio->StateUint32(d_cpu[i].update_clocks);
- state_fio->StateUint32(d_cpu[i].accum_clocks);
- }
- state_fio->StateBuffer(vclocks, sizeof(vclocks), 1);
- state_fio->StateInt32(event_remain);
- state_fio->StateInt32(cpu_remain);
- state_fio->StateInt32(cpu_accum);
- state_fio->StateInt32(cpu_done);
- state_fio->StateUint64(event_clocks);
+ state_fio->StateValue(d_cpu[i].cpu_clocks);
+ state_fio->StateValue(d_cpu[i].update_clocks);
+ state_fio->StateValue(d_cpu[i].accum_clocks);
+ }
+ state_fio->StateArray(vclocks, sizeof(vclocks), 1);
+ state_fio->StateValue(event_remain);
+ state_fio->StateValue(cpu_remain);
+ state_fio->StateValue(cpu_accum);
+ state_fio->StateValue(cpu_done);
+ state_fio->StateValue(event_clocks);
for(int i = 0; i < MAX_EVENT; i++) {
if(loading) {
event[i].device = vm->get_device(state_fio->FgetInt32_LE());
} else {
state_fio->FputInt32_LE(event[i].device != NULL ? event[i].device->this_device_id : -1);
}
- state_fio->StateInt32(event[i].event_id);
- state_fio->StateUint64(event[i].expired_clock);
- state_fio->StateUint64(event[i].loop_clock);
- state_fio->StateUint64(event[i].accum_clocks);
- state_fio->StateBool(event[i].active);
+ state_fio->StateValue(event[i].event_id);
+ state_fio->StateValue(event[i].expired_clock);
+ state_fio->StateValue(event[i].loop_clock);
+ state_fio->StateValue(event[i].accum_clocks);
+ state_fio->StateValue(event[i].active);
if(loading) {
event[i].next = (event_t *)get_event(state_fio->FgetInt32_LE());
event[i].prev = (event_t *)get_event(state_fio->FgetInt32_LE());
state_fio->FputInt32_LE(first_free_event != NULL ? first_free_event->index : -1);
state_fio->FputInt32_LE(first_fire_event != NULL ? first_fire_event->index : -1);
}
- state_fio->StateDouble(frames_per_sec);
- state_fio->StateDouble(next_frames_per_sec);
- state_fio->StateInt32(lines_per_frame);
- state_fio->StateInt32(next_lines_per_frame);
- state_fio->StateBuffer(dev_need_mix, sizeof(dev_need_mix), 1);
- state_fio->StateInt32(need_mix);
+ state_fio->StateValue(frames_per_sec);
+ state_fio->StateValue(next_frames_per_sec);
+ state_fio->StateValue(lines_per_frame);
+ state_fio->StateValue(next_lines_per_frame);
+ state_fio->StateArray(dev_need_mix, sizeof(dev_need_mix), 1);
+ state_fio->StateValue(need_mix);
// post process
if(loading) {
if(!cur_time.process_state((void *)state_fio, loading)) {
return false;
}
- state_fio->StateInt32(register_id_1sec);
- state_fio->StateBuffer(regs, sizeof(regs), 1);
- state_fio->StateInt32(ch);
- state_fio->StateInt32(period);
- state_fio->StateInt32(register_id_sqw);
- state_fio->StateBool(intr);
- state_fio->StateBool(sqw);
- state_fio->StateBool(modified);
+ state_fio->StateValue(register_id_1sec);
+ state_fio->StateArray(regs, sizeof(regs), 1);
+ state_fio->StateValue(ch);
+ state_fio->StateValue(period);
+ state_fio->StateValue(register_id_sqw);
+ state_fio->StateValue(intr);
+ state_fio->StateValue(sqw);
+ state_fio->StateValue(modified);
return true;
}
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- state_fio->StateBuffer(m_ram, sizeof(m_ram), 1);
- state_fio->StateUint8(m_status);
- state_fio->StateUint8(m_output);
-// state_fio->StateInt32(m_cs2);
- state_fio->StateInt32(m_page);
- state_fio->StateInt32(m_x);
- state_fio->StateInt32(m_y);
+ state_fio->StateArray(&m_ram[0][0], sizeof(m_ram), 1);
+ state_fio->StateValue(m_status);
+ state_fio->StateValue(m_output);
+// state_fio->StateValue(m_cs2);
+ state_fio->StateValue(m_page);
+ state_fio->StateValue(m_x);
+ state_fio->StateValue(m_y);
return true;
}
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- state_fio->StateBuffer(regs, sizeof(regs), 1);
- state_fio->StateBuffer(regs_written, sizeof(regs_written), 1);
- state_fio->StateInt32(ch);
- state_fio->StateBool(timing_changed);
- state_fio->StateInt32(cpu_clocks);
+ state_fio->StateArray(regs, sizeof(regs), 1);
+ state_fio->StateArray(regs_written, sizeof(regs_written), 1);
+ state_fio->StateValue(ch);
+ state_fio->StateValue(timing_changed);
+ state_fio->StateValue(cpu_clocks);
if(_E_HD46505_CHAR_CLOCK) {
- state_fio->StateDouble(char_clock);
- state_fio->StateDouble(next_char_clock);
+ state_fio->StateValue(char_clock);
+ state_fio->StateValue(next_char_clock);
} else if(_E_HD46505_HORIZ_FREQ) {
- state_fio->StateDouble(horiz_freq);
- state_fio->StateDouble(next_horiz_freq);
+ state_fio->StateValue(horiz_freq);
+ state_fio->StateValue(next_horiz_freq);
}
- state_fio->StateDouble(frames_per_sec);
- state_fio->StateInt32(hz_total);
- state_fio->StateInt32(hz_disp);
- state_fio->StateInt32(hs_start);
- state_fio->StateInt32(hs_end);
- state_fio->StateInt32(vt_total);
- state_fio->StateInt32(vt_disp);
- state_fio->StateInt32(vs_start);
- state_fio->StateInt32(vs_end);
- state_fio->StateInt32(disp_end_clock);
- state_fio->StateInt32(hs_start_clock);
- state_fio->StateInt32(hs_end_clock);
- state_fio->StateBool(display);
- state_fio->StateBool(vblank);
- state_fio->StateBool(vsync);
- state_fio->StateBool(hsync);
+ state_fio->StateValue(frames_per_sec);
+ state_fio->StateValue(hz_total);
+ state_fio->StateValue(hz_disp);
+ state_fio->StateValue(hs_start);
+ state_fio->StateValue(hs_end);
+ state_fio->StateValue(vt_total);
+ state_fio->StateValue(vt_disp);
+ state_fio->StateValue(vs_start);
+ state_fio->StateValue(vs_end);
+ state_fio->StateValue(disp_end_clock);
+ state_fio->StateValue(hs_start_clock);
+ state_fio->StateValue(hs_end_clock);
+ state_fio->StateValue(display);
+ state_fio->StateValue(vblank);
+ state_fio->StateValue(vsync);
+ state_fio->StateValue(hsync);
// post process
if(loading) {
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- state_fio->StateUint32(pc.d);
- state_fio->StateUint16(prevpc);
- state_fio->StateUint32(sp.d);
- state_fio->StateUint32(ix.d);
- state_fio->StateUint32(acc_d.d);
- state_fio->StateUint32(ea.d);
- state_fio->StateUint8(cc);
- state_fio->StateInt32(wai_state);
- state_fio->StateInt32(int_state);
+ state_fio->StateValue(pc.d);
+ state_fio->StateValue(prevpc);
+ state_fio->StateValue(sp.d);
+ state_fio->StateValue(ix.d);
+ state_fio->StateValue(acc_d.d);
+ state_fio->StateValue(ea.d);
+ state_fio->StateValue(cc);
+ state_fio->StateValue(wai_state);
+ state_fio->StateValue(int_state);
if(__USE_DEBUGGER) {
- state_fio->StateUint64(total_icount);
+ state_fio->StateValue(total_icount);
}
- state_fio->StateInt32(icount);
+ state_fio->StateValue(icount);
// #if defined(HAS_MC6801) || defined(HAS_HD6301)
for(int i = 0; i < 4; i++) {
- state_fio->StateUint8(port[i].wreg);
- state_fio->StateUint8(port[i].rreg);
- state_fio->StateUint8(port[i].ddr);
- state_fio->StateUint8(port[i].latched_data);
- state_fio->StateBool(port[i].latched);
- state_fio->StateBool(port[i].first_write);
+ state_fio->StateValue(port[i].wreg);
+ state_fio->StateValue(port[i].rreg);
+ state_fio->StateValue(port[i].ddr);
+ state_fio->StateValue(port[i].latched_data);
+ state_fio->StateValue(port[i].latched);
+ state_fio->StateValue(port[i].first_write);
}
- state_fio->StateUint8(p3csr);
- state_fio->StateBool(p3csr_is3_flag_read);
- state_fio->StateBool(sc1_state);
- state_fio->StateBool(sc2_state);
- state_fio->StateUint32(counter.d);
- state_fio->StateUint32(output_compare.d);
- state_fio->StateUint32(timer_over.d);
- state_fio->StateUint8(tcsr);
- state_fio->StateUint8(pending_tcsr);
- state_fio->StateUint16(input_capture);
+ state_fio->StateValue(p3csr);
+ state_fio->StateValue(p3csr_is3_flag_read);
+ state_fio->StateValue(sc1_state);
+ state_fio->StateValue(sc2_state);
+ state_fio->StateValue(counter.d);
+ state_fio->StateValue(output_compare.d);
+ state_fio->StateValue(timer_over.d);
+ state_fio->StateValue(tcsr);
+ state_fio->StateValue(pending_tcsr);
+ state_fio->StateValue(input_capture);
// #ifdef HAS_HD6301
- state_fio->StateUint16(latch09);
+ state_fio->StateValue(latch09);
// #endif
- state_fio->StateUint32(timer_next);
+ state_fio->StateValue(timer_next);
if(!recv_buffer->process_state((void *)state_fio, loading)) {
return false;
}
- state_fio->StateUint8(trcsr);
- state_fio->StateUint8(rdr);
- state_fio->StateUint8(tdr);
- state_fio->StateBool(trcsr_read_tdre);
- state_fio->StateBool(trcsr_read_orfe);
- state_fio->StateBool(trcsr_read_rdrf);
- state_fio->StateUint8(rmcr);
- state_fio->StateInt32(sio_counter);
- state_fio->StateUint8(ram_ctrl);
- state_fio->StateBuffer(ram, sizeof(ram), 1);
+ state_fio->StateValue(trcsr);
+ state_fio->StateValue(rdr);
+ state_fio->StateValue(tdr);
+ state_fio->StateValue(trcsr_read_tdre);
+ state_fio->StateValue(trcsr_read_orfe);
+ state_fio->StateValue(trcsr_read_rdrf);
+ state_fio->StateValue(rmcr);
+ state_fio->StateValue(sio_counter);
+ state_fio->StateValue(ram_ctrl);
+ state_fio->StateArray(ram, sizeof(ram), 1);
//#endif
// post process
return passed_icount;
}
-#define STATE_VERSION 4
+#define STATE_VERSION 5
bool HUC6280::process_state(FILEIO* state_fio, bool loading)
{
+ h6280_Regs *cpustate = (h6280_Regs *)opaque;
+
if(!state_fio->StateCheckUint32(STATE_VERSION)) {
return false;
}
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- state_fio->StateBuffer(opaque, sizeof(h6280_Regs), 1);
+ state_fio->StateValue(cpustate->ICount);
+ state_fio->StateValue(cpustate->ppc);
+ state_fio->StateValue(cpustate->pc);
+ state_fio->StateValue(cpustate->sp);
+ state_fio->StateValue(cpustate->zp);
+ state_fio->StateValue(cpustate->ea);
+ state_fio->StateValue(cpustate->a);
+ state_fio->StateValue(cpustate->x);
+ state_fio->StateValue(cpustate->y);
+ state_fio->StateValue(cpustate->p);
+ state_fio->StateArray(cpustate->mmr, sizeof(cpustate->mmr), 1);
+ state_fio->StateValue(cpustate->irq_mask);
+ state_fio->StateValue(cpustate->timer_status);
+ state_fio->StateValue(cpustate->timer_ack);
+ state_fio->StateValue(cpustate->clocks_per_cycle);
+ state_fio->StateValue(cpustate->timer_value);
+ state_fio->StateValue(cpustate->timer_load);
+ state_fio->StateValue(cpustate->nmi_state);
+ state_fio->StateArray(cpustate->irq_state, sizeof(cpustate->irq_state), 1);
+ state_fio->StateValue(cpustate->irq_pending);
+#if LAZY_FLAGS
+ state_fio->StateValue(cpustate->NZ);
+#endif
#ifdef USE_DEBUGGER
- state_fio->StateUint64(total_icount);
+ state_fio->StateValue(total_icount);
#endif
- if(loading) {
- h6280_Regs *cpustate = (h6280_Regs *)opaque;
- cpustate->program = d_mem;
- cpustate->io = d_io;
+ state_fio->StateValue(icount);
+ state_fio->StateValue(busreq);
+
#ifdef USE_DEBUGGER
- cpustate->emu = emu;
- cpustate->debugger = d_debugger;
- cpustate->program_stored = d_mem;
- cpustate->io_stored = d_io;
+ if(loading) {
prev_total_icount = total_icount;
-#endif
}
+#endif
return true;
}
#define STATE_VERSION 5
-void I286::process_state_cpustate(FILEIO* state_fio, bool loading)
-{
-#if defined(HAS_I86) || defined(HAS_I88) || defined(HAS_I186) || defined(HAS_V30)
- struct i8086_state *cpustate = (struct i8086_state *)opaque;
-
- state_fio->StateBuffer(&(cpustate->regs.b[0]), 16, 1);
- state_fio->StateUint32(cpustate->pc);
- state_fio->StateUint32(cpustate->prevpc);
- for(int i = 0; i < 4; i++) {
- state_fio->StateUint32(cpustate->base[i]);
- }
- for(int i = 0; i < 4; i++) {
- state_fio->StateUint16(cpustate->sregs[i]);
- }
- state_fio->StateUint16(cpustate->flags);
- state_fio->StateInt32(cpustate->AuxVal);
- state_fio->StateInt32(cpustate->OverVal);
- state_fio->StateInt32(cpustate->SignVal);
- state_fio->StateInt32(cpustate->ZeroVal);
- state_fio->StateInt32(cpustate->CarryVal);
- state_fio->StateInt32(cpustate->DirVal);
- state_fio->StateUint8(cpustate->ParityVal);
- state_fio->StateUint8(cpustate->TF);
- state_fio->StateUint8(cpustate->IF);
- state_fio->StateUint8(cpustate->MF);
-
- state_fio->StateUint8(cpustate->int_vector);
- state_fio->StateInt8(cpustate->nmi_state);
- state_fio->StateInt8(cpustate->irq_state);
- state_fio->StateInt8(cpustate->test_state);
- state_fio->StateUint8(cpustate->rep_in_progress);
- state_fio->StateInt32(cpustate->extra_cycles);
-
- state_fio->StateInt32(cpustate->halted);
- state_fio->StateInt32(cpustate->busreq);
-
- state_fio->StateUint16(cpustate->ip);
- state_fio->StateUint32(cpustate->sp);
-
- #ifdef USE_DEBUGGER
- state_fio->StateUint64(cpustate->total_icount);
- #endif
- state_fio->StateInt32(cpustate->icount);
-
- state_fio->StateUint8(cpustate->seg_prefix);
- state_fio->StateUint8(cpustate->prefix_seg);
- state_fio->StateUint32(cpustate->ea);
- state_fio->StateUint16(cpustate->eo);
- state_fio->StateUint8(cpustate->ea_seg);
-
-#elif defined(HAS_I286)
-
- struct i80286_state *cpustate = (struct i80286_state *)opaque;
-
- state_fio->StateBuffer(&(cpustate->regs.b[0]), 16, 1);
- state_fio->StateUint32(cpustate->amask);
- state_fio->StateUint32(cpustate->pc);
- state_fio->StateUint32(cpustate->prevpc);
- state_fio->StateUint16(cpustate->flags);
- state_fio->StateUint16(cpustate->msw);
- for(int i = 0; i < 4; i++) {
- state_fio->StateUint32(cpustate->base[i]);
- }
- for(int i = 0; i < 4; i++) {
- state_fio->StateUint16(cpustate->sregs[i]);
- }
- for(int i = 0; i < 4; i++) {
- state_fio->StateUint16(cpustate->limit[i]);
- }
- state_fio->StateBuffer(cpustate->rights, 4, 1);
- for(int i = 0; i < 4; i++) {
- state_fio->StateBool(cpustate->valid[i]);
- }
- state_fio->StateUint32(cpustate->gdtr.base);
- state_fio->StateUint16(cpustate->gdtr.limit);
-
- state_fio->StateUint32(cpustate->idtr.base);
- state_fio->StateUint16(cpustate->idtr.limit);
-
- state_fio->StateUint16(cpustate->ldtr.sel);
- state_fio->StateUint32(cpustate->ldtr.base);
- state_fio->StateUint16(cpustate->ldtr.limit);
- state_fio->StateUint8(cpustate->ldtr.rights);
-
- state_fio->StateUint16(cpustate->tr.sel);
- state_fio->StateUint32(cpustate->tr.base);
- state_fio->StateUint16(cpustate->tr.limit);
- state_fio->StateUint8(cpustate->tr.rights);
-
- state_fio->StateInt32(cpustate->AuxVal);
- state_fio->StateInt32(cpustate->OverVal);
- state_fio->StateInt32(cpustate->SignVal);
- state_fio->StateInt32(cpustate->ZeroVal);
- state_fio->StateInt32(cpustate->CarryVal);
- state_fio->StateInt32(cpustate->DirVal);
- state_fio->StateUint8(cpustate->ParityVal);
- state_fio->StateUint8(cpustate->TF);
- state_fio->StateUint8(cpustate->IF);
- state_fio->StateUint8(cpustate->MF);
-
- state_fio->StateInt8(cpustate->nmi_state);
- state_fio->StateInt8(cpustate->irq_state);
- state_fio->StateInt8(cpustate->test_state);
- state_fio->StateUint8(cpustate->rep_in_progress);
- state_fio->StateInt32(cpustate->extra_cycles);
-
- state_fio->StateInt32(cpustate->halted);
- state_fio->StateInt32(cpustate->busreq);
- state_fio->StateInt32(cpustate->trap_level);
- state_fio->StateInt32(cpustate->shutdown);
-
-
- #ifdef USE_DEBUGGER
- state_fio->StateUint64(cpustate->total_icount);
- #endif
- state_fio->StateInt32(cpustate->icount);
-
- state_fio->StateUint8(cpustate->seg_prefix);
- state_fio->StateUint8(cpustate->prefix_seg);
- state_fio->StateUint32(cpustate->ea);
- state_fio->StateUint16(cpustate->eo);
- state_fio->StateUint8(cpustate->ea_seg);
-#endif
-}
-
bool I286::process_state(FILEIO* state_fio, bool loading)
{
+ cpu_state *cpustate = (cpu_state *)opaque;
+
if(!state_fio->StateCheckUint32(STATE_VERSION)) {
return false;
}
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- //state_fio->StateBuffer(opaque, sizeof(cpu_state), 1);
- process_state_cpustate(state_fio, loading);
-
- // post process
- if(loading) {
- cpu_state *cpustate = (cpu_state *)opaque;
- cpustate->pic = d_pic;
- cpustate->program = d_mem;
- cpustate->io = d_io;
-#ifdef I86_PSEUDO_BIOS
- cpustate->bios = d_bios;
+#if defined(HAS_I86) || defined(HAS_I88) || defined(HAS_I186) || defined(HAS_V30)
+ state_fio->StateArray(cpustate->regs.w, sizeof(cpustate->regs.w), 1);
+ state_fio->StateValue(cpustate->pc);
+ state_fio->StateValue(cpustate->prevpc);
+ state_fio->StateArray(cpustate->base, sizeof(cpustate->base), 1);
+ state_fio->StateArray(cpustate->sregs, sizeof(cpustate->sregs), 1);
+ state_fio->StateValue(cpustate->flags);
+ state_fio->StateValue(cpustate->AuxVal);
+ state_fio->StateValue(cpustate->OverVal);
+ state_fio->StateValue(cpustate->SignVal);
+ state_fio->StateValue(cpustate->ZeroVal);
+ state_fio->StateValue(cpustate->CarryVal);
+ state_fio->StateValue(cpustate->DirVal);
+ state_fio->StateValue(cpustate->ParityVal);
+ state_fio->StateValue(cpustate->TF);
+ state_fio->StateValue(cpustate->IF);
+ state_fio->StateValue(cpustate->MF);
+ state_fio->StateValue(cpustate->int_vector);
+ state_fio->StateValue(cpustate->nmi_state);
+ state_fio->StateValue(cpustate->irq_state);
+ state_fio->StateValue(cpustate->test_state);
+ state_fio->StateValue(cpustate->rep_in_progress);
+ state_fio->StateValue(cpustate->extra_cycles);
+ state_fio->StateValue(cpustate->halted);
+ state_fio->StateValue(cpustate->busreq);
+ state_fio->StateValue(cpustate->ip);
+ state_fio->StateValue(cpustate->sp);
+#ifdef USE_DEBUGGER
+ state_fio->StateValue(cpustate->total_icount);
#endif
-#ifdef SINGLE_MODE_DMA
- cpustate->dma = d_dma;
+ state_fio->StateValue(cpustate->icount);
+ state_fio->StateValue(cpustate->seg_prefix);
+ state_fio->StateValue(cpustate->prefix_seg);
+ state_fio->StateValue(cpustate->ea);
+ state_fio->StateValue(cpustate->eo);
+ state_fio->StateValue(cpustate->ea_seg);
+#elif defined(HAS_I286)
+ state_fio->StateArray(cpustate->regs.w, sizeof(cpustate->regs.w), 1);
+ state_fio->StateValue(cpustate->amask);
+ state_fio->StateValue(cpustate->pc);
+ state_fio->StateValue(cpustate->prevpc);
+ state_fio->StateValue(cpustate->flags);
+ state_fio->StateValue(cpustate->msw);
+ state_fio->StateArray(cpustate->base, sizeof(cpustate->base), 1);
+ state_fio->StateArray(cpustate->sregs, sizeof(cpustate->sregs), 1);
+ state_fio->StateArray(cpustate->limit, sizeof(cpustate->limit), 1);
+ state_fio->StateArray(cpustate->rights, sizeof(cpustate->rights), 1);
+ state_fio->StateArray(cpustate->valid, sizeof(cpustate->valid), 1);
+ state_fio->StateValue(cpustate->gdtr.base);
+ state_fio->StateValue(cpustate->gdtr.limit);
+ state_fio->StateValue(cpustate->idtr.base);
+ state_fio->StateValue(cpustate->idtr.limit);
+ state_fio->StateValue(cpustate->ldtr.sel);
+ state_fio->StateValue(cpustate->ldtr.base);
+ state_fio->StateValue(cpustate->ldtr.limit);
+ state_fio->StateValue(cpustate->ldtr.rights);
+ state_fio->StateValue(cpustate->tr.sel);
+ state_fio->StateValue(cpustate->tr.base);
+ state_fio->StateValue(cpustate->tr.limit);
+ state_fio->StateValue(cpustate->tr.rights);
+ state_fio->StateValue(cpustate->AuxVal);
+ state_fio->StateValue(cpustate->OverVal);
+ state_fio->StateValue(cpustate->SignVal);
+ state_fio->StateValue(cpustate->ZeroVal);
+ state_fio->StateValue(cpustate->CarryVal);
+ state_fio->StateValue(cpustate->DirVal);
+ state_fio->StateValue(cpustate->ParityVal);
+ state_fio->StateValue(cpustate->TF);
+ state_fio->StateValue(cpustate->IF);
+ state_fio->StateValue(cpustate->MF);
+ state_fio->StateValue(cpustate->nmi_state);
+ state_fio->StateValue(cpustate->irq_state);
+ state_fio->StateValue(cpustate->test_state);
+ state_fio->StateValue(cpustate->rep_in_progress);
+ state_fio->StateValue(cpustate->extra_cycles);
+ state_fio->StateValue(cpustate->halted);
+ state_fio->StateValue(cpustate->busreq);
+ state_fio->StateValue(cpustate->trap_level);
+ state_fio->StateValue(cpustate->shutdown);
+#ifdef USE_DEBUGGER
+ state_fio->StateValue(cpustate->total_icount);
#endif
+ state_fio->StateValue(cpustate->icount);
+ state_fio->StateValue(cpustate->seg_prefix);
+ state_fio->StateValue(cpustate->prefix_seg);
+ state_fio->StateValue(cpustate->ea);
+ state_fio->StateValue(cpustate->eo);
+ state_fio->StateValue(cpustate->ea_seg);
+#endif
+
#ifdef USE_DEBUGGER
- cpustate->emu = emu;
- cpustate->debugger = d_debugger;
- cpustate->program_stored = d_mem;
- cpustate->io_stored = d_io;
+ // post process
+ if(loading) {
cpustate->prev_total_icount = cpustate->total_icount;
-#endif
}
+#endif
return true;
}
void save_state_cpustate(FILEIO* state_fio);
void load_state_cpustate(FILEIO* state_fio);
- void process_state_cpustate(FILEIO* state_fio, bool loading);
bool process_state(FILEIO* state_fio, bool loading);
// unique function
return false;
}
#ifdef USE_DEBUGGER
- state_fio->StateUint64(total_count);
-#endif
- state_fio->StateInt32(count);
- state_fio->StateBuffer(regs, sizeof(regs), 1); // ToDo:
- state_fio->StateUint16(SP);
- state_fio->StateUint16(PC);
- state_fio->StateUint16(prevPC);
- state_fio->StateUint16(IM);
- state_fio->StateUint16(RIM_IEN);
- state_fio->StateBool(afterHALT);
- state_fio->StateBool(BUSREQ);
- state_fio->StateBool(SID);
- state_fio->StateBool(afterEI);
+ state_fio->StateValue(total_count);
+#endif
+ state_fio->StateValue(count);
+ state_fio->StateArray(regs, sizeof(regs), 1); // ToDo:
+ state_fio->StateValue(SP);
+ state_fio->StateValue(PC);
+ state_fio->StateValue(prevPC);
+ state_fio->StateValue(IM);
+ state_fio->StateValue(RIM_IEN);
+ state_fio->StateValue(afterHALT);
+ state_fio->StateValue(BUSREQ);
+ state_fio->StateValue(SID);
+ state_fio->StateValue(afterEI);
#ifdef USE_DEBUGGER
// post process
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- state_fio->StateUint16(count);
- state_fio->StateUint16(countreg);
- state_fio->StateBool(now_count);
- state_fio->StateBool(stop_tc);
- state_fio->StateBool(half);
- state_fio->StateBool(prev_out);
- state_fio->StateBool(prev_in);
- state_fio->StateUint64(freq);
- state_fio->StateInt32(register_id);
- state_fio->StateUint32(input_clk);
- state_fio->StateUint32(prev_clk);
- state_fio->StateInt32(period);
- state_fio->StateUint64(cpu_clocks);
+ state_fio->StateValue(count);
+ state_fio->StateValue(countreg);
+ state_fio->StateValue(now_count);
+ state_fio->StateValue(stop_tc);
+ state_fio->StateValue(half);
+ state_fio->StateValue(prev_out);
+ state_fio->StateValue(prev_in);
+ state_fio->StateValue(freq);
+ state_fio->StateValue(register_id);
+ state_fio->StateValue(input_clk);
+ state_fio->StateValue(prev_clk);
+ state_fio->StateValue(period);
+ state_fio->StateValue(cpu_clocks);
for(int i = 0; i < 3; i++) {
- state_fio->StateUint8(pio[i].wreg);
- state_fio->StateUint8(pio[i].rreg);
- state_fio->StateUint8(pio[i].rmask);
- state_fio->StateUint8(pio[i].mode);
- state_fio->StateBool(pio[i].first);
+ state_fio->StateValue(pio[i].wreg);
+ state_fio->StateValue(pio[i].rreg);
+ state_fio->StateValue(pio[i].rmask);
+ state_fio->StateValue(pio[i].mode);
+ state_fio->StateValue(pio[i].first);
}
- state_fio->StateUint8(cmdreg);
- state_fio->StateUint8(statreg);
- state_fio->StateBuffer(ram, sizeof(ram), 1);
+ state_fio->StateValue(cmdreg);
+ state_fio->StateValue(statreg);
+ state_fio->StateArray(ram, sizeof(ram), 1);
return true;
}
return false;
}
for(int i = 0; i < 4; i++) {
- state_fio->StateUint16(dma[i].areg);
- state_fio->StateUint16(dma[i].creg);
- state_fio->StateUint16(dma[i].bareg);
- state_fio->StateUint16(dma[i].bcreg);
- state_fio->StateUint8(dma[i].mode);
- state_fio->StateUint16(dma[i].bankreg);
- state_fio->StateUint16(dma[i].incmask);
+ state_fio->StateValue(dma[i].areg);
+ state_fio->StateValue(dma[i].creg);
+ state_fio->StateValue(dma[i].bareg);
+ state_fio->StateValue(dma[i].bcreg);
+ state_fio->StateValue(dma[i].mode);
+ state_fio->StateValue(dma[i].bankreg);
+ state_fio->StateValue(dma[i].incmask);
}
- state_fio->StateBool(low_high);
- state_fio->StateUint8(cmd);
- state_fio->StateUint8(req);
- state_fio->StateUint8(mask);
- state_fio->StateUint8(tc);
- state_fio->StateUint32(tmp);
- state_fio->StateBool(mode_word);
- state_fio->StateUint32(addr_mask);
+ state_fio->StateValue(low_high);
+ state_fio->StateValue(cmd);
+ state_fio->StateValue(req);
+ state_fio->StateValue(mask);
+ state_fio->StateValue(tc);
+ state_fio->StateValue(tmp);
+ state_fio->StateValue(mode_word);
+ state_fio->StateValue(addr_mask);
return true;
}
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- state_fio->StateUint8(recv);
- state_fio->StateUint8(status);
- state_fio->StateUint8(mode);
- state_fio->StateBool(txen);
- state_fio->StateBool(rxen);
- state_fio->StateBool(loopback);
+ state_fio->StateValue(recv);
+ state_fio->StateValue(status);
+ state_fio->StateValue(mode);
+ state_fio->StateValue(txen);
+ state_fio->StateValue(rxen);
+ state_fio->StateValue(loopback);
if(!recv_buffer->process_state((void *)state_fio, loading)) {
return false;
}
if(!send_buffer->process_state((void *)state_fio, loading)) {
return false;
}
- state_fio->StateInt32(recv_id);
- state_fio->StateInt32(send_id);
+ state_fio->StateValue(recv_id);
+ state_fio->StateValue(send_id);
return true;
}
return false;
}
for(int i = 0; i < 3; i++) {
- state_fio->StateBool(counter[i].prev_out);
- state_fio->StateBool(counter[i].prev_in);
- state_fio->StateBool(counter[i].gate);
- state_fio->StateInt32(counter[i].count);
- state_fio->StateUint16(counter[i].latch);
- state_fio->StateUint16(counter[i].count_reg);
- state_fio->StateUint8(counter[i].ctrl_reg);
- state_fio->StateBool(counter[i].count_latched);
- state_fio->StateBool(counter[i].low_read);
- state_fio->StateBool(counter[i].high_read);
- state_fio->StateBool(counter[i].low_write);
- state_fio->StateBool(counter[i].high_write);
- state_fio->StateInt32(counter[i].mode);
- state_fio->StateBool(counter[i].delay);
- state_fio->StateBool(counter[i].start);
+ state_fio->StateValue(counter[i].prev_out);
+ state_fio->StateValue(counter[i].prev_in);
+ state_fio->StateValue(counter[i].gate);
+ state_fio->StateValue(counter[i].count);
+ state_fio->StateValue(counter[i].latch);
+ state_fio->StateValue(counter[i].count_reg);
+ state_fio->StateValue(counter[i].ctrl_reg);
+ state_fio->StateValue(counter[i].count_latched);
+ state_fio->StateValue(counter[i].low_read);
+ state_fio->StateValue(counter[i].high_read);
+ state_fio->StateValue(counter[i].low_write);
+ state_fio->StateValue(counter[i].high_write);
+ state_fio->StateValue(counter[i].mode);
+ state_fio->StateValue(counter[i].delay);
+ state_fio->StateValue(counter[i].start);
if(__HAS_I8254) {
- state_fio->StateBool(counter[i].null_count);
- state_fio->StateBool(counter[i].status_latched);
- state_fio->StateUint8(counter[i].status);
+ state_fio->StateValue(counter[i].null_count);
+ state_fio->StateValue(counter[i].status_latched);
+ state_fio->StateValue(counter[i].status);
}
- state_fio->StateUint64(counter[i].freq);
- state_fio->StateInt32(counter[i].register_id);
- state_fio->StateUint32(counter[i].input_clk);
- state_fio->StateInt32(counter[i].period);
- state_fio->StateUint32(counter[i].prev_clk);
+ state_fio->StateValue(counter[i].freq);
+ state_fio->StateValue(counter[i].register_id);
+ state_fio->StateValue(counter[i].input_clk);
+ state_fio->StateValue(counter[i].period);
+ state_fio->StateValue(counter[i].prev_clk);
}
- state_fio->StateUint64(cpu_clocks);
+ state_fio->StateValue(cpu_clocks);
return true;
}
return false;
}
for(int i = 0; i < 3; i++) {
- state_fio->StateUint8(port[i].wreg);
- state_fio->StateUint8(port[i].rreg);
- state_fio->StateUint8(port[i].rmask);
- state_fio->StateUint8(port[i].mode);
- state_fio->StateBool(port[i].first);
+ state_fio->StateValue(port[i].wreg);
+ state_fio->StateValue(port[i].rreg);
+ state_fio->StateValue(port[i].rmask);
+ state_fio->StateValue(port[i].mode);
+ state_fio->StateValue(port[i].first);
}
return true;
}
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- state_fio->StateBuffer(pic, sizeof(pic), 1); // ToDo:
- state_fio->StateInt32(req_chip);
- state_fio->StateInt32(req_level);
- state_fio->StateUint8(req_bit);
+ for(int i = 0; i < array_length(pic); i++) {
+ state_fio->StateValue(pic[i].imr);
+ state_fio->StateValue(pic[i].isr);
+ state_fio->StateValue(pic[i].irr);
+ state_fio->StateValue(pic[i].irr_tmp);
+ state_fio->StateValue(pic[i].prio);
+ state_fio->StateValue(pic[i].icw1);
+ state_fio->StateValue(pic[i].icw2);
+ state_fio->StateValue(pic[i].icw3);
+ state_fio->StateValue(pic[i].icw4);
+ state_fio->StateValue(pic[i].ocw3);
+ state_fio->StateValue(pic[i].icw2_r);
+ state_fio->StateValue(pic[i].icw3_r);
+ state_fio->StateValue(pic[i].icw4_r);
+ state_fio->StateValue(pic[i].irr_tmp_id);
+ }
+ state_fio->StateValue(req_chip);
+ state_fio->StateValue(req_level);
+ state_fio->StateValue(req_bit);
return true;
}
return false;
}
for(int i = 0; i < addr_max; i++) {
- state_fio->StateUint32(rd_table[i].value);
+ state_fio->StateValue(rd_table[i].value);
}
return true;
}
#endif
-void I386::cpu_table_call(void)
-{
-#if defined(HAS_I386)
- cpucore->cpu_table_i386();
-#elif defined(HAS_I486)
- cpucore->cpu_table_i486();
-#elif defined(HAS_PENTIUM)
- cpucore->cpu_table_pentium();
-#elif defined(HAS_MEDIAGX)
- cpucore->cpu_table_mediagx();
-#elif defined(HAS_PENTIUM_PRO)
- cpucore->cpu_table_pentium_pro();
-#elif defined(HAS_PENTIUM_MMX)
- cpucore->cpu_table_pentium_mmx();
-#elif defined(HAS_PENTIUM2)
- cpucore->cpu_table_pentium2();
-#elif defined(HAS_PENTIUM3)
- cpucore->cpu_table_pentium3();
-#elif defined(HAS_PENTIUM4)
- cpucore->cpu_table_pentium4();
-#endif
-}
-
bool I386::process_state(FILEIO* state_fio, bool loading)
{
// state_fio->StateBuffer(save, save_size, 1);
// }
+ #ifdef USE_DEBUGGER
// post process
if(loading) {
-#ifdef I86_PSEUDO_BIOS
- cpustate->bios = d_bios;
-#endif
-#ifdef SINGLE_MODE_DMA
- cpustate->dma = d_dma;
-#endif
-#ifdef USE_DEBUGGER
- cpustate->emu = emu;
- cpustate->debugger = d_debugger;
- cpustate->program_stored = d_mem;
- cpustate->io_stored = d_io;
cpustate->prev_total_cycles = cpustate->total_cycles;
-#endif
- cpu_table_call();
-
- cpucore->set_context_pic(d_pic);
- cpucore->set_context_progmem(d_mem);
- cpucore->set_context_io(d_io);
}
+#endif
return true;
}
#ifdef USE_DEBUGGER
DEBUGGER *d_debugger;
#endif
- void cpu_table_call(void);
-
public:
I386(VM_TEMPLATE* parent_vm, EMU* parent_emu) : I386_BASE(parent_vm, parent_emu)
{
#include "../../fileio.h"
-#define STATE_VERSION 3
+#define STATE_VERSION 4
+
+void I386_BASE::process_state_SREG(I386_SREG* val, FILEIO* state_fio)
+{
+ state_fio->StateValue(val->selector);
+ state_fio->StateValue(val->flags);
+ state_fio->StateValue(val->base);
+ state_fio->StateValue(val->limit);
+ state_fio->StateValue(val->d);
+ state_fio->StateValue(val->valid);
+}
+
+void I386_BASE::process_state_SYS_TABLE(I386_SYS_TABLE* val, FILEIO* state_fio)
+{
+ state_fio->StateValue(val->base);
+ state_fio->StateValue(val->limit);
+}
+
+void I386_BASE::process_state_SEG_DESC(I386_SEG_DESC* val, FILEIO* state_fio)
+{
+ state_fio->StateValue(val->segment);
+ state_fio->StateValue(val->flags);
+ state_fio->StateValue(val->base);
+ state_fio->StateValue(val->limit);
+}
+
+void I386_BASE::process_state_GPR(I386_GPR* val, FILEIO* state_fio)
+{
+ state_fio->StateArray(val->d, sizeof(val->d), 1);
+ state_fio->StateArray(val->w, sizeof(val->w), 1);
+ state_fio->StateArray(val->b, sizeof(val->b), 1);
+}
+
+void I386_BASE::process_state_floatx80(floatx80* val, FILEIO* state_fio)
+{
+ state_fio->StateValue(val->high);
+ state_fio->StateValue(val->low);
+}
+
+void I386_BASE::process_state_XMM_REG(XMM_REG* val, FILEIO* state_fio)
+{
+ state_fio->StateArray(val->b, sizeof(val->b), 1);
+ state_fio->StateArray(val->w, sizeof(val->w), 1);
+ state_fio->StateArray(val->d, sizeof(val->d), 1);
+ state_fio->StateArray(val->q, sizeof(val->q), 1);
+ state_fio->StateArray(val->c, sizeof(val->c), 1);
+ state_fio->StateArray(val->s, sizeof(val->s), 1);
+ state_fio->StateArray(val->i, sizeof(val->i), 1);
+ state_fio->StateArray(val->l, sizeof(val->l), 1);
+ state_fio->StateArray(val->f, sizeof(val->f), 1);
+ state_fio->StateArray(val->f64, sizeof(val->f64), 1);
+}
+
+void I386_BASE::process_state_vtlb(vtlb_state* val, FILEIO* state_fio)
+{
+// state_fio->StateValue(val->space);
+// state_fio->StateValue(val->dynamic);
+// state_fio->StateValue(val->fixed);
+ state_fio->StateValue(val->dynindex);
+// state_fio->StateValue(val->pageshift);
+// state_fio->StateValue(val->addrwidth);
+ if(val->live != NULL) {
+ state_fio->StateArray(val->live, val->fixed + val->dynamic, 1);
+ }
+ if(val->fixedpages != NULL) {
+ state_fio->StateArray(val->fixedpages, val->fixed, 1);
+ }
+ if(val->table != NULL) {
+ state_fio->StateArray(val->table, (size_t) 1 << (val->addrwidth - val->pageshift), 1);
+ }
+}
bool I386_BASE::process_state(FILEIO* state_fio, bool loading)
{
i386_state *cpustate = cpucore->get_cpu_state();
-
+
if(!state_fio->StateCheckUint32(STATE_VERSION)) {
return false;
}
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- if(!(cpucore->process_state(state_fio, loading))) return false;
+ process_state_GPR(&cpustate->reg, state_fio);
+ for(int i = 0; i < array_length(cpustate->sreg); i++) {
+ process_state_SREG(&cpustate->sreg[i], state_fio);
+ }
+ state_fio->StateValue(cpustate->eip);
+ state_fio->StateValue(cpustate->pc);
+ state_fio->StateValue(cpustate->prev_eip);
+ state_fio->StateValue(cpustate->prev_pc);
+ state_fio->StateValue(cpustate->eflags);
+ state_fio->StateValue(cpustate->eflags_mask);
+ state_fio->StateValue(cpustate->CF);
+ state_fio->StateValue(cpustate->DF);
+ state_fio->StateValue(cpustate->SF);
+ state_fio->StateValue(cpustate->OF);
+ state_fio->StateValue(cpustate->ZF);
+ state_fio->StateValue(cpustate->PF);
+ state_fio->StateValue(cpustate->AF);
+ state_fio->StateValue(cpustate->IF);
+ state_fio->StateValue(cpustate->TF);
+ state_fio->StateValue(cpustate->IOP1);
+ state_fio->StateValue(cpustate->IOP2);
+ state_fio->StateValue(cpustate->NT);
+ state_fio->StateValue(cpustate->RF);
+ state_fio->StateValue(cpustate->VM);
+ state_fio->StateValue(cpustate->AC);
+ state_fio->StateValue(cpustate->VIF);
+ state_fio->StateValue(cpustate->VIP);
+ state_fio->StateValue(cpustate->ID);
+ state_fio->StateValue(cpustate->CPL);
+ state_fio->StateValue(cpustate->performed_intersegment_jump);
+ state_fio->StateValue(cpustate->delayed_interrupt_enable);
+ state_fio->StateArray(cpustate->cr, sizeof(cpustate->cr), 1);
+ state_fio->StateArray(cpustate->dr, sizeof(cpustate->dr), 1);
+ state_fio->StateArray(cpustate->tr, sizeof(cpustate->tr), 1);
+ process_state_SYS_TABLE(&cpustate->gdtr, state_fio);
+ process_state_SYS_TABLE(&cpustate->idtr, state_fio);
+ process_state_SEG_DESC(&cpustate->task, state_fio);
+ process_state_SEG_DESC(&cpustate->ldtr, state_fio);
+ state_fio->StateValue(cpustate->ext);
+ state_fio->StateValue(cpustate->halted);
+ state_fio->StateValue(cpustate->busreq);
+ state_fio->StateValue(cpustate->shutdown);
+ state_fio->StateValue(cpustate->operand_size);
+ state_fio->StateValue(cpustate->xmm_operand_size);
+ state_fio->StateValue(cpustate->address_size);
+ state_fio->StateValue(cpustate->operand_prefix);
+ state_fio->StateValue(cpustate->address_prefix);
+ state_fio->StateValue(cpustate->segment_prefix);
+ state_fio->StateValue(cpustate->segment_override);
+
+ state_fio->StateValue(cpustate->total_cycles);
+ state_fio->StateValue(cpustate->cycles);
+ state_fio->StateValue(cpustate->extra_cycles);
+ state_fio->StateValue(cpustate->base_cycles);
+ state_fio->StateValue(cpustate->opcode);
+ state_fio->StateValue(cpustate->irq_state);
+ state_fio->StateValue(cpustate->a20_mask);
+ state_fio->StateValue(cpustate->cpuid_max_input_value_eax);
+ state_fio->StateValue(cpustate->cpuid_id0);
+ state_fio->StateValue(cpustate->cpuid_id1);
+ state_fio->StateValue(cpustate->cpuid_id2);
+ state_fio->StateValue(cpustate->cpu_version);
+ state_fio->StateValue(cpustate->feature_flags);
+ state_fio->StateValue(cpustate->tsc);
+ state_fio->StateArray(cpustate->perfctr, sizeof(cpustate->perfctr), 1);
+ for(int i = 0; i < array_length(cpustate->x87_reg); i++) {
+ process_state_floatx80(&cpustate->x87_reg[i], state_fio);
+ }
+ state_fio->StateValue(cpustate->x87_cw);
+ state_fio->StateValue(cpustate->x87_sw);
+ state_fio->StateValue(cpustate->x87_tw);
+ state_fio->StateValue(cpustate->x87_data_ptr);
+ state_fio->StateValue(cpustate->x87_inst_ptr);
+ state_fio->StateValue(cpustate->x87_opcode);
+ for(int i = 0; i < array_length(cpustate->sse_reg); i++) {
+ process_state_XMM_REG(&cpustate->sse_reg[i], state_fio);
+ }
+ state_fio->StateValue(cpustate->mxcsr);
+ state_fio->StateArray(&cpustate->lock_table[0][0], sizeof(cpustate->lock_table), 1);
+ if(cpustate->vtlb != NULL) {
+ process_state_vtlb(cpustate->vtlb, state_fio);
+ }
+ state_fio->StateValue(cpustate->smm);
+ state_fio->StateValue(cpustate->smi);
+ state_fio->StateValue(cpustate->smi_latched);
+ state_fio->StateValue(cpustate->nmi_masked);
+ state_fio->StateValue(cpustate->nmi_latched);
+ state_fio->StateValue(cpustate->smbase);
+// state_fio->StateValue(cpustate->smiact);
+ state_fio->StateValue(cpustate->lock);
+#ifdef DEBUG_MISSING_OPCODE
+ state_fio->StateArray(cpustate->opcode_bytes, sizeof(cpustate->opcode_bytes), 1);
+ state_fio->StateValue(cpustate->opcode_pc);
+ state_fio->StateValue(cpustate->opcode_bytes_length);
+#endif
+
// post process
if(loading) {
- cpustate->pic = d_pic;
- cpustate->program = d_mem;
- cpustate->io = d_io;
-
+ cpustate->prev_total_cycles = cpustate->total_cycles;
}
return true;
}
//#include "../emu.h"
#include <assert.h>
#include "./device.h"
+#include "libcpu_i386/i386priv.h"
+
#define SIG_I386_A20 1
class VM_TEMPLATE;
class DEBUGGER;
class I386_OPS_BASE;
class FILEIO;
+
class I386_BASE : public DEVICE
{
protected:
DEVICE *d_bios;
DEVICE *d_dma;
+
+ void process_state_SREG(I386_SREG* val, FILEIO* state_fio);
+ void process_state_SYS_TABLE(I386_SYS_TABLE* val, FILEIO* state_fio);
+ void process_state_SEG_DESC(I386_SEG_DESC* val, FILEIO* state_fio);
+ void process_state_GPR(I386_GPR* val, FILEIO* state_fio);
+ void process_state_floatx80(floatx80* val, FILEIO* state_fio);
+ void process_state_XMM_REG(XMM_REG* val, FILEIO* state_fio);
+ void process_state_vtlb(vtlb_state* val, FILEIO* state_fio);
+
public:
I386_BASE(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
{
return cpustate;
}
-void I386_OPS_BASE::cpu_table_i386(void)
-{
- build_opcode_table(OP_I386);
- cpustate->cycle_table_rm = cycle_table_rm[CPU_CYCLES_I386];
- cpustate->cycle_table_pm = cycle_table_pm[CPU_CYCLES_I386];
-}
-
-void I386_OPS_BASE::cpu_table_i486(void)
-{
- build_opcode_table(OP_I386 | OP_FPU | OP_I486);
- build_x87_opcode_table();
- cpustate->cycle_table_rm = cycle_table_rm[CPU_CYCLES_I486];
- cpustate->cycle_table_pm = cycle_table_pm[CPU_CYCLES_I486];
-}
-
-void I386_OPS_BASE::cpu_table_pentium(void)
-{
- // 64 dtlb small, 8 dtlb large, 32 itlb
- build_opcode_table(OP_I386 | OP_FPU | OP_I486 | OP_PENTIUM);
- build_x87_opcode_table();
- cpustate->cycle_table_rm = cycle_table_rm[CPU_CYCLES_PENTIUM];
- cpustate->cycle_table_pm = cycle_table_pm[CPU_CYCLES_PENTIUM];
-}
-
-void I386_OPS_BASE::cpu_table_mediagx(void)
-{
- // probably 32 unified
- build_x87_opcode_table();
- build_opcode_table(OP_I386 | OP_FPU | OP_I486 | OP_PENTIUM | OP_CYRIX);
- cpustate->cycle_table_rm = cycle_table_rm[CPU_CYCLES_MEDIAGX];
- cpustate->cycle_table_pm = cycle_table_pm[CPU_CYCLES_MEDIAGX];
-}
-
-void I386_OPS_BASE::cpu_table_pentium_pro(void)
-{
- // 64 dtlb small, 32 itlb
- build_x87_opcode_table();
- build_opcode_table(OP_I386 | OP_FPU | OP_I486 | OP_PENTIUM | OP_PPRO);
- cpustate->cycle_table_rm = cycle_table_rm[CPU_CYCLES_PENTIUM]; // TODO: generate own cycle tables
- cpustate->cycle_table_pm = cycle_table_pm[CPU_CYCLES_PENTIUM]; // TODO: generate own cycle tables
-}
-
-void I386_OPS_BASE::cpu_table_pentium_mmx(void)
-{
- // 64 dtlb small, 8 dtlb large, 32 itlb small, 2 itlb large
- build_x87_opcode_table();
- build_opcode_table(OP_I386 | OP_FPU | OP_I486 | OP_PENTIUM | OP_MMX);
- cpustate->cycle_table_rm = cycle_table_rm[CPU_CYCLES_PENTIUM]; // TODO: generate own cycle tables
- cpustate->cycle_table_pm = cycle_table_pm[CPU_CYCLES_PENTIUM]; // TODO: generate own cycle tables
-}
-
-void I386_OPS_BASE::cpu_table_pentium2(void)
-{
- // 64 dtlb small, 8 dtlb large, 32 itlb small, 2 itlb large
- build_x87_opcode_table();
- build_opcode_table(OP_I386 | OP_FPU | OP_I486 | OP_PENTIUM | OP_PPRO | OP_MMX);
- cpustate->cycle_table_rm = cycle_table_rm[CPU_CYCLES_PENTIUM]; // TODO: generate own cycle tables
- cpustate->cycle_table_pm = cycle_table_pm[CPU_CYCLES_PENTIUM]; // TODO: generate own cycle tables
-}
-
-void I386_OPS_BASE::cpu_table_pentium3(void)
-{
- // 64 dtlb small, 8 dtlb large, 32 itlb small, 2 itlb large
- build_x87_opcode_table();
- build_opcode_table(OP_I386 | OP_FPU | OP_I486 | OP_PENTIUM | OP_PPRO | OP_MMX | OP_SSE);
- cpustate->cycle_table_rm = cycle_table_rm[CPU_CYCLES_PENTIUM]; // TODO: generate own cycle tables
- cpustate->cycle_table_pm = cycle_table_pm[CPU_CYCLES_PENTIUM]; // TODO: generate own cycle tables
-}
-
-void I386_OPS_BASE::cpu_table_pentium4(void)
-{
- // 128 dtlb, 64 itlb
- build_x87_opcode_table();
- build_opcode_table(OP_I386 | OP_FPU | OP_I486 | OP_PENTIUM | OP_PPRO | OP_MMX | OP_SSE | OP_SSE2);
- cpustate->cycle_table_rm = cycle_table_rm[CPU_CYCLES_PENTIUM]; // TODO: generate own cycle tables
- cpustate->cycle_table_pm = cycle_table_pm[CPU_CYCLES_PENTIUM]; // TODO: generate own cycle tables
-}
-
-
-
bool I386_OPS_BASE::process_state(FILEIO *state_fio, bool loading)
{
// ToDo: Write endian
int pageshift; /* bits to shift to get page index */
int addrwidth; /* logical address bus width */
offs_t * live; /* array of live entries by table index */
- int live_size;
int * fixedpages; /* number of pages each fixed entry covers */
- int fixedpages_size;
vtlb_entry * table; /* table of entries by address */
- int table_size;
-// vtlb_entry * save; /* cache of live table entries for saving */
-// int save_size;
+ vtlb_entry * save; /* cache of live table entries for saving */
};
class DEBUG;
void cpu_reset_pentium3(void);
void cpu_reset_pentium4(void);
- // Re-Build table per type.
- void cpu_table_i386(void);
- void cpu_table_i486(void);
- void cpu_table_pentium(void);
- void cpu_table_mediagx(void);
- void cpu_table_pentium_pro(void);
- void cpu_table_pentium_mmx(void);
- void cpu_table_pentium2(void);
- void cpu_table_pentium3(void);
- void cpu_table_pentium4(void);
-
// INSNs.
// i386/op16
void I386OP_D(adc_rm16_r16)(); // Opcode 0x11
int x87_inc_stack();
int x87_dec_stack();
int x87_check_exceptions();
+public:
+
};
extern const X86_OPCODE x86_opcode_table[];
extern const X86_CYCLE_TABLE x86_cycle_table[];
/* allocate the entry array */
vtlb->live = (offs_t *)calloc(fixed_entries + dynamic_entries, sizeof(offs_t));
- vtlb->live_size = (fixed_entries + dynamic_entries) * sizeof(offs_t);
// cpu->save_pointer(NAME(vtlb->live), fixed_entries + dynamic_entries, space);
/* allocate the lookup table */
vtlb->table = (vtlb_entry *)calloc((size_t) 1 << (vtlb->addrwidth - vtlb->pageshift), sizeof(vtlb_entry));
- vtlb->table_size = ((size_t) 1 << (vtlb->addrwidth - vtlb->pageshift)) * sizeof(vtlb_entry);
// cpu->save_pointer(NAME(vtlb->table), 1 << (vtlb->addrwidth - vtlb->pageshift), space);
/* allocate the fixed page count array */
if (fixed_entries > 0)
{
vtlb->fixedpages = (int *)calloc(fixed_entries, sizeof(int));
- vtlb->fixedpages_size = fixed_entries * sizeof(int);
// cpu->save_pointer(NAME(vtlb->fixedpages), fixed_entries, space);
}
return vtlb;
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- state_fio->StateUint8(din);
+ state_fio->StateValue(din);
return true;
}
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- state_fio->StateUint32(count);
- state_fio->StateBool(prev_in);
+ state_fio->StateValue(count);
+ state_fio->StateValue(prev_in);
return true;
}
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- state_fio->StateUint32(pc.d);
- state_fio->StateUint32(sp.d);
- state_fio->StateUint32(zp.d);
- state_fio->StateUint32(ea.d);
- state_fio->StateUint16(prev_pc);
- state_fio->StateUint8(a);
- state_fio->StateUint8(x);
- state_fio->StateUint8(y);
- state_fio->StateUint8(p);
- state_fio->StateBool(pending_irq);
- state_fio->StateBool(after_cli);
- state_fio->StateBool(nmi_state);
- state_fio->StateBool(irq_state);
- state_fio->StateBool(so_state);
+ state_fio->StateValue(pc.d);
+ state_fio->StateValue(sp.d);
+ state_fio->StateValue(zp.d);
+ state_fio->StateValue(ea.d);
+ state_fio->StateValue(prev_pc);
+ state_fio->StateValue(a);
+ state_fio->StateValue(x);
+ state_fio->StateValue(y);
+ state_fio->StateValue(p);
+ state_fio->StateValue(pending_irq);
+ state_fio->StateValue(after_cli);
+ state_fio->StateValue(nmi_state);
+ state_fio->StateValue(irq_state);
+ state_fio->StateValue(so_state);
#ifdef USE_DEBUGGER
- state_fio->StateUint64(total_icount);
+ state_fio->StateValue(total_icount);
#endif
- state_fio->StateInt32(icount);
- state_fio->StateBool(busreq);
+ state_fio->StateValue(icount);
+ state_fio->StateValue(busreq);
#ifdef USE_DEBUGGER
// post process
return false;
}
//
-// state_fio->StateBuffer(fdc, sizeof(fdc), 1);
- for(int ch = 0; ch < 16; ch++) { // ToDo
- process_state_fdc(ch, state_fio, loading);
- }
- for(int i = 0; i < _max_drive; i++) {
+ for(int i = 0; i < array_length(fdc); i++) {
+ state_fio->StateValue(fdc[i].track);
+ state_fio->StateValue(fdc[i].index);
+ state_fio->StateValue(fdc[i].access);
+ state_fio->StateValue(fdc[i].head_load);
+ state_fio->StateValue(fdc[i].id_written);
+ state_fio->StateValue(fdc[i].sector_found);
+ state_fio->StateValue(fdc[i].sector_length);
+ state_fio->StateValue(fdc[i].sector_index);
+ state_fio->StateValue(fdc[i].side);
+ state_fio->StateValue(fdc[i].side_changed);
+ state_fio->StateValue(fdc[i].cur_position);
+ state_fio->StateValue(fdc[i].next_trans_position);
+ state_fio->StateValue(fdc[i].bytes_before_2nd_drq);
+ state_fio->StateValue(fdc[i].next_am1_position);
+ state_fio->StateValue(fdc[i].prev_clock);
+ }
+ for(int i = 0; i < array_length(disk); i++) {
if(!disk[i]->process_state(state_fio, loading)) {
return false;
}
}
- state_fio->StateUint8(status);
- state_fio->StateUint8(status_tmp);
- state_fio->StateUint8(cmdreg);
- state_fio->StateUint8(cmdreg_tmp);
- state_fio->StateUint8(trkreg);
- state_fio->StateUint8(secreg);
- state_fio->StateUint8(datareg);
- state_fio->StateUint8(drvreg);
- state_fio->StateUint8(sidereg);
- state_fio->StateUint8(cmdtype);
- //state_fio->StateBuffer(register_id, sizeof(register_id), 1);
- for(int i = 0; i < (sizeof(register_id) / sizeof(register_id)); i++) {
- state_fio->StateInt32(register_id[i]);
- }
-
- state_fio->StateBool(now_search);
- state_fio->StateBool(now_seek);
- state_fio->StateBool(sector_changed);
- state_fio->StateInt32(no_command);
- state_fio->StateInt32(seektrk);
- state_fio->StateBool(seekvct);
- state_fio->StateBool(motor_on);
- state_fio->StateBool(drive_sel);
- state_fio->StateUint32(prev_drq_clock);
- state_fio->StateUint32(seekend_clock);
+ state_fio->StateValue(status);
+ state_fio->StateValue(status_tmp);
+ state_fio->StateValue(cmdreg);
+ state_fio->StateValue(cmdreg_tmp);
+ state_fio->StateValue(trkreg);
+ state_fio->StateValue(secreg);
+ state_fio->StateValue(datareg);
+ state_fio->StateValue(drvreg);
+ state_fio->StateValue(sidereg);
+ state_fio->StateValue(cmdtype);
+ state_fio->StateArray(register_id, sizeof(register_id), 1);
+ state_fio->StateValue(now_search);
+ state_fio->StateValue(now_seek);
+ state_fio->StateValue(sector_changed);
+ state_fio->StateValue(no_command);
+ state_fio->StateValue(seektrk);
+ state_fio->StateValue(seekvct);
+ state_fio->StateValue(motor_on);
+ state_fio->StateValue(drive_sel);
+ state_fio->StateValue(prev_drq_clock);
+ state_fio->StateValue(seekend_clock);
if(loading) {
fdc_debug_log = config.special_debug_fdc;
}
return true;
}
-void MB8877::process_state_fdc(int ch, FILEIO* state_fio, bool loading)
-{
- state_fio->StateInt32(fdc[ch].track);
- state_fio->StateInt32(fdc[ch].index);
- state_fio->StateBool(fdc[ch].access);
- state_fio->StateBool(fdc[ch].head_load);
- state_fio->StateBool(fdc[ch].id_written);
- state_fio->StateBool(fdc[ch].sector_found);
-
- state_fio->StateInt32(fdc[ch].sector_length);
- state_fio->StateInt32(fdc[ch].sector_index);
-
- state_fio->StateInt32(fdc[ch].side);
- state_fio->StateBool(fdc[ch].side_changed);
-
- state_fio->StateInt32(fdc[ch].cur_position);
- state_fio->StateInt32(fdc[ch].next_trans_position);
-
- state_fio->StateInt32(fdc[ch].bytes_before_2nd_drq);
- state_fio->StateInt32(fdc[ch].next_am1_position);
-
- state_fio->StateUint32(fdc[ch].prev_clock);
- state_fio->StateBool(fdc[ch].count_immediate);
-}
-
void set_irq(bool val);
void set_drq(bool val);
- void process_state_fdc(int ch, FILEIO* state_fio, bool loading);
-
public:
MB8877(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
{
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- state_fio->StateUint32(pc.d);
- state_fio->StateUint16(prevpc);
- state_fio->StateUint32(sp.d);
- state_fio->StateUint32(ix.d);
- state_fio->StateUint32(acc_d.d);
- state_fio->StateUint32(ea.d);
- state_fio->StateUint8(cc);
- state_fio->StateInt32(wai_state);
- state_fio->StateInt32(int_state);
+ state_fio->StateValue(pc.d);
+ state_fio->StateValue(prevpc);
+ state_fio->StateValue(sp.d);
+ state_fio->StateValue(ix.d);
+ state_fio->StateValue(acc_d.d);
+ state_fio->StateValue(ea.d);
+ state_fio->StateValue(cc);
+ state_fio->StateValue(wai_state);
+ state_fio->StateValue(int_state);
if(__USE_DEBUGGER) {
- state_fio->StateUint64(total_icount);
+ state_fio->StateValue(total_icount);
}
- state_fio->StateInt32(icount);
+ state_fio->StateValue(icount);
// post process
if(__USE_DEBUGGER) {
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- state_fio->StateUint32(pc.d);
- state_fio->StateUint16(prevpc);
- state_fio->StateUint32(sp.d);
- state_fio->StateUint32(ix.d);
- state_fio->StateUint32(acc_d.d);
- state_fio->StateUint32(ea.d);
- state_fio->StateUint8(cc);
- state_fio->StateInt32(wai_state);
- state_fio->StateInt32(int_state);
+ state_fio->StateValue(pc.d);
+ state_fio->StateValue(prevpc);
+ state_fio->StateValue(sp.d);
+ state_fio->StateValue(ix.d);
+ state_fio->StateValue(acc_d.d);
+ state_fio->StateValue(ea.d);
+ state_fio->StateValue(cc);
+ state_fio->StateValue(wai_state);
+ state_fio->StateValue(int_state);
if(__USE_DEBUGGER) {
- state_fio->StateUint64(total_icount);
+ state_fio->StateValue(total_icount);
}
- state_fio->StateInt32(icount);
+ state_fio->StateValue(icount);
// #if defined(HAS_MC6801) || defined(HAS_HD6301)
for(int i = 0; i < 4; i++) {
- state_fio->StateUint8(port[i].wreg);
- state_fio->StateUint8(port[i].rreg);
- state_fio->StateUint8(port[i].ddr);
- state_fio->StateUint8(port[i].latched_data);
- state_fio->StateBool(port[i].latched);
- state_fio->StateBool(port[i].first_write);
+ state_fio->StateValue(port[i].wreg);
+ state_fio->StateValue(port[i].rreg);
+ state_fio->StateValue(port[i].ddr);
+ state_fio->StateValue(port[i].latched_data);
+ state_fio->StateValue(port[i].latched);
+ state_fio->StateValue(port[i].first_write);
}
- state_fio->StateUint8(p3csr);
- state_fio->StateBool(p3csr_is3_flag_read);
- state_fio->StateBool(sc1_state);
- state_fio->StateBool(sc2_state);
- state_fio->StateUint32(counter.d);
- state_fio->StateUint32(output_compare.d);
- state_fio->StateUint32(timer_over.d);
- state_fio->StateUint8(tcsr);
- state_fio->StateUint8(pending_tcsr);
- state_fio->StateUint16(input_capture);
- state_fio->StateUint32(timer_next);
+ state_fio->StateValue(p3csr);
+ state_fio->StateValue(p3csr_is3_flag_read);
+ state_fio->StateValue(sc1_state);
+ state_fio->StateValue(sc2_state);
+ state_fio->StateValue(counter.d);
+ state_fio->StateValue(output_compare.d);
+ state_fio->StateValue(timer_over.d);
+ state_fio->StateValue(tcsr);
+ state_fio->StateValue(pending_tcsr);
+ state_fio->StateValue(input_capture);
+ state_fio->StateValue(timer_next);
if(!recv_buffer->process_state((void *)state_fio, loading)) {
return false;
}
- state_fio->StateUint8(trcsr);
- state_fio->StateUint8(rdr);
- state_fio->StateUint8(tdr);
- state_fio->StateBool(trcsr_read_tdre);
- state_fio->StateBool(trcsr_read_orfe);
- state_fio->StateBool(trcsr_read_rdrf);
- state_fio->StateUint8(rmcr);
- state_fio->StateInt32(sio_counter);
- state_fio->StateUint8(ram_ctrl);
- state_fio->StateBuffer(ram, sizeof(ram), 1);
+ state_fio->StateValue(trcsr);
+ state_fio->StateValue(rdr);
+ state_fio->StateValue(tdr);
+ state_fio->StateValue(trcsr_read_tdre);
+ state_fio->StateValue(trcsr_read_orfe);
+ state_fio->StateValue(trcsr_read_rdrf);
+ state_fio->StateValue(rmcr);
+ state_fio->StateValue(sio_counter);
+ state_fio->StateValue(ram_ctrl);
+ state_fio->StateArray(ram, sizeof(ram), 1);
//#endif
// post process
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- state_fio->StateInt32(icount);
- state_fio->StateInt32(extra_icount);
- state_fio->StateUint32(int_state);
-
- state_fio->StateUint32(pc.d);
- state_fio->StateUint32(ppc.d);
- state_fio->StateUint32(acc.d);
- state_fio->StateUint32(dp.d);
- state_fio->StateUint32(u.d);
- state_fio->StateUint32(s.d);
- state_fio->StateUint32(x.d);
- state_fio->StateUint32(y.d);
- state_fio->StateUint8(cc);
- state_fio->StateUint32(ea.d);
+ state_fio->StateValue(icount);
+ state_fio->StateValue(extra_icount);
+ state_fio->StateValue(int_state);
+
+ state_fio->StateValue(pc.d);
+ state_fio->StateValue(ppc.d);
+ state_fio->StateValue(acc.d);
+ state_fio->StateValue(dp.d);
+ state_fio->StateValue(u.d);
+ state_fio->StateValue(s.d);
+ state_fio->StateValue(x.d);
+ state_fio->StateValue(y.d);
+ state_fio->StateValue(cc);
+ state_fio->StateValue(ea.d);
// V2
- state_fio->StateBool(req_halt_on);
- state_fio->StateBool(req_halt_off);
- state_fio->StateBool(busreq);
+ state_fio->StateValue(req_halt_on);
+ state_fio->StateValue(req_halt_off);
+ state_fio->StateValue(busreq);
- state_fio->StateUint64(total_icount);
- state_fio->StateUint32(waitfactor);
- state_fio->StateUint32(waitcount);
+ state_fio->StateValue(total_icount);
+ state_fio->StateValue(waitfactor);
+ state_fio->StateValue(waitcount);
// post process
if(loading) {
return false;
}
for(int i = 0; i < 2; i++) {
- state_fio->StateUint8(port[i].wreg);
- state_fio->StateUint8(port[i].rreg);
- state_fio->StateUint8(port[i].ctrl);
- state_fio->StateUint8(port[i].ddr);
- state_fio->StateBool(port[i].c1);
- state_fio->StateBool(port[i].c2);
- state_fio->StateBool(port[i].first);
+ state_fio->StateValue(port[i].wreg);
+ state_fio->StateValue(port[i].rreg);
+ state_fio->StateValue(port[i].ctrl);
+ state_fio->StateValue(port[i].ddr);
+ state_fio->StateValue(port[i].c1);
+ state_fio->StateValue(port[i].c2);
+ state_fio->StateValue(port[i].first);
}
return true;
}
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- state_fio->StateBuffer(m_control_reg, sizeof(m_control_reg), 1);
- state_fio->StateBuffer(m_output, sizeof(m_output), 1);
- state_fio->StateBuffer(m_gate, sizeof(m_gate), 1);
- state_fio->StateBuffer(m_clk, sizeof(m_clk), 1);
- state_fio->StateBuffer(m_enabled, sizeof(m_enabled), 1);
- state_fio->StateBuffer(m_mode, sizeof(m_mode), 1);
- state_fio->StateBuffer(m_fired, sizeof(m_fired), 1);
- state_fio->StateUint8(m_t3_divisor);
- state_fio->StateUint8(m_t3_scaler);
- state_fio->StateUint8(m_IRQ);
- state_fio->StateUint8(m_status_reg);
- state_fio->StateUint8(m_status_read_since_int);
- state_fio->StateUint8(m_lsb_buffer);
- state_fio->StateUint8(m_msb_buffer);
-
- //state_fio->StateBuffer(m_timer, sizeof(m_timer), 1);
- //state_fio->StateBuffer(m_latch, sizeof(m_latch), 1);
- //state_fio->StateBuffer(m_counter, sizeof(m_counter), 1);
- for(int i = 0; i < (sizeof(m_timer) / sizeof(int)); i++) {
- state_fio->StateInt32(m_timer[i]);
- }
- for(int i = 0; i < (sizeof(m_latch) / sizeof(UINT16)); i++) {
- state_fio->StateUint16(m_latch[i]);
- }
- for(int i = 0; i < (sizeof(m_counter) / sizeof(UINT16)); i++) {
- state_fio->StateUint16(m_counter[i]);
- }
+ state_fio->StateArray(m_control_reg, sizeof(m_control_reg), 1);
+ state_fio->StateArray(m_output, sizeof(m_output), 1);
+ state_fio->StateArray(m_gate, sizeof(m_gate), 1);
+ state_fio->StateArray(m_clk, sizeof(m_clk), 1);
+ state_fio->StateArray(m_enabled, sizeof(m_enabled), 1);
+ state_fio->StateArray(m_mode, sizeof(m_mode), 1);
+ state_fio->StateArray(m_fired, sizeof(m_fired), 1);
+ state_fio->StateValue(m_t3_divisor);
+ state_fio->StateValue(m_t3_scaler);
+ state_fio->StateValue(m_IRQ);
+ state_fio->StateValue(m_status_reg);
+ state_fio->StateValue(m_status_read_since_int);
+ state_fio->StateValue(m_lsb_buffer);
+ state_fio->StateValue(m_msb_buffer);
+ state_fio->StateArray(m_timer, sizeof(m_timer), 1);
+ state_fio->StateArray(m_latch, sizeof(m_latch), 1);
+ state_fio->StateArray(m_counter, sizeof(m_counter), 1);
return true;
}
return false;
}
for(int i = 0; i < 4; i++) {
- state_fio->StateUint32(dma[i].address_reg.d);
- state_fio->StateUint32(dma[i].byte_count_reg.d);
- state_fio->StateUint8(dma[i].channel_ctrl_reg);
+ state_fio->StateValue(dma[i].address_reg.d);
+ state_fio->StateValue(dma[i].byte_count_reg.d);
+ state_fio->StateValue(dma[i].channel_ctrl_reg);
}
- state_fio->StateUint8(priority_ctrl_reg);
- state_fio->StateUint8(interrupt_ctrl_reg);
- state_fio->StateUint8(data_chain_reg);
+ state_fio->StateValue(priority_ctrl_reg);
+ state_fio->StateValue(interrupt_ctrl_reg);
+ state_fio->StateValue(data_chain_reg);
return true;
}
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- state_fio->StateBuffer(sg4, sizeof(sg4), 1);
- state_fio->StateBuffer(sg6, sizeof(sg6), 1);
- state_fio->StateBool(ag);
- state_fio->StateBool(as);
- state_fio->StateBool(intext);
- state_fio->StateUint8(gm);
- state_fio->StateBool(css);
- state_fio->StateBool(inv);
- state_fio->StateBool(vsync);
- state_fio->StateBool(hsync);
- state_fio->StateBool(disp);
- state_fio->StateInt32(tWHS);
- state_fio->StateBool(disabled);
+ state_fio->StateArray(sg4, sizeof(sg4), 1);
+ state_fio->StateArray(sg6, sizeof(sg6), 1);
+ state_fio->StateValue(ag);
+ state_fio->StateValue(as);
+ state_fio->StateValue(intext);
+ state_fio->StateValue(gm);
+ state_fio->StateValue(css);
+ state_fio->StateValue(inv);
+ state_fio->StateValue(vsync);
+ state_fio->StateValue(hsync);
+ state_fio->StateValue(disp);
+ state_fio->StateValue(tWHS);
+ state_fio->StateValue(disabled);
return true;
}
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- state_fio->StateUint8(recv);
- state_fio->StateUint8(status);
- state_fio->StateUint8(ctrl);
+ state_fio->StateValue(recv);
+ state_fio->StateValue(status);
+ state_fio->StateValue(ctrl);
if(!recv_buffer->process_state((void *)state_fio, loading)) {
return false;
}
if(!send_buffer->process_state((void *)state_fio, loading)) {
return false;
}
- state_fio->StateInt32(recv_id);
- state_fio->StateInt32(send_id);
+ state_fio->StateValue(recv_id);
+ state_fio->StateValue(send_id);
return true;
}
bool MCS48::process_state(FILEIO* state_fio, bool loading)
{
+ mcs48_state *cpustate = (mcs48_state *)opaque;
+
if(!state_fio->StateCheckUint32(STATE_VERSION)) {
return false;
}
return false;
}
#ifdef USE_DEBUGGER
- state_fio->StateUint64(total_icount);
+ state_fio->StateValue(total_icount);
#endif
- //state_fio->StateBuffer(opaque, sizeof(mcs48_state), 1);
-
- // BEGIN CPUREGS
- mcs48_state *cpustate = (mcs48_state *)opaque;
- state_fio->StateUint16(cpustate->prevpc);
- state_fio->StateUint16(cpustate->pc);
- state_fio->StateUint8(cpustate->a);
- state_fio->StateInt32(cpustate->regptr);
- state_fio->StateUint8(cpustate->psw);
- state_fio->StateUint8(cpustate->p1);
- state_fio->StateUint8(cpustate->p2);
- state_fio->StateUint8(cpustate->timer);
- state_fio->StateUint8(cpustate->prescaler);
- state_fio->StateUint8(cpustate->t1_history);
- state_fio->StateUint8(cpustate->sts);
- state_fio->StateUint8(cpustate->int_state);
- state_fio->StateUint8(cpustate->irq_state);
- state_fio->StateUint8(cpustate->irq_in_progress);
- state_fio->StateUint8(cpustate->timer_overflow);
- state_fio->StateUint8(cpustate->timer_flag);
- state_fio->StateUint8(cpustate->tirq_enabled);
- state_fio->StateUint8(cpustate->xirq_enabled);
- state_fio->StateUint8(cpustate->t0_clk_enabled);
- state_fio->StateUint8(cpustate->timecount_enabled);
- state_fio->StateUint16(cpustate->a11);
- state_fio->StateInt32(cpustate->icount);
- state_fio->StateBuffer(cpustate->rom, 0x1000, 1); // 0x100 ?
- // END CPUREGS
-
+ state_fio->StateValue(cpustate->prevpc);
+ state_fio->StateValue(cpustate->pc);
+ state_fio->StateValue(cpustate->a);
+ state_fio->StateValue(cpustate->regptr);
+ state_fio->StateValue(cpustate->psw);
+ state_fio->StateValue(cpustate->p1);
+ state_fio->StateValue(cpustate->p2);
+ state_fio->StateValue(cpustate->timer);
+ state_fio->StateValue(cpustate->prescaler);
+ state_fio->StateValue(cpustate->t1_history);
+ state_fio->StateValue(cpustate->sts);
+ state_fio->StateValue(cpustate->int_state);
+ state_fio->StateValue(cpustate->irq_state);
+ state_fio->StateValue(cpustate->irq_in_progress);
+ state_fio->StateValue(cpustate->timer_overflow);
+ state_fio->StateValue(cpustate->timer_flag);
+ state_fio->StateValue(cpustate->tirq_enabled);
+ state_fio->StateValue(cpustate->xirq_enabled);
+ state_fio->StateValue(cpustate->t0_clk_enabled);
+ state_fio->StateValue(cpustate->timecount_enabled);
+ state_fio->StateValue(cpustate->a11);
+ state_fio->StateValue(cpustate->icount);
+// state_fio->StateArray(cpustate->rom, sizeof(cpustate->rom), 1);
+
+ // post process
if(loading) {
mcs48_state *cpustate = (mcs48_state *)opaque;
cpustate->mem = d_mem;
}
//#endif
-#define STATE_VERSION 2
+#define STATE_VERSION 3
bool MCS48MEM::process_state(FILEIO* state_fio, bool loading)
{
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- state_fio->StateBuffer(ram, sizeof(ram), 1);
+ state_fio->StateArray(ram, sizeof(ram), 1);
return true;
}
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- state_fio->StateInt32(m_mod_clock);
- state_fio->StateInt32(m_timer);
- state_fio->StateInt32(m_data);
- state_fio->StateInt32(m_vclk);
- state_fio->StateInt32(m_reset);
- state_fio->StateInt32(m_prescaler);
- state_fio->StateInt32(m_bitwidth);
- state_fio->StateInt32(m_signal);
- state_fio->StateInt32(m_step);
- state_fio->StateInt32(m_select);
- state_fio->StateInt32(volume_m);
+ state_fio->StateValue(m_mod_clock);
+ state_fio->StateValue(m_timer);
+ state_fio->StateValue(m_data);
+ state_fio->StateValue(m_vclk);
+ state_fio->StateValue(m_reset);
+ state_fio->StateValue(m_prescaler);
+ state_fio->StateValue(m_bitwidth);
+ state_fio->StateValue(m_signal);
+ state_fio->StateValue(m_step);
+ state_fio->StateValue(m_select);
+ state_fio->StateValue(volume_m);
return true;
}
if(!cur_time.process_state((void *)state_fio, loading)) {
return false;
}
- state_fio->StateInt32(register_id);
- state_fio->StateBuffer(regs, sizeof(regs), 1);
- state_fio->StateUint8(wreg);
- state_fio->StateUint8(regnum);
- state_fio->StateBool(cs);
- state_fio->StateBool(rd);
- state_fio->StateBool(wr);
- state_fio->StateBool(addr_wr);
- state_fio->StateBool(busy);
- state_fio->StateBool(hold);
- state_fio->StateInt32(count_1024hz);
- state_fio->StateInt32(count_1s);
- state_fio->StateInt32(count_1m);
- state_fio->StateInt32(count_1h);
+ state_fio->StateValue(register_id);
+ state_fio->StateArray(regs, sizeof(regs), 1);
+ state_fio->StateValue(wreg);
+ state_fio->StateValue(regnum);
+ state_fio->StateValue(cs);
+ state_fio->StateValue(rd);
+ state_fio->StateValue(wr);
+ state_fio->StateValue(addr_wr);
+ state_fio->StateValue(busy);
+ state_fio->StateValue(hold);
+ state_fio->StateValue(count_1024hz);
+ state_fio->StateValue(count_1s);
+ state_fio->StateValue(count_1m);
+ state_fio->StateValue(count_1h);
return true;
}
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- state_fio->StateInt32(value);
- state_fio->StateInt32(busy_id);
- state_fio->StateInt32(ack_id);
- state_fio->StateBool(strobe);
- state_fio->StateBool(res);
- state_fio->StateBool(busy);
- state_fio->StateBool(ack);
-// state_fio->StateBuffer(gaiji, sizeof(gaiji), 1);
-// state_fio->StateBuffer(htab, sizeof(htab), 1);
-// state_fio->StateBuffer(vtab, sizeof(vtab), 1);
- for(int i = 0; i < 3; i++) {
- for(int j = 0; j < 94; j++) {
- for(int k = 0; k < 48; k++) {
- for(int l = 0; l < 48; l++) {
- state_fio->StateBool(gaiji[i][j][k][l]);
- }
- }
- }
+ state_fio->StateValue(value);
+ state_fio->StateValue(busy_id);
+ state_fio->StateValue(ack_id);
+ state_fio->StateValue(strobe);
+ state_fio->StateValue(res);
+ state_fio->StateValue(busy);
+ state_fio->StateValue(ack);
+ state_fio->StateArray(&gaiji[0][0][0][0], sizeof(gaiji), 1);
+ state_fio->StateArray(htab, sizeof(htab), 1);
+ for(int i = 0; i < array_length(vtab); i++) {
+ state_fio->StateValue(vtab[i].y);
+ state_fio->StateValue(vtab[i].active);
}
- for(int i = 0; i < (sizeof(htab) / sizeof(bool)) ; i++) {
- state_fio->StateBool(htab[i]);
- }
- for(int i = 0; i < 14; i++) {
- state_fio->StateInt32(vtab[i].y);
- state_fio->StateBool(vtab[i].active);
- }
-
if(!fifo->process_state((void *)state_fio, loading)) {
return false;
}
- state_fio->StateInt32(lf_pitch);
- state_fio->StateBool(prev_esc_6);
- state_fio->StateInt32(margin_left);
- state_fio->StateInt32(margin_right);
- state_fio->StateInt32(pitch_mode);
- state_fio->StateInt32(script_mode);
- state_fio->StateBool(kanji_mode);
- state_fio->StateBool(kanji_half);
- state_fio->StateBool(bold);
- state_fio->StateBool(underline);
- state_fio->StateBool(hiragana_mode);
- state_fio->StateBool(reverse);
- state_fio->StateBool(vertical);
- state_fio->StateBool(ank_double_x);
- state_fio->StateBool(ank_double_y);
- state_fio->StateBool(kanji_double_x);
- state_fio->StateBool(kanji_double_y);
- state_fio->StateInt32(kanji_pitch);
- state_fio->StateInt32(kanji_half_pitch);
- state_fio->StateInt32(dest_line_x);
- state_fio->StateInt32(dest_paper_y);
- state_fio->StateInt32(color_mode);
- state_fio->StateBool(double_y_printed);
+ state_fio->StateValue(lf_pitch);
+ state_fio->StateValue(prev_esc_6);
+ state_fio->StateValue(margin_left);
+ state_fio->StateValue(margin_right);
+ state_fio->StateValue(pitch_mode);
+ state_fio->StateValue(script_mode);
+ state_fio->StateValue(kanji_mode);
+ state_fio->StateValue(kanji_half);
+ state_fio->StateValue(bold);
+ state_fio->StateValue(underline);
+ state_fio->StateValue(hiragana_mode);
+ state_fio->StateValue(reverse);
+ state_fio->StateValue(vertical);
+ state_fio->StateValue(ank_double_x);
+ state_fio->StateValue(ank_double_y);
+ state_fio->StateValue(kanji_double_x);
+ state_fio->StateValue(kanji_double_y);
+ state_fio->StateValue(kanji_pitch);
+ state_fio->StateValue(kanji_half_pitch);
+ state_fio->StateValue(dest_line_x);
+ state_fio->StateValue(dest_paper_y);
+ state_fio->StateValue(color_mode);
+ state_fio->StateValue(double_y_printed);
// post process
if(loading) {
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- state_fio->StateUint32(pc.d);
- state_fio->StateUint32(sp.d);
- state_fio->StateUint32(zp.d);
- state_fio->StateUint32(ea.d);
- state_fio->StateUint16(prev_pc);
- state_fio->StateUint8(a);
- state_fio->StateUint8(x);
- state_fio->StateUint8(y);
- state_fio->StateUint8(p);
- state_fio->StateBool(pending_irq);
- state_fio->StateBool(after_cli);
- state_fio->StateBool(nmi_state);
- state_fio->StateBool(irq_state);
- state_fio->StateBool(so_state);
+ state_fio->StateValue(pc.d);
+ state_fio->StateValue(sp.d);
+ state_fio->StateValue(zp.d);
+ state_fio->StateValue(ea.d);
+ state_fio->StateValue(prev_pc);
+ state_fio->StateValue(a);
+ state_fio->StateValue(x);
+ state_fio->StateValue(y);
+ state_fio->StateValue(p);
+ state_fio->StateValue(pending_irq);
+ state_fio->StateValue(after_cli);
+ state_fio->StateValue(nmi_state);
+ state_fio->StateValue(irq_state);
+ state_fio->StateValue(so_state);
#ifdef USE_DEBUGGER
- state_fio->StateUint64(total_icount);
+ state_fio->StateValue(total_icount);
#endif
- state_fio->StateInt32(icount);
- state_fio->StateBool(busreq);
+ state_fio->StateValue(icount);
+ state_fio->StateValue(busreq);
#ifdef USE_DEBUGGER
// post process
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- state_fio->StateUint32(bits_mask);
- state_fio->StateUint32(bits_in);
- state_fio->StateBool(prev);
- state_fio->StateBool(first);
+ state_fio->StateValue(bits_mask);
+ state_fio->StateValue(bits_in);
+ state_fio->StateValue(prev);
+ state_fio->StateValue(first);
return true;
}
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- state_fio->StateInt32(register_id);
- state_fio->StateInt32(ptr);
- state_fio->StateInt32(sample_l);
- state_fio->StateInt32(sample_r);
- state_fio->StateBool(loop);
- state_fio->StateBool(mute);
+ state_fio->StateValue(register_id);
+ state_fio->StateValue(ptr);
+ state_fio->StateValue(sample_l);
+ state_fio->StateValue(sample_r);
+ state_fio->StateValue(loop);
+ state_fio->StateValue(mute);
return true;
}
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- state_fio->StateUint32(bits_in);
- state_fio->StateBool(prev);
- state_fio->StateBool(first);
+ state_fio->StateValue(bits_in);
+ state_fio->StateValue(prev);
+ state_fio->StateValue(first);
return true;
}
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- state_fio->StateBool(prev);
- state_fio->StateBool(first);
+ state_fio->StateValue(prev);
+ state_fio->StateValue(first);
return true;
}
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- state_fio->StateUint32(bits_in);
- state_fio->StateBool(prev);
- state_fio->StateBool(first);
+ state_fio->StateValue(bits_in);
+ state_fio->StateValue(prev);
+ state_fio->StateValue(first);
return true;
}
return false;
}
}
-// state_fio->StateBuffer(cur_trk, sizeof(cur_trk), 1);
-// state_fio->StateBuffer(cur_sct, sizeof(cur_sct), 1);
-// state_fio->StateBuffer(cur_pos, sizeof(cur_pos), 1);
-// state_fio->StateBuffer(access, sizeof(access), 1);
-// state_fio->StateBuffer(&mdisk, sizeof(DISK60), 1);
- for(int i = 0; i < (sizeof(cur_trk) / sizeof(int)); i++) {
- state_fio->StateInt32(cur_trk[i]);
- }
- for(int i = 0; i < (sizeof(cur_sct) / sizeof(int)); i++) {
- state_fio->StateInt32(cur_sct[i]);
- }
- for(int i = 0; i < (sizeof(cur_pos) / sizeof(int)); i++) {
- state_fio->StateInt32(cur_pos[i]);
- }
- for(int i = 0; i < (sizeof(access) / sizeof(bool)); i++) {
- state_fio->StateBool(access[i]);
- }
+ state_fio->StateArray(cur_trk, sizeof(cur_trk), 1);
+ state_fio->StateArray(cur_sct, sizeof(cur_sct), 1);
+ state_fio->StateArray(cur_pos, sizeof(cur_pos), 1);
+ state_fio->StateArray(access, sizeof(access), 1);
// mdisk
- {
- state_fio->StateInt32(mdisk.ATN);
- state_fio->StateInt32(mdisk.DAC);
- state_fio->StateInt32(mdisk.RFD);
- state_fio->StateInt32(mdisk.DAV);
-
- state_fio->StateInt32(mdisk.command);
- state_fio->StateInt32(mdisk.step);
- state_fio->StateInt32(mdisk.blk);
-
- state_fio->StateInt32(mdisk.drv);
- state_fio->StateInt32(mdisk.trk);
- state_fio->StateInt32(mdisk.sct);
- state_fio->StateInt32(mdisk.size);
-
- state_fio->StateUint8(mdisk.retdat);
- }
- state_fio->StateUint8(io_D1H);
- state_fio->StateUint8(io_D2H);
- state_fio->StateUint8(old_D2H);
- state_fio->StateUint8(io_D3H);
- state_fio->StateInt32(DrvNum);
+ state_fio->StateValue(mdisk.ATN);
+ state_fio->StateValue(mdisk.DAC);
+ state_fio->StateValue(mdisk.RFD);
+ state_fio->StateValue(mdisk.DAV);
+ state_fio->StateValue(mdisk.command);
+ state_fio->StateValue(mdisk.step);
+ state_fio->StateValue(mdisk.blk);
+ state_fio->StateValue(mdisk.drv);
+ state_fio->StateValue(mdisk.trk);
+ state_fio->StateValue(mdisk.sct);
+ state_fio->StateValue(mdisk.size);
+ state_fio->StateValue(mdisk.retdat);
+ state_fio->StateValue(io_D1H);
+ state_fio->StateValue(io_D2H);
+ state_fio->StateValue(old_D2H);
+ state_fio->StateValue(io_D3H);
+ state_fio->StateValue(DrvNum);
return true;
}
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- state_fio->StateBuffer(ram, sizeof(ram), 1);
+ state_fio->StateArray(ram, sizeof(ram), 1);
return true;
}
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- state_fio->StateBool(signal);
- state_fio->StateBool(on);
- state_fio->StateBool(mute);
- state_fio->StateBool(realtime);
- state_fio->StateInt32(changed);
- state_fio->StateUint32(prev_clock);
- state_fio->StateInt32(positive_clocks);
- state_fio->StateInt32(negative_clocks);
+ state_fio->StateValue(signal);
+ state_fio->StateValue(on);
+ state_fio->StateValue(mute);
+ state_fio->StateValue(realtime);
+ state_fio->StateValue(changed);
+ state_fio->StateValue(prev_clock);
+ state_fio->StateValue(positive_clocks);
+ state_fio->StateValue(negative_clocks);
// post process
if(loading) {
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- state_fio->StateInt32(value);
- state_fio->StateInt32(busy_id);
- state_fio->StateInt32(ack_id);
- state_fio->StateBool(strobe);
- state_fio->StateBool(res);
- state_fio->StateBool(busy);
- state_fio->StateBool(ack);
+ state_fio->StateValue(value);
+ state_fio->StateValue(busy_id);
+ state_fio->StateValue(ack_id);
+ state_fio->StateValue(strobe);
+ state_fio->StateValue(res);
+ state_fio->StateValue(busy);
+ state_fio->StateValue(ack);
// post process
if(loading) {
return false;
}
}
- state_fio->StateBuffer(bufr, sizeof(bufr), 1);
- state_fio->StateBuffer(bufs, sizeof(bufs), 1);
- state_fio->StateInt32(buflen);
- state_fio->StateInt32(phase);
+ state_fio->StateArray(bufr, sizeof(bufr), 1);
+ state_fio->StateArray(bufs, sizeof(bufs), 1);
+ state_fio->StateValue(buflen);
+ state_fio->StateValue(phase);
return true;
}
if(!cur_time.process_state((void *)state_fio, loading)) {
return false;
}
- state_fio->StateInt32(register_id);
- state_fio->StateBuffer(regs, sizeof(regs), 1);
- state_fio->StateBuffer(time, sizeof(time), 1);
+ state_fio->StateValue(register_id);
+ state_fio->StateArray(regs, sizeof(regs), 1);
+ state_fio->StateArray(time, sizeof(time), 1);
if(!(__HAS_RP5C15)) {
- state_fio->StateBuffer(ram, sizeof(ram), 1);
- state_fio->StateBool(modified);
+ state_fio->StateArray(ram, sizeof(ram), 1);
+ state_fio->StateValue(modified);
}
- state_fio->StateBool(alarm);
- state_fio->StateBool(pulse_1hz);
- state_fio->StateBool(pulse_16hz);
- state_fio->StateInt32(count_16hz);
+ state_fio->StateValue(alarm);
+ state_fio->StateValue(pulse_1hz);
+ state_fio->StateValue(pulse_16hz);
+ state_fio->StateValue(count_16hz);
return true;
}
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- state_fio->StateUint32(cdda_start_frame);
- state_fio->StateUint32(cdda_end_frame);
- state_fio->StateUint32(cdda_playing_frame);
- state_fio->StateUint8(cdda_status);
- state_fio->StateBool(cdda_repeat);
- state_fio->StateBool(cdda_interrupt);
- state_fio->StateBuffer(cdda_buffer, sizeof(cdda_buffer), 1);
- state_fio->StateInt32(cdda_buffer_ptr);
- state_fio->StateInt32(cdda_sample_l);
- state_fio->StateInt32(cdda_sample_r);
- state_fio->StateInt32(event_cdda);
-// state_fio->StateInt32(mix_loop_num);
- state_fio->StateInt32(volume_m);
+ state_fio->StateValue(cdda_start_frame);
+ state_fio->StateValue(cdda_end_frame);
+ state_fio->StateValue(cdda_playing_frame);
+ state_fio->StateValue(cdda_status);
+ state_fio->StateValue(cdda_repeat);
+ state_fio->StateValue(cdda_interrupt);
+ state_fio->StateArray(cdda_buffer, sizeof(cdda_buffer), 1);
+ state_fio->StateValue(cdda_buffer_ptr);
+ state_fio->StateValue(cdda_sample_l);
+ state_fio->StateValue(cdda_sample_r);
+ state_fio->StateValue(event_cdda);
+// state_fio->StateValue(mix_loop_num);
+ state_fio->StateValue(volume_m);
if(loading) {
offset = state_fio->FgetUint32_LE();
} else {
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- state_fio->StateUint32(data_bus);
- state_fio->StateBool(sel_status);
- state_fio->StateBool(atn_status);
- state_fio->StateBool(ack_status);
- state_fio->StateBool(rst_status);
- state_fio->StateBool(selected);
- state_fio->StateBool(atn_pending);
- state_fio->StateInt32(phase);
- state_fio->StateInt32(next_phase);
- state_fio->StateInt32(next_req);
- state_fio->StateInt32(event_sel);
- state_fio->StateInt32(event_phase);
- state_fio->StateInt32(event_req);
- state_fio->StateUint32(first_req_clock);
- state_fio->StateDouble(next_req_usec);
- state_fio->StateBuffer(command, sizeof(command), 1);
- state_fio->StateInt32(command_index);
+ state_fio->StateValue(data_bus);
+ state_fio->StateValue(sel_status);
+ state_fio->StateValue(atn_status);
+ state_fio->StateValue(ack_status);
+ state_fio->StateValue(rst_status);
+ state_fio->StateValue(selected);
+ state_fio->StateValue(atn_pending);
+ state_fio->StateValue(phase);
+ state_fio->StateValue(next_phase);
+ state_fio->StateValue(next_req);
+ state_fio->StateValue(event_sel);
+ state_fio->StateValue(event_phase);
+ state_fio->StateValue(event_req);
+ state_fio->StateValue(first_req_clock);
+ state_fio->StateValue(next_req_usec);
+ state_fio->StateArray(command, sizeof(command), 1);
+ state_fio->StateValue(command_index);
if(!buffer->process_state((void *)state_fio, loading)) {
return false;
}
- state_fio->StateUint64(position);
- state_fio->StateUint64(remain);
- state_fio->StateUint8(sense_code);
+ state_fio->StateValue(position);
+ state_fio->StateValue(remain);
+ state_fio->StateValue(sense_code);
return true;
}
}
}
*/
- state_fio->StateBuffer(image_path, sizeof(image_path), 1);
-// state_fio->StateBuffer(sector_size, sizeof(sector_size), 1);
- for(int i = 0; i < (sizeof(sector_size) / sizeof(int)); i++) {
- state_fio->StateInt32(sector_size[i]);
- }
+ state_fio->StateArray(image_path, sizeof(image_path), 1);
+ state_fio->StateArray(sector_size, sizeof(sector_size), 1);
return SCSI_DEV::process_state(state_fio, loading);
}
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- state_fio->StateUint32(data_reg);
- state_fio->StateUint32(bsy_status);
- state_fio->StateUint32(cd_status);
- state_fio->StateUint32(io_status);
- state_fio->StateUint32(msg_status);
- state_fio->StateUint32(req_status);
- state_fio->StateUint32(ack_status);
+ state_fio->StateValue(data_reg);
+ state_fio->StateValue(bsy_status);
+ state_fio->StateValue(cd_status);
+ state_fio->StateValue(io_status);
+ state_fio->StateValue(msg_status);
+ state_fio->StateValue(req_status);
+ state_fio->StateValue(ack_status);
return true;
}
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- //state_fio->StateBuffer(regs, sizeof(regs), 1);
- for(int i = 0; i < (sizeof(regs) / sizeof(uint16_t)) ; i++) {
- state_fio->StateUint16(regs[i]);
+ state_fio->StateArray(regs, sizeof(regs), 1);
+ state_fio->StateValue(index);
+ for(int i = 0; i < array_length(ch); i++) {
+ state_fio->StateValue(ch[i].count);
+ state_fio->StateValue(ch[i].period);
+ state_fio->StateValue(ch[i].volume);
+ state_fio->StateValue(ch[i].signal);
}
- state_fio->StateInt32(index);
- //state_fio->StateBuffer(ch, sizeof(ch), 1);
- for(int i = 0; i < 4; i++) {
- state_fio->StateInt32(ch[i].count);
- state_fio->StateInt32(ch[i].period);
- state_fio->StateInt32(ch[i].volume);
- state_fio->StateBool(ch[i].signal);
- }
- state_fio->StateUint32(noise_gen);
- state_fio->StateBool(mute);
- state_fio->StateBool(cs);
- state_fio->StateBool(we);
- state_fio->StateUint8(val);
+ state_fio->StateValue(noise_gen);
+ state_fio->StateValue(mute);
+ state_fio->StateValue(cs);
+ state_fio->StateValue(we);
+ state_fio->StateValue(val);
//if(loading) {
//touch_sound();
//}
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- state_fio->StateUint8(m_in_a);
- state_fio->StateInt32(m_in_ca1);
- state_fio->StateInt32(m_in_ca2);
- state_fio->StateUint8(m_out_a);
- state_fio->StateInt32(m_out_ca2);
- state_fio->StateUint8(m_ddr_a);
- state_fio->StateUint8(m_latch_a);
- state_fio->StateUint8(m_in_b);
- state_fio->StateInt32(m_in_cb1);
- state_fio->StateInt32(m_in_cb2);
- state_fio->StateUint8(m_out_b);
- state_fio->StateInt32(m_out_cb1);
- state_fio->StateInt32(m_out_cb2);
- state_fio->StateUint8(m_ddr_b);
- state_fio->StateUint8(m_latch_b);
- state_fio->StateUint8(m_t1cl);
- state_fio->StateUint8(m_t1ch);
- state_fio->StateUint8(m_t1ll);
- state_fio->StateUint8(m_t1lh);
- state_fio->StateUint8(m_t2cl);
- state_fio->StateUint8(m_t2ch);
- state_fio->StateUint8(m_t2ll);
- state_fio->StateUint8(m_t2lh);
- state_fio->StateUint8(m_sr);
- state_fio->StateUint8(m_pcr);
- state_fio->StateUint8(m_acr);
- state_fio->StateUint8(m_ier);
- state_fio->StateUint8(m_ifr);
- state_fio->StateInt32(m_t1);
- state_fio->StateUint32(m_time1);
- state_fio->StateUint8(m_t1_active);
- state_fio->StateInt32(m_t1_pb7);
- state_fio->StateInt32(m_t2);
- state_fio->StateUint32(m_time2);
- state_fio->StateUint8(m_t2_active);
- state_fio->StateInt32(m_ca2_timer);
- state_fio->StateInt32(m_shift_timer);
- state_fio->StateUint8(m_shift_counter);
+ state_fio->StateValue(m_in_a);
+ state_fio->StateValue(m_in_ca1);
+ state_fio->StateValue(m_in_ca2);
+ state_fio->StateValue(m_out_a);
+ state_fio->StateValue(m_out_ca2);
+ state_fio->StateValue(m_ddr_a);
+ state_fio->StateValue(m_latch_a);
+ state_fio->StateValue(m_in_b);
+ state_fio->StateValue(m_in_cb1);
+ state_fio->StateValue(m_in_cb2);
+ state_fio->StateValue(m_out_b);
+ state_fio->StateValue(m_out_cb1);
+ state_fio->StateValue(m_out_cb2);
+ state_fio->StateValue(m_ddr_b);
+ state_fio->StateValue(m_latch_b);
+ state_fio->StateValue(m_t1cl);
+ state_fio->StateValue(m_t1ch);
+ state_fio->StateValue(m_t1ll);
+ state_fio->StateValue(m_t1lh);
+ state_fio->StateValue(m_t2cl);
+ state_fio->StateValue(m_t2ch);
+ state_fio->StateValue(m_t2ll);
+ state_fio->StateValue(m_t2lh);
+ state_fio->StateValue(m_sr);
+ state_fio->StateValue(m_pcr);
+ state_fio->StateValue(m_acr);
+ state_fio->StateValue(m_ier);
+ state_fio->StateValue(m_ifr);
+ state_fio->StateValue(m_t1);
+ state_fio->StateValue(m_time1);
+ state_fio->StateValue(m_t1_active);
+ state_fio->StateValue(m_t1_pb7);
+ state_fio->StateValue(m_t2);
+ state_fio->StateValue(m_time2);
+ state_fio->StateValue(m_t2_active);
+ state_fio->StateValue(m_ca2_timer);
+ state_fio->StateValue(m_shift_timer);
+ state_fio->StateValue(m_shift_counter);
return true;
}
#define STATE_VERSION 2
-bool T3444A::process_state_fdc(int ch, FILEIO* state_fio, bool loading)
-{
- state_fio->StateInt32(fdc[ch].track);
- state_fio->StateInt32(fdc[ch].index);
- state_fio->StateBool(fdc[ch].access);
- state_fio->StateBool(fdc[ch].head_load);
-
-
- state_fio->StateInt32(fdc[ch].cur_position);
- state_fio->StateInt32(fdc[ch].next_trans_position);
-
- state_fio->StateInt32(fdc[ch].bytes_before_2nd_rqm);
- state_fio->StateInt32(fdc[ch].next_sync_position);
-
- state_fio->StateUint32(fdc[ch].prev_clock);
-
- return true;
-}
-
bool T3444A::process_state(FILEIO* state_fio, bool loading)
{
if(!state_fio->StateCheckUint32(STATE_VERSION)) {
return false;
}
- //state_fio->StateBuffer(fdc, sizeof(fdc), 1);
- for(int ch = 0; ch < 4; ch++) {
- process_state_fdc(ch, state_fio, loading);
- }
- for(int i = 0; i < _max_drive; i++) {
+ for(int i = 0; i < array_length(fdc); i++) {
+ state_fio->StateValue(fdc[i].track);
+ state_fio->StateValue(fdc[i].index);
+ state_fio->StateValue(fdc[i].access);
+ state_fio->StateValue(fdc[i].head_load);
+ state_fio->StateValue(fdc[i].cur_position);
+ state_fio->StateValue(fdc[i].next_trans_position);
+ state_fio->StateValue(fdc[i].bytes_before_2nd_rqm);
+ state_fio->StateValue(fdc[i].next_sync_position);
+ state_fio->StateValue(fdc[i].prev_clock);
+ }
+ for(int i = 0; i < array_length(disk); i++) {
if(!disk[i]->process_state(state_fio, loading)) {
return false;
}
}
- state_fio->StateUint8(status);
- state_fio->StateUint8(cmdreg);
- state_fio->StateUint8(trkreg);
- state_fio->StateUint8(secreg);
- state_fio->StateUint8(datareg);
- state_fio->StateUint8(drvreg);
- state_fio->StateUint8(sidereg);
- state_fio->StateBool(timerflag);
- state_fio->StateBuffer(sector_id, sizeof(sector_id), 1);
- //state_fio->StateBuffer(register_id, sizeof(register_id), 1);
- for(int i = 0; i < (sizeof(register_id) / sizeof(int)); i++) {
- state_fio->StateInt32(register_id[i]);
- }
- state_fio->StateBool(now_search);
- state_fio->StateInt32(seektrk);
- state_fio->StateBool(rqm);
- state_fio->StateBool(tnd);
- state_fio->StateBool(motor_on);
- state_fio->StateUint32(prev_rqm_clock);
+ state_fio->StateValue(status);
+ state_fio->StateValue(cmdreg);
+ state_fio->StateValue(trkreg);
+ state_fio->StateValue(secreg);
+ state_fio->StateValue(datareg);
+ state_fio->StateValue(drvreg);
+ state_fio->StateValue(sidereg);
+ state_fio->StateValue(timerflag);
+ state_fio->StateArray(sector_id, sizeof(sector_id), 1);
+ state_fio->StateArray(register_id, sizeof(register_id), 1);
+ state_fio->StateValue(now_search);
+ state_fio->StateValue(seektrk);
+ state_fio->StateValue(rqm);
+ state_fio->StateValue(tnd);
+ state_fio->StateValue(motor_on);
+ state_fio->StateValue(prev_rqm_clock);
return true;
}
// rqm
void set_rqm(bool val);
- bool process_state_fdc(int ch, FILEIO* state_fio, bool loading);
public:
T3444A(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
{
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- state_fio->StateBuffer(ram, sizeof(ram), 1);
- state_fio->StateBool(rom_selected);
+ state_fio->StateArray(ram, sizeof(ram), 1);
+ state_fio->StateValue(rom_selected);
// post process
if(loading) {
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- state_fio->StateUint8(envelop1);
- state_fio->StateUint8(envelop2);
- state_fio->StateUint8(datareg);
- state_fio->StateUint8(maskreg);
-// state_fio->StateBuffer(ch, sizeof(ch), 1);
- for(int i = 0; i < 8; i++) {
- state_fio->StateUint32(ch[i].freq);
- state_fio->StateUint32(ch[i].count);
+ state_fio->StateValue(envelop1);
+ state_fio->StateValue(envelop2);
+ state_fio->StateValue(datareg);
+ state_fio->StateValue(maskreg);
+ for(int i = 0; i < array_length(ch); i++) {
+ state_fio->StateValue(ch[i].freq);
+ state_fio->StateValue(ch[i].count);
}
-
- state_fio->StateUint8(channel);
- state_fio->StateBool(set_key);
+ state_fio->StateValue(channel);
+ state_fio->StateValue(set_key);
return true;
}
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- //state_fio->StateBuffer(vram, sizeof(vram), 1);
- state_fio->StateBuffer(vram, _VRAM_SIZE, 1);
- state_fio->StateBuffer(regs, sizeof(regs), 1);
- state_fio->StateUint8(status_reg);
- state_fio->StateUint8(read_ahead);
- state_fio->StateUint8(first_byte);
- state_fio->StateUint16(vram_addr);
- state_fio->StateBool(latch);
- state_fio->StateBool(intstat);
- state_fio->StateUint16(color_table);
- state_fio->StateUint16(pattern_table);
- state_fio->StateUint16(name_table);
- state_fio->StateUint16(sprite_pattern);
- state_fio->StateUint16(sprite_attrib);
- state_fio->StateUint16(color_mask);
- state_fio->StateUint16(pattern_mask);
+ state_fio->StateArray(vram, sizeof(vram), 1);
+ state_fio->StateArray(regs, sizeof(regs), 1);
+ state_fio->StateValue(status_reg);
+ state_fio->StateValue(read_ahead);
+ state_fio->StateValue(first_byte);
+ state_fio->StateValue(vram_addr);
+ state_fio->StateValue(latch);
+ state_fio->StateValue(intstat);
+ state_fio->StateValue(color_table);
+ state_fio->StateValue(pattern_table);
+ state_fio->StateValue(name_table);
+ state_fio->StateValue(sprite_pattern);
+ state_fio->StateValue(sprite_attrib);
+ state_fio->StateValue(color_mask);
+ state_fio->StateValue(pattern_mask);
if(_tms9918a_super_impose) {
- state_fio->StateBool(now_super_impose);
+ state_fio->StateValue(now_super_impose);
}
-
return true;
}
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- state_fio->StateUint8(pointer);
- state_fio->StateUint8(mode);
- state_fio->StateBuffer(imem, sizeof(imem), 1);
+ state_fio->StateValue(pointer);
+ state_fio->StateValue(mode);
+ state_fio->StateArray(imem, sizeof(imem), 1);
return true;
}
if(!cur_time.process_state((void *)state_fio, loading)) {
return false;
}
- state_fio->StateInt32(register_id_1sec);
- state_fio->StateUint8(cmd);
- state_fio->StateUint8(mode);
- state_fio->StateUint8(tpmode);
- state_fio->StateUint64(shift_data);
- state_fio->StateBool(clk);
- state_fio->StateBool(stb);
- state_fio->StateBool(din);
- state_fio->StateBool(hold);
- state_fio->StateBool(tp);
- state_fio->StateUint32(dout);
- state_fio->StateBool(dout_changed);
- state_fio->StateInt32(register_id_tp);
+ state_fio->StateValue(register_id_1sec);
+ state_fio->StateValue(cmd);
+ state_fio->StateValue(mode);
+ state_fio->StateValue(tpmode);
+ state_fio->StateValue(shift_data);
+ state_fio->StateValue(clk);
+ state_fio->StateValue(stb);
+ state_fio->StateValue(din);
+ state_fio->StateValue(hold);
+ state_fio->StateValue(tp);
+ state_fio->StateValue(dout);
+ state_fio->StateValue(dout_changed);
+ state_fio->StateValue(register_id_tp);
if(__HAS_UPD4990A) {
- state_fio->StateUint8(shift_cmd);
+ state_fio->StateValue(shift_cmd);
}
return true;
}
if(!cur_time.process_state((void *)state_fio, loading)) {
return false;
}
- state_fio->StateInt32(register_id);
- state_fio->StateBuffer(regs, sizeof(regs), 1);
- state_fio->StateUint8(ctrl1);
- state_fio->StateUint8(ctrl2);
- state_fio->StateUint8(mode);
+ state_fio->StateValue(register_id);
+ state_fio->StateArray(®s[0][0], sizeof(regs), 1);
+ state_fio->StateValue(ctrl1);
+ state_fio->StateValue(ctrl2);
+ state_fio->StateValue(mode);
return true;
}
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
- state_fio->StateInt32(cmdreg);
- state_fio->StateUint8(statreg);
- state_fio->StateBuffer(sync, sizeof(sync), 1);
- state_fio->StateInt32(vtotal);
- state_fio->StateInt32(vfp);
- state_fio->StateInt32(vs);
- state_fio->StateInt32(vbp);
- state_fio->StateInt32(v1);
- state_fio->StateInt32(v2);
- state_fio->StateInt32(v3);
- state_fio->StateInt32(v4);
- state_fio->StateInt32(hfp);
- state_fio->StateInt32(hs);
- state_fio->StateInt32(hbp);
- state_fio->StateInt32(h1);
- state_fio->StateInt32(h2);
- state_fio->StateInt32(h3);
- state_fio->StateInt32(h4);
- state_fio->StateBool(sync_changed);
- state_fio->StateBool(master);
- state_fio->StateUint8(zoom);
- state_fio->StateUint8(zr);
- state_fio->StateUint8(zw);
- state_fio->StateBuffer(ra, sizeof(ra), 1);
- state_fio->StateBuffer(cs, sizeof(cs), 1);
- state_fio->StateUint8(pitch);
- state_fio->StateUint32(lad);
- state_fio->StateBuffer(vect, sizeof(vect), 1);
- state_fio->StateInt32(ead);
- state_fio->StateInt32(dad);
- state_fio->StateUint8(maskl);
- state_fio->StateUint8(maskh);
- state_fio->StateUint8(mod);
- state_fio->StateBool(hsync);
- state_fio->StateBool(hblank);
- state_fio->StateBool(vsync);
- state_fio->StateBool(vblank);
- state_fio->StateBool(start);
- state_fio->StateInt32(blink_cursor);
- state_fio->StateInt32(blink_attr);
- state_fio->StateInt32(blink_rate);
- state_fio->StateBool(low_high);
- state_fio->StateBool(cmd_write_done);
- state_fio->StateInt32(cpu_clocks);
+ state_fio->StateValue(cmdreg);
+ state_fio->StateValue(statreg);
+ state_fio->StateArray(sync, sizeof(sync), 1);
+ state_fio->StateValue(vtotal);
+ state_fio->StateValue(vfp);
+ state_fio->StateValue(vs);
+ state_fio->StateValue(vbp);
+ state_fio->StateValue(v1);
+ state_fio->StateValue(v2);
+ state_fio->StateValue(v3);
+ state_fio->StateValue(v4);
+ state_fio->StateValue(hfp);
+ state_fio->StateValue(hs);
+ state_fio->StateValue(hbp);
+ state_fio->StateValue(h1);
+ state_fio->StateValue(h2);
+ state_fio->StateValue(h3);
+ state_fio->StateValue(h4);
+ state_fio->StateValue(sync_changed);
+ state_fio->StateValue(master);
+ state_fio->StateValue(zoom);
+ state_fio->StateValue(zr);
+ state_fio->StateValue(zw);
+ state_fio->StateArray(ra, sizeof(ra), 1);
+ state_fio->StateArray(cs, sizeof(cs), 1);
+ state_fio->StateValue(pitch);
+ state_fio->StateValue(lad);
+ state_fio->StateArray(vect, sizeof(vect), 1);
+ state_fio->StateValue(ead);
+ state_fio->StateValue(dad);
+ state_fio->StateValue(maskl);
+ state_fio->StateValue(maskh);
+ state_fio->StateValue(mod);
+ state_fio->StateValue(hsync);
+ state_fio->StateValue(hblank);
+ state_fio->StateValue(vsync);
+ state_fio->StateValue(vblank);
+ state_fio->StateValue(start);
+ state_fio->StateValue(blink_cursor);
+ state_fio->StateValue(blink_attr);
+ state_fio->StateValue(blink_rate);
+ state_fio->StateValue(low_high);
+ state_fio->StateValue(cmd_write_done);
+ state_fio->StateValue(cpu_clocks);
#ifdef UPD7220_HORIZ_FREQ
- state_fio->StateInt32(horiz_freq);
- state_fio->StateInt32(next_horiz_freq);
+ state_fio->StateValue(horiz_freq);
+ state_fio->StateValue(next_horiz_freq);
#endif
- state_fio->StateDouble(frames_per_sec);
- state_fio->StateInt32(lines_per_frame);
- state_fio->StateBuffer(params, sizeof(params), 1);
- state_fio->StateInt32(params_count);
+ state_fio->StateValue(frames_per_sec);
+ state_fio->StateValue(lines_per_frame);
+ state_fio->StateArray(params, sizeof(params), 1);
+ state_fio->StateValue(params_count);
if(!fo->process_state((void *)state_fio, loading)) {
return false;
}
- //state_fio->StateBuffer(rt, sizeof(rt), 1);
- for(int i = 0; i < (sizeof(rt) / sizeof(int)) ; i++) {
- state_fio->StateInt32(rt[i]);
- }
- state_fio->StateInt32(dx);
- state_fio->StateInt32(dy);
- state_fio->StateInt32(dir);
- state_fio->StateInt32(dif);
- state_fio->StateInt32(sl);
- state_fio->StateInt32(dc);
- state_fio->StateInt32(d);
- state_fio->StateInt32(d2);
- state_fio->StateInt32(d1);
- state_fio->StateInt32(dm);
- state_fio->StateUint16(pattern);
+ state_fio->StateArray(rt, sizeof(rt), 1);
+ state_fio->StateValue(dx);
+ state_fio->StateValue(dy);
+ state_fio->StateValue(dir);
+ state_fio->StateValue(dif);
+ state_fio->StateValue(sl);
+ state_fio->StateValue(dc);
+ state_fio->StateValue(d);
+ state_fio->StateValue(d2);
+ state_fio->StateValue(d1);
+ state_fio->StateValue(dm);
+ state_fio->StateValue(pattern);
// post process
if(loading && master) {
#define STATE_VERSION 3
-void UPD765A::process_state_fdc(int ch, FILEIO* state_fio, bool loading)
-{
- state_fio->StateUint8(fdc[ch].track);
- state_fio->StateUint8(fdc[ch].cur_track);
- state_fio->StateUint8(fdc[ch].result);
-
- state_fio->StateBool(fdc[ch].access);
- state_fio->StateBool(fdc[ch].head_load);
-
- state_fio->StateInt32(fdc[ch].cur_position);
- state_fio->StateInt32(fdc[ch].next_trans_position);
-
- state_fio->StateUint32(fdc[ch].prev_clock);
-}
-
bool UPD765A::process_state(FILEIO* state_fio, bool loading)
{
if(!state_fio->StateCheckUint32(STATE_VERSION)) {
if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
-// state_fio->StateBuffer(fdc, sizeof(fdc), 1);
- for(int ch = 0; ch < 4; ch++) {
- process_state_fdc(ch, state_fio, loading);
- }
- for(int i = 0; i < 4; i++) {
+ for(int i = 0; i < array_length(fdc); i++) {
+ state_fio->StateValue(fdc[i].track);
+ state_fio->StateValue(fdc[i].cur_track);
+ state_fio->StateValue(fdc[i].result);
+ state_fio->StateValue(fdc[i].access);
+ state_fio->StateValue(fdc[i].head_load);
+ state_fio->StateValue(fdc[i].cur_position);
+ state_fio->StateValue(fdc[i].next_trans_position);
+ state_fio->StateValue(fdc[i].prev_clock);
+ }
+ for(int i = 0; i < array_length(disk); i++) {
if(!disk[i]->process_state(state_fio, loading)) {
return false;
}
}
- state_fio->StateUint8(hdu);
- state_fio->StateUint8(hdue);
- state_fio->StateBuffer(id, sizeof(id), 1);
- state_fio->StateUint8(eot);
- state_fio->StateUint8(gpl);
- state_fio->StateUint8(dtl);
- state_fio->StateInt32(phase);
- state_fio->StateInt32(prevphase);
- state_fio->StateUint8(status);
- state_fio->StateUint8(seekstat);
- state_fio->StateUint8(command);
- state_fio->StateUint32(result);
- state_fio->StateInt32(step_rate_time);
- state_fio->StateInt32(head_unload_time);
- state_fio->StateBool(no_dma_mode);
- state_fio->StateBool(motor_on);
+ state_fio->StateValue(hdu);
+ state_fio->StateValue(hdue);
+ state_fio->StateArray(id, sizeof(id), 1);
+ state_fio->StateValue(eot);
+ state_fio->StateValue(gpl);
+ state_fio->StateValue(dtl);
+ state_fio->StateValue(phase);
+ state_fio->StateValue(prevphase);
+ state_fio->StateValue(status);
+ state_fio->StateValue(seekstat);
+ state_fio->StateValue(command);
+ state_fio->StateValue(result);
+ state_fio->StateValue(step_rate_time);
+ state_fio->StateValue(head_unload_time);
+ state_fio->StateValue(no_dma_mode);
+ state_fio->StateValue(motor_on);
if(_upd765a_dma_mode) {
- state_fio->StateBool(dma_data_lost);
+ state_fio->StateValue(dma_data_lost);
}
- state_fio->StateBool(irq_masked);
- state_fio->StateBool(drq_masked);
+ state_fio->StateValue(irq_masked);
+ state_fio->StateValue(drq_masked);
if(loading) {
bufptr = buffer + state_fio->FgetInt32_LE();
} else {
state_fio->FputInt32_LE((int)(bufptr - buffer));
}
- state_fio->StateBuffer(buffer, sizeof(buffer), 1);
- state_fio->StateInt32(count);
- state_fio->StateInt32(event_phase);
- state_fio->StateInt32(phase_id);
- state_fio->StateInt32(drq_id);
- state_fio->StateInt32(lost_id);
- state_fio->StateInt32(result7_id);
- //state_fio->StateBuffer(seek_step_id, sizeof(seek_step_id), 1);
- //state_fio->StateBuffer(seek_end_id, sizeof(seek_end_id), 1);
- //state_fio->StateBuffer(head_unload_id, sizeof(head_unload_id), 1);
- for(int i = 0; i < (sizeof(seek_step_id) / sizeof(int)); i++) {
- state_fio->StateInt32(seek_step_id[i]);
- }
- for(int i = 0; i < (sizeof(seek_end_id) / sizeof(int)); i++) {
- state_fio->StateInt32(seek_end_id[i]);
- }
- for(int i = 0; i < (sizeof(head_unload_id) / sizeof(int)); i++) {
- state_fio->StateInt32(head_unload_id[i]);
- }
- state_fio->StateBool(force_ready);
- state_fio->StateBool(reset_signal);
- state_fio->StateBool(prev_index);
- state_fio->StateUint32(prev_drq_clock);
+ state_fio->StateArray(buffer, sizeof(buffer), 1);
+ state_fio->StateValue(count);
+ state_fio->StateValue(event_phase);
+ state_fio->StateValue(phase_id);
+ state_fio->StateValue(drq_id);
+ state_fio->StateValue(lost_id);
+ state_fio->StateValue(result7_id);
+ state_fio->StateArray(seek_step_id, sizeof(seek_step_id), 1);
+ state_fio->StateArray(seek_end_id, sizeof(seek_end_id), 1);
+ state_fio->StateArray(head_unload_id, sizeof(head_unload_id), 1);
+ state_fio->StateValue(force_ready);
+ state_fio->StateValue(reset_signal);
+ state_fio->StateValue(prev_index);
+ state_fio->StateValue(prev_drq_clock);
return true;
}
voicebuf = NULL;
}
}
- state_fio->StateBool(mute);
- state_fio->StateInt32(ThreadLoopStop);
- state_fio->StateUint8(io_E0H);
- state_fio->StateUint8(io_E2H);
- state_fio->StateUint8(io_E3H);
- state_fio->StateInt32(VStat);
- state_fio->StateBuffer(ParaBuf, sizeof(ParaBuf), 1);
- state_fio->StateUint8(Pnum);
- state_fio->StateInt32(Fnum);
- state_fio->StateInt32(PReady);
+ state_fio->StateValue(mute);
+ state_fio->StateValue(ThreadLoopStop);
+ state_fio->StateValue(io_E0H);
+ state_fio->StateValue(io_E2H);
+ state_fio->StateValue(io_E3H);
+ state_fio->StateValue(VStat);
+ state_fio->StateArray(ParaBuf, sizeof(ParaBuf), 1);
+ state_fio->StateValue(Pnum);
+ state_fio->StateValue(Fnum);
+ state_fio->StateValue(PReady);
if(loading) {
FbufLength = state_fio->FgetInt32_LE();
if(FbufLength > 0) {
state_fio->Fwrite(Fbuf, FbufLength, 1);
}
}
- state_fio->StateInt32(fin);
- state_fio->StateInt32(fout);
- //state_fio->StateBuffer(&Coef, sizeof(D7752Coef), 1);
- {
- // D7752_FIXED == int
- for(int i = 0; i < 5; i++) {
- state_fio->StateInt32(Coef.f[i]);
- }
- for(int i = 0; i < 5; i++) {
- state_fio->StateInt32(Coef.b[i]);
- }
- state_fio->StateInt32(Coef.amp);
- state_fio->StateInt32(Coef.pitch);
- }
- //state_fio->StateBuffer(Y, sizeof(Y), 1);
- for(int i = 0; i < 5; i++) {
- for(int j = 0; j < 2; j++) {
- state_fio->StateInt32(Y[i][j]);
- }
- }
- state_fio->StateInt32(PitchCount);
- state_fio->StateInt32(FrameSize);
+ state_fio->StateValue(fin);
+ state_fio->StateValue(fout);
+ state_fio->StateArray(Coef.f, sizeof(Coef.f), 1);
+ state_fio->StateArray(Coef.b, sizeof(Coef.b), 1);
+ state_fio->StateValue(Coef.amp);
+ state_fio->StateValue(Coef.pitch);
+ state_fio->StateArray(&Y[0][0], sizeof(Y), 1);
+ state_fio->StateValue(PitchCount);
+ state_fio->StateValue(FrameSize);
return true;
}