1 | ; Project name : XTIDE Universal BIOS
|
---|
2 | ; Description : Int 19h BIOS functions for Boot Menu.
|
---|
3 |
|
---|
4 | ; Section containing code
|
---|
5 | SECTION .text
|
---|
6 |
|
---|
7 | ;--------------------------------------------------------------------
|
---|
8 | ; Boot Menu Loader.
|
---|
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:
|
---|
18 | ; Store POST stack pointer
|
---|
19 | LOAD_BDA_SEGMENT_TO ds, ax
|
---|
20 | STORE_POST_STACK_POINTER
|
---|
21 | SWITCH_TO_BOOT_MENU_STACK
|
---|
22 | call BootMenuPrint_InitializeDisplayContext
|
---|
23 | call RamVars_GetSegmentToDS
|
---|
24 | ; Fall to .ProcessMenuSelectionsUntilBootable
|
---|
25 |
|
---|
26 | ;--------------------------------------------------------------------
|
---|
27 | ; .ProcessMenuSelectionsUntilBootable
|
---|
28 | ; Parameters:
|
---|
29 | ; DS: RAMVARS segment
|
---|
30 | ; Returns:
|
---|
31 | ; Never returns
|
---|
32 | ;--------------------------------------------------------------------
|
---|
33 | ALIGN JUMP_ALIGN
|
---|
34 | .ProcessMenuSelectionsUntilBootable:
|
---|
35 | call BootMenu_DisplayAndReturnSelection
|
---|
36 | call DriveXlate_ToOrBack ; Translate drive number
|
---|
37 | call BootSector_TryToLoadFromDriveDL
|
---|
38 | jnc SHORT .ProcessMenuSelectionsUntilBootable ; Boot failure, show menu again
|
---|
39 | SWITCH_BACK_TO_POST_STACK
|
---|
40 | ; Fall to JumpToBootSector
|
---|
41 |
|
---|
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
|
---|
56 |
|
---|
57 |
|
---|
58 | ;--------------------------------------------------------------------
|
---|
59 | ; Int19hMenu_RomBoot
|
---|
60 | ; Parameters:
|
---|
61 | ; DS: RAMVARS segment
|
---|
62 | ; Returns:
|
---|
63 | ; Never returns
|
---|
64 | ;--------------------------------------------------------------------
|
---|
65 | ALIGN JUMP_ALIGN
|
---|
66 | Int19hMenu_RomBoot:
|
---|
67 | SWITCH_BACK_TO_POST_STACK
|
---|
68 | call ClearSegmentsForBoot
|
---|
69 | int INTV_BOOT_FAILURE ; Never returns
|
---|
70 |
|
---|
71 |
|
---|
72 | ;--------------------------------------------------------------------
|
---|
73 | ; ClearSegmentsForBoot
|
---|
74 | ; Parameters:
|
---|
75 | ; Nothing
|
---|
76 | ; Returns:
|
---|
77 | ; DX: Zero
|
---|
78 | ; DS=ES: Zero
|
---|
79 | ; Corrupts registers:
|
---|
80 | ; Nothing
|
---|
81 | ;--------------------------------------------------------------------
|
---|
82 | ALIGN JUMP_ALIGN
|
---|
83 | ClearSegmentsForBoot:
|
---|
84 | xor dx, dx ; Device supported by INT 13h
|
---|
85 | mov ds, dx
|
---|
86 | mov es, dx
|
---|
87 | ret
|
---|