私は割り込みやキーボードのハードウェア割り込み(割り込みDOS 9など)について学んでいます。 と私は矢印キー(左、右、上、下)を押すと、2つの連続した割り込みが存在することに気づいた。最初のものは 'Shift'ボタン割り込みで、もう1つは私が押した矢印キーです。矢印キーを押すと2つのキーボード割り込みが発生しますか? (int 09h)
私は、押したボタンのスキャンコードを促すためにキーボードの番号9割り込みを書き換えて設定しているので、気づいた。
たとえば、右矢印キーを押すと、「Shift」ボタンの割り込みが発生していることがわかります(画面には、scane code 42が表示されます)。右矢印キー)も割り込み(スキャンコード77)を送信します。
私の質問は、なぜこれが起こっているのですか?
int型9のための私のコード:
void interrupt interrupt_9_Implementation{
unsigned char scanCode;
asm{
in al, 60h // read the keyboard input from port 60h (96 Decimal) into al;
mov scanCode, al // save the keyboard input into 'scanCode' varaible
in al, 61h // read 8255 port 61h (97 Decimal) into al
or al, 128 // set the MSB - the keyboard acknowlege signal
out 61h, al // send the keyboard acknowlege signal from al
xor al, 128 // unset the MSB - the keyboard acknowlege signal
out 61h, al // send the keyboard acknowlege signal from al
}
if(128 > scanCode){ // if the button is being pressed or being released. if the button is being pressed then the MSb isn't set and therfore it must be smaller than 128
printf("You pressed key assigned scan code = %d\n", scanCode);
if(EscScanCode == scanCode)
EscPressed = _True;
else
printf("Press any key (almost)\n:");
}
// send EOI
asm{
mov al, 20h
out 20h, al
}
}
私は矢印キー(例えば、右矢印キー)を押した後、私は買ってあげる:
Press any key (almost)
:You pressed key assigned scan code = 42 // the 'shift' key scan code
Press any key (almost)
:You pressed key assigned scan code = 77 // the right arrow button scan code
は、これまでのところそれだけ起こっています矢印キーで。 「シフト」は押されていません。 Logitech Waveキーボードを使用しています。 http://www.win.tue.nl/~aeb/linux/kbd/scancodes-1.htmlによると