Changeset 167 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Device


Ignore:
Timestamp:
Aug 21, 2011, 3:42:15 PM (13 years ago)
Author:
aitotat@…
google:author:
aitotat@gmail.com
Message:

Changes to XTIDE Universal BIOS:

  • Old Int 13h transfer functions work again.
  • Fixes to eINT13h (EBIOS) support.
Location:
trunk/XTIDE_Universal_BIOS/Src/Device
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm

    r160 r167  
    128128
    129129    ; Output Sector Address High (only used by LBA48)
    130     mov     ax, [bp+IDEPACK.wSectorCountHighAndLbaLowExt]
     130    xor     ax, ax  ; Sector Count High always zero since 127 sector limit
     131    mov     ah, BYTE [bp+IDEPACK.bLbaLowExt]
    131132    mov     cx, [bp+IDEPACK.wLbaMiddleAndHighExt]
    132133    call    OutputSectorCountAndAddress
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm

    r161 r167  
    55; This struct must not be larger than IDEPACK without INTPACK.
    66struc PIOVARS
    7     .wBlocksLeft            resb    2
     7    .wBlockLeftAndSectorsInLastBlock:
     8    .bBlocksLeft            resb    1
     9    .bSectorsInLastBlock:   resb    1
    810    .wBlockSize             resb    2   ; Block size in WORDs (256...32768)
    911    .wDataPort              resb    2
    10     .bSectorsInLastBlock:   resb    1
     12                            resb    1
    1113                            resb    1   ; Offset 7 = IDEPACK.bDeviceControl
    1214    .fnXfer                 resb    2   ; Offset to transfer function
     
    3234ALIGN JUMP_ALIGN
    3335IdeTransfer_StartWithCommandInAL:
    34     mov     ah, [bp+IDEPACK.bSectorCountHighExt]
    35 
    3636    ; Are we reading or writing?
    3737    test    al, 16  ; Bit 4 is cleared on all the read commands but set on 3 of the 4 write commands
     
    4242    ; Prepare to read data to ESSI
    4343    mov     bx, g_rgfnPioRead
    44     mov     al, [bp+IDEPACK.bSectorCount]
    45     call    InitializePiovarsInSSBPwithSectorCountInAX
     44    call    InitializePiovarsToSSBPfromIdepackInSSBP
    4645    xchg    si, di
     46%ifdef USE_186
     47    push    ReadFromDriveToESDI
     48    jmp     Registers_NormalizeESDI
     49%else
    4750    call    Registers_NormalizeESDI
    48     jmp     SHORT ReadFromDrive
     51    jmp     SHORT ReadFromDriveToESDI
     52%endif
    4953
    5054ALIGN JUMP_ALIGN
    5155.PrepareToWriteDataFromESSI:
    5256    mov     bx, g_rgfnPioWrite
    53     mov     al, [bp+IDEPACK.bSectorCount]
    54     call    InitializePiovarsInSSBPwithSectorCountInAX
     57    call    InitializePiovarsToSSBPfromIdepackInSSBP
    5558    call    Registers_NormalizeESSI
    56     ; Fall to WriteToDrive
    57 
    58 
    59 ;--------------------------------------------------------------------
    60 ; WriteToDrive
     59    ; Fall to WriteToDriveFromESSI
     60
     61
     62;--------------------------------------------------------------------
     63; WriteToDriveFromESSI
    6164;   Parameters:
    6265;       DS:DI:  Ptr to DPT (in RAMVARS segment)
     
    7073;       AL, BX, CX, DX, SI, ES
    7174;--------------------------------------------------------------------
    72 WriteToDrive:
     75WriteToDriveFromESSI:
    7376    ; Always poll when writing first block (IRQs are generated for following blocks)
    7477    mov     bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRQ, FLG_STATUS_DRQ)
     
    7881.WriteNextBlock:
    7982    mov     dx, [bp+PIOVARS.wDataPort]
    80     dec     WORD [bp+PIOVARS.wBlocksLeft]       ; Transferring last (possibly partial) block?
     83    dec     BYTE [bp+PIOVARS.bBlocksLeft]       ; Transferring last (possibly partial) block?
    8184    jz      SHORT .XferLastBlock                ;  If so, jump to transfer
    8285    mov     cx, [bp+PIOVARS.wBlockSize]         ; Load block size in WORDs
    8386    call    [bp+PIOVARS.fnXfer]                 ; Transfer full block
    84 
    85     ; Normalize pointer when necessary
    86     mov     ax, si
    87     shr     ax, 1                               ; WORD offset
    88     add     ax, [bp+PIOVARS.wBlockSize]
    89     jns     SHORT .WaitUntilReadyToTransferNextBlock
    90     call    Registers_NormalizeESSI
    91 
    92 ALIGN JUMP_ALIGN
    93 .WaitUntilReadyToTransferNextBlock:
    9487%ifdef USE_186
    9588    push    .WriteNextBlock
     
    117110
    118111;--------------------------------------------------------------------
    119 ; ReadFromDrive
     112; ReadFromDriveToESDI
    120113;   Parameters:
    121114;       ES:DI:  Normalized ptr to buffer to recieve data
     
    131124;--------------------------------------------------------------------
    132125ALIGN JUMP_ALIGN
    133 ReadFromDrive:
     126ReadFromDriveToESDI:
    134127    ; Wait until drive is ready to transfer
    135128    xchg    di, si                              ; DS:DI now points DPT
    136129    call    IdeWait_IRQorDRQ                    ; Wait until ready to transfer
    137     jc      SHORT WriteToDrive.ReturnWithTransferErrorInAH
     130    jc      SHORT WriteToDriveFromESSI.ReturnWithTransferErrorInAH
    138131    xchg    si, di                              ; ES:DI now points buffer
    139132
    140133    ; Transfer full or last (possible partial) block
    141134    mov     dx, [bp+PIOVARS.wDataPort]
    142     dec     WORD [bp+PIOVARS.wBlocksLeft]
     135    dec     BYTE [bp+PIOVARS.bBlocksLeft]
    143136    jz      SHORT .XferLastBlock
    144137    mov     cx, [bp+PIOVARS.wBlockSize]         ; Load block size in WORDs
     138%ifdef USE_186
     139    push    ReadFromDriveToESDI
     140    jmp     [bp+PIOVARS.fnXfer]
     141%else
    145142    call    [bp+PIOVARS.fnXfer]                 ; Transfer full block
    146 
    147     ; Normalize pointer when necessary
    148     mov     ax, di
    149     shr     ax, 1                               ; WORD offset
    150     add     ax, [bp+PIOVARS.wBlockSize]
    151     jns     SHORT ReadFromDrive
    152     call    Registers_NormalizeESDI
    153     jmp     SHORT ReadFromDrive                 ; Loop while blocks left
     143    jmp     SHORT ReadFromDriveToESDI                   ; Loop while blocks left
     144%endif
    154145
    155146ALIGN JUMP_ALIGN
     
    164155
    165156;--------------------------------------------------------------------
    166 ; InitializePiovarsInSSBPwithSectorCountInAX
    167 ;   Parameters:
    168 ;       AX:     Number of sectors to transfer (1...65535)
     157; InitializePiovarsToSSBPfromIdepackInSSBP
     158;   Parameters:
    169159;       BX:     Offset to transfer function lookup table
    170160;       DS:DI:  Ptr to DPT (in RAMVARS segment)
     161;       SS:BP:  Ptr to IDEPACK
     162;   Returns:
    171163;       SS:BP:  Ptr to PIOVARS
    172 ;   Returns:
    173 ;       Nothing
    174164;   Corrupts registers:
    175165;       AX, BX, CX, DX
    176166;--------------------------------------------------------------------
    177167ALIGN JUMP_ALIGN
    178 InitializePiovarsInSSBPwithSectorCountInAX:
     168InitializePiovarsToSSBPfromIdepackInSSBP:
    179169    ; Store number of blocks to transfer
    180     eMOVZX  cx, BYTE [di+DPT_ATA.bSetBlock]     ; Block size in sectors
    181     xor     dx, dx      ; DX:AX = Sectors to transfer (1...65535)
    182     div     cx          ; AX = Full blocks to transfer
    183     test    dx, dx
    184     mov     dh, cl      ; DH = Full block size if no partial blocks to transfer
     170    eMOVZX  cx, BYTE [di+DPT_ATA.bSetBlock]     ; Block size in sectors, zero CH
     171    eMOVZX  ax, BYTE [bp+IDEPACK.bSectorCount]  ; AX = sectors to transfer (1...128)
     172    div     cl          ; AL = Full blocks to transfer
     173    test    ah, ah      ; AH = Sectors in partial block
    185174    jz      SHORT .NoPartialBlocksToTransfer
    186     inc     ax          ; Partial block
    187     mov     dh, dl      ; DH = Size of partial block in sectors
     175    inc     ax          ; Add partial block to total block count
     176    SKIP2B  dx          ; Skip mov ah, cl
    188177.NoPartialBlocksToTransfer:
    189     mov     [bp+PIOVARS.wBlocksLeft], ax
    190     mov     [bp+PIOVARS.bSectorsInLastBlock], dh
     178    mov     ah, cl      ; Full block size if no partial blocks to transfer
     179    mov     [bp+PIOVARS.wBlockLeftAndSectorsInLastBlock], ax
    191180
    192181    ; Store block size in WORDs
  • trunk/XTIDE_Universal_BIOS/Src/Device/Idepack.asm

    r165 r167  
    3939Idepack_ConvertDapToIdepackAndIssueCommandFromAH:
    4040    mov     [bp+IDEPACK.bCommand], ah
    41     mov     ax, [es:si+DAP.wSectorCount]
     41    mov     al, [es:si+DAP.wSectorCount]
    4242    mov     [bp+IDEPACK.bSectorCount], al
    43     mov     [bp+IDEPACK.bSectorCountHighExt], ah    ; Always zero
    4443
    4544    mov     al, [es:si+DAP.qwLBA]       ; LBA byte 0
     
    8483    mov     [bp+IDEPACK.bSectorCount], al
    8584    mov     [bp+IDEPACK.bCommand], ah
    86     mov     BYTE [bp+IDEPACK.bSectorCountHighExt], 0
    8785
    8886    push    bx
     
    127125    mov     [bp+IDEPACK.wSectorCountAndLbaLow], dx
    128126    mov     [bp+IDEPACK.wLbaMiddleAndHigh], cx
    129     mov     BYTE [bp+IDEPACK.bSectorCountHighExt], 0
    130127
    131128    ; Drive and Head select byte
Note: See TracChangeset for help on using the changeset viewer.