OSDN Git Service

[VM][PC9801] Enable to build PC-9801 with upstream 2018-10-05.
[csp-qt/common_source_project-fm7.git] / source / src / vm / pc9801 / cmt.cpp
index b6e46a9..4196372 100644 (file)
@@ -31,7 +31,12 @@ void CMT::reset()
 
 void CMT::write_io8(uint32_t addr, uint32_t data)
 {
-       remote = ((data & 0x20) != 0);
+       switch(addr) {
+       case 0x0095:
+       case 0x0097:
+               remote = ((data & 0x20) != 0);
+               break;
+       }
 }
 
 void CMT::write_signal(int id, uint32_t data, uint32_t mask)
@@ -101,31 +106,19 @@ void CMT::release_tape()
 
 #define STATE_VERSION  1
 
-void CMT::save_state(FILEIO* state_fio)
-{
-       state_fio->FputUint32(STATE_VERSION);
-       state_fio->FputInt32(this_device_id);
-       
-       state_fio->FputInt32(bufcnt);
-       state_fio->Fwrite(buffer, sizeof(buffer), 1);
-       state_fio->FputBool(play);
-       state_fio->FputBool(rec);
-       state_fio->FputBool(remote);
-}
-
-bool CMT::load_state(FILEIO* state_fio)
+bool CMT::process_state(FILEIO* state_fio, bool loading)
 {
-       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;
        }
-       bufcnt = state_fio->FgetInt32();
-       state_fio->Fread(buffer, sizeof(buffer), 1);
-       play = state_fio->FgetBool();
-       rec = state_fio->FgetBool();
-       remote = state_fio->FgetBool();
+       state_fio->StateInt32(bufcnt);
+       state_fio->StateBuffer(buffer, sizeof(buffer), 1);
+       state_fio->StateBool(play);
+       state_fio->StateBool(rec);
+       state_fio->StateBool(remote);
        return true;
 }