Changeset 227 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs


Ignore:
Timestamp:
Jan 29, 2012, 1:33:44 PM (12 years ago)
Author:
aitotat@…
google:author:
aitotat@gmail.com
Message:

Changes to XTIDE Universal BIOS:

  • EBIOS functions now work in lite mode.
Location:
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs
Files:
2 edited

Legend:

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

    r200 r227  
    4040    ret
    4141
    42        
     42
    4343;--------------------------------------------------------------------
    44 ; AccessDPT_GetLCHS
     44; AccessDPT_GetLCHStoAXBLBH
    4545;   Parameters:
    4646;       DS:DI:  Ptr to Disk Parameter Table
    4747;   Returns:
    48 ;       AX:     Number of L-CHS sectors per track
    49 ;       BX:     Number of L-CHS cylinders
    50 ;       DX:     Number of L-CHS heads
     48;       AX:     Number of L-CHS cylinders
     49;       BL:     Number of L-CHS heads
     50;       BH:     Number of L-CHS sectors per track
    5151;   Corrupts registers:
    52 ;       CX
     52;       CX, DX
    5353;--------------------------------------------------------------------
    54 AccessDPT_GetLCHS:
    55     ; Load CHS from DPT
    56     eMOVZX  ax, BYTE [di+DPT.bSectors]
    57     mov     bx, [di+DPT.dwCylinders]
    58     cwd
    59     mov     dl, [di+DPT.bHeads]
     54AccessDPT_GetLCHStoAXBLBH:
     55    ; Return LBA-assisted CHS if LBA addressing used
     56    test    BYTE [di+DPT.bFlagsLow], FLG_DRVNHEAD_LBA
     57    jz      SHORT .ConvertPchsToLchs
    6058
    61     ; Only need to limit sectors for LBA assist
    62     test    BYTE [di+DPT.bFlagsLow], FLG_DRVNHEAD_LBA
    63     jz      SHORT AccessDPT_ShiftPCHinBXDXtoLCH
     59    call    AccessDPT_GetLbaSectorCountToBXDXAX
     60    call    AtaID_GetLbaAssistedCHStoDXAXBLBH
     61    test    dx, dx
     62    jnz     SHORT .LimitAXtoMaxLCHScylinders
     63    cmp     ax, MAX_LCHS_CYLINDERS
     64    jbe     SHORT .returnLCHS
     65.LimitAXtoMaxLCHScylinders:
     66    mov     ax, MAX_LCHS_CYLINDERS
     67.returnLCHS:
     68    ret
    6469
    65     cmp     WORD [di+DPT.dwCylinders+2], BYTE 0
    66     jnz     SHORT .Return_MAX_LCHS_CYLINDERS
     70.ConvertPchsToLchs:
     71    mov     ax, [di+DPT.wPchsCylinders]
     72    mov     bx, [di+DPT.wPchsHeadsAndSectors]
     73    jmp     SHORT AccessDPT_ShiftPCHinAXBLtoLCH
    6774
    68     ; Limit cylinders to 1024
    69     cmp     bx, MAX_LCHS_CYLINDERS
    70     jb      SHORT .Return
    71 ALIGN JUMP_ALIGN
    72 .Return_MAX_LCHS_CYLINDERS:
    73     mov     bx, MAX_LCHS_CYLINDERS
    74 ALIGN JUMP_ALIGN, ret
    75 .Return:
     75
     76;--------------------------------------------------------------------
     77; AccessDPT_GetLbaSectorCountToBXDXAX
     78;   Parameters:
     79;       DS:DI:  Ptr to Disk Parameter Table
     80;   Returns:
     81;       BX:DX:AX:   48-bit sector count
     82;   Corrupts registers:
     83;       Nothing
     84;--------------------------------------------------------------------
     85AccessDPT_GetLbaSectorCountToBXDXAX:
     86    mov     ax, [di+DPT.twLbaSectors]
     87    mov     dx, [di+DPT.twLbaSectors+2]
     88    mov     bx, [di+DPT.twLbaSectors+4]
    7689    ret
    7790
    7891
    7992;--------------------------------------------------------------------
    80 ; AccessDPT_ShiftPCHinBXDXtoLCH
     93; AccessDPT_ShiftPCHinAXBLtoLCH
    8194;   Parameters:
    82 ;       BX:     P-CHS cylinders (1...16383)
    83 ;       DX:     P-CHS heads (1...16)
     95;       AX:     P-CHS cylinders (1...16383)
     96;       BL:     P-CHS heads (1...16)
    8497;   Returns:
    85 ;       BX:     Number of L-CHS cylinders (1...1024)
    86 ;       DX:     Number of L-CHS heads (1...255)
     98;       AX:     Number of L-CHS cylinders (1...1024)
     99;       BL:     Number of L-CHS heads (1...255)
    87100;       CX:     Number of bits shifted
    88101;   Corrupts registers:
    89102;       Nothing
    90103;--------------------------------------------------------------------
    91 AccessDPT_ShiftPCHinBXDXtoLCH:
     104AccessDPT_ShiftPCHinAXBLtoLCH:
    92105    xor     cx, cx
    93106.ShiftLoop:
    94     cmp     bx, MAX_LCHS_CYLINDERS      ; Need to shift?
     107    cmp     ax, MAX_LCHS_CYLINDERS      ; Need to shift?
    95108    jbe     SHORT .LimitHeadsTo255      ;  If not, return
    96109    inc     cx                          ; Increment shift count
    97     shr     bx, 1                       ; Halve cylinders
    98     shl     dx, 1                       ; Double heads
     110    shr     ax, 1                       ; Halve cylinders
     111    shl     bl, 1                       ; Double heads
    99112    jmp     SHORT .ShiftLoop
    100113.LimitHeadsTo255:                       ; DOS does not support drives with 256 heads
    101     sub     dl, dh                      ; DH set only when 256 logical heads
    102     xor     dh, dh
     114    cmp     bl, cl                      ; Set CF if BL is zero
     115    sbb     bl, ch                      ; If BL=0 then BL=255
    103116    ret
    104117
    105        
     118
    106119;--------------------------------------------------------------------
    107120; Returns pointer to DRVPARAMS for master or slave drive.
     
    144157    and     al, MASKL_DPT_ADDRESSING_MODE
    145158%endmacro
    146 
    147        
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CreateDPT.asm

    r193 r227  
    7878;       CS:BP:  Ptr to IDEVARS for the controller
    7979;   Returns:
    80 ;       DX:AX or AX:    Number of cylinders
    81 ;       BH:             Number of sectors per track
    82 ;       BL:             Number of heads
    83 ;   Corrupts registers:
    84 ;       CX, (DX)
     80;       Nothing
     81;   Corrupts registers:
     82;       AX, BX, CX, DX
    8583;--------------------------------------------------------------------
    8684.StoreAddressing:
     
    8886    call    AccessDPT_GetPointerToDRVPARAMStoCSBX
    8987    test    byte [cs:bx+DRVPARAMS.wFlags], FLG_DRVPARAMS_USERCHS    ; User specified CHS?
    90     jnz     SHORT .StoreUserDefinedCHSaddressing
     88    jnz     SHORT .StoreUserDefinedPCHS
    9189
    9290    ; Check if LBA supported
    9391    call    AtaID_GetPCHStoAXBLBHfromAtaInfoInESSI
    9492    test    BYTE [es:si+ATA1.wCaps+1], A1_wCaps_LBA>>8
    95     jz      SHORT .StoreCHSaddressing
     93    jz      SHORT .StoreCHSfromAXBHBL       ; Small old drive with CHS addressing only
    9694
    9795    ; Check if 48-bit LBA supported
     
    102100    or      BYTE [di+DPT.bFlagsLow], ADDRESSING_MODE_LBA28<<ADDRESSING_MODE_FIELD_POSITION
    103101    call    AtaID_GetTotalSectorCountToBXDXAXfromAtaInfoInESSI
     102    mov     [di+DPT.twLbaSectors], ax
     103    mov     [di+DPT.twLbaSectors+2], dx
     104    mov     [di+DPT.twLbaSectors+4], bx
    104105    call    AtaID_GetLbaAssistedCHStoDXAXBLBH
    105     jmp     SHORT .StoreChsFromDXAXBX
    106 
    107     ; Check if P-CHS to L-CHS translation required
    108 .StoreUserDefinedCHSaddressing:
     106    mov     [di+DPT.bLbaHeads], bl
     107    jmp     SHORT .StoreBlockMode
     108
     109;--------------------------------------------------------------------
     110; .StoreUserDefinedPCHS
     111;   Parameters:
     112;       DS:DI:  Ptr to Disk Parameter Table
     113;       ES:SI:  Ptr to 512-byte ATA information read from the drive
     114;       CS:BP:  Ptr to IDEVARS for the controller
     115;   Returns:
     116;       AX:     Number of P-CHS cylinders
     117;       BH:     Number of P-CHS sectors per track
     118;       BL:     Number of P-CHS heads
     119;   Corrupts registers:
     120;       Nothing
     121;--------------------------------------------------------------------
     122.StoreUserDefinedPCHS:
    109123    call    AccessDPT_GetPointerToDRVPARAMStoCSBX
    110124    mov     ax, [cs:bx+DRVPARAMS.wCylinders]
    111125    mov     bx, [cs:bx+DRVPARAMS.wHeadsAndSectors]
    112 .StoreCHSaddressing:
    113     cmp     ax, MAX_LCHS_CYLINDERS
    114     jbe     SHORT .StoreChsFromAXBX     ; No translation required
    115 
    116     ; We need to get number of bits to shift for translation
     126    ; Fall to .StoreCHSfromAXBHBL
     127
     128;--------------------------------------------------------------------
     129; .StoreCHSfromAXBHBL
     130;   Parameters:
     131;       AX:     Number of P-CHS cylinders
     132;       BH:     Number of P-CHS sectors per track
     133;       BL:     Number of P-CHS heads
     134;       DS:DI:  Ptr to Disk Parameter Table
     135;       ES:SI:  Ptr to 512-byte ATA information read from the drive
     136;       CS:BP:  Ptr to IDEVARS for the controller
     137;   Returns:
     138;       AX:     Number of P-CHS cylinders
     139;       BH:     Number of P-CHS sectors per track
     140;       BL:     Number of P-CHS heads
     141;   Corrupts registers:
     142;       CX
     143;--------------------------------------------------------------------
     144.StoreCHSfromAXBHBL:
    117145    push    ax
    118     eMOVZX  dx, bl                      ; Heads now in DX
    119     xchg    bx, ax                      ; Cylinders now in BX
    120     call    AccessDPT_ShiftPCHinBXDXtoLCH   ; Leaves AX untouched
    121     xchg    bx, ax                      ; Restore HeadsAndSectors to BX
     146    push    bx
     147    call    AccessDPT_ShiftPCHinAXBLtoLCH   ; Get number of bits to shift
     148    pop     bx
     149    pop     ax
     150    jcxz    .StorePCHSfromAXDX              ; Small drive so use L-CHS addressing
     151
     152    ; Store P-CHS addressing mode and number of bits to shift in L-CHS to P-CHS translation
    122153    or      cl, ADDRESSING_MODE_PCHS<<ADDRESSING_MODE_FIELD_POSITION
    123     or      [di+DPT.bFlagsLow], cl      ; Store bits to shift
    124     pop     ax
    125     ; Fall to .StoreChsFromAXBX
    126 
    127 ;--------------------------------------------------------------------
    128 ; .StoreChsFromAXBX
    129 ; .StoreChsFromDXAXBX
    130 ;   Parameters:
    131 ;       DX:AX or AX:    Number of cylinders
    132 ;       BH:     Number of sectors per track
    133 ;       BL:     Number of heads
    134 ;       DS:DI:  Ptr to Disk Parameter Table
    135 ;       ES:SI:  Ptr to 512-byte ATA information read from the drive
    136 ;       CS:BP:  Ptr to IDEVARS for the controller
    137 ;   Returns:
    138 ;       Nothing
    139 ;   Corrupts registers:
    140 ;       DX
    141 ;--------------------------------------------------------------------
    142 .StoreChsFromAXBX:
    143     xor     dx, dx
    144 .StoreChsFromDXAXBX:
    145     mov     [di+DPT.dwCylinders], ax
    146     mov     [di+DPT.dwCylinders+2], dx
    147     mov     [di+DPT.wHeadsAndSectors], bx
     154    or      [di+DPT.bFlagsLow], cl
     155    ; Fall to .StoreChsFromAXBLBH
     156
     157;--------------------------------------------------------------------
     158; .StoreChsFromAXBLBH
     159;   Parameters:
     160;       AX:     Number of P-CHS cylinders
     161;       BH:     Number of P-CHS sectors per track
     162;       BL:     Number of P-CHS heads
     163;       DS:DI:  Ptr to Disk Parameter Table
     164;       ES:SI:  Ptr to 512-byte ATA information read from the drive
     165;       CS:BP:  Ptr to IDEVARS for the controller
     166;   Returns:
     167;       Nothing
     168;   Corrupts registers:
     169;       Nothing
     170;--------------------------------------------------------------------
     171.StorePCHSfromAXDX:
     172    mov     [di+DPT.wPchsCylinders], ax
     173    mov     [di+DPT.wPchsHeadsAndSectors], bx
    148174    ; Fall to .StoreBlockMode
    149175
Note: See TracChangeset for help on using the changeset viewer.