[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:
|
---|
| 20 | LOAD_BDA_SEGMENT_TO ds, ax
|
---|
| 21 | call BootVars_StorePostStackPointer
|
---|
| 22 |
|
---|
| 23 | ; Install new INT 19h handler now that BOOTVARS has been initialized
|
---|
| 24 | mov WORD [INTV_BOOTSTRAP*4], Int19hMenu_Display
|
---|
| 25 | mov WORD [INTV_BOOTSTRAP*4+2], cs
|
---|
| 26 | ; Fall to Int19hMenu_Display
|
---|
| 27 |
|
---|
| 28 | ;--------------------------------------------------------------------
|
---|
| 29 | ; Displays Boot Menu so user can select drive to boot from.
|
---|
| 30 | ;
|
---|
| 31 | ; Int19hMenu_Display
|
---|
| 32 | ; Parameters:
|
---|
| 33 | ; Nothing
|
---|
| 34 | ; Returns:
|
---|
| 35 | ; Never returns
|
---|
| 36 | ;--------------------------------------------------------------------
|
---|
| 37 | ALIGN JUMP_ALIGN
|
---|
| 38 | Int19hMenu_Display:
|
---|
| 39 | sti ; Enable interrupts
|
---|
| 40 | call BootVars_SwitchToBootMenuStack
|
---|
| 41 | call RamVars_GetSegmentToDS
|
---|
| 42 | ; Fall to Int19hMenu_ProcessMenuSelectionsUntilBootable
|
---|
| 43 |
|
---|
| 44 | ;--------------------------------------------------------------------
|
---|
| 45 | ; Processes user menu selections until bootable drive is selected.
|
---|
| 46 | ;
|
---|
| 47 | ; Int19hMenu_ProcessMenuSelectionsUntilBootable
|
---|
| 48 | ; Parameters:
|
---|
| 49 | ; DS: RAMVARS segment
|
---|
| 50 | ; Returns:
|
---|
| 51 | ; Never returns
|
---|
| 52 | ;--------------------------------------------------------------------
|
---|
| 53 | ALIGN JUMP_ALIGN
|
---|
| 54 | Int19hMenu_ProcessMenuSelectionsUntilBootable:
|
---|
| 55 | call Int19hMenu_GetDriveOrFunctionFromBootMenu
|
---|
| 56 | jc SHORT Int19hMenu_ExecuteSelectedFunction
|
---|
| 57 | call Int19h_TryToLoadBootSectorFromDL
|
---|
| 58 | jnc SHORT Int19hMenu_ProcessMenuSelectionsUntilBootable ; Boot failure
|
---|
| 59 | call BootVars_SwitchBackToPostStack
|
---|
| 60 | jmp SHORT Int19h_JumpToBootSector
|
---|
| 61 |
|
---|
| 62 |
|
---|
| 63 | ;--------------------------------------------------------------------
|
---|
| 64 | ; Selects Floppy or Hard Disk Drive to boot from or some function.
|
---|
| 65 | ;
|
---|
| 66 | ; Int19hMenu_GetDriveOrFunctionFromBootMenu
|
---|
| 67 | ; Parameters:
|
---|
| 68 | ; DS: RAMVARS segment
|
---|
| 69 | ; Returns:
|
---|
| 70 | ; DX: Drive number (translated, 00h or 80h) or
|
---|
| 71 | ; Function ID
|
---|
| 72 | ; CF: Cleared if drive selected
|
---|
| 73 | ; Set if function selected
|
---|
| 74 | ; Corrupts registers:
|
---|
| 75 | ; All non segment regs
|
---|
| 76 | ;--------------------------------------------------------------------
|
---|
| 77 | ALIGN JUMP_ALIGN
|
---|
| 78 | Int19hMenu_GetDriveOrFunctionFromBootMenu:
|
---|
| 79 | call BootMenu_DisplayAndReturnSelection
|
---|
| 80 | jc SHORT .ReturnFunction
|
---|
| 81 | call DriveXlate_ToOrBack ; Translate drive number
|
---|
| 82 | clc
|
---|
| 83 | ALIGN JUMP_ALIGN
|
---|
| 84 | .ReturnFunction:
|
---|
| 85 | ret
|
---|
| 86 |
|
---|
| 87 |
|
---|
| 88 | ;--------------------------------------------------------------------
|
---|
| 89 | ; Executes any function (non-drive) selected from Boot Menu.
|
---|
| 90 | ;
|
---|
| 91 | ; Int19hMenu_ExecuteSelectedFunction
|
---|
| 92 | ; Parameters:
|
---|
| 93 | ; DX: Function ID (selected from Boot Menu)
|
---|
| 94 | ; DS: RAMVARS segment
|
---|
| 95 | ; Returns:
|
---|
| 96 | ; Nothing
|
---|
| 97 | ; Corrupts registers:
|
---|
| 98 | ; All non segment regs
|
---|
| 99 | ;--------------------------------------------------------------------
|
---|
| 100 | ALIGN JUMP_ALIGN
|
---|
| 101 | Int19hMenu_ExecuteSelectedFunction:
|
---|
| 102 | ePUSH_T ax, Int19hMenu_ProcessMenuSelectionsUntilBootable
|
---|
| 103 | test dx, dx ; 0, IDF_BOOTMNU_ROM
|
---|
| 104 | jz SHORT .Int18hRomBoot
|
---|
| 105 | ret
|
---|
| 106 | ALIGN JUMP_ALIGN
|
---|
| 107 | .Int18hRomBoot:
|
---|
| 108 | call BootVars_SwitchBackToPostStack
|
---|
[90] | 109 | jmp Int19h_BootFailure ; Never returns
|
---|