Changeset 230 in xtideuniversalbios for trunk


Ignore:
Timestamp:
Jan 29, 2012, 11:22:19 PM (13 years ago)
Author:
krille_n_@…
google:author:
krille_n_@hotmail.com
Message:

Changes to XTIDE Universal BIOS:

  • Some small optimizations
Location:
trunk/XTIDE_Universal_BIOS/Src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH48h_GetExtendedDriveParameters.asm

    r229 r230  
    4545    mov     WORD [si+EDRIVE_INFO.wFlags], FLG_DMA_BOUNDARY_ERRORS_HANDLED_BY_BIOS
    4646
     47    push    ds  ; Move CS to DS to avoid segment overrides
     48    push    cs
     49    pop     ds
     50
    4751    ; Limit LBA if necessary
    48     test    BYTE [cs:di+DRVPARAMS.wFlags], FLG_DRVPARAMS_USERLBA
     52    test    BYTE [di+DRVPARAMS.wFlags], FLG_DRVPARAMS_USERLBA
    4953    jz      SHORT .StoreTotalSectorsFromBXDXAX
    5054    test    bx, bx
    5155    jnz     SHORT .LimitTotalSectors
    52     cmp     dx, [cs:di+DRVPARAMS.dwMaximumLBA+2]
     56    cmp     dx, [di+DRVPARAMS.dwMaximumLBA+2]
    5357    jb      SHORT .StoreTotalSectorsFromBXDXAX      ; Real size less than max
    5458    ja      SHORT .LimitTotalSectors
    55     cmp     ax, [cs:di+DRVPARAMS.dwMaximumLBA]
     59    cmp     ax, [di+DRVPARAMS.dwMaximumLBA]
    5660    jbe     SHORT .StoreTotalSectorsFromBXDXAX      ; Real size less than max
    5761
    5862.LimitTotalSectors:
    5963    xor     bx, bx
    60     mov     ax, [cs:di+DRVPARAMS.dwMaximumLBA]
    61     mov     dx, [cs:di+DRVPARAMS.dwMaximumLBA+2]
     64    mov     ax, [di+DRVPARAMS.dwMaximumLBA]
     65    mov     dx, [di+DRVPARAMS.dwMaximumLBA+2]
    6266
    6367.StoreTotalSectorsFromBXDXAX:
     68    pop     ds  ; Restore DS from the change above
    6469    mov     [si+EDRIVE_INFO.qwTotalSectors], ax
    6570    xor     ax, ax                                  ; Return with success
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Tools/Address.asm

    r227 r230  
    8686Address_OldInt13hAddressToIdeAddress:
    8787        call    Address_ExtractLCHSparametersFromOldInt13hAddress
    88            
     88
    8989        AccessDPT_GetUnshiftedAddressModeToALZF
    90        
    91 ;;; 0: ADDR_DPT_LCHS       
    92         jz      DoNotConvertLCHS   
    93        
     90
     91;;; 0: ADDR_DPT_LCHS
     92        jz      DoNotConvertLCHS
     93
    9494;;; 1: ADDR_DPT_PCHS
    95         ; 
     95        ;
    9696        ; Since we are only checking for zero, we can do our math in the high order bits,
    9797        ; in this case effectively subtracting 1 from the address mode.
    9898        ;
    9999        sub     al,(1<<ADDRESSING_MODE_FIELD_POSITION)
    100         jz      ConvertLCHStoPCHS   
     100        jz      ConvertLCHStoPCHS
    101101
    102 ;;; 2: ADDR_DPT_LBA28 and 3: ADDR_DPT_LBA48             
    103         ; Fall through to ConvertLCHStoLBARegisterValues 
    104        
     102;;; 2: ADDR_DPT_LBA28 and 3: ADDR_DPT_LBA48
     103        ; Fall through to ConvertLCHStoLBARegisterValues
     104
    105105;---------------------------------------------------------------------
    106106; Converts LCHS parameters to 28-bit LBA address.
     
    129129    ; cylToSeek*headsPerCyl (18-bit result)
    130130    mov     ax, cx                  ; Copy Cylinder number to AX
     131    ; We could save a byte here by using CWD instead of the XOR DH, DH in eMOVZX
     132    ; but I'm not sure how that would affect speed.
     133
    131134    eMOVZX  dx, BYTE [di+DPT.bLbaHeads]
    132135    mul     dx                      ; DX:AX = cylToSeek*headsPerCyl
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AccessDPT.asm

    r227 r230  
    6262    jnz     SHORT .LimitAXtoMaxLCHScylinders
    6363    cmp     ax, MAX_LCHS_CYLINDERS
    64     jbe     SHORT .returnLCHS
     64    jb      SHORT .returnLCHS
    6565.LimitAXtoMaxLCHScylinders:
    6666    mov     ax, MAX_LCHS_CYLINDERS
     
    7171    mov     ax, [di+DPT.wPchsCylinders]
    7272    mov     bx, [di+DPT.wPchsHeadsAndSectors]
    73     jmp     SHORT AccessDPT_ShiftPCHinAXBLtoLCH
     73    ; Fall to AccessDPT_ShiftPCHinAXBLtoLCH
     74
     75
     76;--------------------------------------------------------------------
     77; AccessDPT_ShiftPCHinAXBLtoLCH
     78;   Parameters:
     79;       AX:     P-CHS cylinders (1...16383)
     80;       BL:     P-CHS heads (1...16)
     81;   Returns:
     82;       AX:     Number of L-CHS cylinders (1...1024)
     83;       BL:     Number of L-CHS heads (1...255)
     84;       CX:     Number of bits shifted (4 at most)
     85;   Corrupts registers:
     86;       Nothing
     87;--------------------------------------------------------------------
     88AccessDPT_ShiftPCHinAXBLtoLCH:
     89    xor     cx, cx
     90.ShiftLoop:
     91    cmp     ax, MAX_LCHS_CYLINDERS      ; Need to shift?
     92    jbe     SHORT .LimitHeadsTo255      ;  If not, return
     93    inc     cx                          ; Increment shift count
     94    shr     ax, 1                       ; Halve cylinders
     95    shl     bl, 1                       ; Double heads
     96    jnz     SHORT .ShiftLoop
     97.LimitHeadsTo255:                       ; DOS does not support drives with 256 heads
     98    cmp     bl, cl                      ; Set CF if BL is zero
     99    sbb     bl, ch                      ; If BL=0 then BL=255
     100    ret
    74101
    75102
     
    87114    mov     dx, [di+DPT.twLbaSectors+2]
    88115    mov     bx, [di+DPT.twLbaSectors+4]
    89     ret
    90 
    91 
    92 ;--------------------------------------------------------------------
    93 ; AccessDPT_ShiftPCHinAXBLtoLCH
    94 ;   Parameters:
    95 ;       AX:     P-CHS cylinders (1...16383)
    96 ;       BL:     P-CHS heads (1...16)
    97 ;   Returns:
    98 ;       AX:     Number of L-CHS cylinders (1...1024)
    99 ;       BL:     Number of L-CHS heads (1...255)
    100 ;       CX:     Number of bits shifted
    101 ;   Corrupts registers:
    102 ;       Nothing
    103 ;--------------------------------------------------------------------
    104 AccessDPT_ShiftPCHinAXBLtoLCH:
    105     xor     cx, cx
    106 .ShiftLoop:
    107     cmp     ax, MAX_LCHS_CYLINDERS      ; Need to shift?
    108     jbe     SHORT .LimitHeadsTo255      ;  If not, return
    109     inc     cx                          ; Increment shift count
    110     shr     ax, 1                       ; Halve cylinders
    111     shl     bl, 1                       ; Double heads
    112     jmp     SHORT .ShiftLoop
    113 .LimitHeadsTo255:                       ; DOS does not support drives with 256 heads
    114     cmp     bl, cl                      ; Set CF if BL is zero
    115     sbb     bl, ch                      ; If BL=0 then BL=255
    116116    ret
    117117
     
    143143;       DS:DI:  Ptr to Disk Parameter Table
    144144;   Returns:
    145 ;       AL:     Addressing Mode (L-CHS, P-CHS, LBA28, LBA48) 
     145;       AL:     Addressing Mode (L-CHS, P-CHS, LBA28, LBA48)
    146146;               unshifted (still shifted where it is in bFlagsLow)
    147147;       ZF:     Set based on value in AL
     
    149149;       AL
    150150;--------------------------------------------------------------------
    151 ; 
    152 ; Converted to a macro since only called in two places, and the call/ret overhead 
     151;
     152; Converted to a macro since only called in two places, and the call/ret overhead
    153153; is not worth it for these two instructions (4 bytes total)
    154154;
Note: See TracChangeset for help on using the changeset viewer.