X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=source%2Fsrc%2Fvm%2Fi286.cpp;h=d975e0071966e2d46756e4595febef0aea014f04;hb=6814d044c4e9c4965ee6bc6bc5ac9cafda3e7cf1;hp=82ad6bfbf69078df51d09c06fff89633e0b5a2de;hpb=12d508e1fd99d1299f4bf292c417475f0894dc16;p=csp-qt%2Fcommon_source_project-fm7.git diff --git a/source/src/vm/i286.cpp b/source/src/vm/i286.cpp index 82ad6bfbf..d975e0071 100644 --- a/source/src/vm/i286.cpp +++ b/source/src/vm/i286.cpp @@ -458,8 +458,10 @@ typedef struct i286_dtr_2_t{ UINT8 rights; }; +#if 0 #include "../statesub.h" + void I286::decl_state_cpustate() { #if defined(HAS_I286) @@ -584,6 +586,7 @@ void I286::decl_state_cpustate() # endif #endif } +#endif void I286::save_state_cpustate(FILEIO* state_fio) { @@ -832,63 +835,35 @@ void I286::load_state_cpustate(FILEIO* state_fio) #define STATE_VERSION 4 -void I286::decl_state() -{ - enter_decl_state(STATE_VERSION); - - decl_state_cpustate(); - - leave_decl_state(); -} - -void I286::save_state(FILEIO* state_fio) -{ - if(state_entry != NULL) { - state_entry->save_state(state_fio); - } - -// state_fio->FputUint32(STATE_VERSION); -// state_fio->FputInt32(this_device_id); - - //state_fio->Fwrite(opaque, sizeof(cpu_state), 1); - //save_state_cpustate(state_fio); -} - -bool I286::load_state(FILEIO* state_fio) -{ - bool mb = false; - if(state_entry != NULL) { - mb = state_entry->load_state(state_fio); - } - if(!mb) return false; - -// if(state_fio->FgetUint32() != STATE_VERSION) { -// return false; -// } -// if(state_fio->FgetInt32() != this_device_id) { -// return false; -// } -// //state_fio->Fread(opaque, sizeof(cpu_state), 1); -// load_state_cpustate(state_fio); - - // post process - cpu_state *cpustate = (cpu_state *)opaque; - cpustate->pic = d_pic; - cpustate->program = d_mem; - cpustate->io = d_io; +bool I286::process_state(FILEIO* state_fio, bool loading) +{ + 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); + + // 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; + cpustate->bios = d_bios; #endif #ifdef SINGLE_MODE_DMA - cpustate->dma = d_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_icount = cpustate->total_icount; + cpustate->emu = emu; + cpustate->debugger = d_debugger; + cpustate->program_stored = d_mem; + cpustate->io_stored = d_io; + cpustate->prev_total_icount = cpustate->total_icount; #endif - return true; + } + return true; } -