Changeset 99 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Initialization


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.
Location:
trunk/XTIDE_Universal_BIOS/Src/Initialization
Files:
3 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
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/DriveXlate.asm

    r35 r99  
    1 ; File name     :   DriveXlate.asm
    2 ; Project name  :   IDE BIOS
    3 ; Created date  :   15.3.2010
    4 ; Last update   :   24.8.2010
    5 ; Author        :   Tomi Tilli
     1; Project name  :   XTIDE Universal BIOS
    62; Description   :   Functions for swapping drive letters.
    73
     
    10096DriveXlate_SwapFloppyDriveOrHardDisk:
    10197    test    dl, 80h                         ; Hard disk?
    102     jnz     SHORT DriveXlate_SwapHardDisk   ; If so, jump to swap
    103     ; Fall to DriveXlate_SwapFloppyDrive
    104 
    105 ;--------------------------------------------------------------------
    106 ; Swaps Floppy Drive number.
    107 ;
    108 ; DriveXlate_SwapFloppyDrive
    109 ;   Parameters:
    110 ;       DL:     Drive number to be possibly swapped
    111 ;       DS:     RAMVARS segment
    112 ;   Returns:
    113 ;       DL:     Translated drive number
    114 ;   Corrupts registers:
    115 ;       AX
    116 ;--------------------------------------------------------------------
    117 ;ALIGN JUMP_ALIGN
    118 DriveXlate_SwapFloppyDrive:
     98    jnz     SHORT .SwapHardDisk ; If so, jump to swap
     99    ; Fall to .SwapFloppyDrive
     100
     101;--------------------------------------------------------------------
     102; .SwapFloppyDrive
     103;   Parameters:
     104;       DL:     Drive number to be possibly swapped
     105;       DS:     RAMVARS segment
     106;   Returns:
     107;       DL:     Translated drive number
     108;   Corrupts registers:
     109;       AX
     110;--------------------------------------------------------------------
     111.SwapFloppyDrive:
    119112    eMOVZX  ax, BYTE [RAMVARS.xlateVars+XLATEVARS.bFDSwap]
    120     jmp     SHORT DriveXlate_SwapDrive
    121 
    122 ;--------------------------------------------------------------------
    123 ; Swaps Hard Disk number.
    124 ;
    125 ; DriveXlate_SwapHardDisk
    126 ;   Parameters:
    127 ;       DL:     Drive number to be possibly swapped
    128 ;       DS:     RAMVARS segment
    129 ;   Returns:
    130 ;       DL:     Translated drive number
    131 ;   Corrupts registers:
    132 ;       AX
    133 ;--------------------------------------------------------------------
    134 ALIGN JUMP_ALIGN
    135 DriveXlate_SwapHardDisk:
     113    jmp     SHORT SwapDrive
     114
     115;--------------------------------------------------------------------
     116; .SwapHardDisk
     117;   Parameters:
     118;       DL:     Drive number to be possibly swapped
     119;       DS:     RAMVARS segment
     120;   Returns:
     121;       DL:     Translated drive number
     122;   Corrupts registers:
     123;       AX
     124;--------------------------------------------------------------------
     125ALIGN JUMP_ALIGN
     126.SwapHardDisk:
    136127    mov     ah, 80h
    137128    mov     al, BYTE [RAMVARS.xlateVars+XLATEVARS.bHDSwap]
    138     ; Fall to DriveXlate_SwapDrive
    139 
    140 ;--------------------------------------------------------------------
    141 ; Swaps Hard Disk or Floppy Drive number.
    142 ;
    143 ; DriveXlate_SwapDrive
     129    ; Fall to SwapDrive
     130
     131;--------------------------------------------------------------------
     132; SwapDrive
    144133;   Parameters:
    145134;       AL:     Drive number to swap to 00h/80h
     
    151140;       Nothing
    152141;--------------------------------------------------------------------
    153 ;ALIGN JUMP_ALIGN
    154 DriveXlate_SwapDrive:
     142SwapDrive:
    155143    cmp     ah, dl              ; Swap DL from 00h/80h to xxh?
    156144    je      SHORT .SwapToXXhInAL
     
    201189DriveXlate_SetDriveToSwap:
    202190    test    dl, 80h             ; Floppy drive?
    203     jnz     SHORT DriveXlate_SetHardDiskToSwap
    204     ; Fall to DriveXlate_SetFloppyDriveToSwap
    205 
    206 ;--------------------------------------------------------------------
    207 ; Stores floppy drive to be swapped.
    208 ;
    209 ; DriveXlate_SetFloppyDriveToSwap
    210 ;   Parameters:
    211 ;       DL:     Drive to swap to 00h
    212 ;       DS:     RAMVARS segment
    213 ;   Returns:
    214 ;       Nothing
    215 ;   Corrupts registers:
    216 ;       Nothing
    217 ;--------------------------------------------------------------------   
    218 ALIGN JUMP_ALIGN
    219 DriveXlate_SetFloppyDriveToSwap:
     191    jnz     SHORT .SetHardDiskToSwap
     192.SetFloppyDriveToSwap:
    220193    mov     [RAMVARS.xlateVars+XLATEVARS.bFDSwap], dl
    221194    ret
    222 
    223 ;--------------------------------------------------------------------
    224 ; Stores hard disk to be swapped.
    225 ;
    226 ; DriveXlate_SetHardDiskToSwap
    227 ;   Parameters:
    228 ;       DL:     Drive to swap to 80h
    229 ;       DS:     RAMVARS segment
    230 ;   Returns:
    231 ;       Nothing
    232 ;   Corrupts registers:
    233 ;       Nothing
    234 ;--------------------------------------------------------------------   
    235 ALIGN JUMP_ALIGN
    236 DriveXlate_SetHardDiskToSwap:
     195ALIGN JUMP_ALIGN
     196.SetHardDiskToSwap:
    237197    mov     [RAMVARS.xlateVars+XLATEVARS.bHDSwap], dl
    238198    ret
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/FloppyDrive.asm

    r86 r99  
    1818;       BX, CX, DI
    1919;--------------------------------------------------------------------
    20 ;ALIGN JUMP_ALIGN
    2120FloppyDrive_IsInt40hInstalled:
    2221    cmp     WORD [es:INTV_FLOPPY_FUNC*4+2], 0C000h  ; Any ROM segment?
    2322    jb      SHORT .Int40hHandlerIsNotInstalled
     23%ifdef USE_AT
    2424    call    .VerifyInt40hHandlerSinceSomeBiosesSimplyReturnFromInt40h
     25%else
     26    clc     ; INT 40h installed. No need to verify on XT systems.
     27%endif
    2528.Int40hHandlerIsNotInstalled:
    2629    cmc
     
    3740;       BX, CX, DI
    3841;--------------------------------------------------------------------
    39 ;ALIGN JUMP_ALIGN
     42%ifdef USE_AT
    4043.VerifyInt40hHandlerSinceSomeBiosesSimplyReturnFromInt40h:
    4144    push    es
     
    4548    call    .LoadInt40hVerifyParameters
    4649    int     INTV_DISK_FUNC
    47     jc      SHORT .AH08hNotSupported    ; AH=08h not supported on XTs but that doesn't
    48     push    es                          ; matter since INT 40h does not need to be verified
    49     push    di                          ; on XTs
     50    jc      SHORT .Int40hIsInstalled    ; Maybe there are not any floppy drives at all
     51    push    es
     52    push    di
    5053
    5154    call    .LoadInt40hVerifyParameters
     
    5861    mov     dx, es
    5962    cmp     cx, dx                      ; Difference in segments?
    60     jne     SHORT .Int40hNotInstalled
    61 .AH08hNotSupported:
    62     clc
    63     jmp     SHORT .Int40hIsInstalled
     63    je      SHORT .Int40hIsInstalled
    6464.Int40hNotInstalled:
    6565    stc
     
    8181;       DH
    8282;--------------------------------------------------------------------
    83 ;ALIGN JUMP_ALIGN
    8483.LoadInt40hVerifyParameters:
    8584    mov     ah, 08h             ; Get Drive Parameters
     
    8887    mov     es, dx              ; ES:DI = 0000:0000h to guard against BIOS bugs
    8988    ret
     89%endif
    9090
    9191
     
    133133FloppyDrive_GetCount:
    134134    push    es
     135%ifdef USE_AT
    135136    call    FloppyDrive_GetCountFromBIOS
    136     jnc     SHORT .CompareToUserMinimum
     137%else
    137138    call    FloppyDrive_GetCountFromBDA
    138 ALIGN JUMP_ALIGN
    139 .CompareToUserMinimum:
     139%endif
    140140    MAX_U   cl, [cs:ROMVARS.bMinFddCnt]
    141141    xor     ch, ch
     
    159159;       CH, ES
    160160;--------------------------------------------------------------------
     161%ifdef USE_AT
    161162ALIGN JUMP_ALIGN
    162163FloppyDrive_GetCountFromBIOS:
     
    176177    pop     di
    177178    ret
     179%endif
    178180
    179181
     
    190192;       CH, ES
    191193;--------------------------------------------------------------------
     194%ifndef USE_AT
    192195ALIGN JUMP_ALIGN
    193196FloppyDrive_GetCountFromBDA:
     
    199202    add     cl, ch                          ; CL = Floppy Drive count
    200203    ret
     204%endif
Note: See TracChangeset for help on using the changeset viewer.