outputting of chars ??
Posted: Thu Oct 17, 2002 10:31 am
hey all,
okay well my keyboard handler works great now, knows all keys, and i can output 1 at a time, over the same spot (X Y) like always at 5, 5
but when i try to incrememnt X to allow, the characters to type out 1 by 1, like a normal command prompt, the code outputs all of them untill the screen is full... i dunno what to do!
so in example, if i hit a: it displays a then fills the screen up, as if it always loops the x++? so i added code to check if a key was being hit, and if it wasn't, NOT to do anything with outputting, but it still outputs hundreds of them... i have no idea, is it possible that my put function is messed up? here is the code:
void put( unsigned c, int x, int y )
{
???unsigned att;
???att = textattrib << 8;
???unsigned short *where;
???
???where = vgaadr + ( y * scrwidth + x );
???*where = c | att;
???
}
i don't think it is, because its not doing anything out of the normal. But here is the code for the keyboard/outputting:
any ideas would be great, thanks in advance!
okay well my keyboard handler works great now, knows all keys, and i can output 1 at a time, over the same spot (X Y) like always at 5, 5
but when i try to incrememnt X to allow, the characters to type out 1 by 1, like a normal command prompt, the code outputs all of them untill the screen is full... i dunno what to do!
so in example, if i hit a: it displays a then fills the screen up, as if it always loops the x++? so i added code to check if a key was being hit, and if it wasn't, NOT to do anything with outputting, but it still outputs hundreds of them... i have no idea, is it possible that my put function is messed up? here is the code:
void put( unsigned c, int x, int y )
{
???unsigned att;
???att = textattrib << 8;
???unsigned short *where;
???
???where = vgaadr + ( y * scrwidth + x );
???*where = c | att;
???
}
i don't think it is, because its not doing anything out of the normal. But here is the code for the keyboard/outputting:
?????? while( scanCode != 01 ) //while we didn't hit ESCAPE key
{
scanCode = KeyboardInterruptHandler(); //get scancode
//we need to check to see if they pressed a key!
if( KeyPressed(scanCode) ) //1 if true, a key was pressed
{
//if they hit enter, then redo prompt and go up a line
if( asciicodes[scanCode-1] == '\n' )
{
//bug here, we are not checking if we go outside the boundaries of the screen!
//y++;
gotoxy( 0, y ); //start cursor there!
printf("tellus: / ]: "); //our prompt, cursor should be right after this!
}
//its something other than a \n or a special char
else
{
put( asciicodes[scanCode-1], x, y ); //output he char we typed minus 1 cause arrays start at 0 we start at 1
//x++;
}
}
else
{
//key was not pressed
}
}
any ideas would be great, thanks in advance!