Changeset 116 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS


Ignore:
Timestamp:
Feb 26, 2011, 11:55:06 PM (13 years ago)
Author:
krille_n_@…
google:author:
krille_n_@hotmail.com
Message:

Changes to all parts of the project:

  • Removed a redundant macro (HPIO_NORMALIZE_PTR)
  • Deleted XTIDE_Universal_BIOS/Inc/BiosData.inc since that was also redundant.
  • Size optimization: Changed the LOAD_BDA_SEGMENT_TO macro to use the stack on 186+ processors (the old behaviour can still be used where needed).
  • Made other minor size optimizations and cleanups to various functions, mostly in the Int13h handler.
Location:
trunk/XTIDE_Universal_BIOS
Files:
1 deleted
10 edited

Legend:

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

    r96 r116  
    9999    xchg    ax, bx      ; Store BX to AX
    100100    eMOVZX  bx, BYTE [cs:si+IDEVARS.bBusType]
    101     mov     bx, [cs:bx+.rgwBusTypeValues]   ; Char to BL, Int to BH 
     101    mov     bx, [cs:bx+.rgwBusTypeValues]   ; Char to BL, Int to BH
    102102    eMOVZX  dx, bh
    103103    push    bx          ; Push character
     
    191191    mov     dl, [di+DPT.bDrvNum]        ; Load Drive number to DL
    192192    call    BootInfo_GetOffsetToBX      ; ES:BX now points...
    193     LOAD_BDA_SEGMENT_TO es, ax          ; ...to BOOTNFO
     193    LOAD_BDA_SEGMENT_TO es, ax, !       ; ...to BOOTNFO
    194194    mov     al, [di+DPT.bIdeOff]
    195195    xchg    si, ax                      ; CS:SI now points to IDEVARS
  • trunk/XTIDE_Universal_BIOS/Src/Boot/BootVars.asm

    r96 r116  
    2828; POST stack is not large enough when DPTs are stored to 30:0h.
    2929;
     30; Note regarding LOAD_BDA_SEGMENT_TO: If you force the use of SP
     31; then you also have to unconditionally enable the CLI/STI pair.
     32; The reason for this is that only some buggy 808x CPU:s need the
     33; CLI/STI instruction pair when changing stacks. Other CPU:s disable
     34; interrupts automatically when SS is modified for the duration of
     35; the immediately following instruction to give time to change SP.
     36;
    3037; BootVars_SwitchToBootMenuStack
    3138;   Parameters:
     
    3946BootVars_SwitchToBootMenuStack:
    4047    pop     ax                          ; Pop return address
     48%ifndef USE_186
    4149    cli                                 ; Disable interrupts
     50%endif
    4251    LOAD_BDA_SEGMENT_TO ss, sp
    4352    mov     sp, BOOTVARS.rgbMnuStack    ; Load offset to stack
     53%ifndef USE_186
    4454    sti                                 ; Enable interrupts
     55%endif
    4556    jmp     ax
    4657
     
    4859;--------------------------------------------------------------------
    4960; Restores SS and SP to initial boot loader values.
     61;
     62; Before doing any changes, see the note regarding
     63; LOAD_BDA_SEGMENT_TO in BootVars_SwitchToBootMenuStack
    5064;
    5165; BootVars_SwitchBackToPostStack
     
    6074BootVars_SwitchBackToPostStack:
    6175    pop     ax                          ; Pop return address
     76%ifndef USE_186
    6277    cli                                 ; Disable interrupts
     78%endif
    6379    LOAD_BDA_SEGMENT_TO ss, sp
    6480%ifndef USE_386
     
    6884    lss     sp, [ss:BOOTVARS.dwPostStack]
    6985%endif
     86%ifndef USE_186
    7087    sti                                 ; Enable interrupts
     88%endif
    7189    jmp     ax
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH1h_HStatus.asm

    r35 r116  
    1 ; File name     :   AH1h_HStatus.asm
    2 ; Project name  :   IDE BIOS
    3 ; Created date  :   27.9.2007
    4 ; Last update   :   24.8.2010
    5 ; Author        :   Tomi Tilli
     1; Project name  :   XTIDE Universal BIOS
    62; Description   :   Int 13h function AH=1h, Read Disk Status.
    73
     
    3026
    3127    LOAD_BDA_SEGMENT_TO ds, di
    32     xor     ah, ah                  ; Zero AH
    33     cmp     ah, [BDA.bHDLastSt]     ; Set CF if error code is non-zero
    3428    mov     ah, [BDA.bHDLastSt]     ; Last error to AH
     29    cmp     ah, 1                   ; Set CF if error code is zero
     30    cmc                             ; Invert CF
    3531
    3632    pop     ds
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH25h_HDrvID.asm

    r88 r116  
    108108;--------------------------------------------------------------------
    109109; Returns timeout value for drive detection.
    110 ; Long timeout is required for detecing first drive to make sure it is
     110; Long timeout is required for detecting first drive to make sure it is
    111111; ready after power-on (ATA specification says up to 31 seconds).
    112112; Short timeout is used for additional drives to prevent long boot time
     
    123123ALIGN JUMP_ALIGN
    124124AH25h_GetDriveDetectionTimeoutValue:
     125    mov     cl, B_TIMEOUT_RESET         ; Load long timeout (assume first drive)
    125126    cmp     BYTE [RAMVARS.bDrvCnt], 0   ; Detecting first drive?
    126     je      SHORT .GetLongDelayForInitialDetection
     127    je      SHORT .Return
    127128    mov     cl, B_TIMEOUT_DRVINFO       ; Load short timeout
     129ALIGN JUMP_ALIGN, ret   ; This speed optimization may be unnecessary
     130.Return:
    128131    ret
    129 ALIGN JUMP_ALIGN
    130 .GetLongDelayForInitialDetection:
    131     mov     cl, B_TIMEOUT_RESET         ; Load long timeout
    132     ret
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AHCh_HSeek.asm

    r84 r116  
    1 ; File name     :   AHCh_HSeek.asm
    2 ; Project name  :   IDE BIOS
    3 ; Created date  :   13.12.2007
    4 ; Last update   :   14.1.2011
    5 ; Author        :   Tomi Tilli,
    6 ;               :   Krister Nordvall (optimizations)
     1; Project name  :   XTIDE Universal BIOS
    72; Description   :   Int 13h function AH=Ch, Seek.
    83
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AHDh_HReset.asm

    r88 r116  
    100100    ; HSR2: Check_status
    101101    mov     cl, B_TIMEOUT_RESET         ; Reset timeout delay
    102     mov     dx, [RAMVARS.wIdeBase]      ; Load base port address
    103     jmp     HStatus_WaitBsyBase
     102    jmp     HStatus_WaitBsy
    104103
    105104
     
    125124    call    AH9h_InitializeDriveForUse
    126125    mov     cl, ah                      ; Copy error code to CL
    127 ALIGN JUMP_ALIGN
    128126.InitializeSlave:
    129127    pop     dx                          ; Restore base port address
     
    132130    call    AH9h_InitializeDriveForUse
    133131    mov     ch, ah                      ; Copy error code to CH
    134 ALIGN JUMP_ALIGN
    135132.CombineErrors:
    136133    or      cl, ch                      ; OR error codes, clear CF
    137     jnz     SHORT .ReturnError
    138     ret
    139 .ReturnError:
     134    jz      SHORT .Return
    140135    mov     ah, RET_HD_RESETFAIL        ; Load Reset Failed error code
    141136    stc
     137.Return:
    142138    ret
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HIRQ.asm

    r86 r116  
    1 ; Project name  :   IDE BIOS
     1; Project name  :   XTIDE Universal BIOS
    22; Description   :   Interrupt handling related functions.
    33
     
    3535    push    ds
    3636
    37     LOAD_BDA_SEGMENT_TO ds, ax          ; Zero AX
     37    LOAD_BDA_SEGMENT_TO ds, ax, !       ; Zero AX
    3838    cli                                 ; Disable interrupts
    3939    cmp     al, [BDA.bHDTaskFlg]        ; Task flag already set?
     
    6868HIRQ_ClearTaskFlag:
    6969    push    ds
    70     LOAD_BDA_SEGMENT_TO ds, ax      ; Also zero AX
     70    LOAD_BDA_SEGMENT_TO ds, ax, !       ; Also zero AX
    7171    mov     [BDA.bHDTaskFlg], al
    7272    pop     ds
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HPIO.asm

    r86 r116  
    1 ; Project name  :   IDE BIOS
     1; Project name  :   XTIDE Universal BIOS
    22; Description   :   PIO transfer functions.
    33
     
    1515
    1616;--------------------------------------------------------------------
    17 ; Normalizes far pointer to that offset overflows won't happen
    18 ; when transferring data using PIO.
    19 ;
    20 ; HPIO_NORMALIZE_PTR
    21 ;   Parameters:
    22 ;       %1:%2:      Far pointer to normalize
    23 ;       %3:         Scratch register
    24 ;       %4:         Scratch register
    25 ;   Returns:
    26 ;       %1:%2:      Normalized far pointer
    27 ;   Corrupts registers:
    28 ;       %3, %4
    29 ;--------------------------------------------------------------------
    30 %macro HPIO_NORMALIZE_PTR 4
    31     mov     %4, %2              ; Copy offset to scratch reg
    32     and     %2, BYTE 0Fh        ; Clear offset bits 15...4
    33     eSHR_IM %4, 4               ; Divide offset by 16
    34     mov     %3, %1              ; Copy segment to scratch reg
    35     add     %3, %4              ; Add shifted offset to segment
    36     mov     %1, %3              ; Set normalized segment
    37 %endmacro
    38 
    39 
    40 ;--------------------------------------------------------------------
    4117; Reads sectors from hard disk using PIO transfer mode.
    4218;
     
    11086    mov     [bp+PIOVARS.fnXfer], bx             ; Store offset to transfer function
    11187    xchg    bx, ax
    112     ; Fall to HPIO_NormalizePtr
    113 
    114 ;--------------------------------------------------------------------
    115 ; Initializes PIOVARS members.
    116 ;
    117 ; HPIO_InitializePIOVARS
     88    ; Fall to HPIO_NormalizeDataPointer
     89
     90;--------------------------------------------------------------------
     91; Normalizes far pointers so that offset overflows won't happen
     92; when transferring data using PIO.
     93;
     94; HPIO_NormalizeDataPointer
    11895;   Parameters:
    11996;       ES:BX:  Ptr to source or destination data buffer
     
    125102;ALIGN JUMP_ALIGN
    126103HPIO_NormalizeDataPointer:
    127     HPIO_NORMALIZE_PTR  es, bx, ax, cx
     104    NORMALIZE_FAR_POINTER es, bx, ax, cx
    128105    ret
    129106
  • trunk/XTIDE_Universal_BIOS/Src/Main.asm

    r112 r116  
    1515; Included .inc files
    1616%include "AssemblyLibrary.inc"  ; Assembly Library. Must be included first!
    17 %include "BiosData.inc"         ; For BIOS Data area equates
    1817%include "Interrupts.inc"       ; For interrupt equates
    1918%include "ATA_ID.inc"           ; For ATA Drive Information structs
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/RamVars.asm

    r99 r116  
    3434    jz      SHORT .InitializeRamvars    ; No need to steal RAM
    3535
    36     LOAD_BDA_SEGMENT_TO ds, ax          ; Zero AX
     36    LOAD_BDA_SEGMENT_TO ds, ax, !       ; Zero AX
    3737    mov     al, [cs:ROMVARS.bStealSize]
    3838    sub     [BDA.wBaseMem], ax
     
    197197;   Corrupts registers:
    198198;       Nothing
    199 ;--------------------------------------------------------------------   
     199;--------------------------------------------------------------------
    200200ALIGN JUMP_ALIGN
    201201RamVars_GetHardDiskCountFromBDAtoCX:
     
    203203    push    dx
    204204
    205     LOAD_BDA_SEGMENT_TO es, cx          ; Zero CX
     205    LOAD_BDA_SEGMENT_TO es, cx, !       ; Zero CX
    206206    call    RamVars_GetCountOfKnownDrivesToDL
    207207    MAX_U   dl, [es:BDA.bHDCount]
     
    220220;   Corrupts registers:
    221221;       Nothing
    222 ;--------------------------------------------------------------------   
     222;--------------------------------------------------------------------
    223223ALIGN JUMP_ALIGN
    224224RamVars_GetCountOfKnownDrivesToDL:
     
    237237;   Corrupts registers:
    238238;       Nothing
    239 ;--------------------------------------------------------------------   
     239;--------------------------------------------------------------------
    240240RamVars_GetIdeControllerCountToCX:
    241241    eMOVZX  cx, BYTE [cs:ROMVARS.bIdeCnt]
Note: See TracChangeset for help on using the changeset viewer.