OSDN Git Service

[VM][DEVICE] Enable to build with new state framework.
authorK.Ohta <whatisthis.sowhat@gmail.com>
Thu, 25 Oct 2018 07:52:38 +0000 (16:52 +0900)
committerK.Ohta <whatisthis.sowhat@gmail.com>
Thu, 25 Oct 2018 07:52:38 +0000 (16:52 +0900)
24 files changed:
source/src/qt/emuutils/CMakeLists.txt
source/src/vm/fmgen/fmgen.cpp
source/src/vm/fmgen/fmtimer.cpp
source/src/vm/fmgen/opm.cpp
source/src/vm/fmgen/opna.cpp
source/src/vm/fmgen/psg.cpp
source/src/vm/libcpu_newdev/i386_base.cpp
source/src/vm/libcpu_newdev/i386_base.h
source/src/vm/libcpu_newdev/libcpu_i386/i386_opdef.cpp
source/src/vm/libcpu_newdev/libcpu_i386/i386_opdef.h
source/src/vm/mb8877.cpp
source/src/vm/t3444a.cpp
source/src/vm/upd765a.cpp
source/src/vm/upd7801.cpp
source/src/vm/upd7810.cpp
source/src/vm/v99x8.cpp
source/src/vm/w3100a.cpp
source/src/vm/ym2151.cpp
source/src/vm/ym2203.cpp
source/src/vm/z80_base.cpp
source/src/vm/z80ctc.cpp
source/src/vm/z80dma.cpp
source/src/vm/z80pio.cpp
source/src/vm/z80sio.cpp

