Subject: Capslock status and toggling 77. ***** Q: How do I detect the CapsLock status, how do I turn it on/off? A: Here are the relevant Turbo Pascal routines in answer to these questions. {} Uses Dos; { The Dos unit is needed } {} (* Is CapsLock on *) function CAPSONFN : boolean; var regs : registers; KeyStatus : byte; begin FillChar (regs, SizeOf(regs), 0); regs.ax := $0200; { Get shift flags } Intr ($16, regs); { The keyboard interrupt } KeyStatus := regs.al; { AL = shift status bits } if (KeyStatus and $40) > 0 then { bit 6 } capsonfn := true else capsonfn := false; end; (* capsonfn *) {} (* Set CapsLock. Use true to turn on, false to turn off *) procedure CAPS (TurnOn : boolean); var keyboardStatus : byte absolute $0040:$0017; regs : registers; begin if TurnOn then keyboardStatus := keyboardStatus or $40 else keyboardStatus := keyboardStatus and $BF; { Interrrupt "check for keystroke" to ensure the LED status } FillChar (regs, SizeOf(regs), 0); regs.ah := $01; Intr ($16, regs); end; (* caps *) {} As you see, CapsLock is indicated by bit 6. The other toggles can be handled in an equivalent way using this information about the memory location Mem[$0040:$0017]: ScrollLock = bit 4 $10 $EF NumLock = bit 5 $20 $DF CapsLock = bit 6 $40 $BF --------------------------------------------------------------------