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

Last change on this file since 121 was 121, checked in by aitotat, 13 years ago

Changes to XTIDE Universal BIOS:

  • Endianness is now corrected for ATA device names.
  • Converted all BootVars.asm functions to macros in BootVars.inc.
  • Display library is now initialized second time before trying to display boot menu.
File size: 3.0 KB
Line 
1; Project name  :   XTIDE Universal BIOS
2; Description   :   Int 19h BIOS functions for Boot Menu.
3
4; Section containing code
5SECTION .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;--------------------------------------------------------------------
18ALIGN JUMP_ALIGN
19Int19hMenu_BootLoader:
20    ; Store POST stack pointer
21    LOAD_BDA_SEGMENT_TO ds, ax
22    STORE_POST_STACK_POINTER
23
24    ; Install new INT 19h handler now that BOOTVARS has been initialized
25    mov     WORD [INTV_BOOTSTRAP*4], DisplayBootMenu
26    mov     WORD [INTV_BOOTSTRAP*4+2], cs
27    ; Fall to DisplayBootMenu
28
29;--------------------------------------------------------------------
30; DisplayBootMenu
31;   Parameters:
32;       Nothing
33;   Returns:
34;       Never returns
35;--------------------------------------------------------------------
36ALIGN JUMP_ALIGN
37DisplayBootMenu:
38    SWITCH_TO_BOOT_MENU_STACK
39    CALL_DISPLAY_LIBRARY InitializeDisplayContext
40    call    RamVars_GetSegmentToDS
41    ; Fall to .ProcessMenuSelectionsUntilBootable
42
43;--------------------------------------------------------------------
44; .ProcessMenuSelectionsUntilBootable
45;   Parameters:
46;       DS:     RAMVARS segment
47;   Returns:
48;       Never returns
49;--------------------------------------------------------------------
50ALIGN JUMP_ALIGN
51.ProcessMenuSelectionsUntilBootable:
52    call    BootMenu_DisplayAndReturnSelection
53    call    DriveXlate_ToOrBack         ; Translate drive number
54    call    BootSector_TryToLoadFromDriveDL
55    jnc     SHORT .ProcessMenuSelectionsUntilBootable   ; Boot failure, show menu again
56    SWITCH_BACK_TO_POST_STACK
57    ; Fall to JumpToBootSector
58
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;--------------------------------------------------------------------
67ALIGN JUMP_ALIGN
68JumpToBootSector:
69    push    es                              ; Push boot sector segment
70    push    bx                              ; Push boot sector offset
71    call    ClearSegmentsForBoot
72    retf
73
74
75;--------------------------------------------------------------------
76; Int19hMenu_RomBoot
77;   Parameters:
78;       DS:     RAMVARS segment
79;   Returns:
80;       Never returns
81;--------------------------------------------------------------------
82ALIGN JUMP_ALIGN
83Int19hMenu_RomBoot:
84    SWITCH_BACK_TO_POST_STACK
85    call    ClearSegmentsForBoot
86    int     INTV_BOOT_FAILURE       ; Never returns
87
88
89;--------------------------------------------------------------------
90; ClearSegmentsForBoot
91;   Parameters:
92;       Nothing
93;   Returns:
94;       DX:     Zero
95;       DS=ES:  Zero
96;   Corrupts registers:
97;       Nothing
98;--------------------------------------------------------------------
99ALIGN JUMP_ALIGN
100ClearSegmentsForBoot:
101    xor     dx, dx                  ; Device supported by INT 13h
102    mov     ds, dx
103    mov     es, dx
104    ret
Note: See TracBrowser for help on using the repository browser.