news@laas.laas.fr (USENET News System) (12/08/89)
Hi netlanders !
I have a problem : I am trying to write a small interrupt
handler, in order to get a vga 800x600 screen hardcopy when
hitting the ALT+SYSRQ keys on my AT-386 keyboard (AMI Bios).
In such a situation, I know the 15H interrupt is called, with
85H in the AX register. The following program install a small driver,
executing a delay loop while ALT-SYSRQ is pressed (It's a Turbo-C
and assembler version).
It works fine, but if I increase the delay (WAIT=2000), the system
hangs up on return (The keyboard is no more operant).
I think the problem is related to some other events occuring while
the handler is executed (timer ?), but inserting a STI instruction
before the loop in order to re-enable interrupts doesn't work...
Any idea ? Thanks !
/*--------------------- START OF LISTING -----------------------*/
#include <dos.h>
#define WAIT 20 /* FAIL IF 2000... */
/*****************************************************/
/* 0x15 INTERRUPT HANDLER, CALLED WHEN SYSRQ PRESSED */
/*****************************************************/
void interrupt my_driver(void)
{
asm cmp ah,85H /* ALT-SYSRQ ? */
asm jne end
asm mov cx,WAIT
q1:
asm mov ax,WAIT /* IF PRESSED, */
q2: /* WAIT FOR A WHILE */
asm dex ax
asm jne q2
asm loop q1
end:
asm nop /* AND RETURN TO CALLER */
}
/*****************************************************/
/* MAIN PROGRAM: INSTALL HANDLER AND STAY RESIDENT */
/*****************************************************/
main()
{
setvect(0x15,my_driver);
keep(0,100);
}