🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: alt.msdos.programmer
1 messages
1 total messages Started by Johannes Beekhuizen Mon, 28 Sep 1992 09:44
Re: Toggling NumLock
#650
Author: Johannes Beekhuizen
Date: Mon, 28 Sep 1992 09:44
115 lines
3327 bytes
TO: m_rheau@pavo.concordia.ca

Hallo RHEAUME,

Op maandag 28 september 1992, schreef RHEAUME, MICHEL aan All:

 RM> Organization: Concordia University
 RM> @Message-ID: <27SEP199221155761@pavo.concordia.ca>

 RM> As simple as it sounds, I can't think of a way to
 RM> toggle the NumLock key (through software of course!).

I found a unit for it in another the other day. All credits to its author!

 Van   : Dirk-Jan Uittenbogaard      2:280/463               wo 23 sep 92 14:48
 Ondw. : Aansturing van CAPS-LOCK en SCROLL-LOCK

 BS> Unit KEYLOCKS;

     USES Dos;                          {he forgot that line}

 BS> interface
 BS> Var
 BS>   Key_Status_Bits: Word absolute $0040:$0017;

 BS> function Alt_Pressed: Boolean;
 BS> function Ctrl_Pressed: Boolean;
 BS> function LeftShift_Pressed: Boolean;
 BS> function RightShift_Pressed: Boolean;

 BS> function CapsOn: Boolean;
 BS> function NumOn: Boolean;
 BS> function ScrollOn: Boolean;

 BS> procedure Set_Caps(On: Boolean);
 BS> procedure Set_Num(On: Boolean);
 BS> procedure Set_Scroll(On: Boolean);

 BS> procedure ResetKeyboard;
 BS> { Aanroepen *na* elke Set_... procedure om de lichtjes daadwerkelijk te
 BS> laten veranderen op het keyboard.
 BS> }


 BS> implementation

 BS> function Alt_Pressed: Boolean;
 BS> begin
 BS>   Alt_Pressed := (Key_Status_Bits AND $08) <> 0
 BS> end {Alt_Pressed};

 BS> function Ctrl_Pressed: Boolean;
 BS> begin
 BS>   Ctrl_Pressed := (Key_Status_Bits AND $04) <> 0
 BS> end {Ctrl_Pressed};

 BS> function LeftShift_Pressed: Boolean;
 BS> begin
 BS>   LeftShift_Pressed := (Key_Status_Bits AND $02) <> 0
 BS> end {LeftShift_Pressed};

 BS> function RightShift_Pressed: Boolean;
 BS> begin
 BS>   RightShift_Pressed := (Key_Status_Bits AND $01) <> 0
 BS> end {RightShift_Pressed};


 BS> function CapsOn: Boolean;
 BS> begin
 BS>   CapsOn := (Key_Status_Bits AND $40) <> 0
 BS> end {CapsOn};

 BS> function NumOn: Boolean;
 BS> begin
 BS>   NumOn := (Key_Status_Bits AND $20) <> 0
 BS> end {NumOn};

 BS> function ScrollOn: Boolean;
 BS> begin
 BS>   ScrollOn := (Key_Status_Bits AND $10) <> 0
 BS> end {ScrollOn};


 BS> procedure Set_Caps(On: Boolean);
 BS> begin
 BS>   If On then Key_Status_Bits := (Key_Status_Bits OR $40)
 BS>         else Key_Status_Bits := (Key_Status_Bits AND $BF)
 BS> end {Set_Caps};

 BS> procedure Set_Num(On: Boolean);
 BS> begin
 BS>   If On then Key_Status_Bits := (Key_Status_Bits OR $20)
 BS>         else Key_Status_Bits := (Key_Status_Bits AND $DF)
 BS> end {Set_Num};

 BS> procedure Set_Scroll(On: Boolean);
 BS> begin
 BS>   If On then Key_Status_Bits := (Key_Status_Bits OR $10)
 BS>         else Key_Status_Bits := (Key_Status_Bits AND $EF)
 BS> end {Set_Scroll};



 BS>   procedure ResetKeyboard;
 BS>   var Regs : Registers;
 BS>   begin
 BS>     Regs.AH := 1;
 BS>     Intr($16, Regs)
 BS>   end;
 BS> end.


Groetjes,

           Hans.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads