Solved

How to test if the INSERT key is active

Posted on 1998-09-21
4
219 Views
Last Modified: 2010-04-16
How to test if the INSERT key is active?
I have found out that this problem can be solved with interrupts. Unfortunately I have newer worked with interrupts, so I dont realy know overcome the problem.
0
Comment
Question by:Malensek
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 1

Accepted Solution

by:
mlaiosa earned 20 total points
ID: 1215636
There is an even easyer solution. The BIOS keeps track of the insert key's state (although most programs dont take advantage of that).

I assume you are useing turbo pascal, the folowing code should work:

function INSERTactive:boolean;
var
 keystate:byte absolute $40:$17;
begin
 INSERTactive := (keystate and 128 = 0);
end;

you can replace the 128 in 'keystate and 128' with
64 for caps lock
32 for num lock
16 for scrool lock
8 for alt pressed
4 for ctrl pressed
2 for left shift pressed
1 for right shift pressed
0
 
LVL 1

Expert Comment

by:FuzzyLogic
ID: 1215637
This method is just what interrupt 16h service 02h does.
However, service 12h gives you extended status about the keboard, like which Alt (or Control) key - left or right and so on.
0
 
LVL 1

Expert Comment

by:FuzzyLogic
ID: 1215638
Ohh, and working with interrupts: (in the pascal file)

var
  Status,EStatus:byte;
.
asm
  mov  ah,12h
  int  16h
  mov  al,Status
  mov  ah,EStatus
end;
.

0
 
LVL 1

Expert Comment

by:mlaiosa
ID: 1215639
you can change "absolute $40:$17;" to "absolute $40:$18;" to retreve the EStatus as showed by FuzzyLogic.  This information is not availble on some older (very older) BIOS's

format of status byte 2 (ie: things to 'and' it with):
128 .. 16 are the same as above.
 8      Pause state active
 4      Sys Req pressed
 2      Left Alt pressed
 1      Left Ctrl pressed


also, if you had the 'keystate' varible as stated above, and wanted to see if caps lock and num lock were active, you could do:

if (keystate and (64+32) = 0) then writeln('Caps and Num lock are active');
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The conference as a whole was very interesting, although if one has to make a choice between this one and some others, you may want to check out the others.  This conference is aimed mainly at government agencies.  So it addresses the various compli…
If you are IT support and need to work after hours to resolve customer issues then here are a few tips on how to handle after hours support
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question