Ignore:
Timestamp:
May 9, 2012, 7:12:53 PM (12 years ago)
Author:
aitotat@…
google:author:
aitotat@gmail.com
Message:

Changes to XTIDE Universal BIOS:

  • Addressing modes are now NORMAL, LARGE and LBA.
  • L-CHS parameters are now generated differently for drives with 8192 or less cylinders.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AccessDPT.asm

    r411 r421  
    3636    mov     bx, [cs:bx+IDEVARS.wPort]
    3737    ret
    38 
    39 %endif
     38%endif  ; MODULE_ADVANCED_ATA
    4039
    4140
    4241;--------------------------------------------------------------------
    43 ; AccessDPT_GetDriveSelectByteToAL
     42; AccessDPT_GetDriveSelectByteForOldInt13hToAL
     43; AccessDPT_GetDriveSelectByteForEbiosToAL
    4444;   Parameters:
    4545;       DS:DI:  Ptr to Disk Parameter Table
     
    5050;--------------------------------------------------------------------
    5151ALIGN JUMP_ALIGN
    52 AccessDPT_GetDriveSelectByteToAL:
     52AccessDPT_GetDriveSelectByteForOldInt13hToAL:
     53    mov     al, [di+DPT.bFlagsLow]
     54    test    al, FLGL_DPT_ASSISTED_LBA
     55    jnz     SHORT GetDriveSelectByteForAssistedLBAtoAL
     56
     57    and     al, FLG_DRVNHEAD_DRV    ; Clear all but drive select bit
     58    or      al, MASK_DRVNHEAD_SET   ; Bits set to 1 for old drives
     59    ret
     60
     61%ifdef MODULE_EBIOS
     62ALIGN JUMP_ALIGN
     63AccessDPT_GetDriveSelectByteForEbiosToAL:
    5364    mov     al, [di+DPT.wFlags]
    54     and     al, FLG_DRVNHEAD_LBA | FLG_DRVNHEAD_DRV
    55     or      al, MASK_DRVNHEAD_SET   ; Bits set to 1 for old drives
     65    ; Fall to GetDriveSelectByteForAssistedLBAtoAL
     66%endif ; MODULE_EBIOS
     67
     68ALIGN JUMP_ALIGN
     69GetDriveSelectByteForAssistedLBAtoAL:
     70    and     al, FLG_DRVNHEAD_DRV    ; Master / Slave select
     71    or      al, FLG_DRVNHEAD_LBA | MASK_DRVNHEAD_SET
    5672    ret
    5773
     
    89105;       BH:     Number of L-CHS sectors per track
    90106;   Corrupts registers:
    91 ;       CX, DX
     107;       Nothing
    92108;--------------------------------------------------------------------
    93109AccessDPT_GetLCHStoAXBLBH:
    94     ; Return LBA-assisted CHS if LBA addressing used
    95     test    BYTE [di+DPT.bFlagsLow], FLG_DRVNHEAD_LBA
    96     jz      SHORT .ConvertPchsToLchs
    97 
    98     call    AccessDPT_GetLbaSectorCountToBXDXAX
    99     call    LbaAssist_ConvertSectorCountFromBXDXAXtoLbaAssistedCHSinDXAXBLBH
    100     LIMIT_LBA_CYLINDERS_IN_DXAX_TO_LCHS_CYLINDERS
    101     ret
    102 
    103 .ConvertPchsToLchs:
    104     mov     ax, [di+DPT.wPchsCylinders]
    105     mov     bx, [di+DPT.wPchsHeadsAndSectors]
    106     ; Fall to AccessDPT_ShiftPCHinAXBLtoLCH
    107 
    108 
    109 ;--------------------------------------------------------------------
    110 ; AccessDPT_ShiftPCHinAXBLtoLCH
    111 ;   Parameters:
    112 ;       AX:     P-CHS cylinders (1...16383)
    113 ;       BL:     P-CHS heads (1...16)
    114 ;   Returns:
    115 ;       AX:     Number of L-CHS cylinders (1...1024)
    116 ;       BL:     Number of L-CHS heads (1...255)
    117 ;       CX:     Number of bits shifted (4 at most)
    118 ;   Corrupts registers:
    119 ;       Nothing
    120 ;--------------------------------------------------------------------
    121 AccessDPT_ShiftPCHinAXBLtoLCH:
    122     xor     cx, cx
    123 .ShiftLoop:
    124     cmp     ax, MAX_LCHS_CYLINDERS      ; Need to shift?
    125     jbe     SHORT .Return               ;  If not, return
    126     inc     cx                          ; Increment shift count
    127     shr     ax, 1                       ; Halve cylinders
    128     shl     bl, 1                       ; Double heads
    129     jnz     SHORT .ShiftLoop            ; Falls through only on the last (4th) iteration and only if BL was 16 on entry
    130     dec     bl                          ; DOS doesn't support drives with 256 heads so we limit heads to 255
    131     ; We can save a byte here by using DEC BX if we don't care about BH
    132 .Return:
     110    mov     ax, [di+DPT.wLchsCylinders]
     111    mov     bx, [di+DPT.wLchsHeadsAndSectors]
    133112    ret
    134113
    135114
     115%ifdef MODULE_EBIOS
    136116;--------------------------------------------------------------------
    137117; AccessDPT_GetLbaSectorCountToBXDXAX
     
    148128    mov     bx, [di+DPT.twLbaSectors+4]
    149129    ret
     130%endif ; MODULE_EBIOS
    150131
    151132
     
    171152    ret
    172153
     154
    173155;--------------------------------------------------------------------
    174 ; AccessDPT_GetUnshiftedAddressModeToALZF
     156; ACCESSDPT__GET_UNSHIFTED_ADDRESS_MODE_TO_AXZF
    175157;   Parameters:
    176158;       DS:DI:  Ptr to Disk Parameter Table
    177159;   Returns:
    178 ;       AL:     Addressing Mode (L-CHS, P-CHS, LBA28, LBA48)
     160;       AX:     Addressing Mode (ADDRESSING_MODE_NORMAL, ADDRESSING_MODE_LARGE or ADDRESSING_MODE_ASSISTED_LBA)
    179161;               unshifted (still shifted where it is in bFlagsLow)
    180162;       ZF:     Set based on value in AL
    181163;   Corrupts registers:
    182 ;       AL
     164;       Nothing
    183165;--------------------------------------------------------------------
    184166;
     
    186168; is not worth it for these two instructions (4 bytes total)
    187169;
    188 %macro AccessDPT_GetUnshiftedAddressModeToALZF 0
     170%macro ACCESSDPT__GET_UNSHIFTED_ADDRESS_MODE_TO_AXZF 0
    189171    mov     al, [di+DPT.bFlagsLow]
    190     and     al, MASKL_DPT_ADDRESSING_MODE
     172    and     ax, BYTE MASKL_DPT_ADDRESSING_MODE
    191173%endmacro
Note: See TracChangeset for help on using the changeset viewer.