Changeset 589 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS


Ignore:
Timestamp:
May 22, 2016, 12:26:57 PM (9 years ago)
Author:
Krister Nordvall
Message:

Changes:

  • BIOS: Fixed a purely cosmetic bug from r542 where, in builds containing MODULE_EBIOS, the boot menu would display an incorrect drive size (0.4 kB with MODULE_STRINGS_COMPRESSED or 0.5 kB without) for old drives with no support for LBA.
  • Fixed a bug from r392 where Vision_DetectAndReturnIDinAXandPortInDXifControllerPresent would return the ID in AL instead of AH (if DANGEROUS_DETECTION had been defined).
  • Fixed a bug from r587 in AdvAtaInit.asm that would prevent detection of QDI Vision controllers.
  • Also changed how the QDI Vision IDs are defined (removed the need for shifting) to avoid confusion. This fixed a potential bug from r587 in AdvAtaInit.asm where some IDs were not being shifted.
  • Fixed a bug in PDC20x30.asm from r587 where GetPdcIDtoAX would not return with the IDE base port in DX so DisablePdcProgrammingMode would fail.
  • Made some changes to ModuleDependency.inc and other files so that MODULE_ADVANCED_ATA now requires USE_386. Consequently it is no longer included in the regular AT-builds, only in the 386_8k-build.
  • Moved the UNROLL_SECTORS_IN_CX_TO_xWORDS macros from IDE_8bit.inc to IdeIO.inc which means it's now possible to build a BIOS without MODULE_8BIT_IDE.
  • XTIDECFG: Added a minimum DOS version check (since it needs DOS version 2+) to allow the program to quit gracefully in the unlikely scenario where someone tries to run it under DOS version 1.
  • Made some changes to Drive.asm to improve drive enumeration. The old method using GET_DOS_DRIVE_PARAMETER_BLOCK_FOR_SPECIFIC_DRIVE worked well in Windows XP but not in Windows 98 SE (in Windows or in DOS mode). The two problems were; 1) The function call would access the drives which on single floppy drive systems would cause Windows to swap between A: and B: (throwing a blue screen asking the user to insert a disk etc). 2) Only floppy drives and FAT16 drives would be available in the list of drives, no FAT32/optical/network drives.
  • Improved code in IdeControllerMenu.asm so that the default port addresses for all IDE interfaces are now restored when (re-)selecting the (same) type of IDE device.
  • Also made it impossible to select a device type unless the required module is included in the loaded BIOS.
  • The version check done when loading a BIOS now uses the FLASH_SIGNATURE definition from Version.inc. Any changes affecting RomVars now only requires updating that definition. This means that changes to RomVars must be implemented in both the BIOS and XTIDECFG before being committed to the repository.
  • Added a compatibility fix for 3Com 3C503 cards to the ROM checksumming code in Buffers.asm (Buffers_GenerateChecksum).
  • SerDrive: Made some minor changes to file names and paths to improve compatibility with case sensitive environments.
  • BIOSDRVS: Made a minor size optimization which as a side effect also makes it compatible with all DOS versions including DOS version 1.
  • Library: Renamed the WAIT_RETRACE_IF_NECESSARY_THEN macro to CALL_WAIT_FOR_RETRACE_IF_NECESSARY_THEN and made a tail-call-optimized version of it (JMP_WAIT_FOR_RETRACE_IF_NECESSARY_THEN).
  • A speed optimization to the eRCL_IM macro for 386 and higher. This change breaks emulation in the sense that the macro will fail when given a memory operand as the first parameter.
  • Other minor optimizations and fixes.
