[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 | ;--------------------------------------------------------------------
|
---|
| 8 | ; Initial Boot Menu Loader.
|
---|
| 9 | ; Prepares BOOTVARS for displaying Boot Menu and accepting
|
---|
| 10 | ; callbacks from INT 18h and 19h.
|
---|
| 11 | ;
|
---|
| 12 | ; Int19hMenu_BootLoader
|
---|
| 13 | ; Parameters:
|
---|
| 14 | ; Nothing
|
---|
| 15 | ; Returns:
|
---|
| 16 | ; Jumps to Int19hMenu_Display, then never returns
|
---|
| 17 | ;--------------------------------------------------------------------
|
---|
| 18 | ALIGN JUMP_ALIGN
|
---|
| 19 | Int19hMenu_BootLoader:
|
---|
[121] | 20 | ; Store POST stack pointer
|
---|
[3] | 21 | LOAD_BDA_SEGMENT_TO ds, ax
|
---|
[121] | 22 | STORE_POST_STACK_POINTER
|
---|
[3] | 23 |
|
---|
| 24 | ; Install new INT 19h handler now that BOOTVARS has been initialized
|
---|
[96] | 25 | mov WORD [INTV_BOOTSTRAP*4], DisplayBootMenu
|
---|
[3] | 26 | mov WORD [INTV_BOOTSTRAP*4+2], cs
|
---|
[96] | 27 | ; Fall to DisplayBootMenu
|
---|
[3] | 28 |
|
---|
| 29 | ;--------------------------------------------------------------------
|
---|
[96] | 30 | ; DisplayBootMenu
|
---|
[3] | 31 | ; Parameters:
|
---|
| 32 | ; Nothing
|
---|
| 33 | ; Returns:
|
---|
| 34 | ; Never returns
|
---|
| 35 | ;--------------------------------------------------------------------
|
---|
| 36 | ALIGN JUMP_ALIGN
|
---|
[96] | 37 | DisplayBootMenu:
|
---|
[121] | 38 | SWITCH_TO_BOOT_MENU_STACK
|
---|
| 39 | CALL_DISPLAY_LIBRARY InitializeDisplayContext
|
---|
[3] | 40 | call RamVars_GetSegmentToDS
|
---|
[96] | 41 | ; Fall to .ProcessMenuSelectionsUntilBootable
|
---|
[3] | 42 |
|
---|
| 43 | ;--------------------------------------------------------------------
|
---|
[96] | 44 | ; .ProcessMenuSelectionsUntilBootable
|
---|
[3] | 45 | ; Parameters:
|
---|
| 46 | ; DS: RAMVARS segment
|
---|
| 47 | ; Returns:
|
---|
| 48 | ; Never returns
|
---|
| 49 | ;--------------------------------------------------------------------
|
---|
| 50 | ALIGN JUMP_ALIGN
|
---|
[96] | 51 | .ProcessMenuSelectionsUntilBootable:
|
---|
[95] | 52 | call BootMenu_DisplayAndReturnSelection
|
---|
| 53 | call DriveXlate_ToOrBack ; Translate drive number
|
---|
[96] | 54 | call BootSector_TryToLoadFromDriveDL
|
---|
| 55 | jnc SHORT .ProcessMenuSelectionsUntilBootable ; Boot failure, show menu again
|
---|
[121] | 56 | SWITCH_BACK_TO_POST_STACK
|
---|
[96] | 57 | ; Fall to JumpToBootSector
|
---|
[3] | 58 |
|
---|
[96] | 59 | ;--------------------------------------------------------------------
|
---|
| 60 | ; JumpToBootSector
|
---|
| 61 | ; Parameters:
|
---|
| 62 | ; DL: Drive to boot from (translated, 00h or 80h)
|
---|
| 63 | ; ES:BX: Ptr to boot sector
|
---|
| 64 | ; Returns:
|
---|
| 65 | ; Never returns
|
---|
| 66 | ;--------------------------------------------------------------------
|
---|
| 67 | ALIGN JUMP_ALIGN
|
---|
| 68 | JumpToBootSector:
|
---|
| 69 | push es ; Push boot sector segment
|
---|
| 70 | push bx ; Push boot sector offset
|
---|
| 71 | call ClearSegmentsForBoot
|
---|
| 72 | retf
|
---|
[3] | 73 |
|
---|
[96] | 74 |
|
---|
[3] | 75 | ;--------------------------------------------------------------------
|
---|
[95] | 76 | ; Int19hMenu_RomBoot
|
---|
[3] | 77 | ; Parameters:
|
---|
| 78 | ; DS: RAMVARS segment
|
---|
| 79 | ; Returns:
|
---|
[95] | 80 | ; Never returns
|
---|
[3] | 81 | ;--------------------------------------------------------------------
|
---|
| 82 | ALIGN JUMP_ALIGN
|
---|
[95] | 83 | Int19hMenu_RomBoot:
|
---|
[121] | 84 | SWITCH_BACK_TO_POST_STACK
|
---|
[96] | 85 | call ClearSegmentsForBoot
|
---|
[95] | 86 | int INTV_BOOT_FAILURE ; Never returns
|
---|
[96] | 87 |
|
---|
| 88 |
|
---|
| 89 | ;--------------------------------------------------------------------
|
---|
| 90 | ; ClearSegmentsForBoot
|
---|
| 91 | ; Parameters:
|
---|
| 92 | ; Nothing
|
---|
| 93 | ; Returns:
|
---|
[121] | 94 | ; DX: Zero
|
---|
[96] | 95 | ; DS=ES: Zero
|
---|
| 96 | ; Corrupts registers:
|
---|
[121] | 97 | ; Nothing
|
---|
[96] | 98 | ;--------------------------------------------------------------------
|
---|
| 99 | ALIGN JUMP_ALIGN
|
---|
| 100 | ClearSegmentsForBoot:
|
---|
[121] | 101 | xor dx, dx ; Device supported by INT 13h
|
---|
| 102 | mov ds, dx
|
---|
| 103 | mov es, dx
|
---|
[96] | 104 | ret
|
---|