Changeset 558 in xtideuniversalbios


Ignore:
Timestamp:
Jun 23, 2013, 3:52:31 PM (11 years ago)
Author:
krille_n_@…
google:author:
krille_n_@hotmail.com
Message:

Changes:

  • Building the BIOS Drive Information Tool now works again.
  • Moved all XT-CF related code to MODULE_8BIT_IDE_ADVANCED. I don't see how an XT-CF card could work without *_ADVANCED anyway but if I'm wrong, feel free to undo this. Note! The autodetection code in XTIDECFG has NOT been changed to reflect this (still relies on MODULE_8BIT_IDE).
  • Optimizations and fixes in general.
Location:
trunk
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • trunk/BIOS_Drive_Information_Tool/Src/AtaInfo.asm

    r526 r558  
    239239    mov     si, bx              ; DS == ES
    240240    mov     dx, TRANSLATEMODE_AUTO
    241     call    AtaGeometry_GetLCHStoAXBLBHfromAtaInfoInESSIandTranslateModeInDX
     241    call    AtaGeometry_GetLCHStoAXBLBHfromAtaInfoInESSIwithTranslateModeInDX
    242242    dec     ax                  ; Reserve diagnostics cylinder
    243243    MIN_U   ax, MAX_LCHS_CYLINDERS
  • trunk/BIOS_Drive_Information_Tool/Src/Main.asm

    r526 r558  
    2727%include "Int13h.inc"           ; From XTIDE Universal BIOS
    2828%include "EBIOS.inc"            ; From XTIDE Universal BIOS
    29 FLG_DRVNHEAD_DRV    EQU (1<<4)  ; Required by CustomDPT.inc
     29%include "IdeRegisters.inc"     ; From XTIDE Universal BIOS
    3030%include "Romvars.inc"          ; From XTIDE Universal BIOS
    3131%include "CustomDPT.inc"        ; From XTIDE Universal BIOS
  • trunk/BIOS_Drive_Information_Tool/Src/Print.asm

    r526 r558  
    262262    push    cx
    263263    mov     si, g_szNewExtensions
    264     jmp     SHORT JumpToFormatNullTerminatedStringFromSI
     264    ; Fall to JumpToFormatNullTerminatedStringFromSI
    265265
    266266
  • trunk/XTIDE_Universal_BIOS/Inc/Controllers/Vision.inc

    r540 r558  
    2828QD65XX_BASE_PORT                    EQU     30h
    2929QD65XX_ALTERNATIVE_BASE_PORT        EQU     0B0h    ; This is the default setting but Intel PIIX4 South Bridge
    30                                                     ; (and likely other PCI chisets as well) mirror PIC registers here
     30                                                    ; (and likely other PCI chipsets as well) mirror PIC registers here
    3131
    3232; Vision Register offsets from QD chip base port
  • trunk/XTIDE_Universal_BIOS/Inc/Controllers/XTCF.inc

    r545 r558  
    2626%define XTCF_INC
    2727
    28 ; XT-CF requires that block must be less than 128 sectors (64 kiB) for DMA
    29 ; transfers.
    30 ;
     28; XT-CF requires that block must be less than 128 sectors (64 kiB) for DMA transfers.
     29;
    3130; Note: XT-CFv3 DMA will not interfere with PC & PC/XT memory refresh,
    3231; since the XT-CFv3 detaches itself from the bus every 16 bytes transferred.
     
    5958; XT-CFv3 cannot be distinguised by software, so user must decide and set
    6059; the mode via a call to Int 13h function 1Eh accordingly (see AH1E_XTCF.asm).
    61 ;;
     60;
    6261XTCF_8BIT_PIO_MODE                  EQU     00h
    6362XTCF_8BIT_PIO_MODE_WITH_BIU_OFFLOAD EQU     01h
     
    8079; SET_XTCF_TRANSFER_MODE
    8180;   Parameters:
    82 ;       DH:     Mode to select,
    83 ;                               i.e. XTCF_8BIT_PIO_MODE
    84 ;               Note there's no way to know if an
    85 ;               XT-CF adapter supports DMA, so the
    86 ;               user should enable DMA only if a
    87 ;               DMA-enabled XT-CFv3 is fitted.
     81;       DH:     Mode to select, i.e. XTCF_8BIT_PIO_MODE
     82;               Note there's no way to know if an XT-CF adapter
     83;               supports DMA, so the user should enable DMA
     84;               only if a DMA-enabled XT-CFv3 is fitted.
    8885;       DL:     Drive Number
    8986;--------------------------------------------------------------------
     
    9592;       DL:     Drive Number
    9693;   Returns:
    97 ;       DL:     Block mode sectors per block
    98 ;               configured
    9994;       DH:     One of the mode values listed above,
    100 ;                               i.e. XTCF_8BIT_PIO_MODE
     95;               i.e. XTCF_8BIT_PIO_MODE
     96;       DL:     Block mode sectors per block configured
    10197;--------------------------------------------------------------------
    10298GET_XTCF_TRANSFER_MODE              EQU     2
  • trunk/XTIDE_Universal_BIOS/Inc/RomVars.inc

    r547 r558  
    121121STANDARD_CONTROL_BLOCK_OFFSET           EQU     200h
    122122XTIDE_CONTROL_BLOCK_OFFSET              EQU     8h      ; for XTIDE, A3 is used to control selected register (CS0 vs CS1)...
    123 XTCF_CONTROL_BLOCK_OFFSET               EQU     10h     ; ...and for XT-CF (all varients), it's A4
     123XTCF_CONTROL_BLOCK_OFFSET               EQU     10h     ; ...and for XT-CF (all variants), it's A4
    124124ADP50L_CONTROL_BLOCK_OFFSET             EQU     10h
    125125
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeDmaBlock.asm

    r551 r558  
    11; Project name  :   XTIDE Universal BIOS
    2 ; Description   :   IDE Read/Write functions for transferring
    3 ;           block using DMA.
    4 ;           These functions should only be called from IdeTransfer.asm.
     2; Description   :   IDE Read/Write functions for transferring block using DMA.
     3;                   These functions should only be called from IdeTransfer.asm.
     4
    55; Modified JJP 05-Jun-13
     6
    67;
    78; XTIDE Universal BIOS and Associated Tools
     
    8485    shl     cx, 9                                   ; CX = Block size in BYTEs
    8586%else
    86     xchg        cl, ch
     87    xchg    cl, ch
    8788    shl     cx, 1
    8889%endif
     
    9293    neg     ax          ; 2s compliment
    9394
    94     ; if DI was zero carry flag will be cleared (and set otherwise)
     95    ; If DI was zero carry flag will be cleared (and set otherwise)
    9596    ; When DI is zero only one transfer is required since we've limited the
    9697    ; XT-CFv3 block size to 32k
    97     jnc .TransferLastDmaPageWithSizeInCX
     98    jnc     SHORT .TransferLastDmaPageWithSizeInCX
    9899
    99100    ; CF was set, so DI != 0 and we might need one or two transfers
    100101    cmp     cx, ax                                  ; if we won't cross a physical page boundary...
    101     jbe SHORT .TransferLastDmaPageWithSizeInCX  ; ...perform the transfer in one operation
     102    jbe     SHORT .TransferLastDmaPageWithSizeInCX  ; ...perform the transfer in one operation
    102103
    103104    ; Calculate how much we can transfer on first and second rounds
    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
     105    xchg    cx, ax      ; CX = BYTEs for first page
     106    sub     ax, cx      ; AX = BYTEs for second page
     107    push    ax          ; Save bytes for second transfer on stack
    107108
    108109    ; Transfer first DMA page
     
    126127;       ES:DI updated (CX is added)
    127128;   Corrupts registers:
    128 ;       AX
     129;       AX, CX
    129130;--------------------------------------------------------------------
    130131ALIGN JUMP_ALIGN
     
    161162    sti                                                         ; Enable interrupts
    162163
     164    ; Update physical address in ES:DI - since IO might need several calls through this function either from here
     165    ; if crossing a physical page boundary, or from IdeTransfer.asm if requested sectors was > PIOVARS.wSectorsInBlock
     166    ; We update the pointer here (before the actual transfer) to avoid having to save the byte count on the stack
     167    mov     ax, es                      ; copy physical page address to ax
     168    add     di, cx                      ; add requested bytes to di
     169    adc     al, 0                       ; and increment physical page address, if required
     170    mov     es, ax                      ; and save it back in es
     171
    163172    ; XT-CF transfers 16 bytes at a time. We need to manually start transfer for every block by writing (anything)
    164173    ; to the XT-CFv3 Control Register, which raises DRQ thereby passing system control to the 8237 DMA controller.
     
    169178
    170179%if 0   ; Slow DMA code - works by checking 8237 status register after each 16-byte transfer, until it reports TC has been raised.
    171 ;ALIGN JUMP_ALIGN
    172 ;.TransferNextBlock:
    173 ;   cli                                 ; We want no ISR to read DMA Status Register before we do
    174 ;   out     dx, al                      ; Transfer up to 16 bytes to/from XT-CF card
    175 ;   in      al, STATUS_REGISTER_DMA8_in
    176 ;   sti
    177 ;   test    al, FLG_CH3_HAS_REACHED_TERMINAL_COUNT
    178 ;   jz      SHORT .TransferNextBlock    ; All bytes transferred?
    179 %endif ; Slow DMA code
    180 
    181 %if 1   ; Fast DMA code - perform computed number of transfers, then check DMA status register to be sure
    182     push    cx                          ; need byte count to update pointer at the end
     180ALIGN JUMP_ALIGN
     181.TransferNextBlock:
     182    cli                                 ; We want no ISR to read DMA Status Register before we do
     183    out     dx, al                      ; Transfer up to 16 bytes to/from XT-CF card
     184    in      al, STATUS_REGISTER_DMA8_in
     185    sti
     186    test    al, FLG_CH3_HAS_REACHED_TERMINAL_COUNT
     187    jz      SHORT .TransferNextBlock    ; All bytes transferred?
     188%else   ; Fast DMA code - perform computed number of transfers, then check DMA status register to be sure
    183189    add     cx, BYTE 15                 ; We'll divide transfers in 16-byte atomic transfers,
    184190    eSHR_IM cx, 4                       ; so include any partial block, which will be terminated
     
    191197    test    al, FLG_CH3_HAS_REACHED_TERMINAL_COUNT  ; ... for channel 3 terminal count
    192198    jz      SHORT .TransferNextDmaBlock ; If not set, get more bytes
    193     pop     cx                          ; get back requested bytes
    194 %endif ; Fast DMA code
    195 
    196     ; Update physical address in ES:DI - since IO might need several calls through this function either from here
    197     ; if crossing a physical page boundary, and from IdeTransfer.asm if requested sectors was > PIOVARS.wSectorsInBlock
    198     mov     ax, es                      ; copy physical page address to ax
    199     add     di, cx                      ; add requested bytes to di
    200     adc     al, 0                       ; and increment physical page address, if required
    201     mov     es, ax                      ; and save it back in es
     199%endif
    202200
    203201    ret
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeIO.asm

    r545 r558  
    6767    je      SHORT .InputToALfromMemoryMappedRegisterInBX
    6868    mov     bl, dl
    69     mov     bh, ADP50L_COMMAND_BLOCK_REGISTER_WINDOW_OFFSET >> 8
     69    mov     bh, ADP50L_COMMAND_BLOCK_REGISTER_WINDOW_OFFSET >> 8
    7070
    7171.InputToALfromMemoryMappedRegisterInBX:
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdePioBlock.asm

    r545 r558  
    11; Project name  :   XTIDE Universal BIOS
    2 ; Description   :   IDE Read/Write functions for transferring
    3 ;                   block using PIO modes.
     2; Description   :   IDE Read/Write functions for transferring block using PIO modes.
    43;                   These functions should only be called from IdeTransfer.asm.
    54
     
    6564;
    6665;   Parameters:
    67 ;       CX: Block size in 512 byte sectors
    68 ;       DX: IDE Data port address
     66;       CX:     Block size in 512 byte sectors
     67;       DX:     IDE Data port address
    6968;       ES:DI:  Normalized ptr to buffer to receive data
    7069;   Returns:
     
    10099;
    101100;   Parameters:
    102 ;       CX: Block size in 512 byte sectors
    103 ;       DX: IDE Data port address
     101;       CX:     Block size in 512 byte sectors
     102;       DX:     IDE Data port address
    104103;       ES:DI:  Normalized ptr to buffer to receive data
    105104;   Returns:
     
    111110IdePioBlock_ReadFrom16bitDataPort:
    112111%ifdef USE_186
    113     xchg        cl, ch  ; Sectors to WORDs
     112    xchg    cl, ch  ; Sectors to WORDs
    114113    rep insw
    115114    ret
     
    120119.ReadNextOword:
    121120    %rep 8  ; WORDs
    122         in      ax, dx  ; Read BYTE
    123         stosw           ; Store BYTE to [ES:DI]
     121        in      ax, dx  ; Read WORD
     122        stosw           ; Store WORD to [ES:DI]
    124123    %endrep
    125124    loop    .ReadNextOword
     
    152151; IdePioBlock_WriteToXtideRev1
    153152;   Parameters:
    154 ;       CX: Block size in 512-byte sectors
    155 ;       DX: IDE Data port address
     153;       CX:     Block size in 512-byte sectors
     154;       DX:     IDE Data port address
    156155;       ES:SI:  Normalized ptr to buffer containing data
    157156;   Returns:
     
    180179; IdePioBlock_WriteToXtideRev2  or rev 1 with swapped A0 and A3 (chuck-mod)
    181180;   Parameters:
    182 ;       CX: Block size in 512-byte sectors
    183 ;       DX: IDE Data port address
     181;       CX:     Block size in 512-byte sectors
     182;       DX:     IDE Data port address
    184183;       ES:SI:  Normalized ptr to buffer containing data
    185184;   Returns:
     
    191190IdePioBlock_WriteToXtideRev2:
    192191    UNROLL_SECTORS_IN_CX_TO_QWORDS
    193     push        ds
    194     push        es      ; Copy ES...
    195     pop         ds      ; ...to DS
     192    push    ds
     193    push    es      ; Copy ES...
     194    pop     ds      ; ...to DS
    196195ALIGN JUMP_ALIGN
    197196.WriteNextQword:
     
    207206; IdePioBlock_WriteTo8bitDataPort
    208207;   Parameters:
    209 ;       CX: Block size in 512-byte sectors
    210 ;       DX: IDE Data port address
     208;       CX:     Block size in 512-byte sectors
     209;       DX:     IDE Data port address
    211210;       ES:SI:  Normalized ptr to buffer containing data
    212211;   Returns:
     
    225224%else ; If 8088/8086
    226225    UNROLL_SECTORS_IN_CX_TO_QWORDS
    227     push        ds
    228     ;mov        ax, es
    229     ;mov        ds, ax  ; move es to ds via ax (does this run faster on 8088?)
    230     push        es
    231     pop         ds
     226    push    ds
     227    ;mov    ax, es
     228    ;mov    ds, ax  ; move es to ds via ax (does this run faster on 8088?)
     229    push    es
     230    pop     ds
    232231ALIGN JUMP_ALIGN
    233232.WriteNextQword:
     
    248247; IdePioBlock_WriteTo32bitDataPort      VLB/PCI 32-bit IDE
    249248;   Parameters:
    250 ;       CX: Block size in 512-byte sectors
    251 ;       DX: IDE Data port address
     249;       CX:     Block size in 512-byte sectors
     250;       DX:     IDE Data port address
    252251;       ES:SI:  Normalized ptr to buffer containing data
    253252;   Returns:
     
    274273.WriteNextQword:
    275274    %rep 4  ; WORDs
    276         lodsw           ; Load BYTE from [DS:SI]
    277         out dx, ax      ; Write BYTE
     275        lodsw           ; Load WORD from [DS:SI]
     276        out dx, ax      ; Write WORD
    278277    %endrep
    279278    loop    .WriteNextQword
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm

    r545 r558  
    209209;       ES:SI:  Normalized pointer
    210210;       AH:     INT 13h Error Code (only when CF set)
    211 ;       CF:     Set of failed to normalize pointer (segment overflow)
     211;       CF:     Set if failed to normalize pointer (segment overflow)
    212212;               Cleared if success
    213213;   Corrupts registers:
     
    295295    ret
    296296%endif ; MODULE_8BIT_IDE_ADVANCED
    297     ; Fall to IdeTransfer_NormalizePointerInESSI if no MODULE_8BIT_IDE
     297    ; Fall to IdeTransfer_NormalizePointerInESSI if no MODULE_8BIT_IDE_ADVANCED
    298298
    299299
     
    305305;   Returns:
    306306;       ES:SI:  Normalized pointer (SI = 0...15)
    307 ;       AH:     INT 13h Error Code (only when CF set)
    308 ;       CF:     Set of failed to normalize pointer (segment overflow)
     307;       AH:     INT 13h Error Code (when USE_AT defined and normalization was attempted)
     308;       CF:     Set if failed to normalize pointer (segment overflow)
    309309;               Cleared if success
    310310;   Corrupts registers:
     
    319319%ifdef USE_AT
    320320    xor     dl, dl
    321     shl     dx, 1
     321    eSHL_IM dx, 1
    322322    dec     dx      ; Prevents normalization when bytes + offset will be zero
    323323    add     dx, si
     
    329329    NORMALIZE_FAR_POINTER   es, si, ax, dx
    330330%ifdef USE_AT       ; CF is always clear for XT builds
    331     jc      SHORT .SegmentOverflow
    332     ret
    333 .SegmentOverflow:
    334     mov     ah, RET_HD_INVALID
     331    ; AH = RET_HD_INVALID (01) if CF set, RET_HD_SUCCESS (00) if not. CF unchanged.
     332    sbb     ah, ah
     333    neg     ah
    335334%endif
    336335    ret
  • trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialCommand.asm

    r538 r558  
    6767        call    IdeTransfer_NormalizePointerInESSI
    6868%ifdef USE_AT
    69         jnc     SHORT .PointerNormalizationWasSuccessfull
     69        jnc     SHORT .PointerNormalizationWasSuccessful
    7070        xor     cx, cx          ; Nothing transferred
    71         jmp     SerialCommand_ReturnError
    72 .PointerNormalizationWasSuccessfull:
     71        stc
     72        ret
     73.PointerNormalizationWasSuccessful:
    7374%endif
    7475
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h.asm

    r557 r558  
    169169    mov     [RAMVARS.xlateVars+XLATEVARS.bXlatedDrv], dl
    170170    push    WORD [RAMVARS.xlateVars+XLATEVARS.wFDandHDswap]
    171     mov     WORD [RAMVARS.xlateVars+XLATEVARS.wFDandHDswap], 8000h  ; No translation
     171    call    DriveXlate_Reset            ; No translation
    172172%endif
    173173
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH1Eh_XTCF.asm

    r545 r558  
    4040;       AH:     Int 13h return status
    4141;       CF:     0 if successful, 1 if error
     42;       DX:     Command return values (see XTCF.inc)
    4243;--------------------------------------------------------------------
    4344AH1Eh_HandlerForXTCFfeatures:
     
    4647    jmp     Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
    4748%else
    48     push        Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
     49    push    Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
    4950    ; Fall to ProcessXTCFsubcommandFromAL
    5051%endif
     
    6061;       AH:     Int 13h return status
    6162;       CF:     0 if successful, 1 if error
    62 ;       DX      Command return values (see XTCF.inc)
    6363;   Corrupts registers:
    6464;       AL, BX, CX, DX, SI
     
    6868    call    AccessDPT_IsThisDeviceXTCF
    6969    jne     SHORT .XTCFnotFound
    70     and     ax, BYTE 7Fh                ; Subcommand now in AX (clears AH and CF)
     70    and     ax, 0FFh                    ; Subcommand now in AX (clears AH and CF)
    7171    jz      SHORT .XTCFfound            ; Sub-function IS_THIS_DRIVE_XTCF (=0)
    7272
     
    7575
    7676    dec     ax                          ; Test subcommand for value 2 (GET_XTCF_TRANSFER_MODE)
    77     jnz     SHORT .XTCFnotFound         ; Invalid subcommand
     77    jnz     SHORT .AH1Eh_LoadInvalidCommandToAHandSetCF
    7878
    7979    ; GET_XTCF_TRANSFER_MODE
    8080    call    AH1Eh_GetCurrentXTCFmodeToAX
     81    mov     dh, al
    8182    mov     dl, [di+DPT_ATA.bBlockSize]
    82     mov     [bp+IDEPACK.intpack+INTPACK.dh], al ; return mode value...
    83     mov     [bp+IDEPACK.intpack+INTPACK.dl], dl ; ...and block size, via INTPACK...
     83    mov     [bp+IDEPACK.intpack+INTPACK.dx], dx ; Return mode value (DH) and block size (DL) via INTPACK
    8484.XTCFfound:
    85     ret                                         ; ...with AH and CF cleared
     85    ret     ; With AH and CF cleared
    8686
    8787.XTCFnotFound:
    8888.AH1Eh_LoadInvalidCommandToAHandSetCF:
    89     stc                 ; set carry flag since XT-CF not found
     89    stc     ; Set carry flag since XT-CF not found or invalid subcommand
    9090    mov     ah, RET_HD_INVALID
    91     ret                 ; and return
     91    ret
    9292
    9393.SetXTCFtransferMode:
    94     mov     al, [bp+IDEPACK.intpack+INTPACK.dh] ; get specified mode (eg XTCF_DMA_MODE)
    95     ; and fall to AH1Eh_ChangeXTCFmodeBasedOnControlRegisterInAL
     94    mov     al, [bp+IDEPACK.intpack+INTPACK.dh] ; Get specified mode (eg XTCF_DMA_MODE)
     95    ; Fall to AH1Eh_ChangeXTCFmodeBasedOnModeInAL
    9696
    9797
     
    102102;       DS:DI:  Ptr to DPT (in RAMVARS segment)
    103103;       SS:BP:  Ptr to IDEPACK
    104 ;   Returns:   
     104;   Returns:
    105105;       AH:     Int 13h return status
    106106;       CF:     0 if successful, 1 if error
     
    110110AH1Eh_ChangeXTCFmodeBasedOnModeInAL:
    111111    ; Note: Control register (as of XT-CFv3) is now a write-only register,
    112     ;       whos purpose is *only* to raise DRQ.  The register cannot be read.
     112    ;       whose purpose is *only* to raise DRQ.  The register cannot be read.
    113113    ;       Selected transfer mode is stored in BIOS variable (DPT_ATA.bDevice).
    114114
    115     ; We always need to enable 8-bit mode since 16-bit mode is restored
    116     ; when controller is reset (AH=00h or 0Dh)
    117     ;
    118115    ; Note that when selecting 'DEVICE_8BIT_PIO_MODE_WITH_BIU_OFFLOAD' mode,
    119116    ; the ATA device (i.e. CompactFlash card) will operate in 8-bit mode, but
    120     ; data will be transferred from it's data register using 16-bit CPU instructions
     117    ; data will be transferred from its data register using 16-bit CPU instructions
    121118    ; like REP INSW.  This works because XT-CF adapters are 8-bit cards, and
    122119    ; the BIU in the machine splits each WORD requested by the CPU into two 8-bit
     
    125122    ; the data for presentation to the CPU.
    126123    ;
    127     ; Also note though that some machines, noteably AT&T PC6300, have hardware
    128     ; errors in the BIU logic, resulting in reversed byte ordering.  Therefore,
    129     ; mode DEVICE_8BIT_PIO is the default transfer mode for best system
    130     ; compatibility.
     124    ; Also note that some machines, noteably the Olivetti M24 (also known as
     125    ; the AT&T PC6300 and Xerox 6060), have hardware errors in the BIU logic,
     126    ; resulting in reversed byte ordering.  Therefore, mode DEVICE_8BIT_PIO is
     127    ; the default transfer mode for best system compatibility.
    131128
     129    ; We always need to enable 8-bit mode since 16-bit mode is restored
     130    ; when controller is reset (AH=00h or 0Dh)
    132131    ePUSH_T bx, AH23h_Enable8bitPioMode
    133132
    134133    ; Convert mode to device type (see XTCF.inc for full details)
    135134    and     ax, 3
    136     jz  SHORT .Set8bitPioMode   ; XTCF_8BIT_PIO_MODE = 0
    137     dec     ax                  ; XTCF_8BIT_PIO_MODE_WITH_BIU_OFFLOAD = 1
    138     jz  SHORT .Set8bitPioModeWithBIUOffload
     135    jz      SHORT .Set8bitPioMode   ; XTCF_8BIT_PIO_MODE = 0
     136    dec     ax                      ; XTCF_8BIT_PIO_MODE_WITH_BIU_OFFLOAD = 1
     137    jz      SHORT .Set8bitPioModeWithBIUOffload
    139138
    140139    ; XTCF_DMA_MODE = 2 (allow 3 as well for more optimized code)
    141140    mov     BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_DMA
    142141
    143     ; DMA transfers have limited block sizee
     142    ; DMA transfers have limited block size
    144143    mov     al, [di+DPT_ATA.bBlockSize]
    145     MIN_U   al, XTCF_DMA_MODE_MAX_BLOCK_SIZE
    146     jmp     AH24h_SetBlockSize
    147     ; exit via ret in AH24_SetBlockSize then through AH23h_Enable8bitPioMode
     144    cmp     al, XTCF_DMA_MODE_MAX_BLOCK_SIZE
     145    jbe     SHORT AH24h_SetBlockSize
     146    mov     al, XTCF_DMA_MODE_MAX_BLOCK_SIZE
     147    jmp     SHORT AH24h_SetBlockSize
    148148
    149149.Set8bitPioMode:
    150     mov     BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_PIO8
    151     ret     ; through AH23h_Enable8bitPioMode
     150    mov     al, DEVICE_8BIT_XTCF_PIO8
     151    SKIP2B  bx
    152152
    153153.Set8bitPioModeWithBIUOffload:
    154     mov     BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_PIO8_WITH_BIU_OFFLOAD
    155     ret     ; through AH23h_Enable8bitPioMode
     154    mov     al, DEVICE_8BIT_XTCF_PIO8_WITH_BIU_OFFLOAD
     155    mov     [di+DPT_ATA.bDevice], al
     156    ret
    156157
    157158
     
    160161;   Parameters:
    161162;       DS:DI:  Ptr to DPT (in RAMVARS segment)
    162 ;   Returns:   
     163;   Returns:
    163164;       AX:     XT-CF mode (XTCF_8BIT_PIO_MODE, XTCF_8BIT_PIO_MODE_WITH_BIU_OFFLOAD or XTCF_DMA_MODE)
    164165;       CF:     Clear
     
    167168;--------------------------------------------------------------------
    168169AH1Eh_GetCurrentXTCFmodeToAX:
    169     eMOVZX  ax, BYTE [di+DPT_ATA.bDevice]   ; get current mode from DPT
    170     sub     al, DEVICE_8BIT_XTCF_PIO8
    171     shr     ax, 1                           ; Device type to XT-CF mode
     170    mov     al, [di+DPT_ATA.bDevice]
     171    shr     al, 1
     172    cbw
     173    sub     al, DEVICE_8BIT_XTCF_PIO8 >> 1
    172174    ret
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH24h_HSetBlocks.asm

    r550 r558  
    8484    pop     bx          ; Pop block size to BL
    8585    jc      SHORT .DisableBlockMode
    86     mov     bh, bl      ; BL and BH both have block size we tried to set
    87     dec     bh
    88     jz      SHORT .DisableBlockMode
     86
     87    ; All valid block sizes are powers of 2 which means BL have just one bit set (parity odd).
     88    ; Incrementing BX will cause all block sizes except 1 to have two bits set (parity even).
     89    ; Note that PF reflects only the lowest 8 bits of any register being modified.
     90    inc     bx                      ; 1 -> 2 ?
     91    jpo     SHORT .DisableBlockMode ; Jump if BL = 2
     92    dec     bx                      ; Restore block size (was larger than 1)
    8993
    9094    ; Enable block mode and store block size
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm

    r550 r558  
    112112
    113113
     114%ifdef MODULE_8BIT_IDE_ADVANCED
    114115;;; Set XT-CF mode
    115 %ifdef MODULE_8BIT_IDE_ADVANCED
    116116    call    AH1Eh_GetCurrentXTCFmodeToAX
    117117    call    AH9h_SetModeFromALtoXTCF
    118118    STORE_ERROR_FLAG_TO_DPT     FLG_INITERROR_FAILED_TO_SET_XTCF_MODE
    119 .DoNotSetXTCFmode:
    120119%endif  ; MODULE_8BIT_IDE_ADVANCED
    121120
     
    124123    call    AH9h_Enable8bitModeForDevice8bitAta
    125124    STORE_ERROR_FLAG_TO_DPT     FLG_INITERROR_FAILED_TO_SET_8BIT_MODE
    126 .DoNotSet8bitMode:
    127125%endif ; MODULE_8BIT_IDE
    128126
     
    138136    call    Idepack_StoreNonExtParametersAndIssueCommandFromAL
    139137    STORE_ERROR_FLAG_TO_DPT     FLG_INITERROR_FAILED_TO_INITIALIZE_CHS_PARAMETERS
    140 .SkipInitializeDeviceParameters:
    141138
    142139
     
    302299    jne     SHORT IgnoreInvalidCommandError
    303300    jmp     AH23h_Enable8bitPioMode
    304 %endif
     301%endif ; MODULE_8BIT_IDE
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Tools/Prepare.asm

    r550 r558  
    4545
    4646    ; Make sure that sector count is valid
     47%ifdef USE_UNDOC_INTEL
     48    eSALC   ; Clear AL using CF (CF is cleared since JB above fell through)
     49    or      al, [es:si+DAP.wSectorCount]
     50%else
    4751    mov     al, [es:si+DAP.wSectorCount]
    4852    test    al, al
     53%endif
    4954    jz      SHORT ZeroSectorsRequestedSoNoErrors
    5055    js      SHORT InvalidNumberOfSectorsRequested
     
    6267    call    Prepare_GetOldInt13hCommandIndexToBX
    6368    mov     al, [di+DPT.bFlagsLow]
    64     shl     al, 1                   ; Set CF if LBA48 supported
     69    eSHL_IM al, 1                   ; Set CF if LBA48 supported
    6570    adc     bl, bh                  ; LBA48 EXT commands
    6671    ret
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectDrives.asm

    r545 r558  
    135135%endif
    136136
     137%ifdef MODULE_8BIT_IDE_ADVANCED
     138NoSlaveDriveAvailable:
     139%endif
    137140    ret
    138141
     
    153156;       ES:     Zero (BDA segment)
    154157;   Returns:
    155 ;       None
     158;       Nothing
    156159;   Corrupts registers:
    157160;       AX, BL, CX, DX, SI, DI
    158161;--------------------------------------------------------------------
    159162StartDetectionWithDriveSelectByteInBHandStringInCX:
    160 %ifdef MODULE_8BIT_IDE
    161     call    DetectDrives_DoesIdevarsInCSBPbelongToXTCF
    162     jne     SHORT .ShouldNotSkipSlaveDriveDetection
     163%ifdef MODULE_8BIT_IDE_ADVANCED
     164    mov     al, [cs:bp+IDEVARS.bDevice]
     165    cmp     al, DEVICE_8BIT_XTCF_PIO8
     166    jb      SHORT .DoNotSkipSlaveDriveDetection
     167    cmp     al, DEVICE_8BIT_XTCF_DMA
     168    ja      SHORT .DoNotSkipSlaveDriveDetection
    163169
    164170    ; XT-CF do not support slave drives so skip detection
    165171    test    bh, FLG_DRVNHEAD_DRV
    166172    jnz     SHORT NoSlaveDriveAvailable
    167 .ShouldNotSkipSlaveDriveDetection:
    168 %endif ; MODULE_8BIT_IDE
     173.DoNotSkipSlaveDriveDetection:
     174%endif ; MODULE_8BIT_IDE_ADVANCED
    169175
    170176    call    DetectPrint_StartDetectWithMasterOrSlaveStringInCXandIdeVarsInCSBP
    171 .DriveDetectionStringPrintedOnScreen:
     177
    172178%ifdef MODULE_HOTKEYS
    173179    call    HotkeyBar_UpdateDuringDriveDetection
     
    247253    call    DriveDetectInfo_CreateForHardDisk
    248254    jmp     SHORT DetectPrint_DriveNameFromDrvDetectInfoInESBX
    249 
    250 
    251 %ifdef MODULE_8BIT_IDE
    252 ;--------------------------------------------------------------------
    253 ; DetectDrives_DoesIdevarsInCSBPbelongToXTCF
    254 ;   Parameters:
    255 ;       CS:BP:  Ptr to IDEVARS for the drive
    256 ;   Returns:
    257 ;       ZF:     Set if IDEVARS belongs to XT-CF device
    258 ;               Cleared if some other device
    259 ;   Corrupts registers:
    260 ;       AL
    261 ;--------------------------------------------------------------------
    262 DetectDrives_DoesIdevarsInCSBPbelongToXTCF:
    263     mov     al, [cs:bp+IDEVARS.bDevice]
    264     cmp     al, DEVICE_8BIT_XTCF_PIO8
    265     je      SHORT .Done
    266     cmp     al, DEVICE_8BIT_XTCF_PIO8_WITH_BIU_OFFLOAD
    267 
    268 %ifdef MODULE_8BIT_IDE_ADVANCED
    269     je      SHORT .Done
    270     cmp     al, DEVICE_8BIT_XTCF_DMA
    271 %endif ; MODULE_8BIT_IDE_ADVANCED
    272 
    273 .Done:      ; return state via ZF, set from the cmp instructions
    274 NoSlaveDriveAvailable:
    275     ret
    276 %endif ; MODULE_8BIT_IDE
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/Initialize.asm

    r556 r558  
    3535Initialize_FromMainBiosRomSearch:       ; unused entrypoint ok
    3636    pushf                               ; To store IF
     37    sti                                 ; Enable interrupts for keystrokes
    3738    push    ds
    3839
     
    4546%endif
    4647
    47     sti                                 ; Enable interrupts for keystrokes
    4848    test    BYTE [BDA.bKBFlgs1], (1<<2) ; Clears ZF if CTRL is held down
    4949    jnz     SHORT .SkipRomInitialization
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm

    r540 r558  
    9797.InitializeHardwareIrqHandlers:
    9898    call    RamVars_GetIdeControllerCountToCX
    99     mov     di, ROMVARS.ideVars0+IDEVARS.bIRQ   ; CS:SI points to first IDEVARS
     99    mov     di, ROMVARS.ideVars0+IDEVARS.bIRQ
    100100.IdeControllerLoop:
    101101    mov     al, [cs:di]
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CompatibleDPT.asm

    r550 r558  
    139139
    140140    mov     al, [si+DPT.bLchsSectorsPerTrack]
    141 %ifdef USE_186
     141%ifndef USE_186
     142    call    StoswALandChecksumFromDL    ; Bytes 14 (Logical sectors per track) and 15 (Checksum)
     143    jmp     SHORT FillStandardDPTtoESDIfromDPTinDSSI.RestoreOffsetsAndReturn
     144%else
    142145    push    FillStandardDPTtoESDIfromDPTinDSSI.RestoreOffsetsAndReturn
    143     jmp     StoswALandChecksumFromDL    ; Bytes 14 (Logical sectors per track) and 15 (Checksum)
    144 %else
    145     call    StoswALandChecksumFromDL
    146     jmp     SHORT FillStandardDPTtoESDIfromDPTinDSSI.RestoreOffsetsAndReturn
    147 %endif
     146    ; Fall to StoswALandChecksumFromDL
     147%endif
     148
     149
     150;--------------------------------------------------------------------
     151; StoswALandChecksumFromDL
     152;   Parameters:
     153;       AL:     Last byte to store before checksum byte
     154;       DL:     Sum of bytes so far
     155;       ES:DI:  Ptr to where to store AL and Checksum byte
     156;   Returns:
     157;       DL:     Sum of bytes so far
     158;       DI:     Incremented by 2
     159;   Corrupts registers:
     160;       Nothing
     161;--------------------------------------------------------------------
     162StoswALandChecksumFromDL:
     163    mov     ah, al
     164    add     ah, dl
     165    neg     ah
     166    stosw
     167    ret
    148168
    149169
     
    226246%ifdef MODULE_ADVANCED_ATA
    227247    or      ah, [si+DPT_ADVANCED_ATA.bPioMode]
    228     jz      SHORT .NoDotSetFastPioFlag
     248    jz      SHORT .DoNotSetFastPioFlag
    229249    cmp     WORD [si+DPT_ADVANCED_ATA.wControllerID], BYTE 0
    230     je      SHORT .NoDotSetFastPioFlag
     250    je      SHORT .DoNotSetFastPioFlag
    231251    inc     cx      ; FLG_FAST_PIO_ENABLED
    232 .NoDotSetFastPioFlag:
     252.DoNotSetFastPioFlag:
    233253%endif
    234254    call    StoswThenAddALandAHtoDL         ; Bytes 8 and 9
     
    276296    ret
    277297
    278 
    279 ;--------------------------------------------------------------------
    280 ; StoswALandChecksumFromDL
    281 ;   Parameters:
    282 ;       AL:     Last byte to store before checksum byte
    283 ;       DL:     Sum of bytes so far
    284 ;       ES:DI:  Ptr to where to store AL and Checksum byte
    285 ;   Returns:
    286 ;       DL:     Sum of bytes so far
    287 ;       DI:     Incremented by 2
    288 ;   Corrupts registers:
    289 ;       Nothing
    290 ;--------------------------------------------------------------------
    291 StoswALandChecksumFromDL:
    292     mov     ah, al
    293     add     ah, dl
    294     neg     ah
    295     stosw
    296     ret
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CreateDPT.asm

    r550 r558  
    3434;       ES:     BDA Segment
    3535;   Returns:
    36 ;       DS:DI:  Ptr to Disk Parameter Table (if successful)
    37 ;       CF:     Cleared if DPT created successfully
    38 ;               Set if any error
     36;       DS:DI:  Ptr to Disk Parameter Table
     37;       CF:     Cleared
    3938;   Corrupts registers:
    4039;       AX, BX, CX, DX
     
    167166    xor     bx, bx
    168167    jmp     SHORT .StoreTotalSectorsFromBXDXAX
    169     ; Fall to .StoreNumberOfLbaSectors
     168
    170169
    171170;--------------------------------------------------------------------
     
    209208; Update drive counts (hard and floppy)
    210209;----------------------------------------------------------------------
    211 
     210%ifdef MODULE_SERIAL
     211; Device_FinalizeDPT returns with CF set only when a floppy was found which can't happen without MODULE_SERIAL
    212212%ifdef MODULE_SERIAL_FLOPPY
    213213;
     
    224224    adc     byte [RAMVARS.xlateVars+XLATEVARS.bFlopCreateCnt], 0
    225225    jnz     .AllDone
    226 %else
     226%else ; ~MODULE_SERIAL_FLOPPY
    227227;
    228228; Even without floppy support enabled, we shouldn't try to mount a floppy image as a hard disk, which
     
    231231;
    232232    jc      .AllDone
    233 %endif
     233%endif ; MODULE_SERIAL_FLOPPY
     234%endif ; MODULE_SERIAL
    234235
    235236    inc     BYTE [RAMVARS.bDrvCnt]      ; Increment drive count to RAMVARS
    236237
     238%ifdef MODULE_SERIAL
    237239.AllDone:
    238240    clc
     241%endif
     242
    239243    ret
    240244
  • trunk/XTIDE_Universal_BIOS/makefile

    r550 r558  
    189189at_large:
    190190    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT_LARGE) -l"$(TARGET)_atl.lst" -o"$(TARGET)_atl.bin"
    191     @echo *Large AT version "$(TARGET)_atl.bin" built.
     191    @echo * Large AT version "$(TARGET)_atl.bin" built.
    192192
    193193xtplus:
     
    197197xtplus_large:
    198198    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XTPLUS_LARGE) -l"$(TARGET)_xtpl.lst" -o"$(TARGET)_xtpl.bin"
    199     @echo *Large XT Plus version "$(TARGET)_xtpl.bin" built.
     199    @echo * Large XT Plus version "$(TARGET)_xtpl.bin" built.
    200200
    201201xt:
     
    205205xt_large:
    206206    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT_LARGE) -l"$(TARGET)_xtl.lst" -o"$(TARGET)_xtl.bin"
    207     @echo *Large XT version "$(TARGET)_xtl.bin" built.
     207    @echo * Large XT version "$(TARGET)_xtl.bin" built.
    208208
    209209xt_tiny:
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/EEPROM.asm

    r526 r558  
    7878EEPROM_GetXtideUniversalBiosSizeFromESDItoDXCX:
    7979    xor     dx, dx
    80     eMOVZX  cx, BYTE [es:di+ROMVARS.bRomSize]
    81     eSHL_IM cx, 9               ; *= 512 for byte count
     80    mov     ch, [es:di+ROMVARS.bRomSize]
     81    mov     cl, dl
     82    eSHL_IM ch, 1
    8283    ret
    8384
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Strings.asm

    r546 r558  
    210210g_szItemIdeEnIRQ:           db  "Enable interrupt",NULL
    211211g_szItemIdeIRQ:             db  "IRQ",NULL
    212 g_szItemIdeXTCFwindow:      db  "XT-CF v2 Sector Window",NULL
    213212g_szItemSerialCOM:          db  "COM Port",NULL
    214213g_szItemSerialBaud:         db  "Baud Rate",NULL
     
    222221g_szDlgIdeEnIRQ:            db  "Enable interrupt?",NULL
    223222g_szDlgIdeIRQ:              db  "Enter IRQ channel (2...7 for 8-bit controllers, 2...15 for any other controller).",NULL
    224 g_szDlgIdeXTCFwindow:       db  "XT-CF v2 Sector Window segment (A000h...E800h).",NULL
    225223
    226224g_szNfoIdeBackToCfgMenu:    db  "Back to XTIDE Universal BIOS Configuration Menu.",NULL
     
    232230g_szNfoIdeEnIRQ:            db  "Interrupt or polling mode.",NULL
    233231g_szNfoIdeIRQ:              db  "IRQ channel to use.",NULL
    234 g_szNfoIdeXTCFwindow:       db  "Segment Address for XT-CF v2 4 kiB Sector Access Window.",NULL
    235232g_szNfoIdeSerialCOM:        db  "Select a COM port by number.",NULL
    236233g_szNfoIdeSerialBaud:       db  "Select the COM port's Baud Rate. The server must match this speed."
     
    285282                            db  "Serial port virtual device",NULL
    286283
    287 g_szValueCfgDevice16b:      db  "16-bit",NULL
    288 g_szValueCfgDevice32b:      db  "32-bit",NULL
    289 g_szValueCfgDevice8b:       db  "8-bit",NULL
    290 g_szValueCfgDeviceRev1:     db  "XTIDE r1",NULL
    291 g_szValueCfgDeviceRev2:     db  "XTIDE r2",NULL
    292 g_szValueCfgDeviceXTCFPio8: db  "XTCF PIO",NULL
     284g_szValueCfgDevice16b:                      db  "16-bit",NULL
     285g_szValueCfgDevice32b:                      db  "32-bit",NULL
     286g_szValueCfgDevice8b:                       db  "8-bit",NULL
     287g_szValueCfgDeviceRev1:                     db  "XTIDE r1",NULL
     288g_szValueCfgDeviceRev2:                     db  "XTIDE r2",NULL
     289g_szValueCfgDeviceXTCFPio8:                 db  "XTCF PIO",NULL
    293290g_szValueCfgDeviceXTCFPio8WithBIUOffload:   db  "XTCF BIU",NULL
    294 g_szValueCfgDeviceXTCFDMA:  db  "XTCF DMA",NULL
    295 g_szValueCfgDeviceJrIdeIsa: db  "JR-ISA",NULL
    296 g_szValueCfgDeviceADP50L:   db  "ADP50L",NULL
    297 g_szValueCfgDeviceSerial:   db  "Serial",NULL
     291g_szValueCfgDeviceXTCFDMA:                  db  "XTCF DMA",NULL
     292g_szValueCfgDeviceJrIdeIsa:                 db  "JR-ISA",NULL
     293g_szValueCfgDeviceADP50L:                   db  "ADP50L",NULL
     294g_szValueCfgDeviceSerial:                   db  "Serial",NULL
    298295
    299296g_szSerialCOMChoice:    db  "COM1 - address 3F8h",LF
Note: See TracChangeset for help on using the changeset viewer.