OSDN Git Service

[VM][WIP] Use namespace to devices per VMs.
[csp-qt/common_source_project-fm7.git] / source / src / vm / mz2500 / cmt.h
1 /*
2         SHARP MZ-80B Emulator 'EmuZ-80B'
3         SHARP MZ-2200 Emulator 'EmuZ-2200'
4         SHARP MZ-2500 Emulator 'EmuZ-2500'
5
6         Author : Takeda.Toshiya
7         Date   : 2006.12.04 -
8
9         [ cmt ]
10 */
11
12 #ifndef _CMT_H_
13 #define _CMT_H_
14
15 #include "../vm.h"
16 #include "../../emu.h"
17 #include "../device.h"
18
19 #define SIG_CMT_PIO_PA  0
20 #define SIG_CMT_PIO_PC  1
21 #define SIG_CMT_OUT     2
22 #define SIG_CMT_REMOTE  3
23 #define SIG_CMT_END     4
24 #define SIG_CMT_TOP     5
25
26 class DATAREC;
27
28 namespace MZ2500 {
29
30 class CMT : public DEVICE
31 {
32 private:
33         DEVICE* d_pio;
34         DATAREC *d_drec;
35         
36         uint8_t pa, pc;
37         bool play, rec;
38         bool now_play, now_rewind;
39         int register_id_frew;
40         int register_id_ffwd;
41         int register_id_fwd;
42         int register_id_stop;
43         int register_id_eject;
44 #ifndef _MZ80B
45         int register_id_apss;
46         bool now_apss;
47         bool now_apss_tmp;
48 #endif
49         int register_id_ipl;
50         
51         void fast_forward();
52         void fast_rewind();
53         void forward();
54         void stop();
55         
56 public:
57         CMT(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
58         {
59                 set_device_name(_T("CMT I/F"));
60         }
61         ~CMT() {}
62         
63         // common functions
64         void initialize();
65         void reset();
66         void write_signal(int id, uint32_t data, uint32_t mask);
67         void event_callback(int event_id, int err);
68         bool process_state(FILEIO* state_fio, bool loading);
69         
70         // unique function
71         void set_context_pio(DEVICE* device)
72         {
73                 d_pio = device;
74         }
75         void set_context_drec(DATAREC* device)
76         {
77                 d_drec = device;
78         }
79         void play_tape(bool value);
80         void rec_tape(bool value);
81         void close_tape();
82 };
83 }
84
85 #endif
86