OSDN Git Service

[VM][STATE] Apply new framework to some VMs.
[csp-qt/common_source_project-fm7.git] / source / src / vm / pc8201 / cmt.h
1 /*
2         NEC PC-8201 Emulator 'ePC-8201'
3
4         Author : Takeda.Toshiya
5         Date   : 2013.04.22-
6
7         [ cmt (record only) ]
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_SOD     1
19
20 // max 256kbytes
21 #define BUFFER_SIZE     0x40000
22
23 class CMT : public DEVICE
24 {
25 private:
26         FILEIO* fio;
27         bool is_wav, rec, remote;
28         _TCHAR rec_file_path[_MAX_PATH];
29         int bufcnt;
30         uint8_t buffer[BUFFER_SIZE];
31         int prev_signal;
32         uint32_t prev_clock;
33         
34         void write_buffer(uint8_t value, int samples);
35         void put_signal();
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 rec_tape(const _TCHAR* file_path);
53         void close_tape();
54         bool is_tape_inserted()
55         {
56                 return rec;
57         }
58         bool is_tape_playing()
59         {
60                 return false;
61         }
62         bool is_tape_recording()
63         {
64                 return rec && remote;
65         }
66         int get_tape_position()
67         {
68                 return 0;
69         }
70 };
71
72 #endif
73