OSDN Git Service

[VM][STATE] Use namespace {VMNAME} to separate per VMs.
[csp-qt/common_source_project-fm7.git] / source / src / vm / tk80bs / cmt.h
index 3427528..c772edf 100644 (file)
@@ -1,5 +1,6 @@
 /*
        NEC TK-80BS (COMPO BS/80) Emulator 'eTK-80BS'
+       NEC TK-80 Emulator 'eTK-80'
 
        Author : Takeda.Toshiya
        Date   : 2008.08.26 -
 #include "../../emu.h"
 #include "../device.h"
 
-#define SIG_CMT_OUT    0
+#define SIG_CMT_MIC    0
+#define SIG_CMT_EAR    1
+#if defined(_TK80BS)
+#define SIG_CMT_OUT    2
+#endif
 
 // max 256kbytes
 #define BUFFER_SIZE    0x40000
 
+namespace TK80 {
+
 class CMT : public DEVICE
 {
 private:
-       DEVICE* d_sio;
+       DEVICE *d_drec, *d_pio;
+#if defined(_TK80BS)
+       DEVICE *d_sio;
+#endif
+       
+       bool mic, ear;
+       bool pulse;
+       int pulse_count;
        
+#if defined(_TK80BS)
        FILEIO* fio;
        bool play, rec;
        _TCHAR rec_file_path[_MAX_PATH];
@@ -31,9 +46,10 @@ private:
        uint8_t buffer[BUFFER_SIZE];
        
        void release_tape();
+#endif
        
 public:
-       CMT(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
+       CMT(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
        {
                set_device_name(_T("CMT I/F"));
        }
@@ -41,25 +57,50 @@ public:
        
        // common functions
        void initialize();
+#if defined(_TK80BS)
        void release();
        void reset();
+#endif
        void write_signal(int id, uint32_t data, uint32_t mask);
-       void save_state(FILEIO* state_fio);
-       bool load_state(FILEIO* state_fio);
+       void event_callback(int event_id, int err);
+       bool process_state(FILEIO* state_fio, bool loading);
        
        // unique functions
-       void play_tape(const _TCHAR* file_path);
-       void rec_tape(const _TCHAR* file_path);
-       void close_tape();
-       bool is_tape_inserted()
+       void set_context_drec(DEVICE* device)
        {
-               return (play || rec);
+               d_drec = device;
        }
+       void set_context_pio(DEVICE* device)
+       {
+               d_pio = device;
+       }
+#if defined(_TK80BS)
        void set_context_sio(DEVICE* device)
        {
                d_sio = device;
        }
+       bool is_tape_inserted()
+       {
+               return (play || rec);
+       }
+       bool is_tape_playing()
+       {
+               return play;
+       }
+       bool is_tape_recording()
+       {
+               return rec;
+       }
+       int get_tape_position()
+       {
+               return 0;
+       }
+       void play_tape(const _TCHAR* file_path);
+       void rec_tape(const _TCHAR* file_path);
+       void close_tape();
+#endif
 };
 
+}
 #endif