Location:
trunk/XTIDE_Universal_BIOS
Files:
34 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Inc/BootVars.inc

    r545 r589  
    4141    .dwPostStack        resb    4       ; POST stack pointer when entering INT 19h
    4242%ifdef MODULE_HOTKEYS
    43     .hotkeyVars             resb    HOTKEYVARS_size
     43    .hotkeyVars         resb    HOTKEYVARS_size
    4444%endif
    4545    .rgDrvDetectInfo:                   ; Array containing DRVDETECTINFO structs
  • trunk/XTIDE_Universal_BIOS/Inc/Controllers/AdvancedID.inc

    r588 r589  
    3232; Vision
    3333; QDI Vision Controller Identification nibbles used by hardware so do not modify these
    34 ID_QD6580_ALTERNATE         EQU     5
    35 ID_QD6580                   EQU     10
    36 ID_QD6500                   EQU     12
     34ID_QD6580_ALTERNATE         EQU     80
     35ID_QD6580                   EQU     160
     36ID_QD6500                   EQU     192
    3737
    3838
  • trunk/XTIDE_Universal_BIOS/Inc/Controllers/PDC20x30.inc

    r587 r589  
    22; Description   :   Promise PDC 20230-C and 20630 VLB IDE controller
    33;                   specifications.
    4 ;
    5 ;                   Specifications can be found at
    64
    75;
  • trunk/XTIDE_Universal_BIOS/Inc/Controllers/XTCF.inc

    r588 r589  
    5656; the mode via a call to Int 13h function 1Eh accordingly (see AH1Eh_XTCF.asm).
    5757;
    58 XTCF_8BIT_PIO_MODE                  EQU     0   ; XT-CF using 8-bit PIO mode
    59 XTCF_8BIT_PIO_MODE_WITH_BIU_OFFLOAD EQU     1   ; XT-CF using 8-bit PIO mode, but with 16-bit instructions
    60 XTCF_16BIT_PIO_WITH_BIU_OFFLOAD     EQU     2   ; Lo-tech 8-bit IDE Adapter
    61 XTCF_DMA_MODE                       EQU     3   ; XT-CFv3 using DMA
     58XTCF_8BIT_PIO_MODE                      EQU     0   ; XT-CF using 8-bit PIO mode
     59XTCF_8BIT_PIO_MODE_WITH_BIU_OFFLOAD     EQU     1   ; XT-CF using 8-bit PIO mode, but with 16-bit instructions
     60XTCF_16BIT_PIO_MODE_WITH_BIU_OFFLOAD    EQU     2   ; Lo-tech 8-bit IDE Adapter
     61XTCF_DMA_MODE                           EQU     3   ; XT-CFv3 using DMA
    6262
    6363
  • trunk/XTIDE_Universal_BIOS/Inc/CustomDPT.inc

    r584 r589  
    8484
    8585
    86     ; Flags for DPT_ADVANCED_ATA.bInitError
     86    ; Flags for DPT.bInitError
    8787    FLG_INITERROR_FAILED_TO_SELECT_DRIVE                EQU (1<<0)
    8888    FLG_INITERROR_FAILED_TO_INITIALIZE_CHS_PARAMETERS   EQU (1<<1)
  • trunk/XTIDE_Universal_BIOS/Inc/IDE_8bit.inc

    r526 r589  
    2121%ifndef IDE_8BIT_INC
    2222%define IDE_8BIT_INC
    23 
    24 ;--------------------------------------------------------------------
    25 ; UNROLL_SECTORS_IN_CX_TO_DWORDS
    26 ; UNROLL_SECTORS_IN_CX_TO_QWORDS
    27 ; UNROLL_SECTORS_IN_CX_TO_OWORDS
    28 ;   Parameters:
    29 ;       CX:     Number of sectors in block
    30 ;   Returns:
    31 ;       CX:     Number of DWORDs, QWORDs or OWORDs in block
    32 ;   Corrupts registers:
    33 ;       Nothing
    34 ;--------------------------------------------------------------------
    35 %macro UNROLL_SECTORS_IN_CX_TO_DWORDS 0
    36 %ifdef USE_186
    37     shl     cx, 7
    38 %else
    39     xchg    cl, ch      ; Sectors to WORDs (SHL CX, 8)
    40     shr     cx, 1
    41 %endif
    42 %endmacro
    43 
    44 %macro UNROLL_SECTORS_IN_CX_TO_QWORDS 0
    45 %ifdef USE_186
    46     shl     cx, 6
    47 %else
    48     UNROLL_SECTORS_IN_CX_TO_DWORDS
    49     shr     cx, 1
    50 %endif
    51 %endmacro
    52 
    53 %macro UNROLL_SECTORS_IN_CX_TO_OWORDS 0
    54 %ifdef USE_186
    55     shl     cx, 5
    56 %else
    57 ;   UNROLL_SECTORS_IN_CX_TO_QWORDS
    58 ;   shr     cx, 1
    59     mov     ch, cl      ; 2 bytes shorter but possibly slower
    60     mov     cl, 3
    61     shr     cx, cl
    62 %endif
    63 %endmacro
    64 
    6523
    6624;--------------------------------------------------------------------
  • trunk/XTIDE_Universal_BIOS/Inc/IdeIO.inc

    r526 r589  
    105105
    106106
     107;--------------------------------------------------------------------
     108; UNROLL_SECTORS_IN_CX_TO_DWORDS
     109; UNROLL_SECTORS_IN_CX_TO_QWORDS
     110; UNROLL_SECTORS_IN_CX_TO_OWORDS
     111;   Parameters:
     112;       CX:     Number of sectors in block
     113;   Returns:
     114;       CX:     Number of DWORDs, QWORDs or OWORDs in block
     115;   Corrupts registers:
     116;       Nothing
     117;--------------------------------------------------------------------
     118%macro UNROLL_SECTORS_IN_CX_TO_DWORDS 0
     119%ifdef USE_186
     120    shl     cx, 7
     121%else
     122    xchg    cl, ch      ; Sectors to WORDs (SHL CX, 8)
     123    shr     cx, 1
     124%endif
     125%endmacro
     126
     127%macro UNROLL_SECTORS_IN_CX_TO_QWORDS 0
     128%ifdef USE_186
     129    shl     cx, 6
     130%else
     131    UNROLL_SECTORS_IN_CX_TO_DWORDS
     132    shr     cx, 1
     133%endif
     134%endmacro
     135
     136%macro UNROLL_SECTORS_IN_CX_TO_OWORDS 0
     137%ifdef USE_186
     138    shl     cx, 5
     139%else
     140;   UNROLL_SECTORS_IN_CX_TO_QWORDS
     141;   shr     cx, 1
     142    mov     ch, cl      ; 2 bytes shorter but possibly slower
     143    mov     cl, 3
     144    shr     cx, cl
     145%endif
     146%endmacro
     147
     148
    107149%endif ; IDE_IO_INC
  • trunk/XTIDE_Universal_BIOS/Inc/ModuleDependency.inc

    r587 r589  
    2626%endif
    2727
    28 
    2928%ifdef MODULE_SERIAL_FLOPPY
    3029    %ifndef MODULE_SERIAL
     
    4140%endif
    4241
    43 ; Include module specific .INC files
    4442%ifdef MODULE_8BIT_IDE
    4543    %include "IDE_8bit.inc"         ; For IDE 8-bit data port macros
     
    4745
    4846%ifdef MODULE_ADVANCED_ATA
     47    %ifndef USE_386
     48        %error "MODULE_ADVANCED_ATA requires USE_386!"
     49    %endif
    4950    %include "AdvancedID.inc"
    5051    %include "PDC20x30.inc"         ; For Promise PDC 20230-C and 20630 controllers
     
    7980; Included modules for ROMVARS.wFlags
    8081%ifdef MODULE_8BIT_IDE
    81     MAIN_FLG_MODULE_8BIT_IDE    EQU FLG_ROMVARS_MODULE_8BIT_IDE
     82    MAIN_FLG_MODULE_8BIT_IDE            EQU FLG_ROMVARS_MODULE_8BIT_IDE
    8283%else
    83     MAIN_FLG_MODULE_8BIT_IDE    EQU 0
     84    MAIN_FLG_MODULE_8BIT_IDE            EQU 0
    8485%endif
    8586
    8687%ifdef MODULE_ADVANCED_ATA
    87     MAIN_FLG_MODULE_ADVANCED_ATA    EQU FLG_ROMVARS_MODULE_ADVANCED_ATA
     88    MAIN_FLG_MODULE_ADVANCED_ATA        EQU FLG_ROMVARS_MODULE_ADVANCED_ATA
    8889%else
    89     MAIN_FLG_MODULE_ADVANCED_ATA    EQU 0
     90    MAIN_FLG_MODULE_ADVANCED_ATA        EQU 0
    9091%endif
    9192
    9293%ifdef MODULE_BOOT_MENU
    93     MAIN_FLG_MODULE_BOOT_MENU   EQU FLG_ROMVARS_MODULE_BOOT_MENU
     94    MAIN_FLG_MODULE_BOOT_MENU           EQU FLG_ROMVARS_MODULE_BOOT_MENU
    9495%else
    95     MAIN_FLG_MODULE_BOOT_MENU   EQU 0
     96    MAIN_FLG_MODULE_BOOT_MENU           EQU 0
    9697%endif
    9798
    9899%ifdef MODULE_EBIOS
    99     MAIN_FLG_MODULE_EBIOS   EQU FLG_ROMVARS_MODULE_EBIOS
     100    MAIN_FLG_MODULE_EBIOS               EQU FLG_ROMVARS_MODULE_EBIOS
    100101%else
    101     MAIN_FLG_MODULE_EBIOS   EQU 0
     102    MAIN_FLG_MODULE_EBIOS               EQU 0
    102103%endif
    103104
    104105%ifdef MODULE_HOTKEYS
    105     MAIN_FLG_MODULE_HOTKEYS EQU FLG_ROMVARS_MODULE_HOTKEYS
     106    MAIN_FLG_MODULE_HOTKEYS             EQU FLG_ROMVARS_MODULE_HOTKEYS
    106107%else
    107     MAIN_FLG_MODULE_HOTKEYS EQU 0
     108    MAIN_FLG_MODULE_HOTKEYS             EQU 0
    108109%endif
    109110
    110111%ifdef MODULE_IRQ
    111     MAIN_FLG_MODULE_IRQ     EQU FLG_ROMVARS_MODULE_IRQ
     112    MAIN_FLG_MODULE_IRQ                 EQU FLG_ROMVARS_MODULE_IRQ
    112113%else
    113     MAIN_FLG_MODULE_IRQ     EQU 0
     114    MAIN_FLG_MODULE_IRQ                 EQU 0
    114115%endif
    115116
    116117%ifdef MODULE_SERIAL
    117     MAIN_FLG_MODULE_SERIAL  EQU FLG_ROMVARS_MODULE_SERIAL
     118    MAIN_FLG_MODULE_SERIAL              EQU FLG_ROMVARS_MODULE_SERIAL
    118119%else
    119     MAIN_FLG_MODULE_SERIAL  EQU 0
     120    MAIN_FLG_MODULE_SERIAL              EQU 0
    120121%endif
    121122
    122123%ifdef MODULE_SERIAL_FLOPPY
    123     MAIN_FLG_MODULE_SERIAL_FLOPPY   EQU FLG_ROMVARS_MODULE_SERIAL_FLOPPY
     124    MAIN_FLG_MODULE_SERIAL_FLOPPY       EQU FLG_ROMVARS_MODULE_SERIAL_FLOPPY
    124125%else
    125     MAIN_FLG_MODULE_SERIAL_FLOPPY   EQU 0
     126    MAIN_FLG_MODULE_SERIAL_FLOPPY       EQU 0
    126127%endif
    127128
     
    145146
    146147MASK_ROMVARS_INCLUDED_MODULES   EQU MAIN_FLG_MODULE_8BIT_IDE | MAIN_FLG_MODULE_ADVANCED_ATA | MAIN_FLG_MODULE_BOOT_MENU | MAIN_FLG_MODULE_EBIOS | MAIN_FLG_MODULE_HOTKEYS | MAIN_FLG_MODULE_IRQ | MAIN_FLG_MODULE_SERIAL | MAIN_FLG_MODULE_SERIAL_FLOPPY | MAIN_FLG_MODULE_STRINGS_COMPRESSED | MAIN_FLG_MODULE_POWER_MANAGEMENT | MAIN_FLG_MODULE_8BIT_IDE_ADVANCED
    147 
  • trunk/XTIDE_Universal_BIOS/Inc/RamVars.inc

    r555 r589  
    132132%endif
    133133
     134                            alignb  2   ; Keep the INTPACK structure and stack pointer WORD aligned
     135
    134136    .intpack                resb    INTPACK_size
    135137endstruc
  • trunk/XTIDE_Universal_BIOS/Inc/RomVars.inc

    r588 r589  
    7171                                                ; (Conveniently, this is 8, a fact we exploit when testing the bit)
    7272
    73 ; Here in case the configuration needs to know functionality is present
     73; Here in case the configuration needs to know functionality is present. Note! Changing the order/location of these flags
     74; also requires changes elsewhere as they are usually tested using byte-accesses for efficiency.
    7475FLG_ROMVARS_MODULE_POWER_MANAGEMENT     EQU (1<<5)
    7576FLG_ROMVARS_MODULE_8BIT_IDE             EQU (1<<6)
     
    146147; Device types for IDEVARS.bDevice
    147148; IDE Devices are grouped so device numbers cannot be changed without modifying code elsewhere!
    148 ; (IdeTransfer.asm)
    149149COUNT_OF_STANDARD_IDE_DEVICES           EQU 2   ; 16- and 32-bit controllers
    150150COUNT_OF_8BIT_IDE_DEVICES               EQU 9
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm

    r584 r589  
    3333IdeCommand_ResetMasterAndSlaveController:
    3434    ; HSR0: Set_SRST
    35     call    AccessDPT_GetDeviceControlByteToAL
    36     or      al, FLG_DEVCONTROL_SRST | FLG_DEVCONTROL_nIEN   ; Set Reset bit
     35; Used to be:
     36;   call    AccessDPT_GetDeviceControlByteToAL
     37;   or      al, FLG_DEVCONTROL_SRST | FLG_DEVCONTROL_nIEN   ; Set Reset bit
     38; Is now:
     39    mov     al, FLG_DEVCONTROL_SRST | FLG_DEVCONTROL_nIEN
     40; ---
    3741    OUTPUT_AL_TO_IDE_CONTROL_BLOCK_REGISTER     DEVICE_CONTROL_REGISTER_out
    3842    mov     ax, HSR0_RESET_WAIT_US
     
    4044
    4145    ; HSR1: Clear_wait
    42     call    AccessDPT_GetDeviceControlByteToAL
    43     or      al, FLG_DEVCONTROL_nIEN
    44     and     al, ~FLG_DEVCONTROL_SRST                        ; Clear reset bit
     46; Used to be:
     47;   call    AccessDPT_GetDeviceControlByteToAL
     48;   or      al, FLG_DEVCONTROL_nIEN
     49;   and     al, ~FLG_DEVCONTROL_SRST                        ; Clear reset bit
     50; Is now:
     51    mov     al, FLG_DEVCONTROL_nIEN
     52; ---
    4553    OUTPUT_AL_TO_IDE_CONTROL_BLOCK_REGISTER     DEVICE_CONTROL_REGISTER_out
    4654    mov     ax, HSR1_RESET_WAIT_US
     
    5159    jmp     IdeWait_PollStatusFlagInBLwithTimeoutInBH
    5260
     61; *FIXME* AccessDPT_GetDeviceControlByteToAL currently always returns with
     62; AL cleared (0) or with only bit 1 set (FLG_DEVCONTROL_nIEN = 2).
     63; The commented away instructions above sets FLG_DEVCONTROL_nIEN anyway
     64; making the call to AccessDPT_GetDeviceControlByteToAL redundant.
     65; I have left this code as is since I don't know if it's a mistake
     66; (from all the way back to r150) or if it's coded this way in anticipation
     67; of some future changes to AccessDPT_GetDeviceControlByteToAL.
    5368
    5469;--------------------------------------------------------------------
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeDmaBlock.asm

    r567 r589  
    9494    ; When DI is zero only one transfer is required since we've limited the
    9595    ; XT-CFv3 block size to 32k
    96     jnc     SHORT .TransferLastDmaPageWithSizeInCX
     96    jnc     SHORT StartDMAtransferForXTCFwithDmaModeInBL
    9797
    9898    ; CF was set, so DI != 0 and we might need one or two transfers
    99     cmp     cx, ax                                  ; if we won't cross a physical page boundary...
    100     jbe     SHORT .TransferLastDmaPageWithSizeInCX  ; ...perform the transfer in one operation
     99    cmp     cx, ax                                          ; if we won't cross a physical page boundary...
     100    jbe     SHORT StartDMAtransferForXTCFwithDmaModeInBL    ; ...perform the transfer in one operation
    101101
    102102    ; Calculate how much we can transfer on first and second rounds
     
    108108    call    StartDMAtransferForXTCFwithDmaModeInBL
    109109    pop     cx                                      ; Pop size for second DMA page
    110 
    111 .TransferLastDmaPageWithSizeInCX:
    112110    ; Fall to StartDMAtransferForXTCFwithDmaModeInBL
    113111
     
    115113;--------------------------------------------------------------------
    116114; StartDMAtransferForXTCFwithDmaModeInBL
    117 ; Updated for XT-CFv3, 11-Apr-13
    118115;   Parameters:
    119116;       BL:     Byte for DMA Mode Register
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdePioBlock.asm

    r580 r589  
    2929; --------------------------------------------------------------------------------------------------
    3030
    31 
    3231%ifdef MODULE_8BIT_IDE
    33 
    3432;--------------------------------------------------------------------
    3533; IdePioBlock_ReadFromXtideRev1
     
    5755
    5856;--------------------------------------------------------------------
     57; 8-bit PIO from a single data port.
     58;
    5959; IdePioBlock_ReadFrom8bitDataPort
    60 ;
    61 ; 8-bit PIO from a single data port.
    62 ;
    6360;   Parameters:
    6461;       CX:     Block size in 512 byte sectors
     
    6865;       Nothing
    6966;   Corrupts registers:
    70 ;       AX, BX, CX
     67;       AX, CX
    7168;--------------------------------------------------------------------
    7269ALIGN JUMP_ALIGN
     
    8784    ret
    8885%endif
    89 
    90 %endif  ; MODULE_8BIT_IDE
    91 
    92 
    93 ;--------------------------------------------------------------------
     86%endif ; MODULE_8BIT_IDE
     87
     88
     89;--------------------------------------------------------------------
     90; 16-bit and 32-bit PIO from a single data port.
     91;
    9492; IdePioBlock_ReadFrom16bitDataPort
    95 ;
    96 ; 16-bit PIO from a single data port.
    97 ;
     93; IdePioBlock_ReadFrom32bitDataPort
    9894;   Parameters:
    9995;       CX:     Block size in 512 byte sectors
     
    10399;       Nothing
    104100;   Corrupts registers:
    105 ;       AX, BX, CX
     101;       AX, CX
    106102;--------------------------------------------------------------------
    107103ALIGN JUMP_ALIGN
    108104IdePioBlock_ReadFrom16bitDataPort:
    109105%ifdef USE_186
    110     xchg    cl, ch  ; Sectors to WORDs
     106    xchg    cl, ch      ; Sectors to WORDs
    111107    rep insw
    112108    ret
     
    126122
    127123;--------------------------------------------------------------------
     124%ifdef MODULE_ADVANCED_ATA
    128125ALIGN JUMP_ALIGN
    129126IdePioBlock_ReadFrom32bitDataPort:
    130     db      0C1h        ; SHL
    131     db      0E1h        ; CX
    132     db      7           ; 7 (Sectors to DWORDs)
    133     rep
    134     db      66h         ; Override operand size to 32-bit
    135     db      6Dh         ; INSW/INSD
    136     ret
    137 
     127    shl     cx, 7       ; Sectors to DWORDs
     128    rep insd
     129    ret
     130%endif ; MODULE_ADVANCED_ATA
    138131
    139132
     
    145138
    146139%ifdef MODULE_8BIT_IDE
    147 
    148140;--------------------------------------------------------------------
    149141; IdePioBlock_WriteToXtideRev1
     
    151143;       CX:     Block size in 512-byte sectors
    152144;       DX:     IDE Data port address
    153 ;       ES:SI:  Normalized ptr to buffer containing data
     145;       DS:SI:  Normalized ptr to buffer containing data
    154146;   Returns:
    155147;       Nothing
     
    159151ALIGN JUMP_ALIGN
    160152IdePioBlock_WriteToXtideRev1:
    161     push    ds
    162153    UNROLL_SECTORS_IN_CX_TO_QWORDS
    163154    mov     bl, 8       ; Bit mask for toggling data low/high reg
    164     push    es
    165     pop     ds
    166155ALIGN JUMP_ALIGN
    167156.OutswLoop:
     
    170159    %endrep
    171160    loop    .OutswLoop
    172     pop     ds
    173161    ret
    174162
     
    179167;       CX:     Block size in 512-byte sectors
    180168;       DX:     IDE Data port address
    181 ;       ES:SI:  Normalized ptr to buffer containing data
    182 ;   Returns:
    183 ;       Nothing
    184 ;   Corrupts registers:
    185 ;       AX, BX, CX
     169;       DS:SI:  Normalized ptr to buffer containing data
     170;   Returns:
     171;       Nothing
     172;   Corrupts registers:
     173;       AX, CX
    186174;--------------------------------------------------------------------
    187175ALIGN JUMP_ALIGN
    188176IdePioBlock_WriteToXtideRev2:
    189177    UNROLL_SECTORS_IN_CX_TO_QWORDS
    190     push    ds
    191     push    es
    192     pop     ds
    193178ALIGN JUMP_ALIGN
    194179.WriteNextQword:
     
    197182    %endrep
    198183    loop    .WriteNextQword
    199     pop     ds
    200184    ret
    201185
     
    206190;       CX:     Block size in 512-byte sectors
    207191;       DX:     IDE Data port address
    208 ;       ES:SI:  Normalized ptr to buffer containing data
    209 ;   Returns:
    210 ;       Nothing
    211 ;   Corrupts registers:
    212 ;       AX, BX, CX
     192;       DS:SI:  Normalized ptr to buffer containing data
     193;   Returns:
     194;       Nothing
     195;   Corrupts registers:
     196;       AX, CX
    213197;--------------------------------------------------------------------
    214198ALIGN JUMP_ALIGN
     
    216200%ifdef USE_186
    217201    shl     cx, 9       ; Sectors to BYTEs
    218     es                  ; Source is ES segment
    219202    rep outsb
    220203    ret
     
    222205%else ; 808x
    223206    UNROLL_SECTORS_IN_CX_TO_QWORDS
    224     push    ds
    225     push    es
    226     pop     ds
    227207ALIGN JUMP_ALIGN
    228208.WriteNextQword:
     
    232212    %endrep
    233213    loop    .WriteNextQword
    234     pop     ds
    235     ret
    236 %endif
    237 
     214    ret
     215%endif
    238216%endif ; MODULE_8BIT_IDE
    239217
     
    245223;       CX:     Block size in 512-byte sectors
    246224;       DX:     IDE Data port address
    247 ;       ES:SI:  Normalized ptr to buffer containing data
    248 ;   Returns:
    249 ;       Nothing
    250 ;   Corrupts registers:
    251 ;       AX, BX, CX
     225;       DS:SI:  Normalized ptr to buffer containing data
     226;   Returns:
     227;       Nothing
     228;   Corrupts registers:
     229;       AX, CX
    252230;--------------------------------------------------------------------
    253231ALIGN JUMP_ALIGN
     
    255233%ifdef USE_186
    256234    xchg    cl, ch      ; Sectors to WORDs
    257     es                  ; Source is ES segment
    258235    rep outsw
    259236    ret
     
    261238%else ; 808x
    262239    UNROLL_SECTORS_IN_CX_TO_QWORDS
    263     push    ds
    264     push    es
    265     pop     ds
    266240ALIGN JUMP_ALIGN
    267241.WriteNextQword:
     
    271245    %endrep
    272246    loop    .WriteNextQword
    273     pop     ds
    274     ret
    275 %endif
    276 
    277 ;--------------------------------------------------------------------
     247    ret
     248%endif
     249
     250;--------------------------------------------------------------------
     251%ifdef MODULE_ADVANCED_ATA
    278252ALIGN JUMP_ALIGN
    279253IdePioBlock_WriteTo32bitDataPort:
    280     db      0C1h        ; SHL
    281     db      0E1h        ; CX
    282     db      7           ; 7 (Sectors to DWORDs)
    283     es                  ; Source is ES segment
    284     rep
    285     db      66h         ; Override operand size to 32-bit
    286     db      6Fh         ; OUTSW/OUTSD
    287     ret
     254    shl     cx, 7       ; Sectors to DWORDs
     255    rep outsd
     256    ret
     257%endif ; MODULE_ADVANCED_ATA
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm

    r584 r589  
    173173    cmp     [bp+PIOVARS.bSectorsLeft], cl
    174174    jbe     SHORT .WriteLastBlockToDrive
     175    push    ds
     176    push    es
     177    pop     ds
    175178    call    [bp+PIOVARS.fnXfer]
    176 
     179    pop     ds
    177180    ; Wait until ready for next block and check for errors
    178181    call    IdeWait_IRQorDRQ                    ; Wait until ready to transfer
     
    189192    mov     cl, [bp+PIOVARS.bSectorsLeft]       ; CH is already zero
    190193    push    cx
     194    push    ds
     195    push    es
     196    pop     ds
    191197    call    [bp+PIOVARS.fnXfer]                 ; Transfer possibly partial block
     198    pop     ds
    192199    jmp     SHORT CheckErrorsAfterTransferringLastBlock
    193200
     
    237244    ; Convert ES:SI to physical address
    238245%ifdef USE_386
    239 
    240246    mov     dx, es
    241247    xor     ax, ax
     
    247253
    248254%elifdef USE_186
    249                         ; Bytes EU Cycles(286)
    250     mov     ax, es      ; 2     2
    251     rol     ax, 4       ; 3     9
    252     mov     dx, ax      ; 2     2
    253     and     ax, BYTE 0Fh; 3     3
    254     xor     dx, ax      ; 2     2
    255     add     si, dx      ; 2     2
    256     adc     al, ah      ; 2     2
    257     mov     es, ax      ; 2     2
    258     ;------------------------------------
    259                         ; 18    24
     255    mov     ax, es
     256    rol     ax, 4
     257    mov     dx, ax
     258    and     ax, 0Fh
     259    xor     dx, ax
     260    add     si, dx
     261    adc     al, ah
     262    mov     es, ax
     263
    260264%else ; 808x
    261                         ; Bytes EU Cycles(808x)
    262     mov     al, 4       ; 2     4
    263     mov     dx, es      ; 2     2
    264     xchg    cx, ax      ; 1     3
    265     rol     dx, cl      ; 2     24
    266     mov     cx, dx      ; 2     2
    267     xchg    cx, ax      ; 1     3
    268     and     ax, BYTE 0Fh; 3     4
    269     xor     dx, ax      ; 2     3
    270     add     si, dx      ; 2     3
    271     adc     al, ah      ; 2     3
    272     mov     es, ax      ; 2     2
    273     ;------------------------------------
    274                         ; 21    53
    275 ;
    276 ; Judging by the Execution Unit cycle count the above block of code is
    277 ; apparently slower. However, the shifts and rotates in the block below
    278 ; execute faster than the Bus Interface Unit on an 8088 can fetch them,
    279 ; thus causing the EU to starve. The difference in true execution speed
    280 ; (if any) might not be worth the extra 5 bytes.
    281 ; In other words, we could use a real world test here.
    282 ;
    283 %if 0
    284                         ; Bytes EU Cycles(808x/286)
    285     xor     dx, dx      ; 2     3/2
    286     mov     ax, es      ; 2     2/2
    287 %rep 4
    288     shl     ax, 1       ; 8     8/8
    289     rcl     dx, 1       ; 8     8/8
    290 %endrep
    291     add     si, ax      ; 2     3/2
    292     adc     dl, dh      ; 2     3/2
    293     mov     es, dx      ; 2     2/2
    294     ;------------------------------------
    295                         ; 26    29/26
    296 %endif ; 0
     265    mov     al, 4
     266    mov     dx, es
     267    xchg    cx, ax
     268    rol     dx, cl
     269    mov     cx, dx
     270    xchg    cx, ax
     271    and     ax, 0Fh
     272    xor     dx, ax
     273    add     si, dx
     274    adc     al, ah
     275    mov     es, ax
     276
    297277%endif
    298278
     
    334314%ifdef USE_AT       ; CF is always clear for XT builds
    335315    ; AH = RET_HD_INVALID (01) if CF set, RET_HD_SUCCESS (00) if not. CF unchanged.
     316%ifdef USE_386
     317    setc    ah
     318%else
    336319    sbb     ah, ah
    337320    neg     ah
    338321%endif
     322%endif ; USE_AT
    339323    ret
    340324
     
    345329g_rgfnPioRead:
    346330        dw      IdePioBlock_ReadFrom16bitDataPort   ; 0, DEVICE_16BIT_ATA
     331%ifdef MODULE_ADVANCED_ATA
    347332        dw      IdePioBlock_ReadFrom32bitDataPort   ; 1, DEVICE_32BIT_ATA
     333%elifdef MODULE_8BIT_IDE
     334        dw      NULL
     335%endif ; MODULE_ADVANCED_ATA
    348336%ifdef MODULE_8BIT_IDE
    349337        dw      IdePioBlock_ReadFrom8bitDataPort    ; 2, DEVICE_8BIT_ATA
     
    361349g_rgfnPioWrite:
    362350        dw      IdePioBlock_WriteTo16bitDataPort    ; 0, DEVICE_16BIT_ATA
     351%ifdef MODULE_ADVANCED_ATA
    363352        dw      IdePioBlock_WriteTo32bitDataPort    ; 1, DEVICE_32BIT_ATA
     353%elifdef MODULE_8BIT_IDE
     354        dw      NULL
     355%endif ; MODULE_ADVANCED_ATA
    364356%ifdef MODULE_8BIT_IDE
    365357        dw      IdePioBlock_WriteTo8bitDataPort     ; 2, DEVICE_8BIT_ATA
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h.asm

    r568 r589  
    9898%endif
    9999    cld                                 ; String instructions to increment pointers
    100     CREATE_FRAME_INTPACK_TO_SSBP    SIZE_OF_IDEPACK_WITHOUT_INTPACK
     100    ePUSHA
     101    push    ds
     102    push    es
     103%ifdef USE_386
     104;   push    fs
     105;   push    gs
     106%endif
     107    sub     sp, BYTE SIZE_OF_IDEPACK_WITHOUT_INTPACK
     108    mov     bp, sp
    101109    call    RamVars_GetSegmentToDS
    102110
     
    297305    ; on INT 13h to enable interrupts.
    298306    or      BYTE [bp+IDEPACK.intpack+INTPACK.flags+1], (FLG_FLAGS_IF>>8)
    299     mov     sp, bp  ; This makes possible to exit anytime, no matter what is on stack
    300     RESTORE_FRAME_INTPACK_FROM_SSBP     SIZE_OF_IDEPACK_WITHOUT_INTPACK
     307
     308    lea     sp, [bp+SIZE_OF_IDEPACK_WITHOUT_INTPACK]
     309%ifdef USE_386
     310;   pop     gs
     311;   pop     fs
     312%endif
     313    pop     es
     314    pop     ds
     315    ePOPA
     316    iret
    301317
    302318
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH1Eh_XTCF.asm

    r588 r589  
    152152
    153153
    154 %if 0
    155     ; We always need to enable 8-bit mode since 16-bit mode is restored
    156     ; when controller is reset (AH=00h or 0Dh)
    157     ePUSH_T bx, AH23h_Enable8bitPioMode
    158 
    159     ; Convert mode to device type (see XTCF.inc for full details)
    160     and     ax, 3
    161     jz      SHORT .Set8bitPioMode   ; XTCF_8BIT_PIO_MODE = 0
    162     dec     ax                      ; XTCF_8BIT_PIO_MODE_WITH_BIU_OFFLOAD = 1
    163     jz      SHORT .Set8bitPioModeWithBIUOffload
    164     dec     ax                      ; XTCF_16BIT_PIO_WITH_BIU_OFFLOAD = 2
    165     jz      SHORT .Set16bitPioModeWithBIUOffload
    166 
    167     ; XTCF_DMA_MODE = 3
    168     mov     BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_DMA
    169 
    170     ; DMA transfers have limited block size
    171     mov     al, [di+DPT_ATA.bBlockSize]
    172     cmp     al, XTCF_DMA_MODE_MAX_BLOCK_SIZE
    173     jbe     SHORT AH24h_SetBlockSize
    174     mov     al, XTCF_DMA_MODE_MAX_BLOCK_SIZE
    175     jmp     SHORT AH24h_SetBlockSize
    176 
    177 .Set16bitPioModeWithBIUOffload:
    178     pop     bx                              ; Do not enable 8-bit PIO...
    179     ePUSH_T bx, AH23h_Disable8bitPioMode    ; ...disable it instead
    180     mov     al, DEVICE_8BIT_XTCF_PIO16_WITH_BIU_OFFLOAD
    181     SKIP2B  bx
    182 
    183 .Set8bitPioMode:
    184     mov     al, DEVICE_8BIT_XTCF_PIO8
    185     SKIP2B  bx
    186 
    187 .Set8bitPioModeWithBIUOffload:
    188     mov     al, DEVICE_8BIT_XTCF_PIO8_WITH_BIU_OFFLOAD
    189     mov     [di+DPT_ATA.bDevice], al
    190     ret
    191 %endif ; 0
    192 
    193 
    194154;--------------------------------------------------------------------
    195155; AH1Eh_GetCurrentXTCFmodeToAX
     
    197157;       DS:DI:  Ptr to DPT (in RAMVARS segment)
    198158;   Returns:
    199 ;       AX:     XT-CF mode (XTCF_8BIT_PIO_MODE, XTCF_8BIT_PIO_MODE_WITH_BIU_OFFLOAD, XTCF_16BIT_PIO_WITH_BIU_OFFLOAD or XTCF_DMA_MODE)
     159;       AX:     XT-CF mode (see XTCF.inc)
    200160;       CF:     Clear
    201161;   Corrupts registers:
     
    208168    ret
    209169
    210 %if 0
    211     mov     al, [di+DPT_ATA.bDevice]
    212     shr     al, 1
    213     cbw
    214     sub     al, XTCF_DEVICE_OFFSET >> 1
    215     ret
    216 %endif ; 0
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH23h_HFeatures.asm

    r584 r589  
    9292    mov     si, FEATURE_ENABLE_8BIT_PIO_TRANSFER_MODE
    9393    jmp     SHORT AH23h_SetControllerFeatures
     94
     95%ifdef MODULE_8BIT_IDE_ADVANCED
    9496AH23h_Disable8bitPioMode:
    9597    mov     si, FEATURE_DISABLE_8BIT_PIO_TRANSFER_MODE
     
    9799    xor     ah, ah          ; Clear error since modern drives might not understand the command and are
    98100    ret                     ; always in 16-bit mode anyway
    99 %endif
     101%endif ; MODULE_8BIT_IDE_ADVANCED
     102%endif ; MODULE_8BIT_IDE
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH2h_HRead.asm

    r526 r589  
    4040;       AH:     Int 13h/40h floppy return status
    4141;       AL:     Burst error length if AH returns 11h (we never return error code 11h)
    42 ;               Number of sectors actually read (only valid if CF set for someBIOSes)
     42;               Number of sectors actually read (only valid if CF set for some BIOSes)
    4343;       CF:     0 if successful, 1 if error
    4444;--------------------------------------------------------------------
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH3h_HWrite.asm

    r526 r589  
    3939;   Returns with INTPACK:
    4040;       AH:     Int 13h/40h floppy return status
    41 ;       AL:     Number of sectors actually written (only valid if CF set for someBIOSes)
     41;       AL:     Number of sectors actually written (only valid if CF set for some BIOSes)
    4242;       CF:     0 if successful, 1 if error
    4343;--------------------------------------------------------------------
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm

    r588 r589  
    184184
    185185    ; Advanced PIO mode 3 and above
    186     mov     dl, [di+DPT_ADVANCED_ATA.bPioMode]
    187     or      dl, PIO_FLOW_CONTROL_MODE_xxx
     186    mov     dl, PIO_FLOW_CONTROL_MODE_xxx
     187    or      dl, [di+DPT_ADVANCED_ATA.bPioMode]
    188188
    189189.IordyNotSupported:
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Tools/Address.asm

    r568 r589  
    174174    ; +=sectToSeek-1 (24-bit result)
    175175    ; Max = 16,450,497 + 63 - 1 = 16,450,559 = FB03FFh
    176     xor     bh, bh                  ; Sector number now in BX
     176    mov     bh, ch                  ; Sector number now in BX, CH=zero
    177177    dec     bx                      ; sectToSeek-=1
    178     add     ax, bx                  ; Add to loword
    179     adc     dl, bh                  ; Add possible carry to byte2, BH=zero
    180 
    181     ; Copy DX:AX to proper return registers
    182     xchg    bx, ax                  ; BL = Sector Number Register (LBA 7...0)
    183     mov     cl, bh                  ; Low Cylinder Register (LBA 15...8)
    184     mov     ch, dl                  ; High Cylinder Register (LBA 23...16)
    185     mov     bh, dh                  ; Drive and Head Register (LBA 27...24)
     178    add     bx, ax                  ; Add loword to BX (BL = Sector Number Register (LBA 7...0))
     179    adc     ch, dl                  ; Add possible carry to byte2 (CH = High Cylinder Register (LBA 23...16))
     180    mov     cl, bh                  ; CL = Low Cylinder Register (LBA 15...8)
     181    mov     bh, dh                  ; BH = Drive and Head Register (LBA 27...24)
    186182    ret
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/AdvancedAta/AdvAtaInit.asm

    r587 r589  
    3737AdvAtaInit_DetectControllerForIdeBaseInBX:
    3838    call    Vision_DetectAndReturnIDinAXandPortInDXifControllerPresent
    39     jne     SHORT .NoAdvancedControllerForPortBX
     39    jnz     SHORT .NoVisionControllerFound
     40
    4041    call    Vision_DoesIdePortInBXbelongToControllerWithIDinAX
    41     jne     SHORT .NoAdvancedControllerForPortBX
     42    jz      SHORT .AdvancedControllerFoundForPortBX
     43
     44.NoVisionControllerFound:
    4245    call    PDC20x30_DetectControllerForIdeBaseInBX
    4346    jnc     SHORT .NoAdvancedControllerForPortBX
    4447
    45     stc     ; Advanced Controller found for port BX
     48.AdvancedControllerFoundForPortBX:
     49    stc
    4650    ret
    4751
    4852.NoAdvancedControllerForPortBX:
    49     xor     ax, ax
     53    xor     ax, ax      ; Clear ID in AX and CF
    5054    ret
    5155
     
    6670AdvAtaInit_GetControllerMaxPioModeToALandMinPioCycleTimeToBX:
    6771    cmp     ah, ID_QD6580_ALTERNATE
     72%ifdef USE_386
     73    jae     Vision_GetMaxPioModeToALandMinCycleTimeToBX
     74    jmp     PDC20x30_GetMaxPioModeToALandMinPioCycleTimeToBX
     75%else
    6876    jae     SHORT .Vision
    6977    jmp     PDC20x30_GetMaxPioModeToALandMinPioCycleTimeToBX
    7078.Vision:
    7179    jmp     Vision_GetMaxPioModeToALandMinCycleTimeToBX
     80%endif
    7281
    7382
     
    8897    test    ax, ax
    8998    jz      SHORT .NoAdvancedController ; Return with CF cleared
    90    
     99
    91100    cmp     ah, ID_QD6580_ALTERNATE
    92101    jae     SHORT .Vision
     
    98107
    99108    call    AdvAtaInit_LoadMasterDPTtoDSSIifSlaveInDSDI
    100     call    Vision_InitializeWithIDinAHandConfigInAL
     109    call    Vision_InitializeWithIDinAH
    101110    xor     ax, ax                      ; Success
    102111
     
    116125;               Zero if Slave Drive not present
    117126;   Corrupts registers:
    118 ;       AX
     127;       AL
    119128;--------------------------------------------------------------------
    120129AdvAtaInit_LoadMasterDPTtoDSSIifSlaveInDSDI:
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/AdvancedAta/PDC20x30.asm

    r588 r589  
    3636    mov     dx, bx
    3737    call    EnablePdcProgrammingMode
    38     jz      .ControllerDetected
    39     clc
    40     ret
    41 .ControllerDetected:
    42     call    GetPdcIDtoAX
     38    jnz     SHORT DisablePdcProgrammingMode.Return  ; PDC controller not detected
     39;   ePUSH_T ax, DisablePdcProgrammingMode           ; Uncomment this if GetPdcIDtoAX needs to be a real function
     40    ; Fall to GetPdcIDtoAX
     41
     42;--------------------------------------------------------------------
     43; Programming mode must be enabled for this function.
     44; This function also enables PDC 20630 extra registers.
     45;
     46; GetPdcIDtoAX
     47;   Parameters:
     48;       DX:     IDE Base port
     49;   Returns:
     50;       AH:     PDC ID
     51;   Corrupts registers:
     52;       AL, BX
     53;--------------------------------------------------------------------
     54GetPdcIDtoAX:
     55    push    dx
     56
     57    ; Try to enable PDC 20630 extra registers
     58    add     dx, BYTE LOW_CYLINDER_REGISTER
     59    in      al, dx
     60    or      al, FLG_PDCLCR_ENABLE_EXTRA_REGISTERS
     61    out     dx, al
     62
     63    ; Try to access PDC 20630 registers to see if they are available
     64    ; Hopefully this does not cause problems for systems with PDC 20230
     65    add     dx, BYTE PDC20630_INDEX_REGISTER - LOW_CYLINDER_REGISTER
     66    mov     al, PDCREG7_STATUS  ; Try to access PDC 20630 status register
     67    out     dx, al
     68    xchg    bx, ax
     69    in      al, dx              ; Does index register contain status register index?
     70    cmp     al, bl
     71    mov     ah, ID_PDC20630
     72    eCMOVNE ah, ID_PDC20230
     73
     74    pop     dx
     75;   ret                         ; Uncomment this to make GetPdcIDtoAX a real function
    4376    ; Fall to DisablePdcProgrammingMode
    4477
     
    4982;       DX:     Base port
    5083;   Returns:
    51 ;       Nothing
     84;       CF:     Set
    5285;   Corrupts registers:
    5386;       AL
     
    5689    add     dx, BYTE HIGH_CYLINDER_REGISTER
    5790    in      al, dx
    58     sub     dx, BYTE HIGH_CYLINDER_REGISTER
    59     stc     ; Set for PDC20x30_DetectControllerForIdeBaseInBX
     91    add     dx, -HIGH_CYLINDER_REGISTER     ; Sets CF for PDC20x30_DetectControllerForIdeBaseInBX
     92.Return:
    6093    ret
    6194
     
    6699;       DX:     Base port
    67100;   Returns:
     101;       CF:     Cleared
    68102;       ZF:     Set if programming mode enabled
    69103;   Corrupts registers:
     
    72106EnablePdcProgrammingMode:
    73107    ; Set bit 7 to sector count register
    74     add     dx, BYTE SECTOR_COUNT_REGISTER
    75     in      al, dx
     108    inc     dx
     109    inc     dx
     110    in      al, dx  ; 1F2h (SECTOR_COUNT_REGISTER)
    76111    or      al, 80h
    77112    out     dx, al
     
    93128    ; PDC20230C and PDC20630 clears the bit we set at the beginning
    94129    in      al, dx
    95     sub     dx, BYTE SECTOR_COUNT_REGISTER
    96     test    al, 80h
    97     ret
    98 
    99 
    100 ;--------------------------------------------------------------------
    101 ; Programming mode must be enabled for this function.
    102 ; This function also enables PDC 20630 extra registers.
    103 ;
    104 ; GetPdcIDtoAX
    105 ;   Parameters:
    106 ;       DX:     IDE Base port
    107 ;   Returns:
    108 ;       AX:     PDC ID word
    109 ;   Corrupts registers:
    110 ;       BX
    111 ;--------------------------------------------------------------------
    112 GetPdcIDtoAX:
    113     ; Try to enable PDC 20630 extra registers
    114     add     dx, BYTE LOW_CYLINDER_REGISTER
    115     in      al, dx
    116     or      al, FLG_PDCLCR_ENABLE_EXTRA_REGISTERS
    117     out     dx, al
    118 
    119     ; Try to access PDC 20630 registers to see if they are available
    120     ; Hopefully this does not cause problems for systems with PDC 20230
    121     add     dx, BYTE PDC20630_INDEX_REGISTER - LOW_CYLINDER_REGISTER
    122     mov     al, PDCREG7_STATUS  ; Try to access PDC 20630 status register
    123     out     dx, al
    124     xchg    bx, ax
    125     in      al, dx              ; Does index register contain status register index?
    126     cmp     al, bl
    127     mov     ah, ID_PDC20630
    128     eCMOVNE ah, ID_PDC20230
     130    dec     dx
     131    dec     dx      ; Base port
     132    test    al, 80h ; Clears CF
    129133    ret
    130134
     
    145149PDC20x30_GetMaxPioModeToALandMinPioCycleTimeToBX:
    146150    cmp     ah, ID_PDC20630
    147     je      SHORT .return       ; No need to limit anything
     151    je      SHORT .Return       ; No need to limit anything
    148152    mov     ax, 2               ; Limit PIO to 2 for ID_PDC20230
    149153    mov     bx, PIO_2_MIN_CYCLE_TIME_NS
    150154    stc
    151 .return:
     155.Return:
    152156    ret
    153157
     
    165169;--------------------------------------------------------------------
    166170PDC20x30_InitializeForDPTinDSDI:
     171%ifdef USE_386
     172    xor     ch, ch
     173    test    BYTE [di+DPT.bFlagsLow], FLGL_DPT_SLAVE
     174    setnz   cl
     175%else
    167176    xor     cx, cx
    168177    test    BYTE [di+DPT.bFlagsLow], FLGL_DPT_SLAVE
    169     eCSETNZ cl
     178    jz      SHORT .NotSlave
     179    inc     cx
     180.NotSlave:
     181%endif
    170182
    171183    mov     dx, [di+DPT.wBasePort]
     
    173185    call    SetSpeedForDriveInCX
    174186    cmp     BYTE [di+DPT_ADVANCED_ATA.wControllerID+1], ID_PDC20630
    175     jne     .initializationCompleted
     187    jne     SHORT .InitializationCompleted
    176188    call    SetPdc20630SpeedForDriveInCX
    177 .initializationCompleted:
     189.InitializationCompleted:
    178190    mov     dx, [di+DPT.wBasePort]
    179191    call    DisablePdcProgrammingMode
     
    201213    mov     bh, ~MASK_PDCSCR_DEV1SPEED  ; Assume slave
    202214    inc     cx
    203     loop    .setSpeed
     215    loop    .SetSpeed
    204216    eSHL_IM bl, POS_PDCSCR_DEV0SPEED
    205217    mov     bh, ~MASK_PDCSCR_DEV0SPEED
    206 .setSpeed:
     218.SetSpeed:
    207219    in      al, dx
    208220    and     al, bh
    209221    or      al, bl
    210222    cmp     bl, 7
    211     jb      SHORT OutputNewValue
     223    jb      SHORT .OutputNewValue
    212224    or      al, FLG_PDCSCR_UNKNOWN_BIT7 ; Flag for PIO 2 and above?
    213     jmp     SHORT OutputNewValue
     225.OutputNewValue:
     226    out     dx, al
     227    ret
    214228
    215229.rgbPioModeToPDCspeedValue:
     
    228242;       DX:     Low Cylinder Register
    229243;   Corrupts registers:
    230 ;       AX, CX
     244;       AX
    231245;--------------------------------------------------------------------
    232246SetPdc20630SpeedForDriveInCX:
    233247    inc     dx      ; LOW_CYLINDER_REGISTER
    234     mov     ah, FLG_PDCLCR_DEV0SPEED_BIT4 | FLG_PDCLCR_DEV0IORDY
    235     shr     ah, cl
    236     in      al, dx
    237     not     ah
     248    mov     ah, ~(FLG_PDCLCR_DEV0SPEED_BIT4 | FLG_PDCLCR_DEV0IORDY)
     249    ror     ah, cl
     250    in      al, dx
    238251    and     al, ah  ; Clear drive specific bits
    239252    cmp     BYTE [di+DPT_ADVANCED_ATA.bPioMode], 2
    240     jbe     .clearBitsOnly
     253    jbe     .ClearBitsOnly
    241254    not     ah
    242255    or      al, ah
    243 .clearBitsOnly:
    244 OutputNewValue:
    245     out     dx, al
    246     ret
    247 
     256.ClearBitsOnly:
     257    out     dx, al
     258    ret
     259
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/AdvancedAta/Vision.asm

    r582 r589  
    2929;       AX:     ID WORD specific for QDI Vision Controllers
    3030;               (AL = QD65xx Config Register contents)
    31 ;               (AH = QDI Vision Controller ID (bits 4...7))
     31;               (AH = QDI Vision Controller ID)
    3232;       DX:     Controller port (not IDE port)
    3333;       ZF:     Set if controller found
     
    4646    ; from Axh to Bxh.
    4747    call    IsConfigRegisterWithIDinAL
    48     je      SHORT VisionControllerDetected
     48    je      SHORT VisionControllerDetected.Return
    4949
    5050    ; Check QD65xx alternative base port
    51     or      dl, QD65XX_ALTERNATIVE_BASE_PORT
     51    mov     dl, QD65XX_ALTERNATIVE_BASE_PORT
    5252    in      al, QD65XX_ALTERNATIVE_BASE_PORT + QD65XX_CONFIG_REGISTER_in
    5353%endif ; DANGEROUS_DETECTION
     
    6868    mov     ah, al
    6969    and     al, MASK_QDCONFIG_CONTROLLER_ID
    70     cmp     al, ID_QD6500 << 4
     70    cmp     al, ID_QD6500
    7171    je      SHORT VisionControllerDetected
    72     cmp     al, ID_QD6580 << 4
     72    cmp     al, ID_QD6580
    7373    je      SHORT VisionControllerDetected
    74     cmp     al, ID_QD6580_ALTERNATE << 4
     74    cmp     al, ID_QD6580_ALTERNATE
    7575VisionControllerDetected:
    7676    xchg    ah, al
     77.Return:
    7778    ret
    7879
     
    8283;   Parameters:
    8384;       AL:     QD65xx Config Register contents
    84 ;       AH:     QDI Vision Controller ID (bits 4...7)
     85;       AH:     QDI Vision Controller ID
    8586;       BX:     IDE Base port to check
    8687;       DX:     Vision Controller port
     
    9293;--------------------------------------------------------------------
    9394Vision_DoesIdePortInBXbelongToControllerWithIDinAX:
    94     cmp     ah, ID_QD6500 << 4
     95    cmp     ah, ID_QD6500
    9596    je      SHORT .DoesIdePortInDXbelongToQD6500
    9697
     
    128129;   Parameters:
    129130;       AL:     QD65xx Config Register contents
    130 ;       AH:     QDI Vision Controller ID (bits 4...7)
     131;       AH:     QDI Vision Controller ID
    131132;   Returns:
    132133;       AL:     Max supported PIO mode
     
    139140;--------------------------------------------------------------------
    140141Vision_GetMaxPioModeToALandMinCycleTimeToBX:
    141     cmp     ah, ID_QD6500 << 4
     142    cmp     ah, ID_QD6500
    142143    jne     SHORT .NoNeedToLimitForQD6580
    143144
     
    149150
    150151;--------------------------------------------------------------------
    151 ; Vision_InitializeWithIDinAHandConfigInAL
    152 ;   Parameters:
    153 ;       AL:     QD65xx Config Register contents
    154 ;       AH:     QDI Vision Controller ID (bits 4...7)
     152; Vision_InitializeWithIDinAH
     153;   Parameters:
     154;       AH:     QDI Vision Controller ID
    155155;       DS:DI:  Ptr to DPT for Single or Slave Drive
    156156;       SI:     Offset to Master DPT if Slave Drive present
     
    162162;       AX, BX, CX, DX, BP
    163163;--------------------------------------------------------------------
    164 Vision_InitializeWithIDinAHandConfigInAL:
     164Vision_InitializeWithIDinAH:
    165165    ; QD6580 has a Control Register that needs to be programmed
    166     cmp     ah, ID_QD6500 << 4
     166    cmp     ah, ID_QD6500
    167167    mov     dx, [di+DPT_ADVANCED_ATA.wControllerBasePort]
    168168    mov     bp, QD6500_MAX_ACTIVE_TIME_CLOCKS | (QD6500_MIN_ACTIVE_TIME_CLOCKS << 8)    ; Assume QD6500
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectDrives.asm

    r580 r589  
    8181    mov     al, [cs:ROMVARS.wFlags]         ; Configurator set to always scan?
    8282    or      al, [es:BDA.bKBFlgs1]           ; Or, did the user hold down the ALT key?
    83     and     al, 8                           ; 8 = alt key depressed, same as FLG_ROMVARS_SERIAL_ALWAYSDETECT
     83    and     al, 8                           ; 8 = alt key depressed, same as FLG_ROMVARS_SERIAL_SCANDETECT
    8484    jnz     .DriveDetectLoop
    8585%endif ; MODULE_SERIAL
     
    135135
    136136    shr     ch, 1                           ; number of drives, 1 or 2 only, to CF flag (clear=1, set=2)
    137     rcl     al, 1                           ; starting drive number in upper 7 bits, number of drives in low bit
     137    eRCL_IM al, 1                           ; starting drive number in upper 7 bits, number of drives in low bit
    138138.NoFloppies:
    139139    mov     [RAMVARS.xlateVars+XLATEVARS.bFlopCntAndFirst], al
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectPrint.asm

    r568 r589  
    9090%ifdef MODULE_SERIAL
    9191    cmp     dh, DEVICE_SERIAL_PORT          ; Check if this is a serial device
    92 
    93     jnz     .pushAndPrint                   ; CX = string to print, AX = port address, DX won't be used
     92    jne     SHORT .pushAndPrint             ; CX = string to print, AX = port address, DX won't be used
    9493
    9594    mov     cl, (g_szDetectCOM-$$) & 0xff   ; Setup print string for COM ports
     
    106105
    107106    test    dl, dl                          ; Check if serial port "Auto"
    108     jz      .pushAndPrintSerial             ; CX = string to print, AX and DX won't be used
     107    jz      SHORT .pushAndPrintSerial       ; CX = string to print, AX and DX won't be used
    109108
    110109    mov     cl, (g_szDetectCOMLarge-$$) & 0xff  ; Setup secondary print string for "COMn/xx.yK"
    111110
    112     mov     al,ah                           ; baud rate divisor to AL
     111    mov     al, ah                          ; baud rate divisor to AL
    113112    cbw                                     ; clear AH, AL will always be less than 128
    114     xchg    si,ax                           ; move AX to SI for divide
    115     mov     ax,1152                         ; baud rate to display is 115200/divisor, the "00" is handled
     113    xchg    si, ax                          ; move AX to SI for divide
     114    mov     ax, 1152                        ; baud rate to display is 115200/divisor, the "00" is handled
    116115                                            ; in the print strings
    117116    cwd                                     ; clear top 16-bits of dividend
    118117    div     si                              ; and divide...  Now AX = baud rate/100, DX = 0 (always a clean divide)
    119118
    120     mov     si,10                           ; Now separate the whole portion from the fractional for "K" display
     119    mov     si, 10                          ; Now separate the whole portion from the fractional for "K" display
    121120    div     si                              ; and divide...  Now AX = baud rate/1000, DX = low order digit
    122121
    123     cmp     ax,si                           ; < 10: "2400", "9600", etc.; >= 10: "19.2K", "38.4K", etc.
    124     jae     .pushAndPrintSerial
     122    cmp     ax, si                          ; < 10: "2400", "9600", etc.; >= 10: "19.2K", "38.4K", etc.
     123    jae     SHORT .pushAndPrintSerial
    125124
    126125    mov     cl, (g_szDetectCOMSmall-$$) & 0xff  ; Setup secondary print string for "COMn/XXy00"
     
    150149DetectPrint_DriveNameFromDrvDetectInfoInESBX:
    151150    push    bp
    152     mov     bp,sp
    153     lea     si,[bx+DRVDETECTINFO.szDrvName]
     151    mov     bp, sp
     152    lea     si, [bx+DRVDETECTINFO.szDrvName]
    154153    push    si
    155     mov     si,g_szDriveName
     154    mov     si, g_szDriveName
    156155    jmp     SHORT DetectPrint_FormatCSSIfromParamsInSSBP
    157156
     
    276275;
    277276    push    bp
    278     mov     bp,sp
     277    mov     bp, sp
    279278    ; Fall to DetectPrint_FormatCSSIfromParamsInSSBP
    280279
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm

    r580 r589  
    240240    push    cx
    241241    xchg    ax, cx              ; IRQ index to CL
    242     mov     ch, 1               ; Load 1 to be shifted
    243     shl     ch, cl              ; Shift bit to correct position
    244     not     ch                  ; Invert to create bit mask for clearing
     242    mov     ch, ~1              ; Load bit mask to be rotated
     243    rol     ch, cl              ; Rotate mask to correct position for clearing
    245244    in      al, dx              ; Read Interrupt Mask Register
    246245    and     al, ch              ; Clear wanted bit
  • trunk/XTIDE_Universal_BIOS/Src/Main.asm

    r588 r589  
    117117
    118118%ifdef MODULE_SERIAL
    119     at  ROMVARS.ideVarsSerialAuto+IDEVARS.bDevice,      db  DEVICE_SERIAL_PORT
     119    at  ROMVARS.ideVarsSerialAuto+IDEVARS.bDevice,  db  DEVICE_SERIAL_PORT
    120120%endif
    121121%else
     
    134134    at  ROMVARS.bIdleTimeout,   db  0                       ; Standby timer disabled by default
    135135
    136 %ifdef MODULE_8BIT_IDE_ADVANCED
    137     at  ROMVARS.ideVars0+IDEVARS.wBasePort,             dw  DEVICE_XTIDE_DEFAULT_PORT       ; Controller Command Block base port
    138     at  ROMVARS.ideVars0+IDEVARS.bDevice,               db  DEVICE_8BIT_XTCF_PIO8
     136%ifndef MODULE_8BIT_IDE
     137    at  ROMVARS.ideVars0+IDEVARS.wBasePort,         dw  DEVICE_ATA_PRIMARY_PORT         ; Controller Command Block base port
     138    at  ROMVARS.ideVars0+IDEVARS.wControlBlockPort, dw  DEVICE_ATA_PRIMARY_PORTCTRL     ; Controller Control Block base port
     139    at  ROMVARS.ideVars0+IDEVARS.bDevice,           db  DEVICE_16BIT_ATA
     140%elifdef MODULE_8BIT_IDE_ADVANCED
     141    at  ROMVARS.ideVars0+IDEVARS.wBasePort,         dw  DEVICE_XTIDE_DEFAULT_PORT       ; Controller Command Block base port
     142    at  ROMVARS.ideVars0+IDEVARS.bDevice,           db  DEVICE_8BIT_XTCF_PIO8
    139143%else
    140     at  ROMVARS.ideVars0+IDEVARS.wBasePort,             dw  DEVICE_XTIDE_DEFAULT_PORT       ; Controller Command Block base port
    141     at  ROMVARS.ideVars0+IDEVARS.wControlBlockPort,     dw  DEVICE_XTIDE_DEFAULT_PORTCTRL   ; Controller Control Block base port
    142     at  ROMVARS.ideVars0+IDEVARS.bDevice,               db  DEVICE_8BIT_XTIDE_REV1
     144    at  ROMVARS.ideVars0+IDEVARS.wBasePort,         dw  DEVICE_XTIDE_DEFAULT_PORT       ; Controller Command Block base port
     145    at  ROMVARS.ideVars0+IDEVARS.wControlBlockPort, dw  DEVICE_XTIDE_DEFAULT_PORTCTRL   ; Controller Control Block base port
     146    at  ROMVARS.ideVars0+IDEVARS.bDevice,           db  DEVICE_8BIT_XTIDE_REV1
    143147%endif
    144148    at  ROMVARS.ideVars0+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags,  db  DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION)
    145149    at  ROMVARS.ideVars0+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags,   db  DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION)
    146150
     151    at  ROMVARS.ideVars1+IDEVARS.wBasePort,         dw  DEVICE_ATA_SECONDARY_PORT
     152    at  ROMVARS.ideVars1+IDEVARS.wControlBlockPort, dw  DEVICE_ATA_SECONDARY_PORTCTRL
     153    at  ROMVARS.ideVars1+IDEVARS.bDevice,           db  DEVICE_16BIT_ATA
    147154    at  ROMVARS.ideVars1+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags,  db  DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION)
    148155    at  ROMVARS.ideVars1+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags,   db  DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION)
    149156
     157    at  ROMVARS.ideVars2+IDEVARS.wBasePort,         dw  DEVICE_ATA_TERTIARY_PORT
     158    at  ROMVARS.ideVars2+IDEVARS.wControlBlockPort, dw  DEVICE_ATA_TERTIARY_PORTCTRL
     159    at  ROMVARS.ideVars2+IDEVARS.bDevice,           db  DEVICE_16BIT_ATA
    150160    at  ROMVARS.ideVars2+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags,  db  DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION)
    151161    at  ROMVARS.ideVars2+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags,   db  DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION)
    152162
     163    at  ROMVARS.ideVars3+IDEVARS.wBasePort,         dw  DEVICE_ATA_QUATERNARY_PORT
     164    at  ROMVARS.ideVars3+IDEVARS.wControlBlockPort, dw  DEVICE_ATA_QUATERNARY_PORTCTRL
     165    at  ROMVARS.ideVars3+IDEVARS.bDevice,           db  DEVICE_16BIT_ATA
    153166    at  ROMVARS.ideVars3+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags,  db  DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION)
    154167    at  ROMVARS.ideVars3+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags,   db  DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION)
    155168
    156169%ifdef MODULE_SERIAL
    157     at  ROMVARS.ideVarsSerialAuto+IDEVARS.bDevice,      db  DEVICE_SERIAL_PORT
     170    at  ROMVARS.ideVarsSerialAuto+IDEVARS.bDevice,  db  DEVICE_SERIAL_PORT
    158171%endif
    159172%endif
     
    286299    %include "AH41h_CheckIfExtensionsPresent.asm"
    287300%endif
     301
     302
     303; Although it's very unlikely to happen, we give warnings for builds that cannot be automatically checksummed due to the size being too large.
     304; In some cases it's theoretically possible to checksum the build anyway (manually) which is why these are warnings and not errors.
     305%if BIOS_SIZE = 8192                ; A small build, possibly a candidate for the ROM socket on a 3Com 3C503 card.
     306    %if ($-$$) <= BIOS_SIZE         ; Only give warnings when the problem isn't obvious anyway.
     307        %if ($-$$) > BIOS_SIZE - 3
     308            %warning "This build is too large to be auto-checksummed!"
     309        %endif
     310    %endif
     311%elif ($-$$) = BIOS_SIZE            ; A large build.
     312    %warning "This build is too large to be auto-checksummed!"
     313%endif
  • trunk/XTIDE_Universal_BIOS/Src/Menus/BootMenu/BootMenuPrint.asm

    r583 r589  
    3939    mov     si, g_szRomBootDash                     ; Standard "Rom Boot" but with a "-" at the front
    4040    mov     al, 20h                                 ; The space between "Rom" and "Boot"
    41     jnc     .ROMBoot                                ; display "Rom Boot" option for last entry
     41    jnc     SHORT .ROMBoot                          ; display "Rom Boot" option for last entry
    4242
    4343    call    FindDPT_ForDriveNumberInDL
    44     jc      .notOurs
     44    jc      SHORT .notOurs
    4545
    4646    call    DriveDetectInfo_ConvertDPTtoBX
    4747    mov     si, g_szDriveNumBOOTNFO                 ; special g_szDriveNum that prints from BDA
    48     jmp     .go
     48    jmp     SHORT .go
    4949
    5050.notOurs:
    51     mov     si,g_szDriveNum
    52     mov     bx,g_szForeignHD                        ; assume a hard disk for the moment
     51    mov     si, g_szDriveNum
     52    mov     bx, g_szForeignHD                       ; assume a hard disk for the moment
    5353
    5454    test    dl, dl
    55     js      .go
    56     mov     bl,((g_szFloppyDrv)-$$ & 0xff)          ; and revisit the earlier assumption...
     55    js      SHORT .go
     56    mov     bl, ((g_szFloppyDrv)-$$ & 0xff)         ; and revisit the earlier assumption...
    5757
    5858.go:
     
    6060    call    DriveXlate_ToOrBack
    6161
    62     test    dl, 0f0h                                ; if there is a character in the upper nibble
    63     jnz     .noSpace
    64     dec     si                                      ; backup a character to a leading space
    65 .noSpace:
     62    cmp     dl, 10h                                 ; Check if there is a character in the upper nibble
     63    sbb     si, 0                                   ; If not, backup a character to a leading space
    6664
    6765    push    dx                                      ; translated drive number
     
    8684;--------------------------------------------------------------------
    8785BootMenuPrint_TitleStrings:
    88     xor     di,di                       ; Null character will be eaten
     86    xor     di, di                      ; Null character will be eaten
    8987    mov     si, g_szBootMenuTitle
    9088    jmp     DetectPrint_RomFoundAtSegment.BootMenuEntry
     
    105103
    106104    call    BootMenu_GetDriveToDXforMenuitemInCX
    107     jnc     BootMenuEvent_Completed                     ; nothing to display if "Rom Boot" option
     105    jnc     SHORT BootMenuEvent_Completed               ; nothing to display if "Rom Boot" option
    108106
    109107    push    bp
     
    116114    inc     dl                                          ; are we a hard disk?
    117115    dec     dl                                          ; inc/dec will set SF, without modifying CF or DL
    118     js      .HardDiskRefreshInformation
    119 
    120     jnc     .ours                                       ; Based on CF from FindDPT_ForDriveNumberInDL above
     116    js      SHORT .HardDiskRefreshInformation
     117
     118    jnc     SHORT .ours                                 ; Based on CF from FindDPT_ForDriveNumberInDL above
    121119    call    FloppyDrive_GetType                         ; Get Floppy Drive type to BX
    122     jmp     .around
     120    jmp     SHORT .around
    123121.ours:
    124122    call    AH8h_GetDriveParameters
     
    132130    cmp     bl, FLOPPY_TYPE_35_ED
    133131    ja      SHORT .PushAXAndOutput
    134 
    135132    ; Fall to .PrintKnownFloppyType
    136133
     
    162159    mov     al, (g_szFddThreeHalf - $$) & 0xff
    163160    cmp     bl, FLOPPY_TYPE_525_HD
    164     ja      .ThreeHalf
     161    ja      SHORT .ThreeHalf
    165162    mov     al, (g_szFddFiveQuarter - $$) & 0xff
    166163.ThreeHalf:
     
    168165
    169166    xor     bh, bh
    170     mov     al,FloppyTypes.rgbCapacityMultiplier
     167    mov     al, FloppyTypes.rgbCapacityMultiplier
    171168    mul     BYTE [cs:bx+FloppyTypes.rgbCapacity - 1]    ; -1 since 0 is handled above and not in the table
    172169
     
    184181;   Parameters:
    185182;       DS:     RAMVARS segment
     183;       DI:     Zero if foreign drive
     184;               Offset to DPT if our drive
     185;       CF:     Set if foreign drive
     186;               Clear if our drive
    186187;   Returns:
    187188;       CF:     Set since menu event was handled successfully
    188189;   Corrupts registers:
    189 ;       BX, CX, DX, SI, DI, ES
     190;       AX, BX, CX, DX, SI, DI, ES
    190191;--------------------------------------------------------------------
    191192.HardDiskRefreshInformation:
    192     jc      .HardDiskMenuitemInfoForForeignDrive        ; Based on CF from FindDPT_ForDriveNumberInDL (way) above
     193    jc      SHORT .HardDiskMenuitemInfoForForeignDrive  ; Based on CF from FindDPT_ForDriveNumberInDL (way) above
    193194
    194195.HardDiskMenuitemInfoForOurDrive:
    195196    ePUSH_T ax, g_szInformation                         ; Add substring for our hard disk information
    196     call    GetTotalSectorCount
    197     jmp     .ConvertSectorCountInBXDXAXtoSizeAndPushForFormat
     197
     198%ifdef MODULE_EBIOS
     199    ePUSH_T ax, .ConvertSectorCountInBXDXAXtoSizeAndPushForFormat
     200    test    BYTE [di+DPT.bFlagsLow], FLGL_DPT_LBA
     201%ifdef USE_386
     202    jnz     AccessDPT_GetLbaSectorCountToBXDXAX
     203    jmp     AH15h_GetSectorCountToBXDXAX
     204%else ; ~USE_386
     205    jz      SHORT .NoLBA
     206    jmp     AccessDPT_GetLbaSectorCountToBXDXAX
     207.NoLBA:
     208    jmp     AH15h_GetSectorCountToBXDXAX
     209%endif
     210%else ; ~MODULE_EBIOS
     211    call    AH15h_GetSectorCountToBXDXAX
     212    jmp     SHORT .ConvertSectorCountInBXDXAXtoSizeAndPushForFormat
     213%endif ; MODULE_EBIOS
    198214
    199215.HardDiskMenuitemInfoForForeignDrive:
     
    226242    db      2880  / FloppyTypes.rgbCapacityMultiplier    ;  type 5
    227243    db      2880  / FloppyTypes.rgbCapacityMultiplier    ;  type 6
    228 
    229 
    230 ;--------------------------------------------------------------------
    231 ; GetTotalSectorCount
    232 ;   Parameters:
    233 ;       DS:DI:      DPT Pointer
    234 ;   Returns:
    235 ;       BX:DX:AX:   48-bit sector count
    236 ;   Corrupts registers:
    237 ;       CX
    238 ;--------------------------------------------------------------------
    239 %ifdef MODULE_EBIOS
    240 GetTotalSectorCount     EQU     AccessDPT_GetLbaSectorCountToBXDXAX
    241 %else
    242 GetTotalSectorCount     EQU     AH15h_GetSectorCountToBXDXAX
    243 %endif
  • trunk/XTIDE_Universal_BIOS/Src/Strings.asm

    r588 r589  
    136136g_szDeviceTypeValues:
    137137g_szDeviceTypeValues_16bit:         db  " 16",NULL
     138%ifdef MODULE_ADVANCED_ATA OR MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
    138139g_szDeviceTypeValues_32bit:         db  " 32",NULL
     140%ifdef MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
    139141g_szDeviceTypeValues_8bit:          db  "  8",NULL
    140142g_szDeviceTypeValues_XTIDEr1:       db  "D8 ",NULL  ; Dual 8-bit
    141143g_szDeviceTypeValues_XTIDEr2:       db  "X8 ",NULL  ; A0<->A3 swapped 8-bit
     144%ifdef MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
    142145g_szDeviceTypeValues_XTCFpio8:      db  "T8 ",NULL  ; True 8-bit
    143146g_szDeviceTypeValues_XTCFpio8BIU:   db  "T8B",NULL
     
    146149g_szDeviceTypeValues_JrIde:         db  "M8 ",NULL  ; Memory Mapped 8-bit
    147150g_szDeviceTypeValues_ADP50L:        db  "M8 ",NULL  ; Memory Mapped 8-bit
     151%ifdef MODULE_SERIAL
    148152g_szDeviceTypeValues_Serial:        db  "SER",NULL
    149 
    150 g_szDeviceTypeValues_Displacement equ (g_szDeviceTypeValues_32bit - g_szDeviceTypeValues)
     153%endif ; MODULE_SERIAL
     154%endif ; MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
     155%endif ; MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
     156%endif ; MODULE_ADVANCED_ATA OR MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
     157
     158g_szDeviceTypeValues_Displacement equ 3     ; 3 compressed, 4 uncompressed
     159;g_szDeviceTypeValues_Displacement equ (g_szDeviceTypeValues_32bit - g_szDeviceTypeValues)
    151160;
    152161; Ensure that device type strings are correctly spaced in memory
     
    156165        %error "g_szDeviceTypeValues Displacement Incorrect 1"
    157166    %endif
     167
     168    %ifdef MODULE_ADVANCED_ATA OR MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
     169
    158170    %if g_szDeviceTypeValues_32bit <> g_szDeviceTypeValues_16bit + g_szDeviceTypeValues_Displacement
    159171        %error "g_szDeviceTypeValues Displacement Incorrect 2"
    160172    %endif
     173
     174    %ifdef MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
     175
    161176    %if g_szDeviceTypeValues_8bit <> g_szDeviceTypeValues_32bit + g_szDeviceTypeValues_Displacement
    162177        %error "g_szDeviceTypeValues Displacement Incorrect 3"
     
    168183        %error "g_szDeviceTypeValues Displacement Incorrect 5"
    169184    %endif
     185
     186    %ifdef MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
     187
    170188    %if g_szDeviceTypeValues_XTCFpio8 <> g_szDeviceTypeValues_XTIDEr2 + g_szDeviceTypeValues_Displacement
    171189        %error "g_szDeviceTypeValues Displacement Incorrect 6"
     
    186204        %error "g_szDeviceTypeValues Displacement Incorrect 11"
    187205    %endif
     206
     207    %ifdef MODULE_SERIAL
     208
    188209    %if g_szDeviceTypeValues_Serial <> g_szDeviceTypeValues_ADP50L + g_szDeviceTypeValues_Displacement
    189210        %error "g_szDeviceTypeValues Displacement Incorrect 12"
    190211    %endif
     212
     213    %endif ; MODULE_SERIAL
     214    %endif ; MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
     215    %endif ; MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
     216    %endif ; MODULE_ADVANCED_ATA OR MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
     217
    191218%endif
    192219
  • trunk/XTIDE_Universal_BIOS/Src/StringsCompressed.asm

    r588 r589  
    257257                                      db     20h,  2bh,  0fh          ; compressed
    258258
     259%ifdef MODULE_ADVANCED_ATA OR MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
    259260g_szDeviceTypeValues_32bit:         ; db    " 32",NULL
    260261                                    ; db     20h,  33h,  32h,  00h    ; uncompressed
    261262                                      db     20h,  2dh,  0ch          ; compressed
    262263
     264%ifdef MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
    263265g_szDeviceTypeValues_8bit:          ; db    "  8",NULL
    264266                                    ; db     20h,  20h,  38h,  00h    ; uncompressed
     
    273275                                      db     5eh,  30h,  00h          ; compressed
    274276
     277%ifdef MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
    275278g_szDeviceTypeValues_XTCFpio8:      ; db    "T8 ",NULL  ; True 8-bit
    276279                                    ; db     54h,  38h,  20h,  00h    ; uncompressed
     
    297300                                      db     53h,  30h,  00h          ; compressed
    298301
     302%ifdef MODULE_SERIAL
    299303g_szDeviceTypeValues_Serial:        ; db    "SER",NULL
    300304                                    ; db     53h,  45h,  52h,  00h    ; uncompressed
    301305                                      db     59h,  4bh,  98h          ; compressed
    302306
    303 
    304 g_szDeviceTypeValues_Displacement equ (g_szDeviceTypeValues_32bit - g_szDeviceTypeValues)
     307%endif ; MODULE_SERIAL
     308%endif ; MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
     309%endif ; MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
     310%endif ; MODULE_ADVANCED_ATA OR MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
     311
     312g_szDeviceTypeValues_Displacement equ 3     ; 3 compressed, 4 uncompressed
     313;g_szDeviceTypeValues_Displacement equ (g_szDeviceTypeValues_32bit - g_szDeviceTypeValues)
    305314;
    306315; Ensure that device type strings are correctly spaced in memory
     
    310319%error "g_szDeviceTypeValues Displacement Incorrect 1"
    311320%endif
     321
     322%ifdef MODULE_ADVANCED_ATA OR MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
     323
    312324%if g_szDeviceTypeValues_32bit <> g_szDeviceTypeValues_16bit + g_szDeviceTypeValues_Displacement
    313325%error "g_szDeviceTypeValues Displacement Incorrect 2"
    314326%endif
     327
     328%ifdef MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
     329
    315330%if g_szDeviceTypeValues_8bit <> g_szDeviceTypeValues_32bit + g_szDeviceTypeValues_Displacement
    316331%error "g_szDeviceTypeValues Displacement Incorrect 3"
     
    322337%error "g_szDeviceTypeValues Displacement Incorrect 5"
    323338%endif
     339
     340%ifdef MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
     341
    324342%if g_szDeviceTypeValues_XTCFpio8 <> g_szDeviceTypeValues_XTIDEr2 + g_szDeviceTypeValues_Displacement
    325343%error "g_szDeviceTypeValues Displacement Incorrect 6"
     
    340358%error "g_szDeviceTypeValues Displacement Incorrect 11"
    341359%endif
     360
     361%ifdef MODULE_SERIAL
     362
    342363%if g_szDeviceTypeValues_Serial <> g_szDeviceTypeValues_ADP50L + g_szDeviceTypeValues_Displacement
    343364%error "g_szDeviceTypeValues Displacement Incorrect 12"
    344365%endif
     366
     367%endif ; MODULE_SERIAL
     368%endif ; MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
     369%endif ; MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
     370%endif ; MODULE_ADVANCED_ATA OR MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
     371
    345372%endif
    346373
     
    567594
    568595;; translated usage stats
    569 ;; 172:2
    570 ;; 47:2
    571 ;; 171:2
    572 ;; 46:3
    573 ;; 48:2
    574 ;; 181:1
    575 ;; 200:1
    576 ;; 54:2
    577 ;; 45:2
    578 ;; 49:2
    579596;; 34:3
    580597;; 179:8
    581 ;; 56:8
     598;; 46:3
     599;; 44:1
     600;; 200:1
     601;; 48:2
     602;; 175:1
     603;; 171:2
     604;; 51:3
     605;; 50:2
    582606;; 33:1
    583607;; 53:2
     608;; 45:2
     609;; 47:2
     610;; 172:2
     611;; 56:8
    584612;; 32:34
    585 ;; 175:1
    586 ;; 44:1
    587 ;; 50:2
    588 ;; 51:3
     613;; 181:1
     614;; 54:2
     615;; 49:2
    589616;; total translated: 20
    590617
    591618;; format usage stats
    592 ;; z:2
     619;; 5-x:1
     620;; 2-u:1
     621;; s:14
    593622;; nl:12
    594 ;; u:6
    595 ;; 5-x:1
    596 ;; c:13
    597623;; A:4
    598 ;; s:14
    599624;; 5-u:2
    600625;; x:5
    601 ;; 2-u:1
    602626;; 2-I:1
     627;; z:2
     628;; u:6
     629;; c:13
    603630;; total format: 11
    604631
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AccessDPT.asm

    r588 r589  
    6262
    6363    jnz     SHORT .EnableDeviceIrq
    64     or      al, FLG_DEVCONTROL_nIEN ; Disable IRQ
     64    mov     al, FLG_DEVCONTROL_nIEN ; Disable IRQ
    6565.EnableDeviceIrq:
    6666%else
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CompatibleDPT.asm

    r568 r589  
    231231
    232232    xor     dl, dl                          ; Clear DL for checksum
     233    push    bp
     234    mov     bp, StoswThenAddALandAHtoDL
    233235
    234236    ; DPTE.wBasePort
    235237    mov     ax, [si+DPT.wBasePort]
    236     call    StoswThenAddALandAHtoDL         ; Bytes 0 and 1
     238    call    bp                              ; Bytes 0 and 1
    237239
    238240    ; DPTE.wControlBlockPort
    239241    eMOVZX  bx, [si+DPT.bIdevarsOffset]
    240242    mov     ax, [cs:bx+IDEVARS.wControlBlockPort]
    241     call    StoswThenAddALandAHtoDL         ; Bytes 2 and 3
     243    call    bp                              ; Bytes 2 and 3
    242244
    243245    ; DPTE.bDrvnhead and DPTE.bBiosVendor
     
    245247    call    AccessDPT_GetDriveSelectByteToAL
    246248    xchg    si, di
    247     call    StoswThenAddALandAHtoDL         ; Bytes 4 and 5
     249    call    bp                              ; Bytes 4 and 5
    248250
    249251    ; DPTE.bIRQ and DPTE.bBlockSize
    250252    mov     al, [cs:bx+IDEVARS.bIRQ]        ; No way to define that we might not use IRQ
    251     mov     ah, [si+DPT_ATA.bBlockSize]
    252     cmp     ah, 1
    253     jbe     SHORT .DoNotSetBlockModeFlag
     253    mov     ah, [si+DPT_ATA.bBlockSize]     ; DPT_ATA.bBlockSize must never be zero!
     254    sahf                                    ; Only block size = 1 sets CF
     255    jc      SHORT .DoNotSetBlockModeFlag
    254256    or      cl, FLG_BLOCK_MODE_ENABLED
    255257.DoNotSetBlockModeFlag:
    256     call    StoswThenAddALandAHtoDL         ; Bytes 6 and 7
     258    call    bp                              ; Bytes 6 and 7
    257259
    258260    ; DPTE.bDmaChannelAndType and DPTE.bPioMode
     
    266268    sbb     cl, -1  ; FLG_FAST_PIO_ENABLED (if .wControllerID > 0)
    267269.DoNotSetFastPioFlag:
    268     call    StoswThenAddALandAHtoDL         ; Bytes 8 and 9
     270    call    bp                              ; Bytes 8 and 9
    269271%endif
    270272
     
    279281.NoChsTranslationOrBitShiftTranslationSet:
    280282    xchg    ax, cx
    281     call    StoswThenAddALandAHtoDL         ; Bytes 10 and 11
     283    call    bp                              ; Bytes 10 and 11
     284    pop     bp
    282285
    283286    ; DPTE.wReserved (must be zero)
  • trunk/XTIDE_Universal_BIOS/makefile

    r580 r589  
    1818# MODULE_8BIT_IDE             Support for 8-BIT IDE cards like XTIDE                               #
    1919# MODULE_8BIT_IDE_ADVANCED    Support for memory mapped and DMA based cards like JRIDE and XTCF    #
    20 # MODULE_ADVANCED_ATA         Native support for some VLB IDE controllers                          #
     20# MODULE_ADVANCED_ATA         Native support for some VLB IDE controllers (requires USE_386)       #
    2121# MODULE_COMPATIBLE_TABLES    Support for ill behaving software that tries to access DPT directly  #
    2222# MODULE_BOOT_MENU            Boot Menu for selection of drive to boot from                        #
     
    108108DEFINES_XT = $(DEFINES_COMMON) ELIMINATE_CGA_SNOW MODULE_8BIT_IDE_ADVANCED
    109109DEFINES_XTPLUS = $(DEFINES_XT) USE_186
    110 DEFINES_AT = $(DEFINES_COMMON) USE_AT USE_286 MODULE_IRQ MODULE_ADVANCED_ATA MODULE_COMPATIBLE_TABLES
     110DEFINES_AT = $(DEFINES_COMMON) USE_AT USE_286 MODULE_IRQ MODULE_COMPATIBLE_TABLES
    111111
    112112DEFINES_XT_LARGE = $(DEFINES_XT) $(DEFINES_COMMON_LARGE)
     
    115115
    116116DEFINES_XT_TINY = MODULE_STRINGS_COMPRESSED MODULE_8BIT_IDE NO_ATAID_VALIDATION
    117 DEFINES_386_8K = $(DEFINES_AT) USE_386
     117DEFINES_386_8K = $(DEFINES_AT) USE_386 MODULE_ADVANCED_ATA
    118118
    119119DEFINES_ALL_FEATURES = MODULE_8BIT_IDE MODULE_8BIT_IDE_ADVANCED MODULE_ADVANCED_ATA MODULE_EBIOS MODULE_BOOT_MENU MODULE_HOTKEYS MODULE_IRQ MODULE_SERIAL MODULE_SERIAL_FLOPPY MODULE_STRINGS_COMPRESSED MODULE_POWER_MANAGEMENT MODULE_COMPATIBLE_TABLES
Note: See TracChangeset for help on using the changeset viewer.