index 595823f..6690b14 100644 (file)
@@ -13,7 +13,7 @@ set(s_qt_emuutils_srcs
 
 QT5_WRAP_CPP(s_qt_emuutils_headers_MOC ${s_qt_emuutils_headers})
        
-SET(THIS_LIB_VERSION 2.14.0
+SET(THIS_LIB_VERSION 2.14.1
 
 add_definitions(-D__LIBEMU_UTIL_VERSION=\"libCSPemu_utils.${THIS_LIB_VERSION}\")
 
index b39fe51..0b9422b 100644 (file)
@@ -295,10 +295,10 @@ bool Chip::ProcessState(void *f, bool loading)
        if(!state_fio->StateCheckUint32(CHIP_STATE_VERSION)) {
                return false;
        }
-       state_fio->StateUint32(ratio_);
-       state_fio->StateUint32(aml_);
-       state_fio->StateUint32(pml_);
-       state_fio->StateInt32(pmv_);
+       state_fio->StateValue(ratio_);
+       state_fio->StateValue(aml_);
+       state_fio->StateValue(pml_);
+       state_fio->StateValue(pmv_);
        return true;
 }
 
@@ -743,30 +743,29 @@ bool Operator::ProcessState(void *f, bool loading)
        if(!state_fio->StateCheckUint32(OPERATOR_STATE_VERSION)) {
                return false;
        }
-       
-       state_fio->StateInt32(out_);
-       state_fio->StateInt32(out2_);
-       state_fio->StateInt32(in2_);
-       state_fio->StateUint32(dp_);
-       state_fio->StateUint32(detune_);
-       state_fio->StateUint32(detune2_);
-       state_fio->StateUint32(multiple_);
-       state_fio->StateUint32(pg_count_);
-       state_fio->StateUint32(pg_diff_);
-       state_fio->StateInt32(pg_diff_lfo_);
-       state_fio->StateUint32(bn_);
-       state_fio->StateInt32(eg_level_);
-       state_fio->StateInt32(eg_level_on_next_phase_);
-       state_fio->StateInt32(eg_count_);
-       state_fio->StateInt32(eg_count_diff_);
-       state_fio->StateInt32(eg_out_);
-       state_fio->StateInt32(tl_out_);
-       state_fio->StateInt32(eg_rate_);
-       state_fio->StateInt32(eg_curve_count_);
-       state_fio->StateInt32(ssg_offset_);
-       state_fio->StateInt32(ssg_vector_);
-       state_fio->StateInt32(ssg_phase_);
-       state_fio->StateUint32(key_scale_rate_);
+       state_fio->StateValue(out_);
+       state_fio->StateValue(out2_);
+       state_fio->StateValue(in2_);
+       state_fio->StateValue(dp_);
+       state_fio->StateValue(detune_);
+       state_fio->StateValue(detune2_);
+       state_fio->StateValue(multiple_);
+       state_fio->StateValue(pg_count_);
+       state_fio->StateValue(pg_diff_);
+       state_fio->StateValue(pg_diff_lfo_);
+       state_fio->StateValue(bn_);
+       state_fio->StateValue(eg_level_);
+       state_fio->StateValue(eg_level_on_next_phase_);
+       state_fio->StateValue(eg_count_);
+       state_fio->StateValue(eg_count_diff_);
+       state_fio->StateValue(eg_out_);
+       state_fio->StateValue(tl_out_);
+       state_fio->StateValue(eg_rate_);
+       state_fio->StateValue(eg_curve_count_);
+       state_fio->StateValue(ssg_offset_);
+       state_fio->StateValue(ssg_vector_);
+       state_fio->StateValue(ssg_phase_);
+       state_fio->StateValue(key_scale_rate_);
        if(loading) {
                eg_phase_ = static_cast<EGPhase>(state_fio->FgetInt32_LE());
                ams_ = &amtable[0][0][0] + state_fio->FgetInt32_LE();
@@ -774,22 +773,22 @@ bool Operator::ProcessState(void *f, bool loading)
                state_fio->FputInt32_LE(static_cast<int>(eg_phase_));
                state_fio->FputInt32_LE((int)(ams_ - &amtable[0][0][0]));
        }
-       state_fio->StateUint32(ms_);
-       state_fio->StateUint32(tl_);
-       state_fio->StateUint32(tl_latch_);
-       state_fio->StateUint32(ar_);
-       state_fio->StateUint32(dr_);
-       state_fio->StateUint32(sr_);
-       state_fio->StateUint32(sl_);
-       state_fio->StateUint32(rr_);
-       state_fio->StateUint32(ks_);
-       state_fio->StateUint32(ssg_type_);
-       state_fio->StateBool(keyon_);
-       state_fio->StateBool(amon_);
-       state_fio->StateBool(param_changed_);
-       state_fio->StateBool(mute_);
-       state_fio->StateInt32(dbgopout_);
-       state_fio->StateInt32(dbgpgout_);
+       state_fio->StateValue(ms_);
+       state_fio->StateValue(tl_);
+       state_fio->StateValue(tl_latch_);
+       state_fio->StateValue(ar_);
+       state_fio->StateValue(dr_);
+       state_fio->StateValue(sr_);
+       state_fio->StateValue(sl_);
+       state_fio->StateValue(rr_);
+       state_fio->StateValue(ks_);
+       state_fio->StateValue(ssg_type_);
+       state_fio->StateValue(keyon_);
+       state_fio->StateValue(amon_);
+       state_fio->StateValue(param_changed_);
+       state_fio->StateValue(mute_);
+       state_fio->StateValue(dbgopout_);
+       state_fio->StateValue(dbgpgout_);
        return true;
 }
 
index 2533348..9d4612f 100644 (file)
@@ -122,13 +122,13 @@ bool Timer::ProcessState(void *f, bool loading)
        if(!state_fio->StateCheckUint32(TIMER_STATE_VERSION)) {
                return false;
        }
-       state_fio->StateUint8(status);
-       state_fio->StateUint8(regtc);
-       state_fio->StateBuffer(regta, sizeof(regta), 1);
-       state_fio->StateInt32(timera);
-       state_fio->StateInt32(timera_count);
-       state_fio->StateInt32(timerb);
-       state_fio->StateInt32(timerb_count);
-       state_fio->StateInt32(prescaler);
+       state_fio->StateValue(status);
+       state_fio->StateValue(regtc);
+       state_fio->StateArray(regta, sizeof(regta), 1);
+       state_fio->StateValue(timera);
+       state_fio->StateValue(timera_count);
+       state_fio->StateValue(timerb);
+       state_fio->StateValue(timerb_count);
+       state_fio->StateValue(prescaler);
        return true;
 }
index d4b951a..44baa5f 100644 (file)
@@ -541,32 +541,32 @@ bool OPM::ProcessState(void *f, bool loading)
        if(!Timer::ProcessState(f, loading)) {
                return false;
        }
-       state_fio->StateInt32(fmvolume_l);
-       state_fio->StateInt32(fmvolume_r);
-       state_fio->StateUint32(clock);
-       state_fio->StateUint32(rate);
-       state_fio->StateUint32(pcmrate);
-       state_fio->StateUint32(pmd);
-       state_fio->StateUint32(amd);
-       state_fio->StateUint32(lfocount);
-       state_fio->StateUint32(lfodcount);
-       state_fio->StateUint32(lfo_count_);
-       state_fio->StateUint32(lfo_count_diff_);
-       state_fio->StateUint32(lfo_step_);
-       state_fio->StateUint32(lfo_count_prev_);
-       state_fio->StateUint32(lfowaveform);
-       state_fio->StateUint32(rateratio);
-       state_fio->StateUint32(noise);
-       state_fio->StateInt32(noisecount);
-       state_fio->StateUint32(noisedelta);
-       state_fio->StateBool(interpolation);
-       state_fio->StateUint8(lfofreq);
-       state_fio->StateUint8(status);
-       state_fio->StateBool(interrupt);
-       state_fio->StateUint8(reg01);
-       state_fio->StateBuffer(kc, sizeof(kc), 1);
-       state_fio->StateBuffer(kf, sizeof(kf), 1);
-       state_fio->StateBuffer(pan, sizeof(pan), 1);
+       state_fio->StateValue(fmvolume_l);
+       state_fio->StateValue(fmvolume_r);
+       state_fio->StateValue(clock);
+       state_fio->StateValue(rate);
+       state_fio->StateValue(pcmrate);
+       state_fio->StateValue(pmd);
+       state_fio->StateValue(amd);
+       state_fio->StateValue(lfocount);
+       state_fio->StateValue(lfodcount);
+       state_fio->StateValue(lfo_count_);
+       state_fio->StateValue(lfo_count_diff_);
+       state_fio->StateValue(lfo_step_);
+       state_fio->StateValue(lfo_count_prev_);
+       state_fio->StateValue(lfowaveform);
+       state_fio->StateValue(rateratio);
+       state_fio->StateValue(noise);
+       state_fio->StateValue(noisecount);
+       state_fio->StateValue(noisedelta);
+       state_fio->StateValue(interpolation);
+       state_fio->StateValue(lfofreq);
+       state_fio->StateValue(status);
+       state_fio->StateValue(interrupt);
+       state_fio->StateValue(reg01);
+       state_fio->StateArray(kc, sizeof(kc), 1);
+       state_fio->StateArray(kf, sizeof(kf), 1);
+       state_fio->StateArray(pan, sizeof(pan), 1);
        for(int i = 0; i < 8; i++) {
                if(!ch[i].ProcessState(f, loading)) {
                        return false;
index ce6e534..c753560 100644 (file)
@@ -208,14 +208,14 @@ bool OPNBase::ProcessState(void *f, bool loading)
        if(!Timer::ProcessState(f, loading)) {
                return false;
        }
-       state_fio->StateInt32(fmvolume_l);
-       state_fio->StateInt32(fmvolume_r);
-       state_fio->StateUint32(clock);
-       state_fio->StateUint32(rate);
-       state_fio->StateUint32(psgrate);
-       state_fio->StateUint32(status);
-       state_fio->StateBool(interrupt);
-       state_fio->StateUint8(prescale);
+       state_fio->StateValue(fmvolume_l);
+       state_fio->StateValue(fmvolume_r);
+       state_fio->StateValue(clock);
+       state_fio->StateValue(rate);
+       state_fio->StateValue(psgrate);
+       state_fio->StateValue(status);
+       state_fio->StateValue(interrupt);
+       state_fio->StateValue(prescale);
        if(loading){
                // Make force-restore around prescaler and timers. 20180625 K.O
                uint bak = prescale;
@@ -450,17 +450,9 @@ bool OPN::ProcessState(void *f, bool loading)
        if(!OPNBase::ProcessState(f, loading)) {
                return false;
        }
-       
-       if(!state_fio->StateCheckUint32(OPN_STATE_VERSION)) {
-               return false;
-       }
-       if(!OPNBase::ProcessState(f, loading)) {
-               return false;
-       }
-
-       state_fio->StateBuffer(fnum, sizeof(fnum), 1);
-       state_fio->StateBuffer(fnum3, sizeof(fnum3), 1);
-       state_fio->StateBuffer(fnum2, sizeof(fnum2), 1);
+       state_fio->StateArray(fnum, sizeof(fnum), 1);
+       state_fio->StateArray(fnum3, sizeof(fnum3), 1);
+       state_fio->StateArray(fnum2, sizeof(fnum2), 1);
        for(int i = 0; i < 3; i++) {
                if(!ch[i].ProcessState(f, loading)) {
                        return false;
@@ -1303,48 +1295,48 @@ bool OPNABase::ProcessState(void *f, bool loading)
        if(!OPNBase::ProcessState(f, loading)) {
                return false;
        }
-       state_fio->StateBuffer(pan, sizeof(pan), 1);
-       state_fio->StateBuffer(fnum2, sizeof(fnum2), 1);
-       state_fio->StateUint8(reg22);
-       state_fio->StateUint32(reg29);
-       state_fio->StateUint32(stmask);
-       state_fio->StateUint32(statusnext);
-       state_fio->StateUint32(lfocount);
-       state_fio->StateUint32(lfodcount);
-       state_fio->StateBuffer(fnum, sizeof(fnum), 1);
-       state_fio->StateBuffer(fnum3, sizeof(fnum3), 1);
-       state_fio->StateBuffer(adpcmbuf, 0x40000, 1);
-       state_fio->StateUint32(adpcmmask);
-       state_fio->StateUint32(adpcmnotice);
-       state_fio->StateUint32(startaddr);
-       state_fio->StateUint32(stopaddr);
-       state_fio->StateUint32(memaddr);
-       state_fio->StateUint32(limitaddr);
-       state_fio->StateInt32(adpcmlevel);
-       state_fio->StateInt32(adpcmvolume_l);
-       state_fio->StateInt32(adpcmvolume_r);
-       state_fio->StateInt32(adpcmvol_l);
-       state_fio->StateInt32(adpcmvol_r);
-       state_fio->StateUint32(deltan);
-       state_fio->StateInt32(adplc);
-       state_fio->StateInt32(adpld);
-       state_fio->StateUint32(adplbase);
-       state_fio->StateInt32(adpcmx);
-       state_fio->StateInt32(adpcmd);
-       state_fio->StateInt32(adpcmout_l);
-       state_fio->StateInt32(adpcmout_r);
-       state_fio->StateInt32(apout0_l);
-       state_fio->StateInt32(apout0_r);
-       state_fio->StateInt32(apout1_l);
-       state_fio->StateInt32(apout1_r);
-       state_fio->StateUint32(adpcmreadbuf);
-       state_fio->StateBool(adpcmplay);
-       state_fio->StateInt8(granuality);
-       state_fio->StateBool(adpcmmask_);
-       state_fio->StateUint8(control1);
-       state_fio->StateUint8(control2);
-       state_fio->StateBuffer(adpcmreg, sizeof(adpcmreg), 1);
-       state_fio->StateInt32(rhythmmask_);
+       state_fio->StateArray(pan, sizeof(pan), 1);
+       state_fio->StateArray(fnum2, sizeof(fnum2), 1);
+       state_fio->StateValue(reg22);
+       state_fio->StateValue(reg29);
+       state_fio->StateValue(stmask);
+       state_fio->StateValue(statusnext);
+       state_fio->StateValue(lfocount);
+       state_fio->StateValue(lfodcount);
+       state_fio->StateArray(fnum, sizeof(fnum), 1);
+       state_fio->StateArray(fnum3, sizeof(fnum3), 1);
+       state_fio->StateArray(adpcmbuf, 0x40000, 1);
+       state_fio->StateValue(adpcmmask);
+       state_fio->StateValue(adpcmnotice);
+       state_fio->StateValue(startaddr);
+       state_fio->StateValue(stopaddr);
+       state_fio->StateValue(memaddr);
+       state_fio->StateValue(limitaddr);
+       state_fio->StateValue(adpcmlevel);
+       state_fio->StateValue(adpcmvolume_l);
+       state_fio->StateValue(adpcmvolume_r);
+       state_fio->StateValue(adpcmvol_l);
+       state_fio->StateValue(adpcmvol_r);
+       state_fio->StateValue(deltan);
+       state_fio->StateValue(adplc);
+       state_fio->StateValue(adpld);
+       state_fio->StateValue(adplbase);
+       state_fio->StateValue(adpcmx);
+       state_fio->StateValue(adpcmd);
+       state_fio->StateValue(adpcmout_l);
+       state_fio->StateValue(adpcmout_r);
+       state_fio->StateValue(apout0_l);
+       state_fio->StateValue(apout0_r);
+       state_fio->StateValue(apout1_l);
+       state_fio->StateValue(apout1_r);
+       state_fio->StateValue(adpcmreadbuf);
+       state_fio->StateValue(adpcmplay);
+       state_fio->StateValue(granuality);
+       state_fio->StateValue(adpcmmask_);
+       state_fio->StateValue(control1);
+       state_fio->StateValue(control2);
+       state_fio->StateArray(adpcmreg, sizeof(adpcmreg), 1);
+       state_fio->StateValue(rhythmmask_);
        for(int i = 0; i < 6; i++) {
                if(!ch[i].ProcessState(f, loading)) {
                        return false;
@@ -1741,14 +1733,14 @@ bool OPNA::ProcessState(void *f, bool loading)
                return false;
        }
        for(int i = 0; i < 6; i++) {
-               state_fio->StateUint8(rhythm[i].pan);
-               state_fio->StateInt8(rhythm[i].level);
-               state_fio->StateUint32(rhythm[i].pos);
+               state_fio->StateValue(rhythm[i].pan);
+               state_fio->StateValue(rhythm[i].level);
+               state_fio->StateValue(rhythm[i].pos);
        }
-       state_fio->StateInt8(rhythmtl);
-       state_fio->StateInt32(rhythmtvol_l);
-       state_fio->StateInt32(rhythmtvol_r);
-       state_fio->StateUint8(rhythmkey);
+       state_fio->StateValue(rhythmtl);
+       state_fio->StateValue(rhythmtvol_l);
+       state_fio->StateValue(rhythmtvol_r);
+       state_fio->StateValue(rhythmkey);
        return true;
 }
  
@@ -2546,16 +2538,16 @@ bool OPN2Base::ProcessState(void *f, bool loading)
        if(!OPNBase::ProcessState(f, loading)) {
                return false;
        }
-       state_fio->StateBuffer(pan, sizeof(pan), 1);
-       state_fio->StateBuffer(fnum2, sizeof(fnum2), 1);
-       state_fio->StateUint8(reg22);
-       state_fio->StateUint32(reg29);
-       state_fio->StateUint32(stmask);
-       state_fio->StateUint32(statusnext);
-       state_fio->StateUint32(lfocount);
-       state_fio->StateUint32(lfodcount);
-       state_fio->StateBuffer(fnum, sizeof(fnum), 1);
-       state_fio->StateBuffer(fnum3, sizeof(fnum3), 1);
+       state_fio->StateArray(pan, sizeof(pan), 1);
+       state_fio->StateArray(fnum2, sizeof(fnum2), 1);
+       state_fio->StateValue(reg22);
+       state_fio->StateValue(reg29);
+       state_fio->StateValue(stmask);
+       state_fio->StateValue(statusnext);
+       state_fio->StateValue(lfocount);
+       state_fio->StateValue(lfodcount);
+       state_fio->StateArray(fnum, sizeof(fnum), 1);
+       state_fio->StateArray(fnum3, sizeof(fnum3), 1);
        
        if(loading) {
                // Make force-restore around prescaler and timers. 20180625 K.O
index a2c3d77..bfc79e5 100644 (file)
@@ -443,24 +443,24 @@ bool PSG::ProcessState(void *f, bool loading)
        if(!state_fio->StateCheckUint32(PSG_STATE_VERSION)) {
                return false;
        }
-       state_fio->StateBuffer(reg, sizeof(reg), 1);
+       state_fio->StateArray(reg, sizeof(reg), 1);
        if(loading) {
                int offset = state_fio->FgetInt32_LE();
                envelop_l = &enveloptable_l[0][0] + offset;
        } else {
                state_fio->FputInt32_LE((int)(envelop_l - &enveloptable_l[0][0]));
        }
-       state_fio->StateBuffer(olevel_l, sizeof(olevel_l), 1);
-       state_fio->StateBuffer(olevel_r, sizeof(olevel_r), 1);
-       state_fio->StateBuffer(scount, sizeof(scount), 1);
-       state_fio->StateBuffer(speriod, sizeof(speriod), 1);
-       state_fio->StateUint32(ecount);
-       state_fio->StateUint32(eperiod);
-       state_fio->StateUint32(ncount);
-       state_fio->StateUint32(nperiod);
-       state_fio->StateUint32(tperiodbase);
-       state_fio->StateUint32(eperiodbase);
-       state_fio->StateUint32(nperiodbase);
-       state_fio->StateInt32(mask);
+       state_fio->StateArray(olevel_l, sizeof(olevel_l), 1);
+       state_fio->StateArray(olevel_r, sizeof(olevel_r), 1);
+       state_fio->StateArray(scount, sizeof(scount), 1);
+       state_fio->StateArray(speriod, sizeof(speriod), 1);
+       state_fio->StateValue(ecount);
+       state_fio->StateValue(eperiod);
+       state_fio->StateValue(ncount);
+       state_fio->StateValue(nperiod);
+       state_fio->StateValue(tperiodbase);
+       state_fio->StateValue(eperiodbase);
+       state_fio->StateValue(nperiodbase);
+       state_fio->StateValue(mask);
        return true;
 }
index decd0de..8ae81a5 100644 (file)
@@ -122,187 +122,15 @@ void I386_BASE::set_context_intr(DEVICE* device)
 
 #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;
        }
-       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->prev_total_cycles = cpustate->total_cycles;
-       }
-       return true;
+       if(cpucore == NULL) return false;
+       return cpucore->process_state(state_fio, loading);
 }
 
index 8975fed..f3db257 100644 (file)
@@ -34,14 +34,6 @@ 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)
        {
index 596ab9b..52d6405 100644 (file)
@@ -2953,6 +2953,78 @@ void *I386_OPS_BASE::cpu_init_i386(void)
        return cpustate;
 }
 
+
+void I386_OPS_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_OPS_BASE::process_state_SYS_TABLE(I386_SYS_TABLE* val, FILEIO* state_fio)
+{
+       state_fio->StateValue(val->base);
+       state_fio->StateValue(val->limit);
+}
+
+void I386_OPS_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_OPS_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_OPS_BASE::process_state_floatx80(floatx80* val, FILEIO* state_fio)
+{
+       state_fio->StateValue(val->high);
+       state_fio->StateValue(val->low);
+}
+
+void I386_OPS_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_OPS_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_OPS_BASE::process_state(FILEIO *state_fio, bool loading)
 {
        // ToDo: Write endian
@@ -2966,41 +3038,106 @@ bool I386_OPS_BASE::process_state(FILEIO *state_fio, bool loading)
        int table_size = 0;
 //     vtlb_entry *save = NULL;
 //     int save_size = 0;
-       if(vtlb != NULL) {
-               cpudevice = vtlb->cpudevice;
-               live = vtlb->live;
-               live_size = vtlb->live_size;
-               fixedpages = vtlb->fixedpages;
-               fixedpages_size = vtlb->fixedpages_size;
-               table = vtlb->table;
-               table_size = vtlb->table_size;
-//             save = vtlb->save;
-//             save_size = vtlb->save_size;
-       }
-       state_fio->StateBuffer(cpustate, sizeof(i386_state), 1);
-       if(vtlb != NULL) {
-               state_fio->StateBuffer(vtlb, sizeof(vtlb_state), 1);
-       }
-       if(live != NULL && live_size > 0) {
-               state_fio->StateBuffer(live, live_size, 1);
-       }
-       if(fixedpages != NULL && fixedpages_size > 0) {
-               state_fio->StateBuffer(fixedpages, fixedpages_size, 1);
-       }
-       if(table != NULL && table_size > 0) {
-               state_fio->StateBuffer(table, table_size, 1);
-       }
-       // post process
-       if(loading) {
-               cpustate->vtlb = vtlb;
-               if(vtlb != NULL) {
-                       vtlb->cpudevice = cpudevice;
-                       vtlb->live = live;
-                       vtlb->fixedpages = fixedpages;
-                       vtlb->table = table;
-//                     vtlb->save = save;
-               }
+
+       
+       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
+
        return true;
 }
 
index 41ccf93..b3e63be 100644 (file)
@@ -553,6 +553,15 @@ protected:
        
        UINT32 i386_escape_ea;   // hack around GCC 4.6 error because we need the side effects of GetEA()
 
+
+       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_OPS_BASE(int cputypes = I386_OPS_CPUTYPE_I386)
        {
index 70eb29b..ea561dc 100644 (file)
@@ -2024,6 +2024,7 @@ bool MB8877::process_state(FILEIO* state_fio, bool loading)
                state_fio->StateValue(fdc[i].prev_clock);
        }
        for(int i = 0; i < array_length(disk); i++) {
+               if(disk[i] == NULL) continue;
                if(!disk[i]->process_state(state_fio, loading)) {
                        return false;
                }
index 2814443..13d85e9 100644 (file)
@@ -822,6 +822,7 @@ bool T3444A::process_state(FILEIO* state_fio, bool loading)
                state_fio->StateValue(fdc[i].prev_clock);
        }
        for(int i = 0; i < array_length(disk); i++) {
+               if(disk[i] == NULL) continue;
                if(!disk[i]->process_state(state_fio, loading)) {
                        return false;
                }
index 5d840bb..1a6297c 100644 (file)
@@ -1840,6 +1840,7 @@ bool UPD765A::process_state(FILEIO* state_fio, bool loading)
                state_fio->StateValue(fdc[i].prev_clock);
        }
        for(int i = 0; i < array_length(disk); i++) {
+               if(disk[i] == NULL) continue;
                if(!disk[i]->process_state(state_fio, loading)) {
                        return false;
                }
index e37b0cc..3f523b3 100644 (file)
@@ -3921,38 +3921,35 @@ bool UPD7801::process_state(FILEIO* state_fio, bool loading)
                return false;
        }
        if(__USE_DEBUGGER) {
-               state_fio->StateUint64(total_count);
+               state_fio->StateValue(total_count);
        }
-       state_fio->StateInt32(count);
-       state_fio->StateInt32(period);
-       state_fio->StateInt32(scount);
-       state_fio->StateInt32(tcount);
-       state_fio->StateBool(wait);
-       //state_fio->StateBuffer(regs, sizeof(regs), 1);
-       for(int i = 0; i < (sizeof(regs) / sizeof(uint32_t)); i++) {
-               state_fio->StateUint32(regs[i].d);
-       }
-       state_fio->StateUint16(SP);
-       state_fio->StateUint16(PC);
-       state_fio->StateUint16(prevPC);
-       state_fio->StateUint8(PSW);
-       state_fio->StateUint8(IRR);
-       state_fio->StateUint8(IFF);
-       state_fio->StateUint8(SIRQ);
-       state_fio->StateUint8(HALT);
-       state_fio->StateUint8(MK);
-       state_fio->StateUint8(MB);
-       state_fio->StateUint8(MC);
-       state_fio->StateUint8(TM0);
-       state_fio->StateUint8(TM1);
-       state_fio->StateUint8(SR);
-       state_fio->StateUint8(SAK);
-       state_fio->StateUint8(TO);
-       state_fio->StateUint8(HLDA);
-       state_fio->StateUint8(PORTC);
-       state_fio->StateBool(SI);
-       state_fio->StateBool(SCK);
-       state_fio->StateInt32(sio_count);
+       state_fio->StateValue(count);
+       state_fio->StateValue(period);
+       state_fio->StateValue(scount);
+       state_fio->StateValue(tcount);
+       state_fio->StateValue(wait);
+       state_fio->StateArray(regs, sizeof(regs), 1);
+       state_fio->StateValue(SP);
+       state_fio->StateValue(PC);
+       state_fio->StateValue(prevPC);
+       state_fio->StateValue(PSW);
+       state_fio->StateValue(IRR);
+       state_fio->StateValue(IFF);
+       state_fio->StateValue(SIRQ);
+       state_fio->StateValue(HALT);
+       state_fio->StateValue(MK);
+       state_fio->StateValue(MB);
+       state_fio->StateValue(MC);
+       state_fio->StateValue(TM0);
+       state_fio->StateValue(TM1);
+       state_fio->StateValue(SR);
+       state_fio->StateValue(SAK);
+       state_fio->StateValue(TO);
+       state_fio->StateValue(HLDA);
+       state_fio->StateValue(PORTC);
+       state_fio->StateValue(SI);
+       state_fio->StateValue(SCK);
+       state_fio->StateValue(sio_count);
        
        // post process
        if(__USE_DEBUGGER) {
index 0f7a940..9101d05 100644 (file)
@@ -365,144 +365,108 @@ int UPD7810::debug_dasm(uint32_t pc, _TCHAR *buffer, size_t buffer_len)
 }
 #endif
 
-#define STATE_VERSION  4
-
-void UPD7810::process_state_cpustate(FILEIO* state_fio, bool loading)
-{
-       upd7810_state *cpustate = (upd7810_state *)opaque;
-
-       state_fio->StateUint32(cpustate->ppc.d);    /* previous program counter */
-       state_fio->StateUint32(cpustate->pc.d);     /* program counter */
-       state_fio->StateUint32(cpustate->sp.d);     /* stack pointer */
-       state_fio->StateUint8(cpustate->op);     /* opcode */
-       state_fio->StateUint8(cpustate->op2);    /* opcode part 2 */
-       state_fio->StateUint8(cpustate->iff);    /* interrupt enable flip flop */
-       state_fio->StateUint8(cpustate->softi);
-       state_fio->StateUint8(cpustate->psw);    /* processor status word */
-       state_fio->StateUint32(cpustate->ea.d);     /* extended accumulator */
-       state_fio->StateUint32(cpustate->va.d);     /* accumulator + vector register */
-       state_fio->StateUint32(cpustate->bc.d);     /* 8bit B and C registers / 16bit BC register */
-       state_fio->StateUint32(cpustate->de.d);     /* 8bit D and E registers / 16bit DE register */
-       state_fio->StateUint32(cpustate->hl.d);     /* 8bit H and L registers / 16bit HL register */
-       state_fio->StateUint32(cpustate->ea2.d);    /* alternate register set */
-       state_fio->StateUint32(cpustate->va2.d);
-       state_fio->StateUint32(cpustate->bc2.d);
-       state_fio->StateUint32(cpustate->de2.d);
-       state_fio->StateUint32(cpustate->hl2.d);
-       state_fio->StateUint32(cpustate->cnt.d);    /* 8 bit timer counter */
-       state_fio->StateUint32(cpustate->tm.d);     /* 8 bit timer 0/1 comparator inputs */
-       state_fio->StateUint32(cpustate->ecnt.d);   /* timer counter register / capture register */
-       state_fio->StateUint32(cpustate->etm.d);    /* timer 0/1 comparator inputs */
-       state_fio->StateUint8(cpustate->ma);     /* port A input or output mask */
-       state_fio->StateUint8(cpustate->mb);     /* port B input or output mask */
-       state_fio->StateUint8(cpustate->mcc);    /* port C control/port select */
-       state_fio->StateUint8(cpustate->mc);     /* port C input or output mask */
-       state_fio->StateUint8(cpustate->mm);     /* memory mapping */
-       state_fio->StateUint8(cpustate->mf);     /* port F input or output mask */
-       state_fio->StateUint8(cpustate->tmm);    /* timer 0 and timer 1 operating parameters */
-       state_fio->StateUint8(cpustate->etmm);   /* 16-bit multifunction timer/event counter */
-       state_fio->StateUint8(cpustate->eom);    /* 16-bit timer/event counter output control */
-       state_fio->StateUint8(cpustate->sml);    /* serial interface parameters low */
-       state_fio->StateUint8(cpustate->smh);    /* -"- high */
-       state_fio->StateUint8(cpustate->anm);    /* analog to digital converter operating parameters */
-       state_fio->StateUint8(cpustate->mkl);    /* interrupt mask low */
-       state_fio->StateUint8(cpustate->mkh);    /* -"- high */
-       state_fio->StateUint8(cpustate->zcm);    /* bias circuitry for ac zero-cross detection */
-       state_fio->StateUint8(cpustate->pa_in);  /* port A,B,C,D,F inputs */
-       state_fio->StateUint8(cpustate->pb_in);
-       state_fio->StateUint8(cpustate->pc_in);
-       state_fio->StateUint8(cpustate->pd_in);
-       state_fio->StateUint8(cpustate->pf_in);
-       state_fio->StateUint8(cpustate->pa_out); /* port A,B,C,D,F outputs */
-       state_fio->StateUint8(cpustate->pb_out);
-       state_fio->StateUint8(cpustate->pc_out);
-       state_fio->StateUint8(cpustate->pd_out);
-       state_fio->StateUint8(cpustate->pf_out);
-       state_fio->StateUint8(cpustate->cr0);    /* analog digital conversion register 0 */
-       state_fio->StateUint8(cpustate->cr1);    /* analog digital conversion register 1 */
-       state_fio->StateUint8(cpustate->cr2);    /* analog digital conversion register 2 */
-       state_fio->StateUint8(cpustate->cr3);    /* analog digital conversion register 3 */
-       state_fio->StateUint8(cpustate->txb);    /* transmitter buffer */
-       state_fio->StateUint8(cpustate->rxb);    /* receiver buffer */
-       state_fio->StateUint8(cpustate->txd);    /* port C control line states */
-       state_fio->StateUint8(cpustate->rxd);
-       state_fio->StateUint8(cpustate->sck);
-       state_fio->StateUint8(cpustate->ti);
-       state_fio->StateUint8(cpustate->to);
-       state_fio->StateUint8(cpustate->ci);
-       state_fio->StateUint8(cpustate->co0);
-       state_fio->StateUint8(cpustate->co1);
-       state_fio->StateUint16(cpustate->irr);    /* interrupt request register */
-       state_fio->StateUint16(cpustate->itf);    /* interrupt test flag register */
-       state_fio->StateInt32(cpustate->int1);   /* keep track of current int1 state. Needed for 7801 irq checking. */
-       state_fio->StateInt32(cpustate->int2);   /* keep track to current int2 state. Needed for 7801 irq checking. */
-
-/* internal helper variables */
-       state_fio->StateUint16(cpustate->txs);    /* transmitter shift register */
-       state_fio->StateUint16(cpustate->rxs);    /* receiver shift register */
-       state_fio->StateUint8(cpustate->txcnt);  /* transmitter shift register bit count */
-       state_fio->StateUint8(cpustate->rxcnt);  /* receiver shift register bit count */
-       state_fio->StateUint8(cpustate->txbuf);  /* transmitter buffer was written */
-       state_fio->StateInt32(cpustate->ovc0);   /* overflow counter for timer 0 ((for clock div 12/384) */
-       state_fio->StateInt32(cpustate->ovc1);   /* overflow counter for timer 0 (for clock div 12/384) */
-       state_fio->StateInt32(cpustate->ovce);   /* overflow counter for ecnt */
-       state_fio->StateInt32(cpustate->ovcf);   /* overflow counter for fixed clock div 3 mode */
-       state_fio->StateInt32(cpustate->ovcs);   /* overflow counter for serial I/O */
-       state_fio->StateInt32(cpustate->ovcsio);
-       state_fio->StateUint8(cpustate->edges);  /* rising/falling edge flag for serial I/O */
-       state_fio->StateInt32(cpustate->icount);
-
-}
+#define STATE_VERSION  5
 
 bool UPD7810::process_state(FILEIO* state_fio, bool loading)
 {
        upd7810_state *cpustate = (upd7810_state *)opaque;
-       const struct opcode_s *opXX = cpustate->opXX;
-       const struct opcode_s *op48 = cpustate->op48;
-       const struct opcode_s *op4C = cpustate->op4C;
-       const struct opcode_s *op4D = cpustate->op4D;
-       const struct opcode_s *op60 = cpustate->op60;
-       const struct opcode_s *op64 = cpustate->op64;
-       const struct opcode_s *op70 = cpustate->op70;
-       const struct opcode_s *op74 = cpustate->op74;
-       void(*handle_timers)(upd7810_state *cpustate, int cycles) = cpustate->handle_timers;
        if(!state_fio->StateCheckUint32(STATE_VERSION)) {
                return false;
        }
        if(!state_fio->StateCheckInt32(this_device_id)) {
                return false;
        }
-       //state_fio->StateBuffer(opaque, sizeof(upd7810_state), 1);
-       process_state_cpustate(state_fio, loading);
+       state_fio->StateValue(cpustate->ppc);
+       state_fio->StateValue(cpustate->pc);
+       state_fio->StateValue(cpustate->sp);
+       state_fio->StateValue(cpustate->op);
+       state_fio->StateValue(cpustate->op2);
+       state_fio->StateValue(cpustate->iff);
+       state_fio->StateValue(cpustate->softi);
+       state_fio->StateValue(cpustate->psw);
+       state_fio->StateValue(cpustate->ea);
+       state_fio->StateValue(cpustate->va);
+       state_fio->StateValue(cpustate->bc);
+       state_fio->StateValue(cpustate->de);
+       state_fio->StateValue(cpustate->hl);
+       state_fio->StateValue(cpustate->ea2);
+       state_fio->StateValue(cpustate->va2);
+       state_fio->StateValue(cpustate->bc2);
+       state_fio->StateValue(cpustate->de2);
+       state_fio->StateValue(cpustate->hl2);
+       state_fio->StateValue(cpustate->cnt);
+       state_fio->StateValue(cpustate->tm);
+       state_fio->StateValue(cpustate->ecnt);
+       state_fio->StateValue(cpustate->etm);
+       state_fio->StateValue(cpustate->ma);
+       state_fio->StateValue(cpustate->mb);
+       state_fio->StateValue(cpustate->mcc);
+       state_fio->StateValue(cpustate->mc);
+       state_fio->StateValue(cpustate->mm);
+       state_fio->StateValue(cpustate->mf);
+       state_fio->StateValue(cpustate->tmm);
+       state_fio->StateValue(cpustate->etmm);
+       state_fio->StateValue(cpustate->eom);
+       state_fio->StateValue(cpustate->sml);
+       state_fio->StateValue(cpustate->smh);
+       state_fio->StateValue(cpustate->anm);
+       state_fio->StateValue(cpustate->mkl);
+       state_fio->StateValue(cpustate->mkh);
+       state_fio->StateValue(cpustate->zcm);
+       state_fio->StateValue(cpustate->pa_in);
+       state_fio->StateValue(cpustate->pb_in);
+       state_fio->StateValue(cpustate->pc_in);
+       state_fio->StateValue(cpustate->pd_in);
+       state_fio->StateValue(cpustate->pf_in);
+       state_fio->StateValue(cpustate->pa_out);
+       state_fio->StateValue(cpustate->pb_out);
+       state_fio->StateValue(cpustate->pc_out);
+       state_fio->StateValue(cpustate->pd_out);
+       state_fio->StateValue(cpustate->pf_out);
+       state_fio->StateValue(cpustate->cr0);
+       state_fio->StateValue(cpustate->cr1);
+       state_fio->StateValue(cpustate->cr2);
+       state_fio->StateValue(cpustate->cr3);
+       state_fio->StateValue(cpustate->txb);
+       state_fio->StateValue(cpustate->rxb);
+       state_fio->StateValue(cpustate->txd);
+       state_fio->StateValue(cpustate->rxd);
+       state_fio->StateValue(cpustate->sck);
+       state_fio->StateValue(cpustate->ti);
+       state_fio->StateValue(cpustate->to);
+       state_fio->StateValue(cpustate->ci);
+       state_fio->StateValue(cpustate->co0);
+       state_fio->StateValue(cpustate->co1);
+       state_fio->StateValue(cpustate->irr);
+       state_fio->StateValue(cpustate->itf);
+       state_fio->StateValue(cpustate->int1);
+       state_fio->StateValue(cpustate->int2);
+       state_fio->StateValue(cpustate->txs);
+       state_fio->StateValue(cpustate->rxs);
+       state_fio->StateValue(cpustate->txcnt);
+       state_fio->StateValue(cpustate->rxcnt);
+       state_fio->StateValue(cpustate->txbuf);
+       state_fio->StateValue(cpustate->ovc0);
+       state_fio->StateValue(cpustate->ovc1);
+       state_fio->StateValue(cpustate->ovce);
+       state_fio->StateValue(cpustate->ovcf);
+       state_fio->StateValue(cpustate->ovcs);
+       state_fio->StateValue(cpustate->ovcsio);
+       state_fio->StateValue(cpustate->edges);
+       state_fio->StateValue(cpustate->icount);
 #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(loading) {
-               cpustate->opXX = opXX;
-               cpustate->op48 = op48;
-               cpustate->op4C = op4C;
-               cpustate->op4D = op4D;
-               cpustate->op60 = op60;
-               cpustate->op64 = op64;
-               cpustate->op70 = op70;
-               cpustate->op74 = op74;
-               cpustate->handle_timers = handle_timers;
-
-               cpustate->program = d_mem;
-               cpustate->io = d_io;
-               cpustate->outputs_to = (void*)&outputs_to;
-               cpustate->outputs_txd = (void*)&outputs_txd;
-#ifdef USE_DEBUGGER
-               cpustate->emu = emu;
-               cpustate->debugger = d_debugger;
-               cpustate->program_stored = d_mem;
-               cpustate->io_stored = d_io;
                prev_total_icount = total_icount;
-#endif
        }
+#endif
        return true;
 }
index 19ac86d..fe2eda4 100644 (file)
@@ -3024,94 +3024,65 @@ bool V99X8::process_state(FILEIO* state_fio, bool loading)
                return false;
        }
 #ifdef USE_CMDTIME
-       state_fio->StateInt32(cmdtime_t);
-       state_fio->StateInt32(cmdtime_m);
+       state_fio->StateValue(cmdtime_t);
+       state_fio->StateValue(cmdtime_m);
 #endif
-       state_fio->StateInt32(latch1);
-       state_fio->StateInt32(latch2);
-       state_fio->StateInt32(vram_addr);
-       state_fio->StateInt32(vram_page);
-       state_fio->StateBool(f_out3);
-       state_fio->StateBool(f_mode);
-       state_fio->StateBool(flag_frame);
-       //state_fio->StateBuffer(&vcom, sizeof(vcom), 1);
-       {
-               state_fio->StateInt32(vcom.xbytes);
-               state_fio->StateInt32(vcom.xmask);
-               state_fio->StateInt32(vcom.ymask);
-               state_fio->StateInt32(vcom.xshift);
-               state_fio->StateInt32(vcom.yshift);
+       state_fio->StateValue(latch1);
+       state_fio->StateValue(latch2);
+       state_fio->StateValue(vram_addr);
+       state_fio->StateValue(vram_page);
+       state_fio->StateValue(f_out3);
+       state_fio->StateValue(f_mode);
+       state_fio->StateValue(flag_frame);
+       //state_fio->StateArray(&vcom, sizeof(vcom), 1); // vcom contains uint8_t*.Pointer of 64bit is sizeof(uint64_t).
+       {
+               state_fio->StateValue(vcom.xbytes);
+               state_fio->StateValue(vcom.xmask);
+               state_fio->StateValue(vcom.ymask);
+               state_fio->StateValue(vcom.xshift);
+               state_fio->StateValue(vcom.yshift);
                
-               state_fio->StateInt32(vcom.sx);
-               state_fio->StateInt32(vcom.sy);
-               state_fio->StateInt32(vcom.dx);
-               state_fio->StateInt32(vcom.dy);
-               state_fio->StateInt32(vcom.nx);
-               state_fio->StateInt32(vcom.ny);
+               state_fio->StateValue(vcom.sx);
+               state_fio->StateValue(vcom.sy);
+               state_fio->StateValue(vcom.dx);
+               state_fio->StateValue(vcom.dy);
+               state_fio->StateValue(vcom.nx);
+               state_fio->StateValue(vcom.ny);
        }
        if(loading) {
-               vcom.src = vram + state_fio->FgetInt32_LE();
-               vcom.dst = vram + state_fio->FgetInt32_LE();
+               uintptr_t p = (uintptr_t)vram;
+               vcom.src = (uint8_t*)(p + state_fio->FgetInt32_LE());
+               vcom.dst = (uint8_t*)(p + state_fio->FgetInt32_LE());
        } else {
-               state_fio->FputInt32_LE((int)(vcom.src - vram));
-               state_fio->FputInt32_LE((int)(vcom.dst - vram));
-       }
-       //state_fio->StateBuffer(&r44, sizeof(r44), 1);
-       {
-               state_fio->StateInt32(r44.sx);
-               state_fio->StateInt32(r44.sy);
-               state_fio->StateInt32(r44.ex);
-               state_fio->StateInt32(r44.ey);
-               state_fio->StateInt32(r44.x);
-               state_fio->StateInt32(r44.y);
-               state_fio->StateInt32(r44.xsize);
-       }               
-       //state_fio->StateBuffer(&pixmask, sizeof(pixmask), 1);
-       {
-               state_fio->StateInt32(pixmask.npix);
-               state_fio->StateInt32(pixmask.xmask);
-               state_fio->StateInt32(pixmask.mask);
-               for(int i = 0; i < 4; i++) {
-                       state_fio->StateInt32(pixmask.pmask[i]);
-               }
-               for(int i = 0; i < 4; i++) {
-                       state_fio->StateInt32(pixmask.lshift[i]);
-               }
-               for(int i = 0; i < 4; i++) {
-                       state_fio->StateInt32(pixmask.rshift[i]);
-               }
+               uintptr_t _v, _s, _d;
+               _v = (uintptr_t)vram;
+               _s = (uintptr_t)(vcom.src);
+               _d = (uintptr_t)(vcom.dst);
+               state_fio->FputInt32_LE((int)(_s - _v));
+               state_fio->FputInt32_LE((int)(_d - _v));
+       }
+
+       state_fio->StateArray(&r44, sizeof(r44), 1); // All of this are Int32
+       state_fio->StateArray(&pixmask, sizeof(pixmask), 1); // All of this are Int32
+       state_fio->StateArray(&v99x8_refresh, sizeof(v99x8_refresh), 1);// All of this are Int32
+       //state_fio->StateArray(pal, sizeof(pal), 1);
+       for(int i = 0; i < array_length(pal); i++) {
+               state_fio->StateValue(pai[i].flag);
+               state_fio->StateValue(pai[i].r);
+               state_fio->StateValue(pai[i].g);
+               state_fio->StateValue(pai[i].b);
+               state_fio->StateValue(pai[i].color);
        }
-       //state_fio->StateBuffer(&v99x8_refresh, sizeof(v99x8_refresh), 1);
-       {
-               state_fio->StateInt32(v99x8_refresh.width);
-               state_fio->StateInt32(v99x8_refresh.height);
-               state_fio->StateInt32(v99x8_refresh.bpp);
-       }
-       //state_fio->StateBuffer(pal, sizeof(pal), 1);
-       //state_fio->StateBuffer(pal_8, sizeof(pal_8), 1);
-       //state_fio->StateBuffer(pal_m, sizeof(pal_m), 1);
-       {
-               for(int i = 0; i < (16 + 1); i++) {
-                       state_fio->StateBool(pal[i].flag);
-                       state_fio->StateUint8(pal[i].r);
-                       state_fio->StateUint8(pal[i].g);
-                       state_fio->StateUint8(pal[i].b);
-                       state_fio->StateUint32(pal[i].color);
-               }
-               for(int i = 0; i < 256; i++) {
-                       state_fio->StateUint32(pal_8[i]);
-               }
-               for(int i = 0; i < 256; i++) {
-                       state_fio->StateUint32(pal_m[i]);
-               }
-       }
-       state_fio->StateInt32(col_bg);
-       state_fio->StateBuffer(tbl_yjk_b, sizeof(tbl_yjk_b), 1);
-       state_fio->StateBuffer(tbl_yjk_rg, sizeof(tbl_yjk_rg), 1);
-       state_fio->StateBuffer(blackbuf, sizeof(blackbuf), 1);
-       state_fio->StateBuffer(sbuf, sizeof(sbuf), 1);
-       state_fio->StateBuffer(this->vram, sizeof(this->vram), 1);
-       state_fio->StateBool(intstat);
+               
+       state_fio->StateArray(pal_8, sizeof(pal_8), 1);
+       state_fio->StateArray(pal_m, sizeof(pal_m), 1);
+       state_fio->StateValue(col_bg);
+       state_fio->StateArray(tbl_yjk_b, sizeof(tbl_yjk_b), 1);
+       state_fio->StateArray(tbl_yjk_rg, sizeof(tbl_yjk_rg), 1);
+       state_fio->StateArray(blackbuf, sizeof(blackbuf), 1);
+       state_fio->StateArray(sbuf, sizeof(sbuf), 1);
+       state_fio->StateArray(vram, sizeof(vram), 1);
+       state_fio->StateValue(intstat);
        // Q: Do not save "v99x8_t v99x8"? 20181014 K.O
        
        // post process
index 2aae8ea..e48b80e 100644 (file)
@@ -397,50 +397,19 @@ bool W3100A::process_state(FILEIO* state_fio, bool loading)
        if(!state_fio->StateCheckInt32(this_device_id)) {
                return false;
        }
-       state_fio->StateUint8(idm_or);
-       state_fio->StateUint8(idm_ar0);
-       state_fio->StateUint8(idm_ar1);
-       state_fio->StateBuffer(regs, sizeof(regs), 1);
-       //state_fio->StateBuffer(is_tcp, sizeof(is_tcp), 1);
-       for(int i = 0; i < 4; i++) {
-               state_fio->StateBool(is_tcp[i]);
-       }
-       //state_fio->StateBuffer(rx_bufsz, sizeof(rx_bufsz), 1);
-       //state_fio->StateBuffer(tx_bufsz, sizeof(tx_bufsz), 1);
-       for(int i = 0; i < 4; i++) {
-               state_fio->StateUint16(rx_bufsz[i]);
-       }
-       for(int i = 0; i < 4; i++) {
-               state_fio->StateUint16(tx_bufsz[i]);
-       }
-       //state_fio->StateBuffer(cx_rw_pr, sizeof(cx_rw_pr), 1);
-       //state_fio->StateBuffer(cx_rr_pr, sizeof(cx_rr_pr), 1);
-       for(int i = 0; i < 4; i++) {
-               state_fio->StateUint32(cx_rw_pr[i]);
-       }
-       for(int i = 0; i < 4; i++) {
-               state_fio->StateUint32(cx_rr_pr[i]);
-       }
-       //state_fio->StateBuffer(cx_ta_pr, sizeof(cx_ta_pr), 1);
-       //state_fio->StateBuffer(cx_tw_pr, sizeof(cx_tw_pr), 1);
-       //state_fio->StateBuffer(cx_tr_pr, sizeof(cx_tr_pr), 1);
-       for(int i = 0; i < 4; i++) {
-               state_fio->StateUint32(cx_ta_pr[i]);
-       }
-       for(int i = 0; i < 4; i++) {
-               state_fio->StateUint32(cx_tw_pr[i]);
-       }
-       for(int i = 0; i < 4; i++) {
-               state_fio->StateUint32(cx_tr_pr[i]);
-       }
-       //state_fio->StateBuffer(send_dst_ptr, sizeof(send_dst_ptr), 1);
-       //state_fio->StateBuffer(recv_dst_ptr, sizeof(recv_dst_ptr), 1);
-       for(int i = 0; i < 4; i++) {
-               state_fio->StateUint32(send_dst_ptr[i]);
-       }
-       for(int i = 0; i < 4; i++) {
-               state_fio->StateUint32(recv_dst_ptr[i]);
-       }
-
+       state_fio->StateValue(idm_or);
+       state_fio->StateValue(idm_ar0);
+       state_fio->StateValue(idm_ar1);
+       state_fio->StateArray(regs, sizeof(regs), 1);
+       state_fio->StateArray(is_tcp, sizeof(is_tcp), 1);
+       state_fio->StateArray(rx_bufsz, sizeof(rx_bufsz), 1);
+       state_fio->StateArray(tx_bufsz, sizeof(tx_bufsz), 1);
+       state_fio->StateArray(cx_rw_pr, sizeof(cx_rw_pr), 1);
+       state_fio->StateArray(cx_rr_pr, sizeof(cx_rr_pr), 1);
+       state_fio->StateArray(cx_ta_pr, sizeof(cx_ta_pr), 1);
+       state_fio->StateArray(cx_tw_pr, sizeof(cx_tw_pr), 1);
+       state_fio->StateArray(cx_tr_pr, sizeof(cx_tr_pr), 1);
+       state_fio->StateArray(send_dst_ptr, sizeof(send_dst_ptr), 1);
+       state_fio->StateArray(recv_dst_ptr, sizeof(recv_dst_ptr), 1);
        return true;
 }
index b7e38e6..e05c7ee 100644 (file)
@@ -246,18 +246,21 @@ bool YM2151::process_state(FILEIO* state_fio, bool loading)
                return false;
        }
 #ifdef SUPPORT_MAME_FM_DLL
