OSDN Git Service

[VM][STATE] Use namespace {VMNAME} to separate per VMs.
[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 namespace PC6001 {
27
28 class SUB : public DEVICE
29 {
30 private:
31         DEVICE *d_pio, *d_drec, *d_timer;
32         const uint8_t* key_stat;
33         int p1_out, p2_in;
34         bool drec_in, rxrdy_in;
35         bool update_key;
36         
37         FILEIO* fio;
38         bool rec, is_wav, is_p6t;
39         _TCHAR rec_file_path[_MAX_PATH];
40         int prev_command, baud, index;
41         bool skip;
42         uint8_t buffer[0x10000];
43         
44 public:
45         SUB(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
46         {
47                 set_device_name(_T("Sub System"));
48         }
49         ~SUB() {}
50         
51         // common functions
52         void initialize();
53         void release();
54         void reset();
55         void write_io8(uint32_t addr, uint32_t data);
56         uint32_t read_io8(uint32_t addr);
57         uint32_t get_intr_ack();
58         void event_frame();
59         void event_callback(int event_id, int err);
60         void write_signal(int id, uint32_t data, uint32_t mask);
61         bool process_state(FILEIO* state_fio, bool loading);
62         
63         // unique functions
64         void set_context_pio(DEVICE* device)
65         {
66                 d_pio = device;
67         }
68         void set_context_drec(DEVICE* device)
69         {
70                 d_drec = device;
71         }
72         void set_context_timer(DEVICE* device)
73         {
74                 d_timer = device;
75         }
76         bool rec_tape(const _TCHAR* file_path);
77         void close_tape();
78         bool is_tape_inserted()
79         {
80                 return rec;
81         }
82 };
83
84 }
85 #endif