Mail Archives: djgpp/1992/03/26/08:19:44
>
> Whilst porting a lisp system to the PC using release 1.05 I wrote a routine
> to periodically poll the keyboard whilst evaulating expressions so that the
> user can abort from infinite loops.
>
> I wrote a boiskey routine similar to that defined in Turbo C:
>
> #include <dos.h>
>
> int bioskey(int cmd)
> {
> union REGS in, out;
> in.h.ah = cmd;
> in.h.al = 0;
> int86(0x16,&in,&out);
> return out.h.al;
^^^^^^^^^^^^^^^^
> }
>
> The code to poll the keyboard is as follows:
>
> if (bioskey(1))
^^^^^^^^^^
> if (bioskey(0) == CONTROL_Q)
> abort_eval(2);
>
>
> The problem is it doesn't work on all machines. I've tried it on an HP vectra,
> which works fine, and a Compaq Despro 386 and Toshiba T5100, both of which
> don't work. The bioskey(1) call should just poll the keyboard and return
> true if a key is pressed, but on the Compaq and Tosh it waits for a key press.
This is not safe. If you look at interXX (*THE* PC interrupts description by
Ralph Brown), you will see, that subfunctions 1 and 11h give back if or not
there's a keystroke pending in the Zero flag or something. So you have to do a
case switching between subfunctions 1/11h and others.
The TC bios functions do this, too. I've examined them with TDebug once upon a
time... I have written some assembler routines for gas to do this task. I'll
send them to you, if you want me to.
> All machines I tested it on were running MS-DOS 5. Any suggestions as to what's
> happening?
This is not a question of DOS, as you directly access (ROM-)BIOS by calling
INT 16h.
- Thomas
greve AT rs1 DOT thch DOT uni-bonn DOT de
greve AT boss1 DOT physik DOT uni-bonn DOT de
greve AT pib1 DOT physik DOT uni-bonn DOT de
unt145 AT dbnrhrz1
- Raw text -