This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Status indecation


Hi Zippo, I'm not sure if this is of help,

 Int 16,2 (int 16, AH=2)

This function returns the state of various keys on the PC keyboard in the 
al register.
The values returned are as follows:

Bit Meaning
7 Insert state (toggle by pressing INS key)
6 Caps lock (1=capslock on)
5 Num lock (1=numlock on)
4 Scroll lock (1=scroll lock on)
3 Alt (1=Alt key currently down)
2 Ctrl (1=Ctrl key currently down)
1 Left shift (1=left shift key down)
0 Right shift (1=right shift key down)

This is the old DOS way of doing things using the BIOS.

You also got a segmentation fault due to acessing a peice of protected 
memory (i.e. outside of your program), you probably running in Protected 
Mode.

-----Original Message-----
From:	zippo [SMTP:zippo752001@comcast.net]
Sent:	23 July 2003 22:10
To:	gcc-help@gcc.gnu.org
Subject:	Status indecation

On Wed, 23 Jul 2003 10:28:33 -0400
zippo <zippo752001@comcast.net> wrote:

> I am trying to write a program and i need to be able to view the bios 
information in memory, "capslock numlock shift etc" how ever i do not know 
the code to read raw from a specific memory location, any help and i will 
be greatful.

>> maybe there is a easier way todo what i am trying todo. All i am trying 
todo is read weather capslock numlock and scrolllock are on and then return 
a value "boolean" i tried


#include <stdio.h>
typedef volatile char byte;
int main() {
	byte* ptr = (byte*)0xC000000;
	printf("%20x\n", *ptr &0xFF);
}

it compiled but when run gave me a Segmentation Fault
I was told about (API) calls but need somemore information. Thanks for any 
and all your help, zippo

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]