OSDN Git Service

[VM][STATE] Use namespace {VMNAME} to separate per VMs.
[csp-qt/common_source_project-fm7.git] / source / src / vm / pc9801 / sasi.cpp
index 15a52d2..f4a2856 100644 (file)
@@ -33,6 +33,8 @@
 #define ISR_IXO                0x04
 #define ISR_INT                0x01
 
+namespace PC9801 {
+
 void SASI::reset()
 {
        ocr = 0;
@@ -102,7 +104,7 @@ uint32_t SASI::read_io8(uint32_t addr)
                                uint32_t dt = 7, ct = 0;
                                
                                if(unit != NULL && unit->mounted()) {
-                                       double size = unit->cylinders * unit->surfaces * unit->sectors * unit->sector_size;
+                                       double size = unit->sector_num * unit->sector_size;
                                        int size_mb = (int)(size / 1024.0 / 1024.0 + 0.5);
                                        
                                        if(size_mb <= 6) {
@@ -197,27 +199,19 @@ void SASI::write_signal(int id, uint32_t data, uint32_t mask)
 
 #define STATE_VERSION  2
 
-void SASI::save_state(FILEIO* state_fio)
+bool SASI::process_state(FILEIO* state_fio, bool loading)
 {
-       state_fio->FputUint32(STATE_VERSION);
-       state_fio->FputInt32(this_device_id);
-       
-       state_fio->FputUint8(ocr);
-       state_fio->FputBool(irq_status);
-       state_fio->FputBool(drq_status);
-}
-
-bool SASI::load_state(FILEIO* state_fio)
-{
-       if(state_fio->FgetUint32() != STATE_VERSION) {
+       if(!state_fio->StateCheckUint32(STATE_VERSION)) {
                return false;
        }
-       if(state_fio->FgetInt32() != this_device_id) {
+       if(!state_fio->StateCheckInt32(this_device_id)) {
                return false;
        }
-       ocr = state_fio->FgetUint8();
-       irq_status = state_fio->FgetBool();
-       drq_status = state_fio->FgetBool();
+       state_fio->StateUint8(ocr);
+       state_fio->StateBool(irq_status);
+       state_fio->StateBool(drq_status);
        return true;
 }
 
+}
+