<--- Turn the page     (contents page)     Turn the page --->



Well, Duuuhhh!

The Keyboard LEDs

Changing the Keyboard Status LEDs



Have you ever wanted to make sure the CAPS LOCK was off, NUM LOCK was on, or both at the start of your program? Well, here we are going to find out how.

DOS has a BYTE in low memory that keeps track of these items. It is very simple to change the bit representation in this BYTE.

This BYTE is at located at address 0040:0017h.

Bit Item
7 Insert 1 = active
6 Caps Lock 1 = active
5 Num Lock 1 = active
4 Scroll Lock 1 = active

To change the state of one of these items, simple set the corresponding BIT to the desired value, 0 for OFF, 1 for ON.

Remember that BIT 7 is the left most BIT in the BYTE.

Let us make sure the CAPS LOCK is off.
  push es
  mov  ax,0040h
  mov  es,ax
  mov  al,es:[0017h]
  and  al,10111111b
  mov  es:[0017h],al
  pop  es
It would be the same for the other four (4) items. ¥




<--- Turn the page     (contents page)     Turn the page --->

Page 3