#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;
}