OSDN Git Service

[VM][STATE] Use namespace {VMNAME} to separate per VMs.
[csp-qt/common_source_project-fm7.git] / source / src / vm / mz5500 / keyboard.h
1 /*
2         SHARP MZ-5500 Emulator 'EmuZ-5500'
3
4         Author : Takeda.Toshiya
5         Date   : 2008.04.10 -
6
7         [ keyboard ]
8 */
9
10 #ifndef _KEYBOARD_H_
11 #define _KEYBOARD_H_
12
13 #include "../vm.h"
14 #include "../../emu.h"
15 #include "../device.h"
16
17 #define SIG_KEYBOARD_INPUT      0
18
19 class FIFO;
20
21 namespace MZ5500 {
22
23 class KEYBOARD : public DEVICE
24 {
25 private:
26         DEVICE *d_pio, *d_pic;
27         
28         void drive();
29         void process(int cmd);
30         
31         const uint8_t *key_stat;
32         const int32_t *mouse_stat;
33         FIFO *key_buf, *rsp_buf;
34         bool caps, kana, graph;
35         int dk, srk;    // to cpu
36         int dc, stc;    // from cpu
37         int send, recv;
38         int phase, timeout;
39         
40 public:
41         KEYBOARD(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
42         {
43                 set_device_name(_T("Keyboard"));
44         }
45         ~KEYBOARD() {}
46         
47         // common functions
48         void initialize();
49         void release();
50         void reset();
51         void write_signal(int id, uint32_t data, uint32_t mask);
52         void event_frame();
53         bool process_state(FILEIO* state_fio, bool loading);
54         
55         // unique functions
56         void set_context_pio(DEVICE* device)
57         {
58                 d_pio = device;
59         }
60         void set_context_pic(DEVICE* device)
61         {
62                 d_pic = device;
63         }
64         void key_down(int code);
65         void key_up(int code);
66         bool get_caps_locked()
67         {
68                 return caps;
69         }
70         bool get_kana_locked()
71         {
72                 return kana;
73         }
74 };
75
76 }
77 #endif