Alt Ctrl Shifts
code to detect the press of those keys.

You can read address 1047 at segment 0:

' Shifts, Ctrls and Alts by Na_th_an
' Note that in most keyboards you can press and detect the 4 keys at
' the same time. I used to use this stuff for games (that way I didn't
' need a keyboard handler). Ideal for jump'n run (IE: CTRL left, ALT right
' and SHIFTs jump). Enjoy!

DEF SEG = 0
CLS
LOCATE 1, 1: PRINT "HIT ESC TO EXIT. PLAY WITH SHIFTs, ALT and CTRL."
DO WHILE INKEY$ <> CHR$(27)

IF PEEK(1047) AND 1 THEN
LOCATE 2, 2: PRINT "RIGHT SHIFT"
ELSE
LOCATE 2, 2: PRINT " "
END IF

IF PEEK(1047) AND 2 THEN
LOCATE 3, 2: PRINT "LEFT SHIFT"
ELSE
LOCATE 3, 2: PRINT " "
END IF

IF PEEK(1047) AND 4 THEN
LOCATE 5, 2: PRINT "CTRL"
ELSE
LOCATE 5, 2: PRINT " "
END IF

IF PEEK(1047) AND 8 THEN
LOCATE 4, 2: PRINT "ALT"
ELSE
LOCATE 4, 2: PRINT " "
END IF

LOOP


complete list:

bit 7: insert (AND 128)
bit 6: caps lock (AND 64)
bit 5: num lock (AND 32)
bit 4: scroll lock (AND 16)
bit 3: Alt (AND 8 )
bit 2: Ctrl (AND 4)
bit 1: right shift (AND 2)
bit 0: left shift (AND 1)

FAQ updated ;) nathe


AltCtrlShifs - page last edited 2003-12-31 05:53:02 by 81.203.196.133 (home) (edit)
Blast WIKI - by RoboticBoy - edited and tweaked for our evil purposes by Hexadecimal Disaster