Changeset 2880 in vbox for trunk/src/VBox
- Timestamp:
- May 25, 2007 3:44:10 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/BIOS/logo.c
r1896 r2880 7 7 #define BMP_HEADER_WIN3 40 8 8 9 #define F12_SCAN_CODE 0x86 10 #define F12_WAIT_TIME 3 * 1000 /* Milliseconds, used only if logo disabled */ 9 #define WAIT_HZ 64 10 #define WAIT_MS 16 11 12 #define F12_SCAN_CODE 0x86 13 #define F12_WAIT_TIME (3 * WAIT_HZ) /* 3 seconds. Used only if logo disabled. */ 11 14 12 15 typedef struct … … 127 130 static unsigned char get_mode(); 128 131 static void set_mode(); 129 static Bit8u wait( ms);132 static Bit8u wait(ticks, stop_on_key); 130 133 static void write_pixel(); 131 134 … … 231 234 { 232 235 // The default is 18.2 ticks per second (~55ms tick interval). 233 // Set the timer to 1ms ticks (65536 / (Hz / 18.2)). 236 // Set the timer to 16ms ticks (64K / (Hz / (PIT_HZ / 64K)) = count). 237 // 0x10000 / (1000 / (1193182 / 0x10000)) = 1193 (0x04a9) 238 // 0x10000 / ( 128 / (1193182 / 0x10000)) = 9321 (0x2469) 239 // 0x10000 / ( 64 / (1193182 / 0x10000)) = 18643 (0x48d3) 234 240 ASM_START 235 241 mov al, #0x34 ; timer0: binary count, 16bit count, mode 2 236 242 out 0x43, al 237 mov al, #0x A9 ; Low byte243 mov al, #0xd3 ; Low byte - 64Hz 238 244 out 0x40, al 239 mov al, #0x 04 ; High byte245 mov al, #0x48 ; High byte - 64Hz 240 246 out 0x40, al 241 247 ASM_END … … 257 263 /* 258 264 * Reinitialize the tick and rollover counts since we've 259 * screwed them up by running the timer at 1000HZ for a while.265 * screwed them up by running the timer at WAIT_HZ for a while. 260 266 */ 261 267 pushad … … 271 277 272 278 /** 273 * Waits (sleeps) for the given number of milliseconds.279 * Waits (sleeps) for the given number of ticks. 274 280 * Checks for keystroke. 275 281 * 276 282 * @returns BIOS scan code if available, 0 if not. 277 * @param ms Number of milliseconds to sleep. 283 * @param ticks Number of ticks to sleep. 284 * @param stop_on_key Whether to stop immediately upon keypress. 278 285 */ 279 Bit8u wait(ms) 280 Bit16u ms; 286 Bit8u wait(ticks, stop_on_key) 287 Bit16u ticks; 288 Bit8u stop_on_key; 281 289 { 282 290 long ticks_to_wait, delta; … … 292 300 sti 293 301 ASM_END 294 ticks_to_wait = ms;302 ticks_to_wait = ticks; 295 303 prev_ticks = read_dword(0x0, 0x46c); 296 304 do … … 313 321 scan_code = get_keystroke(); 314 322 bios_printf(BIOS_PRINTF_INFO, "Key pressed: %x\n", scan_code); 323 if (stop_on_key) 324 return scan_code; 315 325 } 316 326 } while (ticks_to_wait > 0); … … 471 481 *palette++; 472 482 } 473 scode = wait(1 5);483 scode = wait(16 / WAIT_MS, 0); 474 484 if (scode) 475 485 scan_code = scode; … … 516 526 *palette++; 517 527 } 518 scode = wait(1 5);528 scode = wait(16 / WAIT_MS, 0); 519 529 if (scode) 520 530 scan_code = scode; … … 973 983 974 984 // Wait (interval in milliseconds) 975 scode = wait(logo_time );985 scode = wait(logo_time / WAIT_MS, 0); 976 986 if (scode && scan_code != F12_SCAN_CODE) 977 987 scan_code = scode; … … 1031 1041 { 1032 1042 // Wait for timeout or keystroke 1033 for (i = 0; i < F12_WAIT_TIME; i++) 1034 { 1035 scan_code = wait(1); 1036 if (scan_code) 1037 break; 1038 } 1043 scan_code = wait(F12_WAIT_TIME, 1); 1039 1044 } 1040 1045 } … … 1080 1085 1081 1086 // Wait for keystroke 1082 for (;;)1087 do 1083 1088 { 1084 scan_code = wait(1); 1085 if (scan_code) 1086 break; 1087 } 1089 scan_code = wait(WAIT_HZ, 1); 1090 } while (scan_code == 0); 1088 1091 1089 1092 // Change first boot device code to selected one … … 1120 1123 { 1121 1124 printf(" %d", i); 1122 wait( 1000);1125 wait(WAIT_HZ, 0); 1123 1126 } 1124 1127 printf("\n");
Note:
See TracChangeset
for help on using the changeset viewer.