Hey muttski!!
To do multiple key presses you will have to write an interrupt handler for interrupt 09h. The default interrupt handler installed by the BIOS does not allow for multiple keystrokes. It places them in a circular buffer and then reads from the buffer. If the buffer overflows, it will beep. This is fine for normal use but absolutely horrible for games.
Code:
interrupt (*OldInt9Handler)(...) //use ... for C++ programs
interrupt MyInt9Handler(...)
{
int keyhit=inportb(0x60);
if(keyhit & 0x80)
{
keyhit-=128;
}
switch Keys[keyhit]
{
case 1: Keys[keyhit]=0;break;
case 0: Keys[keyhit]=1;break;
}
}
To track them now:
Code:
if (Keys[scancode])
{
//key with scancode has been pressed
}
You cant use a switch statement because switch is for mutually exclusive items. In other words, after you find one item to be true, you do a break which then exits the switch altogether. If you don't break, then all of the next statements will execute until a break is encountered.
To install it:
Code:
OldInt9Handler=getvect(0x09); //save current vector
setvect(0x09,MyInt9Handler); //install new one
To restore the IVT:
Code:
setvect(0x09,OldInt9Handler); //restore vector to old one