OSDN Git Service

[VM] TRY:Use namespace {VMNAME} to separate around VMs. This feature still apply...
[csp-qt/common_source_project-fm7.git] / source / src / vm / fm7 / bubblecasette.h
index 22c6040..1ad3e28 100644 (file)
@@ -18,6 +18,8 @@ class EMU;
 class VM;
 class FILEIO;
 
+namespace FM7 {
+       
 enum {
        BUBBLE_DATA_REG = 0,
        BUBBLE_CMD_REG,
@@ -44,9 +46,6 @@ typedef struct {
 
 class BUBBLECASETTE: public DEVICE {
 protected:
-       EMU *p_emu;
-       VM *p_vm;
-
        FILEIO* fio;
        
        bool is_wrote;
@@ -54,7 +53,7 @@ protected:
        bool header_changed; // if change header: e.g:change write protection flag.
        bool read_access;
        bool write_access;
-       bool write_protect;
+
        uint8_t offset_reg;
        // FD10(RW)
        uint8_t data_reg;
@@ -65,6 +64,9 @@ protected:
        bool cmd_error;  // bit7 : Command error
        bool stat_tdra;  // bit6: Ready to write.
        bool stat_rda;   // bit5: Ready to read.
+       bool not_ready;  // bit4: Not Ready(Slot empty).
+       // bit3 : NOOP
+       bool write_protect; // bit2
        bool stat_error; // bit 1
        bool stat_busy;  // bit 0
 
@@ -100,7 +102,7 @@ private:
        bool read_one_page(void);
        bool write_one_page(void);
 public:
-       BUBBLECASETTE(VM* parent_vm, EMU* parent_emu);
+       BUBBLECASETTE(VM_TEMPLATE* parent_vm, EMU* parent_emu);
        ~BUBBLECASETTE();
 
        void initialize();
@@ -111,15 +113,11 @@ public:
        
        uint32_t read_signal(int id);
        void write_signal(int id, uint32_t data, uint32_t mask);
-       void open(_TCHAR* file_path, int bank);
+       bool open(_TCHAR* file_path, int bank);
        void close();
        void event_callback(int event_id, int err);
-       void save_state(FILEIO* state_fio);
-       bool load_state(FILEIO* state_fio);
-       const _TCHAR *get_device_name()
-       {
-               return _T("FM Bubble Casette");
-       }
+       bool process_state(FILEIO *state_fio, bool loading);
+       
        bool is_bubble_inserted()
        {
                return bubble_inserted;
@@ -130,8 +128,10 @@ public:
        }
        void set_bubble_protect(bool flag)
        {
-               write_protect = flag;
-               header_changed = true;
+               if(write_protect != flag) {
+                       write_protect = flag;
+                       header_changed = true;
+               }
        }
        bool get_access_lamp()
        {
@@ -139,4 +139,7 @@ public:
        }
 
 };
+
+}
+
 #endif