void sleep(int n) { if (n < 60) { unsigned int endtime = (time18() + (18*n)); while (time18() < endtime); } }
static int countdown( const char * msg, register int row, register int timeout, int *optionKey ) { register unsigned long time; int ch = 0; register int col = strlen(msg) + 1; flushKeyboardBuffer(); moveCursor( 0, row ); printf("%s",msg); for ( time = time18(), timeout++; timeout > 0; ) { if ((ch = readKeyboardStatus())){ *optionKey = ch; break; } // Count can be interrupted by holding down shift, // control or alt key if ( ( readKeyboardShiftFlags() & 0x0F ) != 0 ) { ch = 1; break; } if ( time18() >= time ) { time += 18; timeout--; moveCursor( col, row ); printf("(%d)", timeout); #ifdef ShowCurrentDate printf("\n\n\n\nCurrent Date : %s", Date()); #endif } } flushKeyboardBuffer(); return ch; }
static int countdown( const char * msg, int row, int timeout ) { unsigned long time; int ch = 0; int col = strlen(msg) + 1; flushKeyboardBuffer(); moveCursor( 0, row ); printf(msg); for ( time = time18(), timeout++; timeout > 0; ) { if (ch = readKeyboardStatus()) break; // Count can be interrupted by holding down shift, // control or alt key if ( ( readKeyboardShiftFlags() & 0x0F ) != 0 ) { ch = 1; break; } if ( time18() >= time ) { time += 18; timeout--; moveCursor( col, row ); printf("(%d) ", timeout); } } flushKeyboardBuffer(); return ch; }
static int countdown( const char * msg, int row, int timeout ) { unsigned long time; int ch = 0; int col = strlen(msg) + 1; flushKeyboardBuffer(); if( bootArgs->Video.v_display == VGA_TEXT_MODE ) { moveCursor( 0, row ); printf(msg); } else { position_t p = pos( gui.screen.width / 2 + 1 , ( gui.devicelist.pos.y + 3 ) + ( ( gui.devicelist.height - gui.devicelist.iconspacing ) / 2 ) ); char dummy[80]; getBootVolumeDescription( gBootVolume, dummy, sizeof(dummy) - 1, true ); drawDeviceIcon( gBootVolume, gui.screen.pixmap, p, true ); drawStrCenteredAt( (char *) msg, &font_small, gui.screen.pixmap, gui.countdown.pos ); // make this screen the new background memcpy( gui.backbuffer->pixels, gui.screen.pixmap->pixels, gui.backbuffer->width * gui.backbuffer->height * 4 ); } int multi_buff = 18 * (timeout); int multi = ++multi_buff; int lasttime=0; for ( time = time18(), timeout++; timeout > 0; ) { if( time18() > lasttime) { multi--; lasttime=time18(); } if (ch = readKeyboardStatus()) break; // Count can be interrupted by holding down shift, // control or alt key if ( ( readKeyboardShiftFlags() & 0x0F ) != 0 ) { ch = 1; break; } if ( time18() >= time ) { time += 18; timeout--; if( bootArgs->Video.v_display == VGA_TEXT_MODE ) { moveCursor( col, row ); printf("(%d) ", timeout); } } if( bootArgs->Video.v_display == GRAPHICS_MODE ) { drawProgressBar( gui.screen.pixmap, 100, gui.progressbar.pos , ( multi * 100 / multi_buff ) ); gui.redraw = true; updateVRAM(); } } flushKeyboardBuffer(); return ch; }
void sleep(int n) { unsigned int endtime = (time18() + 18*n); while (time18() < endtime); }