BBS: Inland Empire Archive Date: 03-16-92 (12:23) Number: 144 From: MICHAEL MALLEY Refer#: NONE To: MATT GLOVER Recvd: NO Subj: Caps Lock Conf: (2) Quik_Bas
MG>ie. I would like to be able to 1. Turn on Caps lock
MG> 2. Turn Off Caps lock
MG> 3. Lock Caps LOCK in either postion.
MG> 4. Get status of Caps Lock??
417H is the location for the keyboard flags, and bit 6 is the Caps lock
status. So to get the Caps status and toggle it, do this:
DEF SEG = 0
Caps% = PEEK(&H417)
'Bit 6 would be 64 since bits are numbered backwards starting with 7
' Bit Number
' 7 6 5 4 3 2 1 0
'128 64 32 16 8 4 2 1 <-- Values for each bit
IF Caps% AND 64 THEN
PRINT "Caps On"
ELSE
PRINT "Caps Off"
END IF
POKE &H417, Caps% XOR 64
DEF SEG
The following is the mapping of the all bits in this byte:
7 - Insert Key
6 - Caps Lock
5 - Num Lock
4 - Scroll Lock
3 - ALT
2 - CTRL
1 - Left Shift
0 - Right Shift
Hope this helps! :)
* SLMR 2.1a * *IT IS* documented, look after "For Internal Use Only."
--- Maximus 2.01wb
* Origin: UltraTech - Nashville, TN (615) 356-0453 {HST} (1:116/30)

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