OSDN Git Service

[VM][General] Merge upstream 2016-03-01. (Pahse 1).
[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         ~CMT() {}
38         
39         // common functions
40         void initialize();
41         void release();
42         void reset();
43         void write_signal(int id, uint32_t data, uint32_t mask);
44         void save_state(FILEIO* state_fio);
45         bool load_state(FILEIO* state_fio);
46         
47         // unique functions
48         void play_tape(const _TCHAR* file_path);
49         void rec_tape(const _TCHAR* file_path);
50         void close_tape();
51         bool is_tape_inserted()
52         {
53                 return (play || rec);
54         }
55         void set_context_sio(DEVICE* device)
56         {
57                 d_sio = device;
58         }
59 };
60
61 #endif
62