|
|
1.1 root 1: //
2: // nono
1.1.1.4 root 3: // Copyright (C) 2020 nono project
4: // Licensed under nono-license.txt
1.1 root 5: //
6:
1.1.1.10 root 7: //
8: // X68k キーボード
9: //
10:
1.1 root 11: #pragma once
12:
13: #include "keyboard.h"
1.1.1.8 root 14: #include <array>
1.1 root 15:
1.1.1.12 root 16: class MFPDevice;
17: class SCCDevice;
18: class SysportDevice;
19:
1.1 root 20: class X68030Keyboard : public Keyboard
21: {
1.1.1.4 root 22: using inherited = Keyboard;
1.1.1.8 root 23:
24: // マウスステータスデータ
25: static const uint8 YUNFL = 0x80;
26: static const uint8 YOVFL = 0x40;
27: static const uint8 XUNFL = 0x20;
28: static const uint8 XOVFL = 0x10;
1.1.1.11 root 29: static const uint8 SW_R = 0x02;
30: static const uint8 SW_L = 0x01;
1.1.1.8 root 31:
1.1 root 32: public:
33: X68030Keyboard();
1.1.1.13 root 34: ~X68030Keyboard() override;
1.1 root 35:
1.1.1.12 root 36: bool Init() override;
37:
1.1.1.6 root 38: // シフト状態なら true を返す
39: bool IsShift() const override;
40:
1.1.1.2 root 41: // マウス入力
1.1.1.4 root 42: void MouseInput(int x, int y, bool rb, bool lb, bool mb) override;
43:
1.1.1.8 root 44: // マウスデータを VM に送信する MD 処理
45: void MouseSendStart() override;
46:
1.1.1.4 root 47: // ホストからの制御コマンド
48: void Command(uint32 data) override;
1.1 root 49:
1.1.1.6 root 50: // ホストからの Ready 通知
51: // (実際のハードウェアでは単にキーボードが待っている)
52: void Ready();
53:
1.1 root 54: private:
1.1.1.11 root 55: DECLARE_MONITOR_CALLBACK(MonitorUpdate);
56:
1.1.1.10 root 57: // キーボードの接続と取り外し
58: void MDConnect() override;
59: void MDDisconnect() override;
60:
1.1.1.6 root 61: // MD キーコードに変換
1.1.1.9 root 62: uint KeyToMDKey(uint keystat) const override;
1.1.1.2 root 63:
1.1.1.7 root 64: // キーを1つ処理する
65: void KeyInput(uint keystat) override;
1.1 root 66:
1.1.1.6 root 67: // キーイベントを登録(追加)する
68: void SendStart() override;
1.1 root 69:
1.1.1.7 root 70: // キーリピートイベント
1.1.1.16! root 71: void ReptCallback(Event *);
1.1.1.7 root 72:
1.1.1.8 root 73: // マウスイベント
1.1.1.16! root 74: void MouseCallback(Event *);
1.1.1.8 root 75:
1.1.1.6 root 76: // 変換テーブル
77: static const uint keycode2x68kkey_table[KC_max];
1.1 root 78:
1.1.1.7 root 79: // キーリピート開始時間
1.1.1.14 root 80: uint rept_delay_data {}; // 設定値
1.1.1.11 root 81: uint64 rept_delay {}; // [nsec]
1.1.1.7 root 82: // キーリピート間隔
1.1.1.14 root 83: uint rept_time_data {}; // 設定値
1.1.1.11 root 84: uint64 rept_time {}; // [nsec]
1.1.1.7 root 85: // キーリピートイベント
1.1.1.16! root 86: Event *rept_event {};
1.1.1.7 root 87: // リピートしている共通キーコード
88: uint rept_key {};
1.1.1.4 root 89:
90: // LED 暗さ (0 明るい <-> 3 暗い)
91: uint32 led_darkness {};
92:
93: // LED は以下の7つ。
94: // 0: かな
95: // 1: ローマ字
96: // 2: コード入力
97: // 3: CAPS
98: // 4: INS
99: // 5: ひらがな
100: // 6: 全角
101:
1.1.1.10 root 102: // マウス送信データ
103: std::array<uint8, 3> mouse_data {};
104:
1.1.1.12 root 105: MFPDevice *mfp {};
106: SCCDevice *scc {};
107: SysportDevice *sysport {};
108:
1.1.1.8 root 109: // マウスイベント
1.1.1.16! root 110: Event *mouse_event {};
1.1.1.8 root 111:
1.1.1.15 root 112: Monitor *monitor {};
1.1.1.11 root 113:
1.1 root 114: // X680x0 キーコード
115: static const uint NoKey = 0;
116: static const uint X68kKey_ESC = 0x01;
117: static const uint X68kKey_1 = 0x02;
118: static const uint X68kKey_2 = 0x03;
119: static const uint X68kKey_3 = 0x04;
120: static const uint X68kKey_4 = 0x05;
121: static const uint X68kKey_5 = 0x06;
122: static const uint X68kKey_6 = 0x07;
123: static const uint X68kKey_7 = 0x08;
124: static const uint X68kKey_8 = 0x09;
125: static const uint X68kKey_9 = 0x0a;
126: static const uint X68kKey_0 = 0x0b;
127: static const uint X68kKey_minus = 0x0c;
128: static const uint X68kKey_circum = 0x0d;
129: static const uint X68kKey_backslash = 0x0e;
130: static const uint X68kKey_BS = 0x0f;
131:
132: static const uint X68kKey_TAB = 0x10;
133: static const uint X68kKey_Q = 0x11;
134: static const uint X68kKey_W = 0x12;
135: static const uint X68kKey_E = 0x13;
136: static const uint X68kKey_R = 0x14;
137: static const uint X68kKey_T = 0x15;
138: static const uint X68kKey_Y = 0x16;
139: static const uint X68kKey_U = 0x17;
140: static const uint X68kKey_I = 0x18;
141: static const uint X68kKey_O = 0x19;
142: static const uint X68kKey_P = 0x1a;
143: static const uint X68kKey_at = 0x1b;
144: static const uint X68kKey_bracketleft = 0x1c;
145: static const uint X68kKey_enter = 0x1d;
146: static const uint X68kKey_A = 0x1e;
147: static const uint X68kKey_S = 0x1f;
148:
149: static const uint X68kKey_D = 0x20;
150: static const uint X68kKey_F = 0x21;
151: static const uint X68kKey_G = 0x22;
152: static const uint X68kKey_H = 0x23;
153: static const uint X68kKey_J = 0x24;
154: static const uint X68kKey_K = 0x25;
155: static const uint X68kKey_L = 0x26;
156: static const uint X68kKey_semicolon = 0x27;
157: static const uint X68kKey_colon = 0x28;
158: static const uint X68kKey_bracketright = 0x29;
159: static const uint X68kKey_Z = 0x2a;
160: static const uint X68kKey_X = 0x2b;
161: static const uint X68kKey_C = 0x2c;
162: static const uint X68kKey_V = 0x2d;
163: static const uint X68kKey_B = 0x2e;
164: static const uint X68kKey_N = 0x2f;
165:
166: static const uint X68kKey_M = 0x30;
167: static const uint X68kKey_comma = 0x31;
168: static const uint X68kKey_period = 0x32;
169: static const uint X68kKey_slash = 0x33;
170: static const uint X68kKey_underscore = 0x34;
171: static const uint X68kKey_space = 0x35;
172: static const uint X68kKey_HOME = 0x36;
173: static const uint X68kKey_DEL = 0x37;
174: static const uint X68kKey_ROLLUP = 0x38;
175: static const uint X68kKey_ROLLDOWN = 0x39;
176: static const uint X68kKey_UNDO = 0x3a;
177: static const uint X68kKey_left = 0x3b;
178: static const uint X68kKey_up = 0x3c;
179: static const uint X68kKey_right = 0x3d;
180: static const uint X68kKey_down = 0x3e;
181: static const uint X68kKey_PAD_CLR = 0x3f;
182:
183: static const uint X68kKey_PAD_divide = 0x40;
184: static const uint X68kKey_PAD_multiply = 0x41;
185: static const uint X68kKey_PAD_minus = 0x42;
186: static const uint X68kKey_PAD_7 = 0x43;
187: static const uint X68kKey_PAD_8 = 0x44;
188: static const uint X68kKey_PAD_9 = 0x45;
189: static const uint X68kKey_PAD_plus = 0x46;
190: static const uint X68kKey_PAD_4 = 0x47;
191: static const uint X68kKey_PAD_5 = 0x48;
192: static const uint X68kKey_PAD_6 = 0x49;
193: static const uint X68kKey_PAD_equal = 0x4a;
194: static const uint X68kKey_PAD_1 = 0x4b;
195: static const uint X68kKey_PAD_2 = 0x4c;
196: static const uint X68kKey_PAD_3 = 0x4d;
197: static const uint X68kKey_PAD_enter = 0x4e;
198: static const uint X68kKey_PAD_0 = 0x4f;
199:
200: static const uint X68kKey_PAD_comma = 0x50;
201: static const uint X68kKey_PAD_decimal = 0x51;
202: static const uint X68kKey_kigou = 0x52;
203: static const uint X68kKey_touroku = 0x53;
204: static const uint X68kKey_HELP = 0x54;
205: static const uint X68kKey_XF1 = 0x55;
206: static const uint X68kKey_XF2 = 0x56;
207: static const uint X68kKey_XF3 = 0x57;
208: static const uint X68kKey_XF4 = 0x58;
209: static const uint X68kKey_XF5 = 0x59;
210: static const uint X68kKey_kana = 0x5a;
211: static const uint X68kKey_romaji = 0x5b;
212: static const uint X68kKey_code = 0x5c;
213: static const uint X68kKey_CAPS = 0x5d;
214: static const uint X68kKey_INS = 0x5e;
215: static const uint X68kKey_hira = 0x5f;
216:
217: static const uint X68kKey_zenkaku = 0x60;
218: static const uint X68kKey_BREAK = 0x61;
219: static const uint X68kKey_COPY = 0x62;
220: static const uint X68kKey_F1 = 0x63;
221: static const uint X68kKey_F2 = 0x64;
222: static const uint X68kKey_F3 = 0x65;
223: static const uint X68kKey_F4 = 0x66;
224: static const uint X68kKey_F5 = 0x67;
225: static const uint X68kKey_F6 = 0x68;
226: static const uint X68kKey_F7 = 0x69;
227: static const uint X68kKey_F8 = 0x6a;
228: static const uint X68kKey_F9 = 0x6b;
229: static const uint X68kKey_F10 = 0x6c;
230:
231: static const uint X68kKey_SHIFT = 0x70;
232: static const uint X68kKey_CTRL = 0x71;
233: static const uint X68kKey_OPT1 = 0x72;
234: static const uint X68kKey_OPT2 = 0x73;
235: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.