Changeset 421 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Initialization/AtaID.asm


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/Initialization/AtaID.asm

    r411 r421  
    2121; Section containing code
    2222SECTION .text
    23 
    24 ;--------------------------------------------------------------------
    25 ; AtaID_GetPCHStoAXBLBHfromAtaInfoInESSI
    26 ;   Parameters:
    27 ;       ES:SI:  Ptr to 512-byte ATA information read from the drive
    28 ;   Returns:
    29 ;       AX:     Number of user specified P-CHS cylinders
    30 ;       BH:     Number of user specified P-CHS sectors per track
    31 ;       BL:     Number of user specified P-CHS heads
    32 ;   Corrupts registers:
    33 ;       Nothing
    34 ;--------------------------------------------------------------------
    35 AtaID_GetPCHStoAXBLBHfromAtaInfoInESSI:
    36     mov     ax, [es:si+ATA1.wCylCnt]    ; Cylinders (1...16383)
    37     mov     bl, [es:si+ATA1.wHeadCnt]   ; Heads (1...16)
    38     mov     bh, [es:si+ATA1.wSPT]       ; Sectors per Track (1...63)
    39     ret
    40 
    41 
    42 ;--------------------------------------------------------------------
    43 ; AtaID_GetTotalSectorCountToBXDXAXfromAtaInfoInESSI
    44 ;   Parameters:
    45 ;       ES:SI:  Ptr to 512-byte ATA information read from the drive
    46 ;   Returns:
    47 ;       BX:DX:AX:   48-bit sector count
    48 ;   Corrupts registers:
    49 ;       Nothing
    50 ;--------------------------------------------------------------------
    51 AtaID_GetTotalSectorCountToBXDXAXfromAtaInfoInESSI:
    52     mov     bx, Registers_ExchangeDSSIwithESDI
    53     call    bx  ; ATA info now in DS:DI
    54     push    bx  ; We will return via Registers_ExchangeDSSIwithESDI
    55     xor     bx, bx
    56     test    BYTE [di+ATA1.wCaps+1], A1_wCaps_LBA>>8
    57     jz      SHORT .GetChsSectorCount
    58     ; Fall to .GetLbaSectorCount
    59 
    60 ;--------------------------------------------------------------------
    61 ; .GetLbaSectorCount
    62 ; .GetLba28SectorCount
    63 ; .GetChsSectorCount
    64 ;   Parameters:
    65 ;       BX:     Zero
    66 ;       DS:DI:  Ptr to 512-byte ATA information read from the drive
    67 ;   Returns:
    68 ;       BX:DX:AX:   48-bit sector count
    69 ;   Corrupts registers:
    70 ;       Nothing
    71 ;--------------------------------------------------------------------
    72 .GetLbaSectorCount:
    73 %ifdef MODULE_EBIOS
    74     test    BYTE [di+ATA6.wSetSup83+1], A6_wSetSup83_LBA48>>8
    75     jz      SHORT .GetLba28SectorCount
    76 
    77     ; Get LBA48 sector count
    78     mov     ax, [di+ATA6.qwLBACnt]
    79     mov     dx, [di+ATA6.qwLBACnt+2]
    80     mov     bx, [di+ATA6.qwLBACnt+4]
    81     ret
    82 %endif
    83 
    84 .GetLba28SectorCount:
    85     mov     ax, [di+ATA1.dwLBACnt]
    86     mov     dx, [di+ATA1.dwLBACnt+2]
    87     ret
    88 
    89 .GetChsSectorCount:
    90     mov     al, [di+ATA1.wSPT]      ; AL=Sectors per track
    91     mul     BYTE [di+ATA1.wHeadCnt] ; AX=Sectors per track * number of heads
    92     mul     WORD [di+ATA1.wCylCnt]  ; DX:AX=Sectors per track * number of heads * number of cylinders
    93     ret
    94 
    9523
    9624%ifdef MODULE_ADVANCED_ATA
Note: See TracChangeset for help on using the changeset viewer.