OSDN Git Service

[VM][WIP] Use namespace to devices per VMs.
[csp-qt/common_source_project-fm7.git] / source / src / vm / mz80k / keyboard.h
1 /*
2         SHARP MZ-80K/C Emulator 'EmuZ-80K'
3         SHARP MZ-1200 Emulator 'EmuZ-1200'
4
5         Author : Takeda.Toshiya
6         Date   : 2010.08.18-
7
8         [ keyboard ]
9 */
10
11 #ifndef _KEYBOARD_H_
12 #define _KEYBOARD_H_
13
14 #include "../vm.h"
15 #include "../../emu.h"
16 #include "../device.h"
17
18 #define SIG_KEYBOARD_COLUMN     0
19
20 namespace MZ80 {
21
22 class KEYBOARD : public DEVICE
23 {
24 private:
25         DEVICE *d_pio;
26         
27 #if defined(_MZ80K) || defined(_MZ1200)
28         uint8_t key_buf[256];
29 #endif
30         const uint8_t* key_stat;
31         uint8_t column;
32         bool kana;
33         void update_key();
34         
35 public:
36         KEYBOARD(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
37         {
38                 set_device_name(_T("Keyboard"));
39         }
40         ~KEYBOARD() {}
41         
42         // common functions
43         void initialize();
44         void write_signal(int id, uint32_t data, uint32_t mask);
45         void event_frame();
46         bool process_state(FILEIO* state_fio, bool loading);
47         
48         // unique functions
49         void set_context_pio(DEVICE* device)
50         {
51                 d_pio = device;
52         }
53         void key_down(int code);
54         bool get_caps_locked()
55         {
56 //              return caps;
57                 return true;
58         }
59         bool get_kana_locked()
60         {
61                 return kana;
62         }
63 };
64
65 }
66 #endif