-       state_fio->StateBuffer(port_log, sizeof(port_log), 1);
+       for(int i = 0; i < array_length(port_log); i++) {
+               state_fio->StateValue(port_log[i].written);
+               state_fio->StateValue(port_log[i].data);
+       }
 #endif
-       state_fio->StateInt32(chip_clock);
-       state_fio->StateUint8(ch);
-       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(ch);
+       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);
        
 #ifdef SUPPORT_MAME_FM_DLL
        // post process
index 8b8792c..fcafbf5 100644 (file)
@@ -743,30 +743,33 @@ bool YM2203::process_state(FILEIO* state_fio, bool loading)
                }
        }
 #ifdef SUPPORT_MAME_FM_DLL
-       state_fio->StateBuffer(port_log, sizeof(port_log), 1);
+       for(int i = 0; i < array_length(port_log); i++) {
+               state_fio->StateValue(port_log[i].written);
+               state_fio->StateValue(port_log[i].data);
+       }
 #endif
-       state_fio->StateUint8(ch);
-       state_fio->StateUint8(fnum2);
+       state_fio->StateValue(ch);
+       state_fio->StateValue(fnum2);
        if(_HAS_YM2608) {
-               state_fio->StateUint8(ch1);
-               state_fio->StateUint8(data1);
-               state_fio->StateUint8(fnum21);
+       state_fio->StateValue(ch1);
+       state_fio->StateValue(data1);
+       state_fio->StateValue(fnum21);
        }
        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->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(mode);
