OSDN Git Service

21883ea638b8941e86ea11532971958128589857
[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 class KEYBOARD : public DEVICE
22 {
23 private:
24         DEVICE *d_pio, *d_pic;
25         
26         void drive();
27         void process(int cmd);
28         
29         const uint8_t *key_stat;
30         const int32_t *mouse_stat;
31         FIFO *key_buf, *rsp_buf;
32         bool caps, kana, graph;
33         int dk, srk;    // to cpu
34         int dc, stc;    // from cpu
35         int send, recv;
36         int phase, timeout;
37         
38 public:
39         KEYBOARD(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
40         {
41                 set_device_name(_T("Keyboard"));
42         }
43         ~KEYBOARD() {}
44         
45         // common functions
46         void initialize();
47         void release();
48         void reset();
49         void write_signal(int id, uint32_t data, uint32_t mask);
50         void event_frame();
51         void decl_state();
52         void save_state(FILEIO* state_fio);
53         bool load_state(FILEIO* state_fio);
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 #endif