source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19hMenu.asm @ 35

Last change on this file since 35 was 3, checked in by aitotat, 14 years ago
File size: 3.6 KB
Line 
1; File name     :   Int19hMenu.asm
2; Project name  :   IDE BIOS
3; Created date  :   25.3.2010
4; Last update   :   12.4.2010
5; Author        :   Tomi Tilli
6; Description   :   Int 19h BIOS functions for Boot Menu.
7
8; Section containing code
9SECTION .text
10
11;--------------------------------------------------------------------
12; Initial Boot Menu Loader.
13; Prepares BOOTVARS for displaying Boot Menu and accepting
14; callbacks from INT 18h and 19h.
15;
16; Int19hMenu_BootLoader
17;   Parameters:
18;       Nothing
19;   Returns:
20;       Jumps to Int19hMenu_Display, then never returns
21;--------------------------------------------------------------------
22ALIGN JUMP_ALIGN
23Int19hMenu_BootLoader:
24    LOAD_BDA_SEGMENT_TO ds, ax
25    call    BootVars_StorePostStackPointer
26    call    BootVars_StoreSystemInt18hAndInstallOurs
27
28    ; Install new INT 19h handler now that BOOTVARS has been initialized
29    mov     WORD [INTV_BOOTSTRAP*4], Int19hMenu_Display
30    mov     WORD [INTV_BOOTSTRAP*4+2], cs
31    ; Fall to Int19hMenu_Display
32
33;--------------------------------------------------------------------
34; Displays Boot Menu so user can select drive to boot from.
35;
36; Int19hMenu_Display
37;   Parameters:
38;       Nothing
39;   Returns:
40;       Never returns
41;--------------------------------------------------------------------
42ALIGN JUMP_ALIGN
43Int19hMenu_Display:
44    sti                                 ; Enable interrupts
45    call    BootVars_SwitchToBootMenuStack
46    call    RamVars_GetSegmentToDS
47    ; Fall to Int19hMenu_ProcessMenuSelectionsUntilBootable
48
49;--------------------------------------------------------------------
50; Processes user menu selections until bootable drive is selected.
51;
52; Int19hMenu_ProcessMenuSelectionsUntilBootable
53;   Parameters:
54;       DS:     RAMVARS segment
55;   Returns:
56;       Never returns
57;--------------------------------------------------------------------
58ALIGN JUMP_ALIGN
59Int19hMenu_ProcessMenuSelectionsUntilBootable:
60    call    Int19hMenu_GetDriveOrFunctionFromBootMenu
61    jc      SHORT Int19hMenu_ExecuteSelectedFunction
62    call    Int19h_TryToLoadBootSectorFromDL
63    jnc     SHORT Int19hMenu_ProcessMenuSelectionsUntilBootable ; Boot failure
64    call    BootVars_SwitchBackToPostStack
65    jmp     SHORT Int19h_JumpToBootSector
66
67
68;--------------------------------------------------------------------
69; Selects Floppy or Hard Disk Drive to boot from or some function.
70;
71; Int19hMenu_GetDriveOrFunctionFromBootMenu
72;   Parameters:
73;       DS:     RAMVARS segment
74;   Returns:
75;       DX:     Drive number (translated, 00h or 80h) or
76;               Function ID
77;       CF:     Cleared if drive selected
78;               Set if function selected
79;   Corrupts registers:
80;       All non segment regs
81;--------------------------------------------------------------------
82ALIGN JUMP_ALIGN
83Int19hMenu_GetDriveOrFunctionFromBootMenu:
84    call    BootMenu_DisplayAndReturnSelection
85    jc      SHORT .ReturnFunction
86    call    DriveXlate_ToOrBack         ; Translate drive number
87    clc
88ALIGN JUMP_ALIGN
89.ReturnFunction:
90    ret
91
92
93;--------------------------------------------------------------------
94; Executes any function (non-drive) selected from Boot Menu.
95;
96; Int19hMenu_ExecuteSelectedFunction
97;   Parameters:
98;       DX:     Function ID (selected from Boot Menu)
99;       DS:     RAMVARS segment
100;   Returns:
101;       Nothing
102;   Corrupts registers:
103;       All non segment regs
104;--------------------------------------------------------------------
105ALIGN JUMP_ALIGN
106Int19hMenu_ExecuteSelectedFunction:
107    ePUSH_T ax, Int19hMenu_ProcessMenuSelectionsUntilBootable
108    test    dx, dx                      ; 0, IDF_BOOTMNU_ROM
109    jz      SHORT .Int18hRomBoot
110    ret
111ALIGN JUMP_ALIGN
112.Int18hRomBoot:
113    call    BootVars_RestoreSystemInt18h
114    call    BootVars_SwitchBackToPostStack
115    call    Int19h_BootFailure          ; Should never return
116    jmp     SHORT Int19hMenu_BootLoader ; Status unknown so reinitialize boot loader
Note: See TracBrowser for help on using the repository browser.