Mail Archives: djgpp/2000/04/09/22:44:39
On Fri, 07 Apr 2000 10:33:57 +0200, Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
wrote:
>Raymond Martineau wrote:
>>
>>
>> Under MS-DOS 7.0 (Windows 95 in Dos mode), I encounter keyboard
>> lockups when I quit a program compiled by a recent version of DJGPP.
>> When I either press or release a key during a split second window of
>> the program terminating, the keyboard completely locks up, and does
>> not respond.
>
>I have never seen such problems, and neither did anyone else complained about
>this, ever.
>
>If this phenomenon happens only in certain program(s) (as opposed to _all_
>DJGPP programs, including those you download from SimTel), I'd first suspect
>some subtle bug in the program.
From my testing with the bug, the smallest program size it could be
reproduced in is a medium sized program. One program in particular,
called QCCX (available at http://elohim.ai.mit.edu/qccx/) does not
have any visible code that hooks interrupts, and contains the problems
existing when compiled with GCC.
This bug also seems to be introduced in a later version of DJGPP. If
you compile Quake version 1.09, the problem may exist, but the
official binaries for version 1.08 (or any earlier version) do not
contain this problem.
>So please describe what does the affected program(s) do when they exit. For
>that matter, please describe the procedure to reproduce the problem (pressing
>a key during a split second sounds pretty tricky, especially on fast
>machines).
Except for the keyboard lock-up, the program will exit normally as if
the problem is not occurring. The computer itself does not freeze,
since I managed to load the program again while the keyboard was
frozen, and have the parent program (attached to this posting, QBASIC
source) fix the keyboard.
If you use Ctrl-C or Ctrl-Break to stop the program, you will receive
the standard response if the keyboard locks up (which is just a simple
register dump, which is independant of the problem.)
>
>Also, please elaborate what do you mean by ``Windows 95 in DOS mode''. Do
>you boot into plain DOS mode, without loading the GUI part of Windows, or do
>you switch to DOS Mode *from inside* Windows. Or maybe you run the program
>from the Windows DOS box?
Windows 95 in Dos mode is booting into Plain dos mode before the GUI
is loaded. Loading the GUI and opening a Dos window is not the same
as the environment, since it contains a protection system that
prevents the lock-up from occurring.
Anyway, I have a small Qbasic program that makes it easier to
reproduce this problem. I have only reproduced this on two out of
three computers I tested (The two were pentium class machines, the
third was a 486.) This program is designed to be used with two
specific programs: QCCX and Proqcc (available at
http://elohim.ai.mit.edu/qccx/ and
ftp://ftp.cdrom.com/pub/quake/utils/quakec/proqc160.zip respectivly.
Both are <110K downloads.)
' keyfix.bas by Raymond Martineau
'
' This program is designed to demonstrate and fix a keyboard lockup
' problem found in DJGPP. For this lockup to occurr, you must be in
' Full-Dos. You will not reproduce the problem if you are running
' Windows 95, since Windows 95 is capable of avoiding such problems by
' keeping control of the Keyboard Interrupt.
'
' This program requires Qbasic. If you do not have Qbasic, comments
' have been placed in this program to help interpret the activity.
'
' A good chance of reproducing the problem is to either type rapidly
' when the program is quitting, or by quickly hitting and releasing
' Ctrl-C. You may need to vary the speed slightly to get the desired
' result.
DEFINT A-Z
DIM a AS SINGLE
PRINT "Running program"
' The first loop will make ten passes at running the program. These
' ten passes make it fairly easy to reproduce the error, but
' reproducing the problem early will cause you to wait some time.
' The program in this loop is Qccx, a quake-c compiler, is available
' at http://elohim.ai.mit.edu/qccx/
'
' You may also use Proqcc, where the keyboard lockup is slightly
' easier to reprocuce by pressing Ctrl-C. Proqcc is located at
' ftp://ftp.cdrom.com/pub/quake/utils/quakec/proqc160.zip
'
' You will need source code for these compilers. You can have them
' compile the Threewave CTF which is available at
'
ftp://ftp.cdrom.com/pub/quake/planetquake/threewave/ctf/server/3wave41.zip
FOR x = 1 TO 10
SHELL "qccx.exe"
NEXT
' This section will check if the keyboard is working.
PRINT "Press a key"
a = TIMER
WHILE (TIMER - a < 10 AND fl = 0)
b$ = INKEY$: IF b$ <> "" THEN PRINT b$: fl = 1
WEND
IF fl = 0 THEN
PRINT "Fixing keyboard"
' Since the keyboard is not working, it needs to be fixed.
' This section of the code tells the keyboard that the key has
' just been read. The keyboard will no longer worry about the
' the current event, and proceed to the next one.
al = INP(&H60)
al = INP(&H61)
al = al OR &H80
OUT &H61, al
al = al AND &H7F
OUT &H61, al
OUT &H20, &H20
'The DJGPP equivalany for the above procedure is the following:
' int a;
' a=inportb(0x60);
' a=inportb(0x61) | 0x80;
' outportb(0x61,a);
' outportb(0x6a,a & 0x7f);
' outportb(0x20, 0x20);
PRINT "Press a key"
a! = TIMER
' Make another attempt. If it fails, it is probably due to a
' non-standard keyboard, or for some other reason.
WHILE (TIMER - a < 10 AND fl = 0)
b$ = INKEY$: IF b$ <> "" THEN PRINT b$: fl = 1
WEND
IF fl = 0 THEN PRINT "Keyboard is jammed. Sorry."
END IF
--
Raymond Martineau - dynamo_tamarin AT yahoo DOT com
Frik-TF 0.09 Beta 2: http://www.ncf.ca/~bk039/index.htm
- Raw text -