Need Help in understanding this function

Can Anyone Explain This function ?

int getkey()
{
union REGS i,o;

while(!kbhit())
;
i.h.ah=0;
int86(22,&i,&o);
return(o.h.ah);
}

also what is h & ah in this function ?

Replies

  • illuminatus
    illuminatus
    Re: Need Help

    Sm more info abt the prog might help!!!
  • wassup
    wassup
    As the name itself suggests it's function to getkey or read a key pressed. The union REGS and int86 are defined in dos.h
    int86 allows you call interrupts. In this program you are calling interrupt number 22. Which is related to keyboard. The union REGS maps x86 registers. So you need one variable for input and one for output.
    The REGS union has two types defined x which is 32 bit and h which 16 bit.
    ax/ah bx/bh are x86 registers.

    REMEMBER this works only in DOS!
  • dipen30
    dipen30
    thanx wassup

You are reading an archived discussion.

Related Posts

There are two types of wind turbines; horizontal and vertical. They’re also known as HAWT or VAWT, which stands for horizontal axis wind turbine or vertical axis wind turbine. A...
Hi Friends check out this Ecofriendly & “World’s First Safe for Eyes Study Lamp” that [FONT="]LEDs instead of bulbs:[/FONT] [FONT="]https://www.studylite.in/index.php?option=com_content&view=article&id=30&Itemid=38&cid=cm[/FONT]
Hello everybody!! I graduated in 2008 and I'm currently working as an IT Analyst.I am and I will always be a computer game freak.I want to get into Computer Game...
hiii...i am a final year mechanical engg student and want to do a final year project on all terrain robot for space or defence application...so, can anyone give me some...
In this fastest world, english is very important language. This language understood in all countries. Education is an important part of life and we can't imagine anything without it. Many...