- Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathkeyboard.cpp
More file actions
Latest commit
74 lines (68 loc) · 2.01 KB
/
Copy pathkeyboard.cpp
File metadata and controls
74 lines (68 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#include"keyboard.h"
Keyboard::Keyboard()
{
}
charKeyboard::GetKeyCharacter(constunsignedchar code)
{
switch(code)
{
caseKEYS::A: return'A';
caseKEYS::B: return'B';
caseKEYS::C: return'C';
caseKEYS::D: return'D';
caseKEYS::E: return'E';
caseKEYS::F: return'F';
caseKEYS::G: return'G';
caseKEYS::H: return'H';
caseKEYS::I: return'I';
caseKEYS::J: return'J';
caseKEYS::K: return'K';
caseKEYS::L: return'L';
caseKEYS::M: return'M';
caseKEYS::N: return'N';
caseKEYS::O: return'O';
caseKEYS::P: return'P';
caseKEYS::Q: return'Q';
caseKEYS::R: return'R';
caseKEYS::S: return'S';
caseKEYS::T: return'T';
caseKEYS::U: return'U';
caseKEYS::V: return'V';
caseKEYS::W: return'W';
caseKEYS::X: return'X';
caseKEYS::Y: return'Y';
caseKEYS::Z: return'Z';
caseKEYS::_1: return'1';
caseKEYS::_2: return'2';
caseKEYS::_3: return'3';
caseKEYS::_4: return'4';
caseKEYS::_5: return'5';
caseKEYS::_6: return'6';
caseKEYS::_7: return'7';
caseKEYS::_8: return'8';
caseKEYS::_9: return'9';
caseKEYS::_0: return'0';
caseKEYS::SPACE: return'';
caseKEYS::OPEN_BRACKET: return'[';
caseKEYS::CLOSE_BRACKET: return']';
caseKEYS::COMMA: return',';
caseKEYS::DOT: return'.';
caseKEYS::SEMICOLON: return';';
caseKEYS::FORWARD_SLASH: return'/';
caseKEYS::SLASH: return'\\';
default: return0;
}
}
charKeyboard::GetInput()
{
char key = 0;
asmvolatile("inb %1, %0" : "=a" (key) : "d" (Addresses::keyboard_port));
if(key == KEYS::ENTER)
{
return'\n';
}
else
{
returnthis->GetKeyCharacter(key);
}
}