[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 |
---|
| 22 | CALL_DISPLAY_LIBRARY InitializeDisplayContext |
---|
[3] | 23 | call RamVars_GetSegmentToDS |
---|
[96] | 24 | ; Fall to .ProcessMenuSelectionsUntilBootable |
---|
[3] | 25 | |
---|
| 26 | ;-------------------------------------------------------------------- |
---|
[96] | 27 | ; .ProcessMenuSelectionsUntilBootable |
---|
[3] | 28 | ; Parameters: |
---|
| 29 | ; DS: RAMVARS segment |
---|
| 30 | ; Returns: |
---|
| 31 | ; Never returns |
---|
| 32 | ;-------------------------------------------------------------------- |
---|
| 33 | ALIGN JUMP_ALIGN |
---|
[96] | 34 | .ProcessMenuSelectionsUntilBootable: |
---|
[95] | 35 | call BootMenu_DisplayAndReturnSelection |
---|
| 36 | call DriveXlate_ToOrBack ; Translate drive number |
---|
[96] | 37 | call BootSector_TryToLoadFromDriveDL |
---|
| 38 | jnc SHORT .ProcessMenuSelectionsUntilBootable ; Boot failure, show menu again |
---|
[121] | 39 | SWITCH_BACK_TO_POST_STACK |
---|
[96] | 40 | ; Fall to JumpToBootSector |
---|
[3] | 41 | |
---|
[96] | 42 | ;-------------------------------------------------------------------- |
---|
| 43 | ; JumpToBootSector |
---|
| 44 | ; Parameters: |
---|
| 45 | ; DL: Drive to boot from (translated, 00h or 80h) |
---|
| 46 | ; ES:BX: Ptr to boot sector |
---|
| 47 | ; Returns: |
---|
| 48 | ; Never returns |
---|
| 49 | ;-------------------------------------------------------------------- |
---|
| 50 | ALIGN JUMP_ALIGN |
---|
| 51 | JumpToBootSector: |
---|
| 52 | push es ; Push boot sector segment |
---|
| 53 | push bx ; Push boot sector offset |
---|
| 54 | call ClearSegmentsForBoot |
---|
| 55 | retf |
---|
[3] | 56 | |
---|
[96] | 57 | |
---|
[3] | 58 | ;-------------------------------------------------------------------- |
---|
[95] | 59 | ; Int19hMenu_RomBoot |
---|
[3] | 60 | ; Parameters: |
---|
| 61 | ; DS: RAMVARS segment |
---|
| 62 | ; Returns: |
---|
[95] | 63 | ; Never returns |
---|
[3] | 64 | ;-------------------------------------------------------------------- |
---|
| 65 | ALIGN JUMP_ALIGN |
---|
[95] | 66 | Int19hMenu_RomBoot: |
---|
[121] | 67 | SWITCH_BACK_TO_POST_STACK |
---|
[96] | 68 | call ClearSegmentsForBoot |
---|
[95] | 69 | int INTV_BOOT_FAILURE ; Never returns |
---|
[96] | 70 | |
---|
| 71 | |
---|
| 72 | ;-------------------------------------------------------------------- |
---|
| 73 | ; ClearSegmentsForBoot |
---|
| 74 | ; Parameters: |
---|
| 75 | ; Nothing |
---|
| 76 | ; Returns: |
---|
[121] | 77 | ; DX: Zero |
---|
[96] | 78 | ; DS=ES: Zero |
---|
| 79 | ; Corrupts registers: |
---|
[121] | 80 | ; Nothing |
---|
[96] | 81 | ;-------------------------------------------------------------------- |
---|
| 82 | ALIGN JUMP_ALIGN |
---|
| 83 | ClearSegmentsForBoot: |
---|
[121] | 84 | xor dx, dx ; Device supported by INT 13h |
---|
| 85 | mov ds, dx |
---|
| 86 | mov es, dx |
---|
[96] | 87 | ret |
---|