+       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);
        
 #ifdef SUPPORT_MAME_FM_DLL
        // post process
index 0cb7e1f..bc6f8cb 100644 (file)
@@ -3726,38 +3726,38 @@ bool Z80_BASE::process_state(FILEIO* state_fio, bool loading)
        if(!state_fio->StateCheckInt32(this_device_id)) {
                return false;
        }
-       state_fio->StateUint64(total_icount);
+       state_fio->StateValue(total_icount);
        
-       state_fio->StateInt32(icount);
-       state_fio->StateInt32(extra_icount);
-       state_fio->StateUint16(prevpc);
-       state_fio->StateUint32(pc.d);
-       state_fio->StateUint32(sp.d);
-       state_fio->StateUint32(af.d);
-       state_fio->StateUint32(bc.d);
-       state_fio->StateUint32(de.d);
-       state_fio->StateUint32(hl.d);
-       state_fio->StateUint32(ix.d);
-       state_fio->StateUint32(iy.d);
-       state_fio->StateUint32(wz.d);
-       state_fio->StateUint32(af2.d);
-       state_fio->StateUint32(bc2.d);
-       state_fio->StateUint32(de2.d);
-       state_fio->StateUint32(hl2.d);
-       state_fio->StateUint8(I);
-       state_fio->StateUint8(R);
-       state_fio->StateUint8(R2);
-       state_fio->StateUint32(ea);
-       state_fio->StateBool(busreq);
-       state_fio->StateBool(after_halt);
-       state_fio->StateUint8(im);
-       state_fio->StateUint8(iff1);
-       state_fio->StateUint8(iff2);
-       state_fio->StateUint8(icr);
-       state_fio->StateBool(after_ei);
-       state_fio->StateBool(after_ldair);
-       state_fio->StateUint32(intr_req_bit);
-       state_fio->StateUint32(intr_pend_bit);
+       state_fio->StateValue(icount);
+       state_fio->StateValue(extra_icount);
+       state_fio->StateValue(prevpc);
+       state_fio->StateValue(pc.d);
+       state_fio->StateValue(sp.d);
+       state_fio->StateValue(af.d);
+       state_fio->StateValue(bc.d);
+       state_fio->StateValue(de.d);
+       state_fio->StateValue(hl.d);
+       state_fio->StateValue(ix.d);
+       state_fio->StateValue(iy.d);
+       state_fio->StateValue(wz.d);
+       state_fio->StateValue(af2.d);
+       state_fio->StateValue(bc2.d);
+       state_fio->StateValue(de2.d);
+       state_fio->StateValue(hl2.d);
+       state_fio->StateValue(I);
+       state_fio->StateValue(R);
+       state_fio->StateValue(R2);
+       state_fio->StateValue(ea);
+       state_fio->StateValue(busreq);
+       state_fio->StateValue(after_halt);
+       state_fio->StateValue(im);
+       state_fio->StateValue(iff1);
+       state_fio->StateValue(iff2);
+       state_fio->StateValue(icr);
+       state_fio->StateValue(after_ei);
+       state_fio->StateValue(after_ldair);
+       state_fio->StateValue(intr_req_bit);
+       state_fio->StateValue(intr_pend_bit);
        
        // post process
        if(loading) {
index 3f115bb..fb02b7a 100644 (file)
@@ -357,30 +357,30 @@ bool Z80CTC::process_state(FILEIO* state_fio, bool loading)
                return false;
        }
        for(int i = 0; i < 4; i++) {
-               state_fio->StateUint8(counter[i].control);
-               state_fio->StateBool(counter[i].slope);
-               state_fio->StateUint16(counter[i].count);
-               state_fio->StateUint16(counter[i].constant);
-               state_fio->StateUint8(counter[i].vector);
-               state_fio->StateInt32(counter[i].clocks);
-               state_fio->StateInt32(counter[i].prescaler);
-               state_fio->StateBool(counter[i].freeze);
-               state_fio->StateBool(counter[i].start);
-               state_fio->StateBool(counter[i].latch);
-               state_fio->StateBool(counter[i].prev_in);
-               state_fio->StateBool(counter[i].first_constant);
-               state_fio->StateUint64(counter[i].freq);
-               state_fio->StateInt32(counter[i].clock_id);
-               state_fio->StateInt32(counter[i].sysclock_id);
-               state_fio->StateUint32(counter[i].input);
-               state_fio->StateUint32(counter[i].period);
-               state_fio->StateUint32(counter[i].prev);
-               state_fio->StateBool(counter[i].req_intr);
-               state_fio->StateBool(counter[i].in_service);
+               state_fio->StateValue(counter[i].control);
+               state_fio->StateValue(counter[i].slope);
+               state_fio->StateValue(counter[i].count);
+               state_fio->StateValue(counter[i].constant);
+               state_fio->StateValue(counter[i].vector);
+               state_fio->StateValue(counter[i].clocks);
+               state_fio->StateValue(counter[i].prescaler);
+               state_fio->StateValue(counter[i].freeze);
+               state_fio->StateValue(counter[i].start);
+               state_fio->StateValue(counter[i].latch);
+               state_fio->StateValue(counter[i].prev_in);
+               state_fio->StateValue(counter[i].first_constant);
+               state_fio->StateValue(counter[i].freq);
+               state_fio->StateValue(counter[i].clock_id);
+               state_fio->StateValue(counter[i].sysclock_id);
+               state_fio->StateValue(counter[i].input);
+               state_fio->StateValue(counter[i].period);
+               state_fio->StateValue(counter[i].prev);
+               state_fio->StateValue(counter[i].req_intr);
+               state_fio->StateValue(counter[i].in_service);
        }
