BBS: Inland Empire Archive Date: 07-08-92 (05:51) Number: 278 From: RAY CARSON Refer#: NONE To: MARK BUTLER Recvd: NO Subj: PEEKs n' POKEs Conf: (2) Quik_Bas
Here is code using PEEK with the keyboard buffer, I didn't see it on the fine list you recently posted. On my system the arrow keys on the keypad and the arrow keys on the inverted "T" have different scan codes, I am wondering if others are the same. This code will display any difference. COLOR 7, 0: CLS COLOR 14, 0 LOCATE 25, 27 PRINT "Press <Esc> twice to Exit"; COLOR 7, 0 LOCATE 2, 13 PRINT "Press any Key or Key Combination for the ASCII value."; COLOR 2, 0 LOCATE 3, 13 PRINT "Values for extended Keys will be displayed in green."; COLOR 7, 0 LOCATE 5, 25: PRINT " Scan Codes"; LOCATE 6, 25: PRINT "ASCII Length #1 #2 "; LOCATE 7, 25: PRINT "------ ------ ---- ----"; LOCATE 23, 25: PRINT "------------------------------"; VIEW PRINT 8 TO 22 DO DO Keycode$ = INKEY$ LOOP UNTIL LEN(Keycode$) IF LEN(Keycode$) = 2 THEN Keycode = ASC(RIGHT$(Keycode$, 1)) KeycodeLength = 2 COLOR 2, 0 ELSE Keycode = ASC(Keycode$) KeycodeLength = 1 COLOR 7, 0 END IF DEF SEG = &H40 Tail = PEEK(26) Tail = Tail - 2 IF Tail < 30 THEN Tail = 60 ScanCode1 = PEEK(Tail) ScanCode2 = PEEK(Tail + 1) DEF SEG IF Keycode = 27 THEN IF Count = 1 THEN EXIT DO ELSE Count = 1 END IF ELSE Count = 0 END IF LOCATE , 25: PRINT USING "###"; Keycode; LOCATE , 36: PRINT KeycodeLength; LOCATE , 45: PRINT USING "###"; ScanCode1; LOCATE , 51: PRINT USING "###"; ScanCode2 LOOP END --- T.A.G. 2.6c1 Standard * Origin: CSI Online - TagScan Alpha Site 2! (1:106/3198)
Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET