Article View: comp.os.msdos.programmer
Article #714Re: How to test for a key ALREADY pressed?
From: Hermann Schmidt
Date: Wed, 08 Apr 1992 07:07
Date: Wed, 08 Apr 1992 07:07
47 lines
1563 bytes
1563 bytes
These few lines of assembler do the job. First, the keyboard status is checked; if there is a keycode the program reads the code and return the ascii portion, 0 otherwise. Does not work with function keys because they generate an ascii value of 0 and can only be distinguished by the scan code. (Yes, I know, not much changes necessary, but I didn't need that feature :-). Feed the following lines into debug (debug < file). (Emtpy lines are intended - Don't leave them out.) ---cut here a XOR AL,AL MOV AH,01 INT 16 JNZ 010C XOR AL,AL JMP 0110 XOR AX,AX INT 16 MOV AH,4C INT 21 w ntestkey.com rcx 14 w q --- cut here If you run testkey.com in a batch file and test for errorlevel 1 any key pressed at that time makes the condition become true. Example: rem begin of autoexec.bat echo press any key if you don't like to run WINDOZE . [stuff that takes some time to run] . testkey if errorlevel 1 goto no_win win :no_win :end
Technical Details
Message-ID:
<1992Apr8.070721.25202@Informatik.TU-Muenchen.DE>Path:
arc1-ca.pugleaf.net!sparky!uunet!math.fu-berlin.de!NewsServ!schmiherReferences:
<rqjbpINNiqv@matt.ksu.ksu.edu> <1992Apr7.205732.21831@uwasa.fi>Show Full Headers
Complete Article Headers
Newsgroups: comp.os.msdos.programmer Path: arc1-ca.pugleaf.net!sparky!uunet!math.fu-berlin.de!NewsServ!schmiher From: schmiher@Informatik.TU-Muenchen.DE (Hermann Schmidt) Subject: Re: How to test for a key ALREADY pressed? References: <rqjbpINNiqv@matt.ksu.ksu.edu> <1992Apr7.205732.21831@uwasa.fi> Originator: schmiher@hphalle7c.informatik.tu-muenchen.de Sender: news@Informatik.TU-Muenchen.DE (USENET Newssystem) Organization: Technische Universitaet Muenchen, Germany Date: Wed, 8 Apr 1992 07:07:21 GMT Message-ID: <1992Apr8.070721.25202@Informatik.TU-Muenchen.DE> Lines: 47