Changeset 551 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Device/IDE


Ignore:
Timestamp:
Jun 6, 2013, 3:31:51 PM (11 years ago)
Author:
aitotat@…
google:author:
aitotat@gmail.com
Message:

Changes to XTIDE Universal BIOS:

  • DMA fixes by James Pearce.
  • Interrupt handlers are now installed before starting to detect drives (HotkeyBar require INT 40h handler for correct drive letters).
File:
1 edited

Legend:

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

    r545 r551  
    11; Project name  :   XTIDE Universal BIOS
    22; Description   :   IDE Read/Write functions for transferring
    3 ;                   block using DMA.
    4 ;                   These functions should only be called from IdeTransfer.asm.
    5 
     3;           block using DMA.
     4;           These functions should only be called from IdeTransfer.asm.
     5; Modified JJP 05-Jun-13
    66;
    77; XTIDE Universal BIOS and Associated Tools
     
    1919; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
    2020;
    21 
    2221
    2322; Section containing code
     
    8180    add     dl, XTCF_CONTROL_REGISTER
    8281
    83     ; Calculate bytes for first page
    84     mov     ax, di
    85     neg     ax                                      ; AX = Max BYTEs for first page
     82    ; convert sectors in CX to BYTES
    8683%ifdef USE_186
    8784    shl     cx, 9                                   ; CX = Block size in BYTEs
    8885%else
    89     xchg    cl, ch
     86    xchg        cl, ch
    9087    shl     cx, 1
    9188%endif
     89
     90    ; Calculate bytes for first page
     91    mov     ax, di
     92    neg     ax          ; 2s compliment
     93
     94    ; if DI was zero carry flag will be cleared (and set otherwise)
     95    ; When DI is zero only one transfer is required since we've limited the
     96    ; XT-CFv3 block size to 32k
     97    jnc .TransferLastDmaPageWithSizeInCX
     98
     99    ; CF was set, so DI != 0 and we might need one or two transfers
    92100    cmp     cx, ax                                  ; if we won't cross a physical page boundary...
    93     jbe     SHORT .TransferLastDmaPageWithSizeInCX  ; ...perform the transfer in one operation
     101    jbe SHORT .TransferLastDmaPageWithSizeInCX  ; ...perform the transfer in one operation
    94102
    95103    ; Calculate how much we can transfer on first and second rounds
    96     xchg    cx, ax                                  ; CX = BYTEs for first page
    97     sub     ax, cx                                  ; AX = BYTEs for second page
    98     push    ax                                      ; Save bytes for second transfer on stack
     104    xchg        cx, ax          ; CX = BYTEs for first page
     105    sub     ax, cx          ; AX = BYTEs for second page
     106    push        ax          ; Save bytes for second transfer on stack
    99107
    100108    ; Transfer first DMA page
     
    111119;   Parameters:
    112120;       BL:     Byte for DMA Mode Register
    113 ;       CX:     Number of BYTEs to transfer (512...32768 since max block size is limited to 64)
     121;       CX:     Number of BYTEs to transfer (1...32768 since max block size is limited to 64)
    114122;       DX:     XT-CFv3 Control Register
    115123;       ES:     Bits 3..0 have physical address bits 19..16
Note: See TracChangeset for help on using the changeset viewer.