DEFINT A-Z '*** Made by Tim Kostka. If you have any questions or comments, please feel ' free to contact me at 'dkostka@salsgiver.com' or 'dbaggio@geocities.com' '*** This is a program that demonstrates the use of the KeyOnn sub '*** Declare the sub DECLARE SUB KeyOnn (InsKey%, CapKey%, NumKey%, ScrKey%, AltKey%, CtrKey%, LSfKey%, RSfKey%) '*** Clear the screen and hide the cursor CLS LOCATE , , 0 '*** Start of the main loop DO '*** Get the last key pressed Hi$ = INKEY$ '*** Call the sub CALL KeyOnn(InsKey, CapKey, NumKey, ScrKey, AltKey, CtrKey, LSfKey, RSfKey) '*** Print out the returned data LOCATE 1, 1: PRINT "Insert:", , InsKey; LOCATE 2, 1: PRINT "Capitals Lock:", CapKey; LOCATE 3, 1: PRINT "Number Lock:", , NumKey; LOCATE 4, 1: PRINT "Scroll Lock:", , ScrKey; LOCATE 5, 1: PRINT "Alternate:", , AltKey; LOCATE 6, 1: PRINT "Control:", , CtrKey; LOCATE 7, 1: PRINT "Left Shift:", , LSfKey; LOCATE 8, 1: PRINT "Right Shift:", , RSfKey; '*** End the loop when the user presses Esc LOOP UNTIL Hi$ = CHR$(27) '*** End the program END DEFINT A-Z SUB KeyOnn (InsKey%, CapKey%, NumKey%, ScrKey%, AltKey%, CtrKey%, LSfKey%, RSfKey%) DEF SEG = 0: KeySts% = PEEK(1047) InsKey% = 0: NumKey% = 0: CapKey% = 0: ScrKey% = 0 RSfKey% = 0: LSfKey% = 0: CtrKey% = 0: AltKey% = 0 IF KeySts% >= 128 THEN KeySts% = KeySts% - 128: InsKey% = 1 IF KeySts% >= 64 THEN KeySts% = KeySts% - 64: CapKey% = 1 IF KeySts% >= 32 THEN KeySts% = KeySts% - 32: NumKey% = 1 IF KeySts% >= 16 THEN KeySts% = KeySts% - 16: ScrKey% = 1 IF KeySts% >= 8 THEN KeySts% = KeySts% - 8: AltKey% = 1 IF KeySts% >= 4 THEN KeySts% = KeySts% - 4: CtrKey% = 1 IF KeySts% >= 2 THEN KeySts% = KeySts% - 2: LSfKey% = 1 IF KeySts% >= 1 THEN KeySts% = KeySts% - 1: RSfKey% = 1 END SUB