OSDN Git Service

[STATESUB][COLECOVISION][EX80][FAMILYBASIC][PC8801] Apply some new state framework...
[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 class CMT : public DEVICE
23 {
24 private:
25         DEVICE* d_sio;
26         
27         FILEIO* fio;
28         bool play, rec;
29         _TCHAR rec_file_path[_MAX_PATH];
30         int bufcnt;
31         uint8_t buffer[BUFFER_SIZE];
32         
33         void release_tape();
34         
35 public:
36         CMT(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
37         {
38                 set_device_name(_T("CMT I/F"));
39         }
40         ~CMT() {}
41         
42         // common functions
43         void initialize();
44         void release();
45         void reset();
46         void write_signal(int id, uint32_t data, uint32_t mask);
47         void decl_state();
48         void save_state(FILEIO* state_fio);
49         bool load_state(FILEIO* state_fio);
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 #endif
66