[90] | 1 | ; Project name : XTIDE Universal BIOS
|
---|
[3] | 2 | ; Description : Int 19h BIOS functions for Boot Menu.
|
---|
| 3 |
|
---|
| 4 | ; Section containing code
|
---|
| 5 | SECTION .text
|
---|
| 6 |
|
---|
| 7 | ;--------------------------------------------------------------------
|
---|
[122] | 8 | ; Boot Menu Loader.
|
---|
[3] | 9 | ;
|
---|
| 10 | ; Int19hMenu_BootLoader
|
---|
| 11 | ; Parameters:
|
---|
| 12 | ; Nothing
|
---|
| 13 | ; Returns:
|
---|
| 14 | ; Jumps to Int19hMenu_Display, then never returns
|
---|
| 15 | ;--------------------------------------------------------------------
|
---|
| 16 | ALIGN JUMP_ALIGN
|
---|
| 17 | Int19hMenu_BootLoader:
|
---|
[121] | 18 | ; Store POST stack pointer
|
---|
[3] | 19 | LOAD_BDA_SEGMENT_TO ds, ax
|
---|
[121] | 20 | STORE_POST_STACK_POINTER
|
---|
| 21 | SWITCH_TO_BOOT_MENU_STACK
|
---|
[143] | 22 | call RamVars_GetSegmentToDS
|
---|
| 23 | ; Fall to .InitializeDisplayForBootMenu
|
---|
| 24 |
|
---|
| 25 | ;--------------------------------------------------------------------
|
---|
| 26 | ; .InitializeDisplayForBootMenu
|
---|
| 27 | ; Parameters:
|
---|
| 28 | ; Nothing
|
---|
| 29 | ; Returns:
|
---|
| 30 | ; Nothing
|
---|
| 31 | ; Corrupts registers:
|
---|
| 32 | ; AX, DI
|
---|
| 33 | ;--------------------------------------------------------------------
|
---|
| 34 | .InitializeDisplayForBootMenu:
|
---|
| 35 | ; Change display mode if necessary
|
---|
| 36 | mov ax, [cs:ROMVARS.wDisplayMode] ; AH 00h = Set Video Mode
|
---|
| 37 | cmp al, DEFAULT_TEXT_MODE
|
---|
| 38 | je SHORT .InitializeDisplayLibrary
|
---|
| 39 | int BIOS_VIDEO_INTERRUPT_10h
|
---|
| 40 | .InitializeDisplayLibrary:
|
---|
[130] | 41 | call BootMenuPrint_InitializeDisplayContext
|
---|
[96] | 42 | ; Fall to .ProcessMenuSelectionsUntilBootable
|
---|
[3] | 43 |
|
---|
| 44 | ;--------------------------------------------------------------------
|
---|
[96] | 45 | ; .ProcessMenuSelectionsUntilBootable
|
---|
[3] | 46 | ; Parameters:
|
---|
| 47 | ; DS: RAMVARS segment
|
---|
| 48 | ; Returns:
|
---|
| 49 | ; Never returns
|
---|
| 50 | ;--------------------------------------------------------------------
|
---|
| 51 | ALIGN JUMP_ALIGN
|
---|
[96] | 52 | .ProcessMenuSelectionsUntilBootable:
|
---|
[95] | 53 | call BootMenu_DisplayAndReturnSelection
|
---|
[130] | 54 | call DriveXlate_ToOrBack ; Translate drive number
|
---|
[96] | 55 | call BootSector_TryToLoadFromDriveDL
|
---|
| 56 | jnc SHORT .ProcessMenuSelectionsUntilBootable ; Boot failure, show menu again
|
---|
[121] | 57 | SWITCH_BACK_TO_POST_STACK
|
---|
[96] | 58 | ; Fall to JumpToBootSector
|
---|
[3] | 59 |
|
---|
[96] | 60 | ;--------------------------------------------------------------------
|
---|
| 61 | ; JumpToBootSector
|
---|
| 62 | ; Parameters:
|
---|
| 63 | ; DL: Drive to boot from (translated, 00h or 80h)
|
---|
| 64 | ; ES:BX: Ptr to boot sector
|
---|
| 65 | ; Returns:
|
---|
| 66 | ; Never returns
|
---|
| 67 | ;--------------------------------------------------------------------
|
---|
| 68 | ALIGN JUMP_ALIGN
|
---|
| 69 | JumpToBootSector:
|
---|
| 70 | push es ; Push boot sector segment
|
---|
| 71 | push bx ; Push boot sector offset
|
---|
| 72 | call ClearSegmentsForBoot
|
---|
| 73 | retf
|
---|
[3] | 74 |
|
---|
[96] | 75 |
|
---|
[3] | 76 | ;--------------------------------------------------------------------
|
---|
[95] | 77 | ; Int19hMenu_RomBoot
|
---|
[3] | 78 | ; Parameters:
|
---|
| 79 | ; DS: RAMVARS segment
|
---|
| 80 | ; Returns:
|
---|
[95] | 81 | ; Never returns
|
---|
[3] | 82 | ;--------------------------------------------------------------------
|
---|
| 83 | ALIGN JUMP_ALIGN
|
---|
[95] | 84 | Int19hMenu_RomBoot:
|
---|
[121] | 85 | SWITCH_BACK_TO_POST_STACK
|
---|
[96] | 86 | call ClearSegmentsForBoot
|
---|
[95] | 87 | int INTV_BOOT_FAILURE ; Never returns
|
---|
[96] | 88 |
|
---|
| 89 |
|
---|
| 90 | ;--------------------------------------------------------------------
|
---|
| 91 | ; ClearSegmentsForBoot
|
---|
| 92 | ; Parameters:
|
---|
| 93 | ; Nothing
|
---|
| 94 | ; Returns:
|
---|
[121] | 95 | ; DX: Zero
|
---|
[96] | 96 | ; DS=ES: Zero
|
---|
| 97 | ; Corrupts registers:
|
---|
[121] | 98 | ; Nothing
|
---|
[96] | 99 | ;--------------------------------------------------------------------
|
---|
| 100 | ALIGN JUMP_ALIGN
|
---|
| 101 | ClearSegmentsForBoot:
|
---|
[121] | 102 | xor dx, dx ; Device supported by INT 13h
|
---|
| 103 | mov ds, dx
|
---|
| 104 | mov es, dx
|
---|
[96] | 105 | ret
|
---|