Changeset 121 in xtideuniversalbios for trunk


Ignore:
Timestamp:
Feb 28, 2011, 5:13:38 PM (14 years ago)
Author:
Tomi Tilli
google:author:
aitotat
Message:

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.
Location:
trunk/XTIDE_Universal_BIOS
Files:
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Inc/BootVars.inc

    r96 r121  
    3232
    3333
     34;--------------------------------------------------------------------
     35; Stores POST stack pointer to BOOTVARS.
     36;
     37; STORE_POST_STACK_POINTER
     38;   Parameters:
     39;       DS:     BDA and Interrupt Vector segment (zero)
     40;   Returns:
     41;       Nothing
     42;   Corrupts registers:
     43;       Nothing
     44;--------------------------------------------------------------------
     45%macro STORE_POST_STACK_POINTER 0
     46    mov     [BOOTVARS.dwPostStack], sp
     47    mov     [BOOTVARS.dwPostStack+2], ss
     48%endmacro
     49
     50
     51;--------------------------------------------------------------------
     52; Initializes stack for boot menu usage.
     53; POST stack is not large enough when DPTs are stored to 30:0h.
     54;
     55; Note regarding LOAD_BDA_SEGMENT_TO: If you force the use of SP
     56; then you also have to unconditionally enable the CLI/STI pair.
     57; The reason for this is that only some buggy 808x CPU:s need the
     58; CLI/STI instruction pair when changing stacks. Other CPU:s disable
     59; interrupts automatically when SS is modified for the duration of
     60; the immediately following instruction to give time to change SP.
     61;
     62; SWITCH_TO_BOOT_MENU_STACK
     63;   Parameters:
     64;       Nothing
     65;   Returns:
     66;       SS:SP:  Pointer to top of Boot Menu stack
     67;   Corrupts registers:
     68;       Nothing
     69;--------------------------------------------------------------------
     70%macro SWITCH_TO_BOOT_MENU_STACK 0
     71%ifndef USE_186
     72    cli                                 ; Disable interrupts
     73%endif
     74    LOAD_BDA_SEGMENT_TO ss, sp
     75    mov     sp, BOOTVARS.rgbMnuStack    ; Load offset to stack
     76%ifndef USE_186
     77    sti                                 ; Enable interrupts
     78%endif
     79%endmacro
     80
     81
     82;--------------------------------------------------------------------
     83; Restores SS and SP to initial boot loader values.
     84;
     85; Before doing any changes, see the note regarding
     86; LOAD_BDA_SEGMENT_TO in BootVars_SwitchToBootMenuStack
     87;
     88; SWITCH_BACK_TO_POST_STACK
     89;   Parameters:
     90;       Nothing
     91;   Returns:
     92;       SS:SP:  Ptr to POST stack
     93;   Corrupts registers:
     94;       Nothing
     95;--------------------------------------------------------------------
     96%macro SWITCH_BACK_TO_POST_STACK 0
     97%ifndef USE_386
     98    cli                                 ; Disable interrupts
     99    LOAD_BDA_SEGMENT_TO ss, sp
     100    mov     sp, [ss:BOOTVARS.dwPostStack]
     101    mov     ss, [ss:BOOTVARS.dwPostStack+2]
     102    sti                                 ; Enable interrupts
     103%else
     104    LOAD_BDA_SEGMENT_TO ss, sp
     105    lss     sp, [ss:BOOTVARS.dwPostStack]
     106%endif
     107%endmacro
     108
     109
    34110%endif ; BOOTVARS_INC
  • trunk/XTIDE_Universal_BIOS/Src/Boot/BootInfo.asm

    r100 r121  
    6767    add     si, BYTE ATA1.strModel      ; DS:SI now points drive name
    6868    lea     di, [bx+BOOTNFO.szDrvName]  ; ES:DI now points to name destination
    69     mov     cx, LEN_BOOTNFO_DRV
    70     call    Memory_CopyCXbytesFromDSSItoESDI
     69    mov     cx, LEN_BOOTNFO_DRV / 2     ; Max number of WORDs allowed
     70.CopyNextWord:
     71    lodsw
     72    xchg    al, ah                      ; Change endianness
     73    stosw
     74    loop    .CopyNextWord
    7175    xor     ax, ax
    7276    stosb                               ; Terminate with NULL
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19hMenu.asm

    r96 r121  
    1818ALIGN JUMP_ALIGN
    1919Int19hMenu_BootLoader:
     20    ; Store POST stack pointer
    2021    LOAD_BDA_SEGMENT_TO ds, ax
    21     call    BootVars_StorePostStackPointer
     22    STORE_POST_STACK_POINTER
    2223
    2324    ; Install new INT 19h handler now that BOOTVARS has been initialized
     
    3536ALIGN JUMP_ALIGN
    3637DisplayBootMenu:
    37     call    BootVars_SwitchToBootMenuStack
     38    SWITCH_TO_BOOT_MENU_STACK
     39    CALL_DISPLAY_LIBRARY InitializeDisplayContext
    3840    call    RamVars_GetSegmentToDS
    3941    ; Fall to .ProcessMenuSelectionsUntilBootable
     
    5254    call    BootSector_TryToLoadFromDriveDL
    5355    jnc     SHORT .ProcessMenuSelectionsUntilBootable   ; Boot failure, show menu again
    54     call    BootVars_SwitchBackToPostStack
     56    SWITCH_BACK_TO_POST_STACK
    5557    ; Fall to JumpToBootSector
    5658
     
    6870    push    bx                              ; Push boot sector offset
    6971    call    ClearSegmentsForBoot
    70     xor     dh, dh                          ; Device supported by INT 13h
    7172    retf
    7273
     
    8182ALIGN JUMP_ALIGN
    8283Int19hMenu_RomBoot:
    83     call    BootVars_SwitchBackToPostStack
     84    SWITCH_BACK_TO_POST_STACK
    8485    call    ClearSegmentsForBoot
    8586    int     INTV_BOOT_FAILURE       ; Never returns
     
    9192;       Nothing
    9293;   Returns:
     94;       DX:     Zero
    9395;       DS=ES:  Zero
    9496;   Corrupts registers:
    95 ;       AX
     97;       Nothing
    9698;--------------------------------------------------------------------
    9799ALIGN JUMP_ALIGN
    98100ClearSegmentsForBoot:
    99     xor     ax, ax
    100     mov     ds, ax
    101     mov     es, ax
     101    xor     dx, dx                  ; Device supported by INT 13h
     102    mov     ds, dx
     103    mov     es, dx
    102104    ret
  • trunk/XTIDE_Universal_BIOS/Src/Main.asm

    r116 r121  
    117117
    118118; Include .asm files (boot menu)
    119 %include "BootVars.asm"         ; For accessing BOOTVARS struct
    120119%include "BootMenu.asm"         ; For Boot Menu operations
    121120%include "BootMenuEvent.asm"    ; For menu library event handling
Note: See TracChangeset for help on using the changeset viewer.