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
RevLine 
[90]1; Project name  :   XTIDE Universal BIOS
[3]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
[96]24    mov     WORD [INTV_BOOTSTRAP*4], DisplayBootMenu
[3]25    mov     WORD [INTV_BOOTSTRAP*4+2], cs
[96]26    ; Fall to DisplayBootMenu
[3]27
28;--------------------------------------------------------------------
[96]29; DisplayBootMenu
[3]30;   Parameters:
31;       Nothing
32;   Returns:
33;       Never returns
34;--------------------------------------------------------------------
35ALIGN JUMP_ALIGN
[96]36DisplayBootMenu:
[3]37    call    BootVars_SwitchToBootMenuStack
38    call    RamVars_GetSegmentToDS
[96]39    ; Fall to .ProcessMenuSelectionsUntilBootable
[3]40
41;--------------------------------------------------------------------
[96]42; .ProcessMenuSelectionsUntilBootable
[3]43;   Parameters:
44;       DS:     RAMVARS segment
45;   Returns:
46;       Never returns
47;--------------------------------------------------------------------
48ALIGN JUMP_ALIGN
[96]49.ProcessMenuSelectionsUntilBootable:
[95]50    call    BootMenu_DisplayAndReturnSelection
51    call    DriveXlate_ToOrBack         ; Translate drive number
[96]52    call    BootSector_TryToLoadFromDriveDL
53    jnc     SHORT .ProcessMenuSelectionsUntilBootable   ; Boot failure, show menu again
[3]54    call    BootVars_SwitchBackToPostStack
[96]55    ; Fall to JumpToBootSector
[3]56
[96]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
[3]72
[96]73
[3]74;--------------------------------------------------------------------
[95]75; Int19hMenu_RomBoot
[3]76;   Parameters:
77;       DS:     RAMVARS segment
78;   Returns:
[95]79;       Never returns
[3]80;--------------------------------------------------------------------
81ALIGN JUMP_ALIGN
[95]82Int19hMenu_RomBoot:
[3]83    call    BootVars_SwitchBackToPostStack
[96]84    call    ClearSegmentsForBoot
[95]85    int     INTV_BOOT_FAILURE       ; Never returns
[96]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.