OSDN Git Service

[General] Tracking to upstream, rev 2015-01-14.
[csp-qt/common_source_project-fm7.git] / source / src / vm / pc6001 / sub.h
1 /*\r
2         NEC PC-6001 Emulator 'yaPC-6001'\r
3         NEC PC-6001mkII Emulator 'yaPC-6201'\r
4         NEC PC-6001mkIISR Emulator 'yaPC-6401'\r
5         NEC PC-6601 Emulator 'yaPC-6601'\r
6         NEC PC-6601SR Emulator 'yaPC-6801'\r
7 \r
8         Author : Takeda.Toshiya\r
9         Date   : 2014.05.24-\r
10 \r
11         [ sub cpu ]\r
12 */\r
13 \r
14 #ifndef _SUB_H_\r
15 #define _SUB_H_\r
16 \r
17 #include "../vm.h"\r
18 #include "../../emu.h"\r
19 #include "../device.h"\r
20 \r
21 #define SIG_SUB_DATAREC 0\r
22 #define SIG_SUB_RXRDY   1\r
23 \r
24 class FILEIO;\r
25 \r
26 class SUB : public DEVICE\r
27 {\r
28 private:\r
29         DEVICE *d_pio, *d_drec, *d_timer;\r
30         uint8* key_stat;\r
31         int p1_out, p2_in;\r
32         bool drec_in, rxrdy_in;\r
33         bool update_key;\r
34         \r
35         FILEIO* fio;\r
36         bool rec, is_wav, is_p6t;\r
37         int prev_command, baud, index;\r
38         bool skip;\r
39         uint8 buffer[0x10000];\r
40         \r
41 public:\r
42         SUB(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu) {}\r
43         ~SUB() {}\r
44         \r
45         // common functions\r
46         void initialize();\r
47         void release();\r
48         void reset();\r
49         void write_io8(uint32 addr, uint32 data);\r
50         uint32 read_io8(uint32 addr);\r
51         uint32 intr_ack();\r
52         void event_frame();\r
53         void event_callback(int event_id, int err);\r
54         void write_signal(int id, uint32 data, uint32 mask);\r
55         \r
56         // unique functions\r
57         void set_context_pio(DEVICE* device)\r
58         {\r
59                 d_pio = device;\r
60         }\r
61         void set_context_drec(DEVICE* device)\r
62         {\r
63                 d_drec = device;\r
64         }\r
65         void set_context_timer(DEVICE* device)\r
66         {\r
67                 d_timer = device;\r
68         }\r
69         bool rec_tape(_TCHAR* file_path);\r
70         void close_tape();\r
71         bool tape_inserted()\r
72         {\r
73                 return rec;\r
74         }\r
75 };\r
76 #endif\r