1080 |
* %al = ASCII character |
* %al = ASCII character |
1081 |
*/ |
*/ |
1082 |
|
|
1083 |
|
/* this table is used in translate_keycode below */ |
1084 |
|
translation_table: |
1085 |
|
.word PUPA_CONSOLE_KEY_LEFT, 2 |
1086 |
|
.word PUPA_CONSOLE_KEY_RIGHT, 6 |
1087 |
|
.word PUPA_CONSOLE_KEY_UP, 16 |
1088 |
|
.word PUPA_CONSOLE_KEY_DOWN, 14 |
1089 |
|
.word PUPA_CONSOLE_KEY_HOME, 1 |
1090 |
|
.word PUPA_CONSOLE_KEY_END, 5 |
1091 |
|
.word PUPA_CONSOLE_KEY_DC, 4 |
1092 |
|
.word PUPA_CONSOLE_KEY_BACKSPACE, 8 |
1093 |
|
.word PUPA_CONSOLE_KEY_PPAGE, 7 |
1094 |
|
.word PUPA_CONSOLE_KEY_NPAGE, 3 |
1095 |
|
.word 0 |
1096 |
|
|
1097 |
|
/* |
1098 |
|
* translate_keycode translates the key code %dx to an ascii code. |
1099 |
|
*/ |
1100 |
|
.code16 |
1101 |
|
|
1102 |
|
translate_keycode: |
1103 |
|
pushw %bx |
1104 |
|
pushw %si |
1105 |
|
|
1106 |
|
movw $ABS(translation_table), %si |
1107 |
|
|
1108 |
|
1: lodsw |
1109 |
|
/* check if this is the end */ |
1110 |
|
testw %ax, %ax |
1111 |
|
jz 2f |
1112 |
|
/* load the ascii code into %ax */ |
1113 |
|
movw %ax, %bx |
1114 |
|
lodsw |
1115 |
|
/* check if this matches the key code */ |
1116 |
|
cmpw %bx, %dx |
1117 |
|
jne 1b |
1118 |
|
/* translate %dx, if successful */ |
1119 |
|
movw %ax, %dx |
1120 |
|
|
1121 |
|
2: popw %si |
1122 |
|
popw %bx |
1123 |
|
ret |
1124 |
|
|
1125 |
|
.code32 |
1126 |
|
|
1127 |
FUNCTION(pupa_console_getkey) |
FUNCTION(pupa_console_getkey) |
1128 |
pushl %ebp |
pushl %ebp |
1129 |
|
|
1133 |
int $0x16 |
int $0x16 |
1134 |
|
|
1135 |
movw %ax, %dx /* real_to_prot uses %eax */ |
movw %ax, %dx /* real_to_prot uses %eax */ |
1136 |
|
call translate_keycode |
1137 |
|
|
1138 |
DATA32 call real_to_prot |
DATA32 call real_to_prot |
1139 |
.code32 |
.code32 |
1140 |
|
|