delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1992/03/26/01:19:44

Via: louis.ecs.soton.ac.uk; Wed, 25 Mar 92 10:45:27 GMT
From: Berrington N <N DOT Berrington AT ecs DOT southampton DOT ac DOT uk>
Subject: Bios problem
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Date: Wed, 25 Mar 92 10:50:11 GMT
Status: O

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.

All machines I tested it on were running MS-DOS 5. Any suggestions as to what's
happening?

Neil.

-- 
Neil Berrington                  Phone: 0703 593116  FAX: 0703 593045
UK:     nb88r AT uk DOT ac DOT soton DOT ecs    Dept. of Electronics and  Computer Science,
World:  nb88r AT ecs DOT soton DOT ac DOT uk    Mountbatten Building, Room 411,  Highfield,
                                 The University of Southampton, S09 5NH, UK.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019