-       state_fio->StateUint64(cpu_clocks);
-       state_fio->StateBool(iei);
-       state_fio->StateBool(oei);
-       state_fio->StateUint32(intr_bit);
+       state_fio->StateValue(cpu_clocks);
+       state_fio->StateValue(iei);
+       state_fio->StateValue(oei);
+       state_fio->StateValue(intr_bit);
        return true;
 }
index 92c58cb..8c89611 100644 (file)
@@ -770,44 +770,29 @@ bool Z80DMA::process_state(FILEIO* state_fio, bool loading)
        if(!state_fio->StateCheckInt32(this_device_id)) {
                return false;
        }
-       //state_fio->StateBuffer(&regs, sizeof(regs), 1);
-       {
-               for(int i = 0; i < 7; i++) {
-                       for(int j = 0; j < 8; j++) {
-                               state_fio->StateUint16(regs.m[i][j]);
-                       }
-               }
-               for(int i = 0; i < (6 * 8 + 1 + 1); i++) {
-                       state_fio->StateUint16(regs.t[i]);
-               }
-       }
-       state_fio->StateUint8(status);
-       //state_fio->StateBuffer(wr_tmp, sizeof(wr_tmp), 1);
-       for(int i = 0; i < (sizeof(wr_tmp) / sizeof(uint16_t)); i++) {
-               state_fio->StateUint16(wr_tmp[i]);
-       }
-       state_fio->StateInt32(wr_num);
-       state_fio->StateInt32(wr_ptr);
-       //state_fio->StateBuffer(rr_tmp, sizeof(rr_tmp), 1);
-       for(int i = 0; i < (sizeof(rr_tmp) / sizeof(uint16_t)); i++) {
-               state_fio->StateUint16(rr_tmp[i]);
-       }
-       state_fio->StateInt32(rr_num);
-       state_fio->StateInt32(rr_ptr);
-       state_fio->StateBool(enabled);
-       state_fio->StateUint32(ready);
-       state_fio->StateBool(force_ready);
-       state_fio->StateUint16(addr_a);
-       state_fio->StateUint16(addr_b);
-       state_fio->StateInt32(upcount);
-       state_fio->StateInt32(blocklen);
-       state_fio->StateBool(dma_stop);
-       state_fio->StateBool(bus_master);
-       state_fio->StateBool(req_intr);
-       state_fio->StateBool(in_service);
-       state_fio->StateUint8(vector);
-       state_fio->StateBool(iei);
-       state_fio->StateBool(oei);
-       state_fio->StateUint32(intr_bit);
+       state_fio->StateArray(&regs.m[0][0], sizeof(regs.m), 1);
+       state_fio->StateArray(&regs.t[0], sizeof(regs.t), 1);
+       state_fio->StateValue(status);
+       state_fio->StateArray(wr_tmp, sizeof(wr_tmp), 1);
+       state_fio->StateValue(wr_num);
+       state_fio->StateValue(wr_ptr);
+       state_fio->StateArray(rr_tmp, sizeof(rr_tmp), 1);
+       state_fio->StateValue(rr_num);
+       state_fio->StateValue(rr_ptr);
+       state_fio->StateValue(enabled);
+       state_fio->StateValue(ready);
+       state_fio->StateValue(force_ready);
+       state_fio->StateValue(addr_a);
+       state_fio->StateValue(addr_b);
+       state_fio->StateValue(upcount);
+       state_fio->StateValue(blocklen);
+       state_fio->StateValue(dma_stop);
+       state_fio->StateValue(bus_master);
+       state_fio->StateValue(req_intr);
+       state_fio->StateValue(in_service);
+       state_fio->StateValue(vector);
+       state_fio->StateValue(iei);
+       state_fio->StateValue(oei);
+       state_fio->StateValue(intr_bit);
        return true;
 }
