Ignore:
Timestamp:
Oct 10, 2012, 6:22:23 PM (12 years ago)
Author:
aitotat@…
google:author:
aitotat@gmail.com
Message:

Changes to XTIDE Universal BIOS:

  • Large changes to prepare full XT-CF support (DMA not yet implemented and memory mapped transfers are not working).
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH1Eh_XTCF.asm

    r472 r473  
    3838;--------------------------------------------------------------------
    3939AH1Eh_HandlerForXTCFfeatures:
    40     xor     ah, ah      ; Subcommand now in AX
    4140%ifndef USE_186
    42     call    AH1Eh_ProcessXTCFsubcommandFromAX
     41    call    AH1Eh_ProcessXTCFsubcommandFromAL
    4342    jmp     Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
    4443%else
    4544    push    Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
    46     ; Fall to AH1Eh_ProcessXTCFsubcommandFromAX
     45    ; Fall to AH1Eh_ProcessXTCFsubcommandFromAL
    4746%endif
    4847
    4948
    5049;--------------------------------------------------------------------
    51 ; AH1Eh_ProcessXTCFsubcommandFromAX
     50; AH1Eh_ProcessXTCFsubcommandFromAL
    5251;   Parameters:
    53 ;       AX:     XT-CF subcommand (see XTCF.inc for more info)
     52;       AL:     XT-CF subcommand (see XTCF.inc for more info)
    5453;       DS:DI:  Ptr to DPT (in RAMVARS segment)
    5554;       SS:BP:  Ptr to IDEPACK
     
    5857;       CF:     0 if successful, 1 if error
    5958;   Corrupts registers:
    60 ;       AL, BX, CX, DX
     59;       AL, BX, CX, DX, SI
    6160;--------------------------------------------------------------------
    62 AH1Eh_ProcessXTCFsubcommandFromAX:
     61AH1Eh_ProcessXTCFsubcommandFromAL:
    6362    ; IS_THIS_DRIVE_XTCF. We check this for all commands.
    64     dec     ax      ; Subcommand
    65     mov     dx, [di+DPT.wXTCFport]
    66     test    dx, dx  ; Never zero for XT-CF, Always zero for other devices
    67     jz      SHORT XTCFnotFound
     63    call    AccessDPT_IsThisDeviceXTCF
     64    jne     SHORT XTCFnotFound
     65    and     ax, BYTE 7Fh                ; Subcommand now in AX
     66    jz      SHORT .ReturnWithSuccess    ; IS_THIS_DRIVE_XTCF
    6867
    6968    ; READ_XTCF_CONTROL_REGISTER_TO_DH
    70     add     dl, XTCF_CONTROL_REGISTER   ; DX to Control Register
    71     dec     ax      ; Subcommand
     69    dec     ax                          ; Subcommand
    7270    jnz     SHORT .SkipReadXtcfControlRegisterToDH
     71    mov     dx, [di+DPT.wBasePort]
     72    add     dl, XTCF_CONTROL_REGISTER
    7373    in      al, dx
    7474    mov     [bp+IDEPACK.intpack+INTPACK.dh], al
    75     jmp     SHORT .ReturnWithSuccess
     75.ReturnWithSuccess:
     76    xor     ah, ah
     77    ret
    7678.SkipReadXtcfControlRegisterToDH:
    7779
    7880    ; WRITE_DH_TO_XTCF_CONTROL_REGISTER
    79     dec     ax      ; Subcommand
     81    dec     ax                          ; Subcommand
    8082    jnz     SHORT XTCFnotFound          ; Invalid subcommand
    8183    mov     al, [bp+IDEPACK.intpack+INTPACK.dh]
     84    ; Fall to AH1Eh_ChangeXTCFmodeBasedOnControlRegisterInAL
     85
     86
     87;--------------------------------------------------------------------
     88; AH1Eh_ChangeXTCFmodeBasedOnControlRegisterInAL
     89;   Parameters:
     90;       AL:     XT-CF Control Register
     91;       DS:DI:  Ptr to DPT (in RAMVARS segment)
     92;       SS:BP:  Ptr to IDEPACK
     93;   Returns:
     94;       AH:     Int 13h return status
     95;       CF:     0 if successful, 1 if error
     96;   Corrupts registers:
     97;       AL, BX, CX, DX, SI
     98;--------------------------------------------------------------------
     99AH1Eh_ChangeXTCFmodeBasedOnControlRegisterInAL:
     100    ; Output Control Register
     101    mov     dx, [di+DPT.wBasePort]
     102    add     dl, XTCF_CONTROL_REGISTER
    82103    out     dx, al
    83 .ReturnWithSuccess:
    84     xor     ah, ah
    85     ret
     104
     105    ; Convert Control Register Contents to device code
     106    test    al, al
     107    jz      SHORT .Set8bitPioMode
     108    cmp     al, XTCF_MEMORY_MAPPED_MODE
     109    jae     SHORT .SetMemoryMappedMode
     110
     111    ; Set DMA Mode
     112    mov     BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_DMA
     113    jmp     AH23h_Disable8bitPioMode
     114
     115.SetMemoryMappedMode:
     116    mov     BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_MEMMAP
     117    jmp     AH23h_Disable8bitPioMode
     118
     119.Set8bitPioMode:
     120    mov     BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_PIO8
     121    jmp     AH23h_Enable8bitPioMode
    86122
    87123
     
    96132;               Set if XT-CF not found
    97133;   Corrupts registers:
    98 ;       AL, DX
     134;       AL
    99135;--------------------------------------------------------------------
    100136AH1Eh_DetectXTCFwithBasePortInDX:
     137    push    dx
    101138    add     dl, XTCT_CONTROL_REGISTER_INVERTED_in   ; set DX to XT-CF config register (inverted)
    102139    in      al, dx      ; get value
     
    104141    inc     dx          ; set DX to XT-CF config register (non-inverted)
    105142    in      al, dx      ; get value
    106     not     al          ; invert it
     143    not     al          ; invert value
     144    pop     dx
    107145    sub     ah, al      ; do they match? (clear AH if they do)
    108146    jz      SHORT XTCFfound
    109147
    110148XTCFnotFound:
     149AH1Eh_LoadInvalidCommandToAHandSetCF:
    111150    stc                 ; set carry flag since XT-CF not found
    112151    mov     ah, RET_HD_INVALID
Note: See TracChangeset for help on using the changeset viewer.