Changeset 92 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Boot
- Timestamp:
- Jan 27, 2011, 5:44:27 PM (14 years ago)
- google:author:
- aitotat
- Location:
- trunk/XTIDE_Universal_BIOS/Src/Boot
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenu.asm
r88 r92 27 27 cmp cx, BYTE NO_ITEM_SELECTED 28 28 je SHORT BootMenu_DisplayAndReturnSelection 29 jmp BootMenu_ConvertMenuitemToDriveOrFunction29 jmp SHORT BootMenu_ConvertMenuitemFromCXtoDriveInDX 30 30 31 31 … … 66 66 call FloppyDrive_GetCount 67 67 add ax, cx 68 call BootMenu_GetMenuFunctionCount69 add cx, ax70 ret71 72 ;--------------------------------------------------------------------73 ; Returns number of functions displayed in Boot Menu.74 ;75 ; BootMenu_GetMenuFunctionCount76 ; Parameters:77 ; Nothing78 ; Returns:79 ; CX: Number of boot menu functions80 ; Corrupts registers:81 ; Nothing82 ;--------------------------------------------------------------------83 ALIGN JUMP_ALIGN84 BootMenu_GetMenuFunctionCount:85 xor cx, cx86 test BYTE [cs:ROMVARS.wFlags], FLG_ROMVARS_ROMBOOT87 jz SHORT .DontIncludeRomBoot88 inc cx89 ALIGN JUMP_ALIGN90 .DontIncludeRomBoot:91 68 ret 92 69 … … 110 87 111 88 ;-------------------------------------------------------------------- 112 ; Converts any hotkey to Boot Menu menuitem index. 113 ; 114 ; BootMenu_ConvertHotkeyToMenuitem 115 ; Parameters: 116 ; AX: ASCII hotkey starting from upper case 'A' 89 ; BootMenu_ConvertAsciiHotkeyFromALtoMenuitemInCX 90 ; Parameters: 91 ; AL: ASCII hotkey starting from upper case 'A' 117 92 ; Returns: 118 93 ; CX: Menuitem index … … 121 96 ;-------------------------------------------------------------------- 122 97 ALIGN JUMP_ALIGN 123 BootMenu_Convert HotkeyToMenuitem:124 call BootMenu_GetLetterForFirstHardDisk 98 BootMenu_ConvertAsciiHotkeyFromALtoMenuitemInCX: 99 call BootMenu_GetLetterForFirstHardDiskToCL 125 100 cmp al, cl ; Letter is for Hard Disk? 126 101 jae SHORT .StartFromHardDiskLetter … … 139 114 ; can be higher if more than two floppy drives are found. 140 115 ; 141 ; BootMenu_GetLetterForFirstHardDisk 116 ; BootMenu_GetLetterForFirstHardDiskToCL 142 117 ; Parameters: 143 118 ; Nothing … … 148 123 ;-------------------------------------------------------------------- 149 124 ALIGN JUMP_ALIGN 150 BootMenu_GetLetterForFirstHardDisk :125 BootMenu_GetLetterForFirstHardDiskToCL: 151 126 call FloppyDrive_GetCount 152 127 add cl, 'A' … … 156 131 157 132 ;-------------------------------------------------------------------- 158 ; Converts selected menuitem index to drive number or function ID. 159 ; 160 ; BootMenu_ConvertMenuitemToDriveOrFunction 133 ; BootMenu_ConvertMenuitemFromCXtoDriveInDX 161 134 ; Parameters: 162 135 ; CX: Index of menuitem selected from Boot Menu 163 136 ; DS: RAMVARS segment 164 137 ; Returns: 165 ; DX: Drive number to be used for booting (if CF cleared) 166 ; Function ID (if CF set) 167 ; CF: Cleared if drive selected 168 ; Set if function selected 169 ; Corrupts registers: 170 ; AX, CX 171 ;-------------------------------------------------------------------- 172 ALIGN JUMP_ALIGN 173 BootMenu_ConvertMenuitemToDriveOrFunction: 138 ; DX: Drive number to be used for booting 139 ; Corrupts registers: 140 ; CX 141 ;-------------------------------------------------------------------- 142 ALIGN JUMP_ALIGN 143 BootMenu_ConvertMenuitemFromCXtoDriveInDX: 174 144 mov dx, cx ; Copy menuitem index to DX 175 145 call FloppyDrive_GetCount … … 177 147 jb SHORT .ReturnFloppyDriveInDX 178 148 sub dx, cx ; Remove floppy drives from index 179 call RamVars_GetHardDiskCountFromBDAtoCX180 cmp dx, cx ; Hard disk?181 jb SHORT .ReturnHardDiskInDX182 sub dx, cx ; Remove hard disks from index183 jmp SHORT BootMenu_ConvertFunctionIndexToID184 ALIGN JUMP_ALIGN185 .ReturnHardDiskInDX:186 149 or dl, 80h 187 ALIGN JUMP_ALIGN188 150 .ReturnFloppyDriveInDX: 189 clc190 ret191 192 193 ;--------------------------------------------------------------------194 ; Converts selected menuitem index to drive number or function ID.195 ;196 ; BootMenu_ConvertFunctionIndexToID197 ; Parameters:198 ; CX: Menuitem index199 ; DX: Function index (Menuitem index - floppy count - HD count)200 ; Returns:201 ; DX: Function ID202 ; CF: Set to indicate function203 ; Corrupts registers:204 ; AX, CX205 ;--------------------------------------------------------------------206 ALIGN JUMP_ALIGN207 BootMenu_ConvertFunctionIndexToID:208 mov dx, ID_BOOTFUNC_ROMBOOT209 stc210 151 ret 211 152 -
trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuEvent.asm
r88 r92 62 62 mov BYTE [si+MENUINIT.bWidth], BOOT_MENU_WIDTH 63 63 call BootMenu_GetHeightToAHwithItemCountInCL 64 sub ah, MENU_SCREEN_BOTTOM_LINES*2 64 65 mov [si+MENUINIT.bHeight], ah 65 66 stc … … 90 91 call RamVars_GetSegmentToDS 91 92 call DriveXlate_Reset 92 call BootMenu_ConvertMenuitemToDriveOrFunction 93 jc SHORT .UpdatePreviousAndNewMenuitem ; Selection changed to a function 93 call BootMenu_ConvertMenuitemFromCXtoDriveInDX 94 94 call DriveXlate_SetDriveToSwap 95 96 .UpdatePreviousAndNewMenuitem:97 95 pop ax ; Update previous item 98 96 CALL_MENU_LIBRARY RefreshItemFromAX … … 109 107 ALIGN JUMP_ALIGN 110 108 .KeyStrokeInAX: 111 xor ah, ah ; ASCII drive letter now in AX 112 call BootMenu_ConvertHotkeyToMenuitem 109 cmp ah, ROM_BOOT_HOTKEY_SCANCODE 110 jne SHORT .CheckDriveHotkeys 111 int INTV_BOOT_FAILURE ; ROM Boot, never returns 112 ALIGN JUMP_ALIGN 113 .CheckDriveHotkeys: 114 call BootMenu_ConvertAsciiHotkeyFromALtoMenuitemInCX 113 115 cmp cx, [bp+MENUINIT.wItems] 114 jae SHORT .Event NotHandled ; Invalid key116 jae SHORT .EventCompleted ; Invalid key 115 117 xchg ax, cx 116 118 CALL_MENU_LIBRARY HighlightItemFromAX … … 159 161 160 162 call RamVars_GetSegmentToDS 161 call BootMenu_ConvertMenuitemToDriveOrFunction 162 jc SHORT .DrawFunction 163 call BootMenu_ConvertMenuitemFromCXtoDriveInDX 163 164 test dl, 80h ; Floppy drive? 164 165 jz SHORT .DrawFloppyDrive 165 166 jmp [cs:bx+ITEM_TYPE_REFRESH.HardDisk] 166 ALIGN JUMP_ALIGN167 .DrawFunction:168 jmp [cs:bx+ITEM_TYPE_REFRESH.SpecialFunction]169 167 ALIGN JUMP_ALIGN 170 168 .DrawFloppyDrive: … … 177 175 at ITEM_TYPE_REFRESH.HardDisk, dw BootMenuPrint_HardDiskMenuitem 178 176 at ITEM_TYPE_REFRESH.FloppyDrive, dw BootMenuPrint_FloppyMenuitem 179 at ITEM_TYPE_REFRESH.SpecialFunction, dw BootMenuPrint_FunctionMenuitem180 177 iend 181 178 .rgwInformationItemTypeRefresh: … … 183 180 at ITEM_TYPE_REFRESH.HardDisk, dw BootMenuPrint_HardDiskMenuitemInformation 184 181 at ITEM_TYPE_REFRESH.FloppyDrive, dw BootMenuPrint_FloppyMenuitemInformation 185 at ITEM_TYPE_REFRESH.SpecialFunction, dw BootMenuPrint_ClearInformationArea186 182 iend -
trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrint.asm
r88 r92 39 39 ret 40 40 41 42 ;--------------------------------------------------------------------43 ; Prints Floppy Drive hotkey string.44 ;45 ; BootMenuPrint_FloppyHotkeyString46 ; Parameters:47 ; BL: Number of floppy drives in system48 ; Returns:49 ; Nothing50 ; Corrupts registers:51 ; AX, SI52 ;--------------------------------------------------------------------53 ALIGN JUMP_ALIGN54 BootMenuPrint_FloppyHotkeyString:55 test bl, bl ; Any floppy drives?56 jz SHORT NoFloppyDrivesOrHardDisksToPrint57 push bp58 59 mov bp, sp60 mov al, 'A'61 push ax ; 'A'62 dec ax63 add al, bl64 push ax ; Last floppy drive letter65 ePUSH_T ax, g_szFDD66 ePUSH_T ax, g_szHDD67 jmp SHORT PrintHotkeyString68 69 ;--------------------------------------------------------------------70 ; Prints Hard Disk hotkey string.71 ;72 ; BootMenuPrint_FloppyHotkeyString73 ; Parameters:74 ; BH: Number of hard disks in system75 ; Returns:76 ; Nothing77 ; Corrupts registers:78 ; AX, CX, SI79 ;--------------------------------------------------------------------80 ALIGN JUMP_ALIGN81 BootMenuPrint_HardDiskHotkeyString:82 test bh, bh ; Any hard disks?83 jz SHORT NoFloppyDrivesOrHardDisksToPrint84 push bp85 86 mov bp, sp87 call BootMenu_GetLetterForFirstHardDisk88 push cx ; First hard disk letter89 dec cx90 add cl, bh91 push cx ; Last hard disk letter92 ePUSH_T ax, g_szHDD93 ePUSH_T ax, g_szFDD94 ; Fall to PrintHotkeyString95 96 ALIGN JUMP_ALIGN97 PrintHotkeyString:98 mov si, g_szBottomScrn99 jmp BootMenuPrint_FormatCSSIfromParamsInSSBP100 NoFloppyDrivesOrHardDisksToPrint:101 ret102 41 103 42 ;-------------------------------------------------------------------- … … 216 155 .HardDiskMenuitemForForeignDrive: 217 156 mov si, g_szforeignHD 218 jmp PrintNullTerminatedStringFromCSSIandSetCF219 220 221 ;--------------------------------------------------------------------222 ; BootMenuPrint_FunctionMenuitem223 ; Parameters:224 ; DX: Function ID225 ; Returns:226 ; CF: Set if menu event was handled successfully227 ; Corrupts registers:228 ; AX, DX, SI, DI229 ;--------------------------------------------------------------------230 ALIGN JUMP_ALIGN231 BootMenuPrint_FunctionMenuitem:232 test dx, dx ; ID_BOOTFUNC_ROMBOOT233 jz SHORT .PrintRomBootMenuitem234 ret235 236 ALIGN JUMP_ALIGN237 .PrintRomBootMenuitem:238 mov si, g_szRomBoot239 157 jmp PrintNullTerminatedStringFromCSSIandSetCF 240 158 … … 479 397 480 398 ;-------------------------------------------------------------------- 481 ; Prints information strings to the bottom of the screen.482 ;483 399 ; BootMenuPrint_TheBottomOfScreen 484 400 ; Parameters: … … 487 403 ; Nothing 488 404 ; Corrupts registers: 489 ; AX, BX, CX, DX, SI 405 ; AX, BX, CX, DX, SI, DI 490 406 ;-------------------------------------------------------------------- 491 407 ALIGN JUMP_ALIGN … … 495 411 call RamVars_GetHardDiskCountFromBDAtoCX 496 412 mov bh, cl ; Hard Disk count to BH 497 call BootMenuPrint_GetCoordinatesForBottomStrings 498 call BootMenuPrint_SetCursorPosition 499 call BootMenuPrint_FloppyHotkeyString 500 jmp BootMenuPrint_HardDiskHotkeyString 501 502 503 ;-------------------------------------------------------------------- 504 ; Returns coordinates for bottom strings. 505 ; 506 ; BootMenuPrint_GetCoordinatesForBottomStrings 507 ; Parameters: 508 ; BL: Number of floppy drives in system 509 ; BH: Number of hard disks in system 510 ; Returns: 511 ; DL: Cursor X coordinate 512 ; DH: Cursor Y coordinate 513 ; Corrupts registers: 514 ; Nothing 515 ;-------------------------------------------------------------------- 516 ALIGN JUMP_ALIGN 517 BootMenuPrint_GetCoordinatesForBottomStrings: 518 mov dx, 1800h ; (0, 24) 519 cmp dl, bl ; Set CF if any floppy drives 520 sbb dh, dl ; Decrement Y-coordinate if necessary 521 cmp dl, bh ; Set CF if any hard disks 522 sbb dh, dl ; Decrement Y-coordinate if necessary 523 ret 524 525 526 ;-------------------------------------------------------------------- 527 ; Sets cursor to wanted screen coordinates. 528 ; 529 ; BootMenuPrint_SetCursorPosition 530 ; Parameters: 531 ; DL: Cursor X coordinate 532 ; DH: Cursor Y coordinate 533 ; Returns: 534 ; Nothing 535 ; Corrupts registers: 536 ; AX 537 ;-------------------------------------------------------------------- 538 ALIGN JUMP_ALIGN 539 BootMenuPrint_SetCursorPosition: 540 push di 541 mov ax, dx 413 ; Fall to .MoveCursorToHotkeyStrings 414 415 ;-------------------------------------------------------------------- 416 ; .MoveCursorToHotkeyStrings 417 ; Parameters: 418 ; Nothing 419 ; Returns: 420 ; Nothing 421 ; Corrupts registers: 422 ; AX, DI 423 ;-------------------------------------------------------------------- 424 .MoveCursorToHotkeyStrings: 425 CALL_DISPLAY_LIBRARY GetColumnsToALandRowsToAH 426 xor al, al 427 dec ah 542 428 CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX 543 pop di 544 ret 429 ; Fall to .PrintHotkeyString 430 431 ;-------------------------------------------------------------------- 432 ; .PrintHotkeyString 433 ; Parameters: 434 ; BL: Floppy Drives 435 ; BH: Hard Drives 436 ; Returns: 437 ; Nothing 438 ; Corrupts registers: 439 ; AX, CX, DX, SI 440 ;-------------------------------------------------------------------- 441 .PrintHotkeyString: 442 ; Display Library should not be called like this 443 mov si, ATTRIBUTE_CHARS.cTitle 444 call MenuAttribute_GetToAXfromTypeInSI 445 xchg cx, ax 446 mov si, ATTRIBUTE_CHARS.cHighlightedItem 447 call MenuAttribute_GetToAXfromTypeInSI 448 xchg dx, ax 449 450 test bl, bl ; Any Floppy Drives? 451 jz SHORT .SkipFloppyDriveHotkeys 452 mov ax, 'A' | (ANGLE_QUOTE_RIGHT<<8) 453 mov si, g_szFDD 454 call PushHotkeyParamsAndFormat 455 456 .SkipFloppyDriveHotkeys: 457 test bh, bh ; Any Hard Drives? 458 jz SHORT .SkipHardDriveHotkeys 459 call BootMenu_GetLetterForFirstHardDiskToCL 460 mov ch, ANGLE_QUOTE_RIGHT 461 xchg ax, cx 462 mov si, g_szHDD 463 call PushHotkeyParamsAndFormat 464 465 .SkipHardDriveHotkeys: 466 ; Fall to .PrintRomBootHotkey 467 468 ;-------------------------------------------------------------------- 469 ; .PrintRomBootHotkey 470 ; Parameters: 471 ; CX: Key Attribute 472 ; DX: Description Attribute 473 ; Returns: 474 ; Nothing 475 ; Corrupts registers: 476 ; AX, SI 477 ;-------------------------------------------------------------------- 478 .PrintRomBootHotkey: 479 mov ax, 'F' | ('8'<<8) ; F8 480 mov si, g_szRomBoot 481 ; Fall to PushHotkeyParamsAndFormat 482 483 ;-------------------------------------------------------------------- 484 ; PushHotkeyParamsAndFormat 485 ; Parameters: 486 ; AL: First character 487 ; AH: Second character 488 ; CX: Key Attribute 489 ; DX: Description Attribute 490 ; CS:SI: Description string 491 ; Returns: 492 ; Nothing 493 ; Corrupts registers: 494 ; AX, SI 495 ;-------------------------------------------------------------------- 496 ALIGN JUMP_ALIGN 497 PushHotkeyParamsAndFormat: 498 push bp 499 mov bp, sp 500 501 push cx ; Key attribute 502 push ax ; First character 503 xchg al, ah 504 push ax ; Second character 505 push dx ; Description attribute 506 push si ; Description string 507 push cx ; Key attribute for last space 508 mov si, g_szHotkey 509 jmp BootMenuPrint_FormatCSSIfromParamsInSSBP
Note:
See TracChangeset
for help on using the changeset viewer.