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 / bubcom80 / cmt.h
1 /*
2         Systems Formulate BUBCOM80 Emulator 'eBUBCOM80'
3
4         Author : Takeda.Toshiya
5         Date   : 2018.05.09-
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 namespace BUBCOM80 {
18 #define SIG_CMT_REMOTE  0
19 #define SIG_CMT_OUT     1
20
21 // max 256kbytes
22 #define BUFFER_SIZE     0x40000
23
24 class CMT : public DEVICE
25 {
26 private:
27         DEVICE* d_sio;
28         
29         FILEIO* fio;
30         bool play, rec, remote;
31         _TCHAR rec_file_path[_MAX_PATH];
32         int bufcnt;
33         uint8_t buffer[BUFFER_SIZE];
34         
35         void release_tape();
36         
37 public:
38         CMT(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
39         {
40                 set_device_name(_T("CMT I/F"));
41         }
42         ~CMT() {}
43         
44         // common functions
45         void initialize();
46         void release();
47         void reset();
48         void write_signal(int id, uint32_t data, uint32_t mask);
49         bool process_state(FILEIO* state_fio, bool loading);
50         
51         // unique functions
52         void play_tape(const _TCHAR* file_path);
53         void rec_tape(const _TCHAR* file_path);
54         void close_tape();
55         bool is_tape_inserted()
56         {
57                 return (play || rec);
58         }
59         void set_context_sio(DEVICE* device)
60         {
61                 d_sio = device;
62         }
63 };
64 }
65
66 #endif
67