OSDN Git Service

97c66338e6ca9a375d3fc60b159ed1679667fd3a
[csp-qt/common_source_project-fm7.git] / source / src / vm / multi8 / cmt.h
1 /*
2         MITSUBISHI Electric MULTI8 Emulator 'EmuLTI8'
3
4         Author : Takeda.Toshiya
5         Date   : 2006.09.16 -
6
7         [ cmt ]
8 */
9
10 #ifndef _CMT_H_
11 #define _CMT_H_
12
13 #include "../vm.h"
14 #include "../../emu.h"
15 #include "../device.h"
16
17 #define SIG_CMT_REMOTE  0
18 #define SIG_CMT_OUT     1
19
20 // max 256kbytes
21 #define BUFFER_SIZE     0x40000
22
23 class CMT : public DEVICE
24 {
25 private:
26         DEVICE* d_sio;
27         
28         FILEIO* fio;
29         bool play, rec, remote;
30         _TCHAR rec_file_path[_MAX_PATH];
31         int bufcnt;
32         uint8_t buffer[BUFFER_SIZE];
33         
34         void release_tape();
35         
36 public:
37         CMT(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
38         {
39                 set_device_name(_T("CMT I/F"));
40         }
41         ~CMT() {}
42         
43         // common functions
44         void initialize();
45         void release();
46         void reset();
47         void write_signal(int id, uint32_t data, uint32_t mask);
48         void decl_state();
49         void save_state(FILEIO* state_fio);
50         bool load_state(FILEIO* state_fio);
51         
52         // unique functions
53         void play_tape(const _TCHAR* file_path);
54         void rec_tape(const _TCHAR* file_path);
55         void close_tape();
56         bool is_tape_inserted()
57         {
58                 return (play || rec);
59         }
60         void set_context_sio(DEVICE* device)
61         {
62                 d_sio = device;
63         }
64 };
65
66 #endif
67