// If not installed, uses BIOS and returns getch(); // Else returns pending key (or waits for one if none waiting). int key_getch() { int dummy=0; if (!Installed) return getch(); while (!key_checkch()) dummy++; return key_inkey(); }
int key_getch() { int dummy=0; if (!bInstalled) return 0; // return getch(); while (!key_checkch()) dummy++; return KeyInKey(); }
// If not installed, uses BIOS and returns getch(); // Else returns pending key (or waits for one if none waiting). int key_getch() { int dummy=0; int in; if ( !key_inited ) return 0; while (!key_checkch()){ os_poll(); dummy++; } in = key_inkey(); return in; }
int key_getch() { int dummy=0; if (!Installed) return 0; // return getch(); while (!key_checkch()){ dummy++; #ifdef SUPPORTS_NICEFPS d_delay(1); #endif } return key_inkey(); }
void main (void) { char ascii; int c; setbuf( stdout, NULL ); key_init(); //timer_init( 0, NULL ); //keyd_buffer_type = 2; keyd_repeat = 0; printf( "\n\n\n\nThis tests the keyboard library.\n\n" ); printf( "Press any key to start...\n" ); printf( "You pressed: %c\n\n", key_getch() ); printf( "Press F1 to turn off buffering.\n" ); printf( " F2 to turn on buffering.\n" ); printf( " F4 to flush keyboard.\n" ); printf( " F5 to turn repeat off.\n"); printf( " F6 to turn repeat on.\n"); printf( " F7 to do an INT 3.\n" ); printf( " F10 to display some boxes.\n" ); printf( " The arrows to see fast multiple keystrokes.\n"); printf( " ESC to exit.\n\n" ); while( !keyd_pressed[KEY_ESC] ) { int i,j; for (i=0; i<256; i++ ) { if (keyd_pressed[i]) { j = key_to_ascii(i); if (j==255) vidmem[i*2] = 219; else vidmem[i*2] = j; } else vidmem[i*2] = 32; } if (keyd_pressed[KEY_F1]) keyd_buffer_type = 0; if (keyd_pressed[KEY_F2]) keyd_buffer_type = 1; if (keyd_pressed[KEY_F4]) key_flush(); if (keyd_pressed[KEY_F5]) { keyd_repeat = 0; printf( "Repeat off" ); } if (keyd_pressed[KEY_F6]) { keyd_repeat = 1; printf( "Repeat on" ); } // if (keyd_pressed[KEY_F7] ) // key_debug(); if (keyd_pressed[KEY_PAUSE]) putch( 254 ); if (key_checkch()) { c = key_getch(); ascii=key_to_ascii(c); if ( ascii==255 ) { printf("[%4X] ", c ); fflush( stdout ); } else putch( ascii ); if (c==1) break; } delay(100); } key_close(); //timer_close(); }