Mail Archives: djgpp/1997/04/22/10:06:39
Can somebody please help ? I am attempting to implement my own keyboard
handler and I cannot get it to work. My system either crashes or locks
up. As this is my first attempt at such things, I don't know where I am
going wrong.
If you can help me out, or suggest some links that might help, please do.
My code is outlined below...
..
..
void OldKeyISR(); // For old handler
void NewKeyISR(); // For new handler
_go32_dpmi_seginfo Old_Handler,New_Handler;
int Key;
..
..
void NewKeyISR()
{
asm("
sti
inb $0x60,%%al
xorb %%ah,%%ah
movw %%ax,_Key
inb $0x61,%%al
orb $0x82,%%al
outb %%al,$0x61
andb $0x7f,%%al
outb %%al,$0x61
movb $0x20,%%al
outb %%al,$0x20"
: // no output registers
: // no input registers
: "%eax"
);
// KEYPRESS PROCESSED HERE
}
void InstallKeyboard()
{
New_Handler.pm_offset = (long unsigned int)NewKeyISR;
New_Handler.pm_selector = _go32_my_cs();
_go32_dpmi_allocate_iret_wrapper(&New_Handler);
_go32_dpmi_get_protected_mode_interrupt_vector(0x09,&Old_Handler);
_go32_dpmi_set_protected_mode_interrupt_vector(0x09,&New_Handler);
}
void RemoveKeyboard()
{
_go32_dpmi_set_protected_mode_interrupt_vector(0x09,&Old_Handler);
}
Any suggestions ???
Thanks,
Andy
Andy - cc505870 AT ntu DOT ac DOT uk
- Raw text -