OSDN Git Service

[VM][STATE] Use namespace {VMNAME} to separate per VMs.
[csp-qt/common_source_project-fm7.git] / source / src / vm / mz5500 / sysport.cpp
index 69ce764..99d6afe 100644 (file)
@@ -8,7 +8,8 @@
 */
 
 #include "sysport.h"
-#include "../../fileio.h"
+
+namespace MZ5500 {
 
 void SYSPORT::initialize()
 {
@@ -16,7 +17,7 @@ void SYSPORT::initialize()
        register_frame_event(this);
 }
 
-void SYSPORT::write_io8(uint32 addr, uint32 data)
+void SYSPORT::write_io8(uint32_t addr, uint32_t data)
 {
        switch(addr & 0x3f0) {
        case 0x70:
@@ -31,13 +32,13 @@ void SYSPORT::write_io8(uint32 addr, uint32 data)
        case 0x260:
                // z80ctc reti
                if(data == 0x4d) {
-                       d_ctc->intr_reti();
+                       d_ctc->notify_intr_reti();
                }
                break;
        }
 }
 
-uint32 SYSPORT::read_io8(uint32 addr)
+uint32_t SYSPORT::read_io8(uint32_t addr)
 {
        switch(addr & 0x3ff) {
        case 0x60:
@@ -49,10 +50,10 @@ uint32 SYSPORT::read_io8(uint32 addr)
 #endif
        case 0x240:
                // z80ctc vector
-               return d_ctc->intr_ack();
+               return d_ctc->get_intr_ack();
        case 0x250:
                // z80sio vector
-               return d_sio->intr_ack();
+               return d_sio->get_intr_ack();
        case 0x270:
                // port-b
                return 0xff;
@@ -69,25 +70,17 @@ void SYSPORT::event_frame()
 
 #define STATE_VERSION  1
 
-void SYSPORT::save_state(FILEIO* state_fio)
+bool SYSPORT::process_state(FILEIO* state_fio, bool loading)
 {
-       state_fio->FputUint32(STATE_VERSION);
-       state_fio->FputInt32(this_device_id);
-       
-       state_fio->FputInt32(rst);
-       state_fio->FputInt32(highden);
-}
-
-bool SYSPORT::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;
        }
-       rst = state_fio->FgetInt32();
-       highden = state_fio->FgetInt32();
+       state_fio->StateInt32(rst);
+       state_fio->StateInt32(highden);
        return true;
 }
 
+}