index e6be378..35b3d5c 100644 (file)
@@ -333,28 +333,28 @@ bool Z80PIO::process_state(FILEIO* state_fio, bool loading)
                return false;
        }
        for(int i = 0; i < 2; i++) {
-               state_fio->StateUint32(port[i].wreg);
-               state_fio->StateUint8(port[i].rreg);
-               state_fio->StateUint8(port[i].mode);
-               state_fio->StateUint8(port[i].ctrl1);
-               state_fio->StateUint8(port[i].ctrl2);
-               state_fio->StateUint8(port[i].dir);
-               state_fio->StateUint8(port[i].mask);
-               state_fio->StateUint8(port[i].vector);
-               state_fio->StateBool(port[i].set_dir);
-               state_fio->StateBool(port[i].set_mask);
-               state_fio->StateBool(port[i].hand_shake);
-               state_fio->StateInt32(port[i].ready_signal);
-               state_fio->StateBool(port[i].input_empty);
-               state_fio->StateBool(port[i].output_ready);
-               state_fio->StateBool(port[i].enb_intr);
-               state_fio->StateBool(port[i].enb_intr_tmp);
-               state_fio->StateBool(port[i].req_intr);
-               state_fio->StateBool(port[i].in_service);
+               state_fio->StateValue(port[i].wreg);
+               state_fio->StateValue(port[i].rreg);
+               state_fio->StateValue(port[i].mode);
+               state_fio->StateValue(port[i].ctrl1);
+               state_fio->StateValue(port[i].ctrl2);
+               state_fio->StateValue(port[i].dir);
+               state_fio->StateValue(port[i].mask);
+               state_fio->StateValue(port[i].vector);
+               state_fio->StateValue(port[i].set_dir);
+               state_fio->StateValue(port[i].set_mask);
+               state_fio->StateValue(port[i].hand_shake);
+               state_fio->StateValue(port[i].ready_signal);
+               state_fio->StateValue(port[i].input_empty);
+               state_fio->StateValue(port[i].output_ready);
+               state_fio->StateValue(port[i].enb_intr);
+               state_fio->StateValue(port[i].enb_intr_tmp);
+               state_fio->StateValue(port[i].req_intr);
+               state_fio->StateValue(port[i].in_service);
        }
