OSDN Git Service

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