Mail Archives: djgpp/1997/06/13/07:03:48
From: | Gary Preston <gary AT prestons DOT demon DOT co DOT uk>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Keyboard.
|
Date: | Wed, 11 Jun 1997 17:35:23 +0100
|
Organization: | None
|
Distribution: | world
|
Message-ID: | <OUiugBALPtnzEw9k@prestons.demon.co.uk>
|
NNTP-Posting-Host: | prestons.demon.co.uk
|
MIME-Version: | 1.0
|
Lines: | 72
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Hi, I've written a pong game ( yes I know old but sweet ) the reason
is I'm trying to get used to using djgpp, now I've used getch() to read
the keys which is ok ish but I'd rather use the keyboard routines I've
used in my 16 bit games (see below ). If there is a better way I'd like
to know eventually I will try and prot my keyboard handler but for now
any help on the below routine is greatly appreciated. I've also included
my attempt of porting it.
unsigned char Get_Scan_Code( void )
{
asm{
mov ah, 01h
int 16h
jz empty
mov ah, 00h
int 16h
mov al, ah
xor ah, ah
jmp one
empty:
xor ax,ax
done:
}
}
This is how I've tried to port it but I don't really understand what I
have done below which is why I don't have a clue how to get it to work
H E L P !!!! P L E A S E !!!
int Get_Scan_Code()
{
int i = 1;
__asm__ ("
mov $0x01, %%ah\n
int $0x16\n
jz empty\n
mov $0x00, %%ah\n
int $0x16\n
mov %%ah, %%al\n
xor %%ah, %%ah\n
jmp done\n
empty:
xor %%ax, %%ax\n
done:
mov %%ax, %0
"
: "=g" (i)
);
return i;
}
--
Gary Preston. Gary AT prestons DOT demon DOT co DOT uk
Last game (SpaceFighter) available from my web page:
http://www.prestons.demon.co.uk/index.html
Its only a bug if someone else wrote it, otherwise its a special feature.
- Raw text -