[comp.sys.ibm.pc] NumLock and/or CapsLock Disabling

emanuel@cernvax.UUCP (emanuel) (05/19/88)

Hi there, folks,

Do you know by chance how to disable (or enable) by software the
NumLock and CapsLock keys?

Is there an 'easy' way to do EXACLTY that (i.e. without trying to go
AROUND the problem)?

Thanks for any replies,

Emanuel Machado
-- 
Emanuel T.M. Machado, CERN     | "Science is true.   | UUCP:
   _                        _  |   Don't be misled   |  emanuel@cernvax.UUCP
 /_  ____  __   __      _  </  |     by facts."      | DECNET:
/_  / / / /_ < / / /_/ <'_ /_  |  -- Finagle's Creed |  machado@vxcern.cern

rmarks@KSP.Unisys.COM (Richard Marks) (05/22/88)

In article <686@cernvax.UUCP> emanuel@cernvax.UUCP () writes:
>Do you know by chance how to disable (or enable) by software the
>NumLock and CapsLock keys?
>
>Is there an 'easy' way to do EXACLTY that (i.e. without trying to go
>AROUND the problem)?

There is no way to just tell the keyboard to ignore these keys.
As far as the keyboard is concerned, they are just another key,
the BIOS gives the key meaning.

One way to surpress these keys is to write a small TSR routine
that sits on INT 9 (the interrupt the keyboard generates whenever
a key is pressed or depressed).

This routine would pass control down to the next levels in the INT 9
chain via a routine call (not a branch). Then when control perculates
back up via the lower level IRETs, you would clear the keyboard
status word bits at 40:17 for the NumLock and CapLock.

Richard Marks
rmarks@KSP.unisys.COM

pajerek@kadsma.kadsm (Don Pajerek) (05/24/88)

In article <605@bbking.KSP.Unisys.COM> rmarks@KSP.Unisys.COM (Richard Marks) writes:
>In article <686@cernvax.UUCP> emanuel@cernvax.UUCP () writes:
>>Do you know by chance how to disable (or enable) by software the
>>NumLock and CapsLock keys?

>There is no way to just tell the keyboard to ignore these keys.

Sure there is. Write a small TSR that traps INT 09H and looks at each keypress.
If it sees the scan codes for the NumLock or CapsLock keys, it just resets
the keyboard and the 8259 and returns. Otherwise, it would pass the key on
to the BIOS keyboard handler. The startup routine for this TSR could set
the NumLock and CapsLock bits (40:17) to the desired values.

>Richard Marks

DJP

jcmorris@mitre-bedford.ARPA (Joseph C. Morris) (05/25/88)

In a recent article rmarks@KSP.Unisys.COM (Richard Marks) writes:
>In article <686@cernvax.UUCP> emanuel@cernvax.UUCP () writes:
>>Do you know by chance how to disable (or enable) by software the
>>NumLock and CapsLock keys?
>>
>One way to surpress these keys is to write a small TSR routine
>that sits on INT 9 (the interrupt the keyboard generates whenever
>a key is pressed or depressed).

If the machine is an AT or such with a relatively recent BIOS, you
may be able to handle it by stealing INT 15 (originally the cassette
support interrupt) and checking for subcode 4c-or-whatever (I don't
have my notes handy).  The recent machines I've checked have code in
the INT 9 handler which passes the scan code just read from the
keyboard to INT 15, then looks at the carry latch on return and
if it is set discards the scan code completely.  This includes *all*
scan codes, including key-break and the strange E0 scan codes used
as placeholders in the new extended keyboard.  You can test for the
NumLock and ScrLock keys there.

Look at your INT 9 BIOS code using DEBUG; the call to INT 15 is very
early in the logic.

This won't help you if you've got the old BIOS, but if your system
uses the INT 15 exit it provides a defined (and supposedly supported)
interface.