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

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

Changes to XTIDE Universal BIOS:

  • Cleaned boot loader code some more.
File size: 2.9 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    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], DisplayBootMenu
25    mov     WORD [INTV_BOOTSTRAP*4+2], cs
26    ; Fall to DisplayBootMenu
27
28;--------------------------------------------------------------------
29; DisplayBootMenu
30;   Parameters:
31;       Nothing
32;   Returns:
33;       Never returns
34;--------------------------------------------------------------------
35ALIGN JUMP_ALIGN
36DisplayBootMenu:
37    call    BootVars_SwitchToBootMenuStack
38    call    RamVars_GetSegmentToDS
39    ; Fall to .ProcessMenuSelectionsUntilBootable
40
41;--------------------------------------------------------------------
42; .ProcessMenuSelectionsUntilBootable
43;   Parameters:
44;       DS:     RAMVARS segment
45;   Returns:
46;       Never returns
47;--------------------------------------------------------------------
48ALIGN JUMP_ALIGN
49.ProcessMenuSelectionsUntilBootable:
50    call    BootMenu_DisplayAndReturnSelection
51    call    DriveXlate_ToOrBack         ; Translate drive number
52    call    BootSector_TryToLoadFromDriveDL
53    jnc     SHORT .ProcessMenuSelectionsUntilBootable   ; Boot failure, show menu again
54    call    BootVars_SwitchBackToPostStack
55    ; Fall to JumpToBootSector
56
57;--------------------------------------------------------------------
58; JumpToBootSector
59;   Parameters:
60;       DL:     Drive to boot from (translated, 00h or 80h)
61;       ES:BX:  Ptr to boot sector
62;   Returns:
63;       Never returns
64;--------------------------------------------------------------------
65ALIGN JUMP_ALIGN
66JumpToBootSector:
67    push    es                              ; Push boot sector segment
68    push    bx                              ; Push boot sector offset
69    call    ClearSegmentsForBoot
70    xor     dh, dh                          ; Device supported by INT 13h
71    retf
72
73
74;--------------------------------------------------------------------
75; Int19hMenu_RomBoot
76;   Parameters:
77;       DS:     RAMVARS segment
78;   Returns:
79;       Never returns
80;--------------------------------------------------------------------
81ALIGN JUMP_ALIGN
82Int19hMenu_RomBoot:
83    call    BootVars_SwitchBackToPostStack
84    call    ClearSegmentsForBoot
85    int     INTV_BOOT_FAILURE       ; Never returns
86
87
88;--------------------------------------------------------------------
89; ClearSegmentsForBoot
90;   Parameters:
91;       Nothing
92;   Returns:
93;       DS=ES:  Zero
94;   Corrupts registers:
95;       AX
96;--------------------------------------------------------------------
97ALIGN JUMP_ALIGN
98ClearSegmentsForBoot:
99    xor     ax, ax
100    mov     ds, ax
101    mov     es, ax
102    ret
Note: See TracBrowser for help on using the repository browser.