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


Ignore:
Timestamp:
Jan 31, 2011, 11:27:17 AM (13 years ago)
Author:
aitotat
google:author:
aitotat
Message:

Changes to XTIDE Universal BIOS:

  • Even more initialization code inlining.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/AtaID.asm

    r3 r99  
    1 ; File name     :   AtaID.asm
    2 ; Project name  :   IDE BIOS
    3 ; Created date  :   6.4.2010
    4 ; Last update   :   9.4.2010
    5 ; Author        :   Tomi Tilli
     1; Project name  :   XTIDE Universal BIOS
    62; Description   :   Functions for accessing ATA information read with
    73;                   IDENTIFY DEVICE command.
     
    117
    128;--------------------------------------------------------------------
    13 ; Returns P-CHS values from ATA information.
    14 ;
    159; AtaID_GetPCHS
    1610;   Parameters:
     
    1812;   Returns:
    1913;       AX:     Number of user specified P-CHS cylinders
    20 ;       BL:     Number of user specified P-CHS sectors per track
    21 ;       BH:     Number of user specified P-CHS heads
     14;       BH:     Number of user specified P-CHS sectors per track
     15;       BL:     Number of user specified P-CHS heads
    2216;   Corrupts registers:
    2317;       Nothing
    2418;--------------------------------------------------------------------
    25 ALIGN JUMP_ALIGN
    2619AtaID_GetPCHS:
    2720    mov     ax, [es:si+ATA1.wCylCnt]    ; Cylinders (1...16383)
    28     mov     bh, [es:si+ATA1.wHeadCnt]   ; Heads (1...16)
    29     mov     bl, [es:si+ATA1.wSPT]       ; Sectors per Track (1...63)
     21    mov     bl, [es:si+ATA1.wHeadCnt]   ; Heads (1...16)
     22    mov     bh, [es:si+ATA1.wSPT]       ; Sectors per Track (1...63)
    3023    ret
    3124
    3225
    3326;--------------------------------------------------------------------
    34 ; Returns total number of available sectors from ATA information.
    35 ;
    3627; AtaID_GetTotalSectorCount
    3728;   Parameters:
     
    4233;       Nothing
    4334;--------------------------------------------------------------------
    44 ALIGN JUMP_ALIGN
    4535AtaID_GetTotalSectorCount:
     36    push    ds
     37
     38    push    es
     39    pop     ds
    4640    xor     bx, bx
    47     test    WORD [es:si+ATA1.wCaps], A1_wCaps_LBA
    48     jz      SHORT AtaID_GetChsSectorCount
    49     ; Fall to AtaID_GetLbaSectorCount
     41    test    WORD [si+ATA1.wCaps], A1_wCaps_LBA
     42    jz      SHORT .GetChsSectorCount
     43    ; Fall to .GetLbaSectorCount
    5044
    5145;--------------------------------------------------------------------
    52 ; Returns total number of available sectors for LBA addressing.
    53 ;
    54 ; AtaID_GetLbaSectorCount
     46; .GetLbaSectorCount
    5547;   Parameters:
    5648;       BX:     Zero
    57 ;       ES:SI:  Ptr to 512-byte ATA information read from the drive
     49;       DS:SI:  Ptr to 512-byte ATA information read from the drive
    5850;   Returns:
    5951;       BX:DX:AX:   48-bit sector count
     
    6153;       Nothing
    6254;--------------------------------------------------------------------
    63 ;ALIGN JUMP_ALIGN
    64 AtaID_GetLbaSectorCount:
    65     test    WORD [es:si+ATA6.wSetSup83], A6_wSetSup83_LBA48
     55.GetLbaSectorCount:
     56    test    WORD [si+ATA6.wSetSup83], A6_wSetSup83_LBA48
    6657    jz      SHORT .GetLba28SectorCount
    67     mov     ax, [es:si+ATA6.qwLBACnt]
    68     mov     dx, [es:si+ATA6.qwLBACnt+2]
    69     mov     bx, [es:si+ATA6.qwLBACnt+4]
     58    mov     ax, [si+ATA6.qwLBACnt]
     59    mov     dx, [si+ATA6.qwLBACnt+2]
     60    mov     bx, [si+ATA6.qwLBACnt+4]
     61    pop     ds
    7062    ret
    71 ALIGN JUMP_ALIGN
    7263.GetLba28SectorCount:
    73     mov     ax, [es:si+ATA1.dwLBACnt]
    74     mov     dx, [es:si+ATA1.dwLBACnt+2]
     64    mov     ax, [si+ATA1.dwLBACnt]
     65    mov     dx, [si+ATA1.dwLBACnt+2]
     66    pop     ds
    7567    ret
    7668
    7769;--------------------------------------------------------------------
    78 ; Returns total number of available sectors for P-CHS addressing.
    79 ;
    80 ; AtaID_GetChsSectorCount
     70; .GetChsSectorCount
    8171;   Parameters:
    82 ;       ES:SI:  Ptr to 512-byte ATA information read from the drive
     72;       DS:SI:  Ptr to 512-byte ATA information read from the drive
    8373;   Returns:
    8474;       DX:AX:  24-bit sector count
     
    8676;       Nothing
    8777;--------------------------------------------------------------------
    88 ALIGN JUMP_ALIGN
    89 AtaID_GetChsSectorCount:
    90     mov     al, [es:si+ATA1.wSPT]       ; AL=Sectors per track
    91     mul     BYTE [es:si+ATA1.wHeadCnt]  ; AX=Sectors per track * number of heads
    92     mul     WORD [es:si+ATA1.wCylCnt]   ; DX:AX=Sectors per track * number of heads * number of cylinders
     78.GetChsSectorCount:
     79    mov     al, [si+ATA1.wSPT]      ; AL=Sectors per track
     80    mul     BYTE [si+ATA1.wHeadCnt] ; AX=Sectors per track * number of heads
     81    mul     WORD [si+ATA1.wCylCnt]  ; DX:AX=Sectors per track * number of heads * number of cylinders
     82    pop     ds
    9383    ret
Note: See TracChangeset for help on using the changeset viewer.