Category : BASIC Source Code
Archive   : QBFAQR01.ZIP
Filename : KEYCODE.DOC

 
Output of file : KEYCODE.DOC contained in archive : QBFAQR01.ZIP
===========================================================================
BBS: ® SMARTalec Toronto (416) 253-5900 ¯
Date: 02-24-92 (02:07) Number: 3015
From: DAVE NAVARRO Refer#: NONE
To: MARK THOMPSON Recvd: NO
Subj: ZF = Z Flag? Conf: (135) R-QBasic
---------------------------------------------------------------------------
Here is some PowerBASIC code to read a key from the keyboard (101 key
aware).

The "zero" flag us actually bit 7 of the "flags" register..

'GetKey - Check if a key is pending and return the key to your program
' Extended keyboard aware.

FUNCTION GetKey$ PUBLIC
REG 1, &HC000 'BIOS get configuration
CALL INTERRUPT &H15
DEF SEG=REG(9)
ExKy%=(PEEK(REG(2)+5) AND 16)=16 'returns true if extended KB
DEF SEG
IF ExKy% THEN Extended
REG 1, &H0100 'regular BIOS check key routine
CALL INTERRUPT &H16
IF (REG(0) AND 64)=64 THEN EXIT FUNCTION 'if zero flag then no key
REG 1, &H0000 'regular BIOS read key routine
CALL INTERRUPT &H16
K1%=REG(1) AND &HFF 'ASCII code in AL
K2%=(REG(1)\2 AND &H7FFF)\128 'scan code in AH
IF K1%=0 THEN
GetKey$=CHR$(0,K2%)
ELSE
GetKey$=CHR$(K1%)
END IF
EXIT FUNCTION
Extended:
REG 1, &H1100
CALL INTERRUPT &H16
IF (REG(0) AND 64)=64 THEN EXIT FUNCTION
REG 1, &H1000
CALL INTERRUPT &H16
K1%=REG(1) AND &HFF
K2%=(REG(1)\2 AND &H7FFF)\128
IF K1%=0 THEN
GetKey$=CHR$(0,K2%)
ELSEIF K1%=224 AND K2%>0 THEN
GetKey$=CHR$(0,K2%)
ELSE
GetKey$=CHR$(K1%)
END IF
END FUNCTION
---
þ OLX 2.1 þ çh­$ ç†gœ­üŠ m¦ë‰ Ÿâím â䇝‡œ‰ë $‡­­ ‡h†â ›çäâ$

PCRelay:ICEBOX -> #665 RelayNet (tm)
4.10 ÔÍ>THE ICEBOX BBSþ718.793.8548þNew Yorkþ


  3 Responses to “Category : BASIC Source Code
Archive   : QBFAQR01.ZIP
Filename : KEYCODE.DOC

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/