Changeset 96 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src


Ignore:
Timestamp:
Jan 28, 2011, 4:29:42 PM (13 years ago)
Author:
aitotat
google:author:
aitotat
Message:

Changes to XTIDE Universal BIOS:

  • Cleaned boot loader code some more.
Location:
trunk/XTIDE_Universal_BIOS/Src
Files:
1 added
1 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrint.asm

    r92 r96  
    1919BootMenuPrint_TitleStrings:
    2020    mov     si, ROMVARS.szTitle
    21     call    PrintNullTerminatedStringFromCSSIandSetCF
    22     call    BootMenuPrint_Newline
     21    call    BootMenuPrint_NullTerminatedStringFromCSSIandSetCF
     22    CALL_DISPLAY_LIBRARY PrintNewlineCharacters
    2323    mov     si, ROMVARS.szVersion
    24     jmp     PrintNullTerminatedStringFromCSSIandSetCF
    25 
    26 
    27 ;--------------------------------------------------------------------
    28 ; BootMenuPrint_Newline
     24    jmp     BootMenuPrint_NullTerminatedStringFromCSSIandSetCF
     25
     26
     27;--------------------------------------------------------------------
     28; BootMenuPrint_ClearScreen
    2929;   Parameters:
    3030;       Nothing
     
    3535;--------------------------------------------------------------------
    3636ALIGN JUMP_ALIGN
    37 BootMenuPrint_Newline:
    38     CALL_DISPLAY_LIBRARY PrintNewlineCharacters
    39     ret
    40 
    41 
    42 ;--------------------------------------------------------------------
    43 ; BootMenuPrint_ClearScreen
    44 ;   Parameters:
    45 ;       Nothing
    46 ;   Returns:
    47 ;       Nothing
    48 ;   Corrupts registers:
    49 ;       AX
    50 ;--------------------------------------------------------------------
    51 ALIGN JUMP_ALIGN
    5237BootMenuPrint_ClearScreen:
    53     push    di
    5438    mov     ax, ' ' | (MONO_NORMAL<<8)
    5539    CALL_DISPLAY_LIBRARY ClearScreenWithCharInALandAttrInAH
    56     pop     di
    57     ret
    58 
    59 
    60 ;--------------------------------------------------------------------
    61 ; Translates and prints drive number.
    62 ;
    63 ; BootMenuPrint_TranslatedDriveNumber
    64 ;   Parameters:
    65 ;       DL:     Untranslated drive number
    66 ;       DS:     RAMVARS segment
    67 ;   Returns:
    68 ;       Nothing
    69 ;   Corrupts registers:
    70 ;       AX, DI
    71 ;--------------------------------------------------------------------
    72 ALIGN JUMP_ALIGN
    73 BootMenuPrint_TranslatedDriveNumber:
    74     push    dx
    75     push    bx
    76 
    77     call    DriveXlate_ToOrBack
    78     eMOVZX  ax, dl      ; Drive number to AL
    79     CALL_DISPLAY_LIBRARY PrintWordFromAXwithBaseInBX
    80     mov     al, ' '     ; Print space
    81     CALL_DISPLAY_LIBRARY PrintCharacterFromAL
    82 
    83     pop     bx
    84     pop     dx
    8540    ret
    8641
     
    155110.HardDiskMenuitemForForeignDrive:
    156111    mov     si, g_szforeignHD
    157     jmp     PrintNullTerminatedStringFromCSSIandSetCF
     112    jmp     BootMenuPrint_NullTerminatedStringFromCSSIandSetCF
    158113
    159114
     
    365320
    366321;--------------------------------------------------------------------
    367 ; PrintNullTerminatedStringFromCSSIandSetCF
     322; BootMenuPrint_NullTerminatedStringFromCSSIandSetCF
    368323;   Parameters:
    369324;       CS:SI:  Ptr to NULL terminated string to print
     
    374329;--------------------------------------------------------------------
    375330ALIGN JUMP_ALIGN
    376 PrintNullTerminatedStringFromCSSIandSetCF:
     331BootMenuPrint_NullTerminatedStringFromCSSIandSetCF:
    377332    CALL_DISPLAY_LIBRARY PrintNullTerminatedStringFromCSSI
    378333    stc
  • trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrintCfg.asm

    r88 r96  
    2020ALIGN JUMP_ALIGN
    2121BootMenuPrintCfg_ForOurDrive:
    22     call    BootMenuPrintCfg_HeaderAndChangeLine
     22    mov     si, g_szCfgHeader
     23    call    BootMenuPrint_NullTerminatedStringFromCSSIandSetCF
    2324    call    BootMenuPrintCfg_GetPointers
    24     call    BootMenuPrintCfg_PushAndFormatCfgString
    25     jmp     BootMenuPrint_Newline
     25    ; Fall to PushAndFormatCfgString
    2626
    2727
    2828;--------------------------------------------------------------------
    29 ; Prints configuration header and changes for printing values.
    30 ;
    31 ; BootMenuPrintCfg_HeaderAndChangeLine
    32 ;   Parameters:
    33 ;       Nothing
    34 ;   Returns:
    35 ;       Nothing
    36 ;   Corrupts registers:
    37 ;       AX, SI, DI
    38 ;--------------------------------------------------------------------
    39 ALIGN JUMP_ALIGN
    40 BootMenuPrintCfg_HeaderAndChangeLine:
    41     mov     si, g_szCfgHeader
    42     call    PrintNullTerminatedStringFromCSSIandSetCF
    43     jmp     BootMenuPrint_Newline
    44 
    45 
    46 ;--------------------------------------------------------------------
    47 ; Return all necessary pointers to drive information structs.
    48 ;
    49 ; BootMenuPrintCfg_GetPointers
    50 ;   Parameters:
    51 ;       DS:DI:  Ptr to DPT
    52 ;   Returns:
    53 ;       DS:DI:  Ptr to DPT
    54 ;       ES:BX:  Ptr to BOOTNFO
    55 ;       CS:SI:  Ptr to IDEVARS
    56 ;   Corrupts registers:
    57 ;       AX, DL
    58 ;--------------------------------------------------------------------
    59 ALIGN JUMP_ALIGN
    60 BootMenuPrintCfg_GetPointers:
    61     mov     dl, [di+DPT.bDrvNum]        ; Load Drive number to DL
    62     call    BootInfo_GetOffsetToBX      ; ES:BX now points...
    63     LOAD_BDA_SEGMENT_TO es, ax          ; ...to BOOTNFO
    64     mov     al, [di+DPT.bIdeOff]
    65     xchg    si, ax                      ; CS:SI now points to IDEVARS
    66     ret
    67 
    68 
    69 ;--------------------------------------------------------------------
    70 ; Pushes all string formatting parameters and prints
    71 ; formatted configuration string.
    72 ;
    73 ; BootMenuPrintCfg_PushAndFormatCfgString
     29; PushAndFormatCfgString
    7430;   Parameters:
    7531;       DS:DI:  Ptr to DPT
     
    8238;--------------------------------------------------------------------
    8339ALIGN JUMP_ALIGN
    84 BootMenuPrintCfg_PushAndFormatCfgString:
     40PushAndFormatCfgString:
    8541    push    bp
    86 
    8742    mov     bp, sp
    8843    ; Fall to first push below
     
    9752;       Nothing (jumps to next push below)
    9853;   Corrupts registers:
    99 ;       AX, DX
     54;       AX
    10055;--------------------------------------------------------------------
    10156PushAddressingMode:
    102     mov     dx, bx              ; Backup BX to DX
     57    xchg    ax, bx
    10358    mov     bx, MASK_DPT_ADDR   ; Load addressing mode mask
    10459    and     bl, [di+DPT.bFlags] ; Addressing mode now in BX
    10560    push    WORD [cs:bx+.rgszAddressingModeString]
    106     mov     bx, dx
     61    xchg    bx, ax
    10762    jmp     SHORT .NextPush
    10863ALIGN WORD_ALIGN
     
    208163
    209164;--------------------------------------------------------------------
    210 ; Prints formatted configuration string from parameters pushed to stack.
    211 ;
    212 ; BootMenuPrintCfg_ValuesFromStack
     165; PrintValuesFromStack
    213166;   Parameters:
    214167;       Stack:  All formatting parameters
     
    218171;       AX, SI, DI
    219172;--------------------------------------------------------------------
    220 BootMenuPrintCfg_ValuesFromStack:
     173PrintValuesFromStack:
    221174    mov     si, g_szCfgFormat
    222     jmp     PrintNullTerminatedStringFromCSSIandSetCF
     175    jmp     BootMenuPrint_NullTerminatedStringFromCSSIandSetCF
     176
     177
     178;--------------------------------------------------------------------
     179; BootMenuPrintCfg_GetPointers
     180;   Parameters:
     181;       DS:DI:  Ptr to DPT
     182;   Returns:
     183;       DS:DI:  Ptr to DPT
     184;       ES:BX:  Ptr to BOOTNFO
     185;       CS:SI:  Ptr to IDEVARS
     186;   Corrupts registers:
     187;       AX, DL
     188;--------------------------------------------------------------------
     189ALIGN JUMP_ALIGN
     190BootMenuPrintCfg_GetPointers:
     191    mov     dl, [di+DPT.bDrvNum]        ; Load Drive number to DL
     192    call    BootInfo_GetOffsetToBX      ; ES:BX now points...
     193    LOAD_BDA_SEGMENT_TO es, ax          ; ...to BOOTNFO
     194    mov     al, [di+DPT.bIdeOff]
     195    xchg    si, ax                      ; CS:SI now points to IDEVARS
     196    ret
  • trunk/XTIDE_Universal_BIOS/Src/Boot/BootVars.asm

    r90 r96  
    6262    cli                                 ; Disable interrupts
    6363    LOAD_BDA_SEGMENT_TO ss, sp
    64 ;   eLSS    sp, ss:BOOTVARS.dwPostStack ; Expanded macro to remove
    65                                         ; unneeded CLI instruction
    6664%ifndef USE_386
    6765    mov     sp, [ss:BOOTVARS.dwPostStack]
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19hMenu.asm

    r95 r96  
    2222
    2323    ; Install new INT 19h handler now that BOOTVARS has been initialized
    24     mov     WORD [INTV_BOOTSTRAP*4], Int19hMenu_Display
     24    mov     WORD [INTV_BOOTSTRAP*4], DisplayBootMenu
    2525    mov     WORD [INTV_BOOTSTRAP*4+2], cs
    26     ; Fall to Int19hMenu_Display
     26    ; Fall to DisplayBootMenu
    2727
    2828;--------------------------------------------------------------------
    29 ; Displays Boot Menu so user can select drive to boot from.
    30 ;
    31 ; Int19hMenu_Display
     29; DisplayBootMenu
    3230;   Parameters:
    3331;       Nothing
     
    3634;--------------------------------------------------------------------
    3735ALIGN JUMP_ALIGN
    38 Int19hMenu_Display:
    39     sti                                 ; Enable interrupts
     36DisplayBootMenu:
    4037    call    BootVars_SwitchToBootMenuStack
    4138    call    RamVars_GetSegmentToDS
    42     ; Fall to Int19hMenu_ProcessMenuSelectionsUntilBootable
     39    ; Fall to .ProcessMenuSelectionsUntilBootable
    4340
    4441;--------------------------------------------------------------------
    45 ; Processes user menu selections until bootable drive is selected.
    46 ;
    47 ; Int19hMenu_ProcessMenuSelectionsUntilBootable
     42; .ProcessMenuSelectionsUntilBootable
    4843;   Parameters:
    4944;       DS:     RAMVARS segment
     
    5247;--------------------------------------------------------------------
    5348ALIGN JUMP_ALIGN
    54 Int19hMenu_ProcessMenuSelectionsUntilBootable:
     49.ProcessMenuSelectionsUntilBootable:
    5550    call    BootMenu_DisplayAndReturnSelection
    5651    call    DriveXlate_ToOrBack         ; Translate drive number
    57     call    Int19h_TryToLoadBootSectorFromDL
    58     jnc     SHORT Int19hMenu_ProcessMenuSelectionsUntilBootable ; Boot failure, show menu again
     52    call    BootSector_TryToLoadFromDriveDL
     53    jnc     SHORT .ProcessMenuSelectionsUntilBootable   ; Boot failure, show menu again
    5954    call    BootVars_SwitchBackToPostStack
    60     jmp     Int19h_JumpToBootSector
     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
    6172
    6273
     
    7182Int19hMenu_RomBoot:
    7283    call    BootVars_SwitchBackToPostStack
    73     call    Int19h_ClearSegmentsForBoot
     84    call    ClearSegmentsForBoot
    7485    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
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectPrint.asm

    r88 r96  
    104104.PrintDriveNotFound:
    105105    mov     si, g_szNotFound
    106     call    PrintNullTerminatedStringFromCSSIandSetCF
     106    call    BootMenuPrint_NullTerminatedStringFromCSSIandSetCF
    107107    pop     di
    108108    ret
  • trunk/XTIDE_Universal_BIOS/Src/Main.asm

    r93 r96  
    124124%include "BootMenuEvent.asm"    ; For menu library event handling
    125125%include "FloppyDrive.asm"      ; Floppy Drive related functions
     126%include "BootSector.asm"       ; For loading boot sector
     127%include "BootPrint.asm"        ; For printing boot information
    126128%include "BootMenuPrint.asm"    ; For printing Boot Menu strings
    127129%include "BootMenuPrintCfg.asm" ; For printing hard disk configuration
     
    140142; Include .asm files (Interrupt handlers)
    141143%include "Int13h.asm"           ; For Int 13h, Disk functions
    142 %include "Int19h.asm"           ; For Int 19h, Boot Loader
    143144%ifndef USE_AT
    144145    %include "Int19hLate.asm"   ; For late initialization
    145146%endif
    146147%include "Int19hMenu.asm"       ; For Int 19h, Boot Loader for Boot Menu
    147 %include "BootPrint.asm"        ; For printing boot information
    148148
    149149; Include .asm files (Hard Disk BIOS functions)
  • trunk/XTIDE_Universal_BIOS/Src/Strings.asm

    r95 r96  
    3535g_szSizeSingle: db  "%s%u.%u %ciB",NULL
    3636g_szSizeDual:   db  "%s%u.%u %ciB / %u.%u %ciB",NULL
    37 g_szCfgHeader:  db  "Addr.",SINGLE_VERTICAL,"Block",SINGLE_VERTICAL,"Bus",  SINGLE_VERTICAL,"IRQ",  SINGLE_VERTICAL,"Reset",NULL
     37g_szCfgHeader:  db  "Addr.",SINGLE_VERTICAL,"Block",SINGLE_VERTICAL,"Bus",  SINGLE_VERTICAL,"IRQ",  SINGLE_VERTICAL,"Reset",CR,LF,NULL
    3838g_szCfgFormat:  db  "%s"   ,SINGLE_VERTICAL,"%5u",  SINGLE_VERTICAL,"%c%2u",SINGLE_VERTICAL," %c%c",SINGLE_VERTICAL,"%5x",  NULL
    3939g_szLCHS:       db  "L-CHS",NULL
Note: See TracChangeset for help on using the changeset viewer.