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 / ex80 / cmt.h
1 /*
2         TOSHIBA EX-80 Emulator 'eEX-80'
3
4         Author : Takeda.Toshiya
5         Date   : 2015.12.10-
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_OUT     0
18
19 // max 256kbytes
20 #define BUFFER_SIZE     0x40000
21
22 namespace EX80 {
23 class CMT : public DEVICE
24 {
25 private:
26         DEVICE* d_sio;
27         
28         FILEIO* fio;
29         bool play, rec;
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         bool process_state(FILEIO* state_fio, bool loading);
49         
50         // unique functions
51         void play_tape(const _TCHAR* file_path);
52         void rec_tape(const _TCHAR* file_path);
53         void close_tape();
54         bool is_tape_inserted()
55         {
56                 return (play || rec);
57         }
58         void set_context_sio(DEVICE* device)
59         {
60                 d_sio = device;
61         }
62 };
63 }
64
65 #endif
66