OSDN Git Service

[VM][STATE] Use namespace {VMNAME} to separate per VMs.
[csp-qt/common_source_project-fm7.git] / source / src / vm / pc9801 / cmt.h
1 /*
2         NEC PC-9801 Emulator 'ePC-9801'
3         NEC PC-9801E/F/M Emulator 'ePC-9801E'
4
5         Author : Takeda.Toshiya
6         Date   : 2011.04.08-
7
8         [ cmt ]
9 */
10
11 #ifndef _CMT_H_
12 #define _CMT_H_
13
14 #include "../vm.h"
15 #include "../../emu.h"
16 #include "../device.h"
17
18 #define SIG_CMT_OUT     0
19 #define SIG_CMT_TXRDY   1
20 #define SIG_CMT_RXRDY   2
21 #define SIG_CMT_TXEMP   3
22
23 // max 256kbytes
24 #define BUFFER_SIZE     0x40000
25
26 namespace PC9801 {
27
28 class CMT : public DEVICE
29 {
30 private:
31         DEVICE* d_sio;
32         
33         FILEIO* fio;
34         int bufcnt;
35         uint8_t buffer[BUFFER_SIZE];
36         bool play, rec, remote;
37         
38         void release_tape();
39         
40 public:
41         CMT(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
42         {
43                 set_device_name(_T("CMT I/F"));
44         }
45         ~CMT() {}
46         
47         // common functions
48         void initialize();
49         void release();
50         void reset();
51         void write_io8(uint32_t addr, uint32_t data);
52         void write_signal(int id, uint32_t data, uint32_t mask);
53         bool process_state(FILEIO* state_fio, bool loading);
54         
55         // unique functions
56         void set_context_sio(DEVICE* device)
57         {
58                 d_sio = device;
59         }
60         void play_tape(const _TCHAR* file_path);
61         void rec_tape(const _TCHAR* file_path);
62         void close_tape();
63         bool is_tape_inserted()
64         {
65                 return (play || rec);
66         }
67 };
68
69 }
70 #endif
71