-       state_fio->StateBool(iei);
-       state_fio->StateBool(oei);
-       state_fio->StateUint32(intr_bit);
+       state_fio->StateValue(iei);
+       state_fio->StateValue(oei);
+       state_fio->StateValue(intr_bit);
        return true;
 }
 
index a6a41a1..a130f74 100644 (file)
@@ -934,32 +934,32 @@ bool Z80SIO::process_state(FILEIO* state_fio, bool loading)
                return false;
        }
        for(int i = 0; i < 2; i++) {
-               state_fio->StateInt32(port[i].pointer);
-               state_fio->StateBuffer(port[i].wr, sizeof(port[i].wr), 1);
-               state_fio->StateUint8(port[i].vector);
-               state_fio->StateUint8(port[i].affect);
-               state_fio->StateBool(port[i].nextrecv_intr);
-               state_fio->StateBool(port[i].first_data);
-               state_fio->StateBool(port[i].over_flow);
-               state_fio->StateBool(port[i].under_run);
-               state_fio->StateBool(port[i].abort);
-               state_fio->StateBool(port[i].sync);
-               state_fio->StateUint8(port[i].sync_bit);
+               state_fio->StateValue(port[i].pointer);
+               state_fio->StateArray(port[i].wr, sizeof(port[i].wr), 1);
+               state_fio->StateValue(port[i].vector);
+               state_fio->StateValue(port[i].affect);
+               state_fio->StateValue(port[i].nextrecv_intr);
+               state_fio->StateValue(port[i].first_data);
+               state_fio->StateValue(port[i].over_flow);
+               state_fio->StateValue(port[i].under_run);
+               state_fio->StateValue(port[i].abort);
+               state_fio->StateValue(port[i].sync);
+               state_fio->StateValue(port[i].sync_bit);
                if(__HAS_UPD7201) {
-                       state_fio->StateUint16(port[i].tx_count);
-                       state_fio->StateUint8(port[i].tx_count_hi);
-               }
-               state_fio->StateDouble(port[i].tx_clock);
-               state_fio->StateDouble(port[i].tx_interval);
-               state_fio->StateDouble(port[i].rx_clock);
-               state_fio->StateDouble(port[i].rx_interval);
-               state_fio->StateInt32(port[i].tx_data_bits);
-               state_fio->StateInt32(port[i].tx_bits_x2);
-               state_fio->StateInt32(port[i].tx_bits_x2_remain);
-               state_fio->StateInt32(port[i].rx_bits_x2);
-               state_fio->StateInt32(port[i].rx_bits_x2_remain);
-               state_fio->StateBool(port[i].prev_tx_clock_signal);
-               state_fio->StateBool(port[i].prev_rx_clock_signal);
+               state_fio->StateValue(port[i].tx_count);
+               state_fio->StateValue(port[i].tx_count_hi);
+               }
+               state_fio->StateValue(port[i].tx_clock);
+               state_fio->StateValue(port[i].tx_interval);
+               state_fio->StateValue(port[i].rx_clock);
+               state_fio->StateValue(port[i].rx_interval);
+               state_fio->StateValue(port[i].tx_data_bits);
+               state_fio->StateValue(port[i].tx_bits_x2);
+               state_fio->StateValue(port[i].tx_bits_x2_remain);
+               state_fio->StateValue(port[i].rx_bits_x2);
+               state_fio->StateValue(port[i].rx_bits_x2_remain);
+               state_fio->StateValue(port[i].prev_tx_clock_signal);
+               state_fio->StateValue(port[i].prev_rx_clock_signal);
                if(!port[i].send->process_state((void *)state_fio, loading)) {
                        return false;
                }
