wiggin
asked on
Linux Registers
I have the following code sample from a DOS program I wrote. I would like to port the program to Linux, but I don't know how to reach the registers without dos.h The code also uses int86() which I don't think is usable within Linux. I am looking for a replacement for the following member function:
// The purpose of the function is to return a key value only if a key
//is hit, otherwise return 0. It does NOT wait for a key to be pressed
int Fractal::GetKey ()
{
union REGS r; // Gain access to the registers
if (!kbhit ()) // Return if no key pressed
return 0;
r.h.ah = 0;
int86 (0x16, &r, &r); // Get scancode of key
if (!r.h.al)
return (r.h.ah | 128);
return (r.h.al & 255); // Return the key number
}
// The purpose of the function is to return a key value only if a key
//is hit, otherwise return 0. It does NOT wait for a key to be pressed
int Fractal::GetKey ()
{
union REGS r; // Gain access to the registers
if (!kbhit ()) // Return if no key pressed
return 0;
r.h.ah = 0;
int86 (0x16, &r, &r); // Get scancode of key
if (!r.h.al)
return (r.h.ah | 128);
return (r.h.al & 255); // Return the key number
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.