OSDN Git Service

[General] Merge from upstream version, 2015-01-28.
[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         uint8 *key_stat;
30         int *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* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu) {}
40         ~KEYBOARD() {}
41         
42         // common functions
43         void initialize();
44         void release();
45         void reset();
46         void write_signal(int id, uint32 data, uint32 mask);
47         void event_frame();
48         void save_state(FILEIO* state_fio);
49         bool load_state(FILEIO* state_fio);
50         
51         // unique functions
52         void set_context_pio(DEVICE* device)
53         {
54                 d_pio = device;
55         }
56         void set_context_pic(DEVICE* device)
57         {
58                 d_pic = device;
59         }
60         void key_down(int code);
61         void key_up(int code);
62 };
63
64 #endif