@@ -969,21 +969,21 @@ bool Z80SIO::process_state(FILEIO* state_fio, bool loading)
                if(!port[i].rtmp->process_state((void *)state_fio, loading)) {
                        return false;
                }
-               state_fio->StateInt32(port[i].shift_reg);
-               state_fio->StateInt32(port[i].send_id);
-               state_fio->StateInt32(port[i].recv_id);
-               state_fio->StateBool(port[i].err_intr);
-               state_fio->StateInt32(port[i].recv_intr);
-               state_fio->StateBool(port[i].stat_intr);
-               state_fio->StateBool(port[i].send_intr);
-               state_fio->StateBool(port[i].req_intr);
-               state_fio->StateBool(port[i].in_service);
-               state_fio->StateBool(port[i].dcd);
-               state_fio->StateBool(port[i].cts);
+               state_fio->StateValue(port[i].shift_reg);
+               state_fio->StateValue(port[i].send_id);
+               state_fio->StateValue(port[i].recv_id);
+               state_fio->StateValue(port[i].err_intr);
+               state_fio->StateValue(port[i].recv_intr);
+               state_fio->StateValue(port[i].stat_intr);
+               state_fio->StateValue(port[i].send_intr);
+               state_fio->StateValue(port[i].req_intr);
+               state_fio->StateValue(port[i].in_service);
+               state_fio->StateValue(port[i].dcd);
+               state_fio->StateValue(port[i].cts);
        }
-       state_fio->StateBool(iei);
-       state_fio->StateBool(oei);
-       state_fio->StateUint32(intr_bit);
+       state_fio->StateValue(iei);
+       state_fio->StateValue(oei);
+       state_fio->StateValue(intr_bit);
        return true;
 }