Changeset 473 in xtideuniversalbios


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

Changes to XTIDE Universal BIOS:

  • Large changes to prepare full XT-CF support (DMA not yet implemented and memory mapped transfers are not working).
Location:
trunk/XTIDE_Universal_BIOS
Files:
2 added
32 edited

Legend:

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

    r422 r473  
    3737    .dwPostStack        resb    4       ; POST stack pointer when entering INT 19h
    3838
     39%ifdef MODULE_8BIT_IDE
     40    .wNextXTCFportToScan    resb    2   ; Needed for XT-CF port autodetection
     41%endif
     42
    3943    .clearToZeroFromThisPoint:
    4044%ifdef MODULE_HOTKEYS
    4145    .hotkeyVars         resb    HOTKEYVARS_size
    4246%endif
    43    
     47
    4448    .rgDrvDetectInfo:                   ; Array containing DRVDETECTINFO structs
    4549endstruc
  • trunk/XTIDE_Universal_BIOS/Inc/Controllers/XTCF.inc

    r472 r473  
    2323%define XTCF_INC
    2424
     25XTCF_DMA_MODE_MAX_BLOCK_SIZE        EQU     64      ; Sectors
     26OFFSET_TO_CONTROL_BLOCK_REGISTERS   EQU     8
     27
    2528; Possible base addresses. Note that all XT-CF IDE registers are SHL 1 compared
    2629; to standard IDE registers.
     
    4245; 8-bit PIO transfers (port I/O) are used if Control Register is zero.
    4346; Any other value means DMA transfers (using DMA channel 3).
     47XTCF_8BIT_PIO_MODE                  EQU     0
     48XTCF_MEMORY_MAPPED_MODE             EQU     0A0h
     49
    4450
    4551
  • trunk/XTIDE_Universal_BIOS/Inc/CustomDPT.inc

    r472 r473  
    2424; Base DPT for all device types
    2525struc DPT
    26     ; General Disk Parameter Table related (Bytes 0...3)
     26    ; General Disk Parameter Table related
    2727    .wFlags:
    2828    .bFlagsLow              resb    1
     
    3030    .bIdevarsOffset         resb    1   ; Offset to IDEVARS for this drive
    3131    .bInitError             resb    1   ; Flags for AH=09h initialization errors
     32    .wBasePort              resb    2   ; Segment for JR-IDE/ISA
    3233
    33     ; CHS variables (Bytes 4...8)
     34    ; CHS variables
    3435    .wLchsCylinders         resb    2   ; (1...1027, yes 1027)
    3536    .wLchsHeadsAndSectors:
     
    4344    .wPchsCylinders         resb    2
    4445    .twLbaSectors           resb    6   ; 48-bit sector count for LBA addressing
    45 %endif
    46 
    47 %ifdef MODULE_8BIT_IDE
    48     .wXTCFport              resb    2   ; Autodetected XT-CF port
    4946%endif
    5047                            alignb  2   ; WORD alignent for DPT_SERIAL or DPT_ATA
     
    9693    FLG_INITERROR_FAILED_TO_SET_PIO_MODE                EQU (1<<5)
    9794    FLG_INITERROR_FAILED_TO_INITIALIZE_STANDBY_TIMER    EQU (1<<6)
    98     FLG_INITERROR_FAILED_TO_ENABLE_8BIT_PIO_MODE        EQU (1<<7)
     95    FLG_INITERROR_FAILED_TO_SET_XTCF_MODE               EQU (1<<7)
    9996
    10097
    10198
    10299; DPT for ATA devices
    103 struc DPT_ATA   ; 10/18 bytes + 2 bytes = 12/20 bytes
     100struc DPT_ATA
    104101    .dpt                    resb    DPT_size
     102    .bDevice                resb    1   ; Device Type from IDEVARS (overrided when 32-bit controller detected)
    105103    .bBlockSize             resb    1   ; Current block size in sectors (do not set to zero!)
    106     .bDevice                resb    1   ; Device Type from IDEVARS (overrided when 32-bit controller detected)
    107104endstruc
    108105
     
    112109; EBDA must be reserved for DPTs when using these!
    113110%ifdef MODULE_ADVANCED_ATA
    114 struc DPT_ADVANCED_ATA  ; 12/20 bytes + 8 bytes = 20/28 bytes
     111struc DPT_ADVANCED_ATA
    115112    .dpt_ata                resb    DPT_ATA_size
    116113    .wControllerID          resb    2   ; Controller specific ID WORD (from Advanced Controller detection)
     
    125122; DPT for Serial devices
    126123%ifdef MODULE_SERIAL
    127 struc DPT_SERIAL    ; 8/18 bytes + 2 bytes = 10/20 bytes
     124struc DPT_SERIAL
    128125    .dpt                    resb    DPT_size
    129126    .wSerialPortAndBaud:
  • trunk/XTIDE_Universal_BIOS/Inc/DeviceIDE.inc

    r444 r473  
    3232
    3333%ifdef MODULE_FEATURE_SETS
    34 TIMEOUT_BSY             EQU     TIMEOUT_MOTOR_STARTUP
    35 TIMEOUT_DRDY            EQU     TIMEOUT_MOTOR_STARTUP
     34    TIMEOUT_BSY         EQU     TIMEOUT_MOTOR_STARTUP
     35    TIMEOUT_DRDY        EQU     TIMEOUT_MOTOR_STARTUP
    3636%else
    37 TIMEOUT_BSY             EQU     (2600/55)   ; 2600 ms
    38 TIMEOUT_DRDY            EQU     (2600/55)   ; 2600 ms
     37    TIMEOUT_BSY         EQU     (2600/55)   ; 2600 ms
     38    TIMEOUT_DRDY        EQU     (2600/55)   ; 2600 ms
    3939%endif
    4040
  • trunk/XTIDE_Universal_BIOS/Inc/IdeIO.inc

    r400 r473  
    2121%define IDE_IO_INC
    2222
    23 JRIDE_SECTOR_ACCESS_WINDOW_OFFSET           EQU 3C00h   ; 512 byte IDE Sector Access Window
    24 JRIDE_COMMAND_BLOCK_REGISTER_WINDOW_OFFSET  EQU 3E00h   ; 8 byte CS0 IDE Register Window
    25 JRIDE_CONTROL_BLOCK_REGISTER_WINDOW_OFFSET  EQU 3E08h   ; 8 byte CS1 IDE Register Window
    26 JRIDE_SECTOR_ACCESS_WINDOW_SIZE             EQU 512     ; 512 bytes
    27 
    28 
    2923;--------------------------------------------------------------------
    30 ; OUTPUT_AL_TO_IDE_REGISTER_IN_DL
    31 ; JUMP_TO_OUTPUT_AL_TO_IDE_REGISTER_IN_DL
    32 ; OUTPUT_AL_TO_IDE_CONTROL_BLOCK_REGISTER_IN_DL
     24; OUTPUT_AL_TO_IDE_REGISTER
     25; OUTPUT_AL_TO_IDE_CONTROL_BLOCK_REGISTER
    3326;   Parameters:
    3427;       AL:     Byte to output
     
    4235;--------------------------------------------------------------------
    4336%macro OUTPUT_AL_TO_IDE_REGISTER 1
    44 %ifnidni %1, dl
    45     mov     dl, %1
     37%ifndef MODULE_8BIT_IDE ; Standard IDE controllers only
     38
     39    %ifnidni %1, dx
     40        mov     dx, %1
     41    %endif
     42    add     dx, [di+DPT.wBasePort]
     43    out     dx, al
     44
     45%else   ; Register translations required
     46
     47    %ifnidni %1, dl
     48        mov     dl, %1
     49    %endif
     50    call    IdeIO_OutputALtoIdeRegisterInDL
     51
    4652%endif
    47     call    IdeIO_OutputALtoIdeRegisterInDL
    4853%endmacro
    4954
    50 %macro JUMP_TO_OUTPUT_AL_TO_IDE_REGISTER 1
    51 %ifnidni %1, dl
    52     mov     dl, %1
    53 %endif
    54     jmp     IdeIO_OutputALtoIdeRegisterInDL
    55 %endmacro
    5655
    5756%macro OUTPUT_AL_TO_IDE_CONTROL_BLOCK_REGISTER 1
    58 %ifnidni %1, dl
    59     mov     dl, %1
     57%ifndef MODULE_8BIT_IDE ; Standard IDE controllers only
     58
     59    %ifnidni %1, dx
     60        mov     dx, %1
     61    %endif
     62    eMOVZX  bx, BYTE [di+DPT.bIdevarsOffset]
     63    add     dx, [cs:bx+IDEVARS.wControlBlockPort]
     64    out     dx, al
     65
     66%else   ; Register translations required
     67
     68    %ifnidni %1, dl
     69        mov     dl, %1
     70    %endif
     71    call    IdeIO_OutputALtoIdeControlBlockRegisterInDL
     72
    6073%endif
    61     call    IdeIO_OutputALtoIdeControlBlockRegisterInDL
    6274%endmacro
    6375
     
    7486;--------------------------------------------------------------------
    7587%macro INPUT_TO_AL_FROM_IDE_REGISTER 1
    76 %ifnidni %1, dl
    77     mov     dl, %1
     88%ifndef MODULE_8BIT_IDE ; Standard IDE controllers only
     89
     90    %ifnidni %1, dx
     91        mov     dx, %1
     92    %endif
     93    add     dx, [di+DPT.wBasePort]
     94    in      al, dx
     95
     96%else   ; Register translations required
     97
     98    %ifnidni %1, dl
     99        mov     dl, %1
     100    %endif
     101        call    IdeIO_InputToALfromIdeRegisterInDL
     102
    78103%endif
    79     call    IdeIO_InputToALfromIdeRegisterInDL
    80104%endmacro
    81105
  • trunk/XTIDE_Universal_BIOS/Inc/IdeRegisters.inc

    r437 r473  
    103103FEATURE_ENABLE_8BIT_PIO_TRANSFER_MODE   EQU     01h     ; CFA feature set only
    104104FEATURE_ENABLE_WRITE_CACHE              EQU     02h
     105FEATURE_DISABLE_8BIT_PIO_TRANSFER_MODE  EQU     81h     ; CFA feature set only
    105106FEATURE_DISABLE_WRITE_CACHE             EQU     82h     ; Can also be used to flush cache
    106107FEATURE_SET_TRANSFER_MODE               EQU     03h     ; Transfer mode goes to the Sector Count Register
  • trunk/XTIDE_Universal_BIOS/Inc/ModuleDependency.inc

    r471 r473  
    3232%endif
    3333
    34 %ifdef MODULE_JRIDE
    35     %ifndef MODULE_8BIT_IDE
    36         %define MODULE_8BIT_IDE
    37     %endif
    38 %endif
    39 
    4034
    4135
     
    4438    %include "IDE_8bit.inc"         ; For IDE 8-bit data port macros
    4539    %include "XTCF.inc"             ; For Lo-tech XT-CF
     40    %include "JRIDE_ISA.inc"        ; For JR-IDE/ISA
    4641%endif
    4742
     
    10499%endif
    105100
    106 %ifdef MODULE_JRIDE
    107     MAIN_FLG_MODULE_JRIDE   EQU FLG_ROMVARS_MODULE_JRIDE
    108 %else
    109     MAIN_FLG_MODULE_JRIDE   EQU 0
    110 %endif
    111 
    112101%ifdef MODULE_SERIAL
    113102    MAIN_FLG_MODULE_SERIAL  EQU FLG_ROMVARS_MODULE_SERIAL
     
    134123%endif
    135124
    136 MASK_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_JRIDE | MAIN_FLG_MODULE_SERIAL | MAIN_FLG_MODULE_SERIAL_FLOPPY | MAIN_FLG_MODULE_STRINGS_COMPRESSED | MAIN_FLG_MODULE_FEATURE_SETS
     125MASK_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_FEATURE_SETS
  • trunk/XTIDE_Universal_BIOS/Inc/RomVars.inc

    r437 r473  
    7272FLG_ROMVARS_MODULE_FEATURE_SETS         EQU (1<<5)
    7373FLG_ROMVARS_MODULE_8BIT_IDE             EQU (1<<6)
    74 FLG_ROMVARS_MODULE_JRIDE                EQU (1<<7)
     74
    7575FLG_ROMVARS_MODULE_ADVANCED_ATA         EQU (1<<8)
    7676FLG_ROMVARS_MODULE_BOOT_MENU            EQU (1<<9)
     
    9191;;; Word 0
    9292    .wSerialPortAndBaud:                    ; Serial connection port (low, divided by 4) and baud rate divisor (high)
    93     .wPort:                                 ; IDE Base Port for Command Block (usual) Registers
     93    .wBasePort:                             ; IDE Base Port for Command Block (usual) Registers
    9494    .bSerialPort                resb    1
    9595    .bSerialBaud                resb    1
    9696
    9797;;; Word 1
    98     .wPortCtrl:
     98    .wControlBlockPort:
     99    .bXTCFcontrolRegister:                  ; XT-CF autodetects ports
    99100    .bSerialUnused              resb    1   ; IDE Base Port for Control Block Registers
    100101
     
    104105;;; Word 2
    105106    .bDevice                    resb    1   ; Device type
    106 
    107107    .bIRQ                       resb    1   ; Interrupt Request Number
    108108
     
    137137
    138138; Device types for IDEVARS.bDevice
     139; IDE Devices are grouped so device numbers cannot be changed without modifying code elsewhere!
    139140;
    140 DEVICE_8BIT_JRIDE_ISA                   EQU (0<<1)  ; JR-IDE/ISA (must be 0)
    141 DEVICE_8BIT_XTCF                        EQU (1<<1)  ; Lo-tech XT-CF
    142 DEVICE_8BIT_XTIDE_REV2                  EQU (2<<1)  ; Or rev 1 with swapped A0 and A3 (must be 1 or 2)
    143 DEVICE_8BIT_XTIDE_REV1                  EQU (3<<1)  ; Must be 4
    144 COUNT_OF_8BIT_IDE_DEVICES               EQU 4
    145 
    146 DEVICE_16BIT_ATA                        EQU (COUNT_OF_8BIT_IDE_DEVICES<<1)
    147 DEVICE_32BIT_ATA                        EQU ((COUNT_OF_8BIT_IDE_DEVICES+1)<<1)
    148 COUNT_OF_16BIT_IDE_DEVICES              EQU 2
    149 COUNT_OF_ALL_IDE_DEVICES                EQU (COUNT_OF_8BIT_IDE_DEVICES + COUNT_OF_16BIT_IDE_DEVICES)
    150 
     141COUNT_OF_STANDARD_IDE_DEVICES           EQU 2
     142COUNT_OF_8BIT_IDE_DEVICES               EQU 6
     143COUNT_OF_ALL_IDE_DEVICES                EQU (COUNT_OF_8BIT_IDE_DEVICES + COUNT_OF_STANDARD_IDE_DEVICES)
     144; Standard port mapped I/O
     145DEVICE_16BIT_ATA                        EQU (0<<1)
     146DEVICE_32BIT_ATA                        EQU (1<<1)
     147DEVICE_8BIT_XTIDE_REV1                  EQU (COUNT_OF_STANDARD_IDE_DEVICES<<1)
     148; Address lines A0 and A3 are swapped
     149DEVICE_8BIT_XTIDE_REV2                  EQU ((COUNT_OF_STANDARD_IDE_DEVICES+1)<<1)  ; Or rev 1 with swapped A0 and A3
     150; IDE Register offsets are SHL 1
     151DEVICE_8BIT_XTCF_PIO8                   EQU ((COUNT_OF_STANDARD_IDE_DEVICES+2)<<1)  ; XT-CF using 8-bit PIO mode
     152DEVICE_8BIT_XTCF_DMA                    EQU ((COUNT_OF_STANDARD_IDE_DEVICES+3)<<1)  ; XT-CF using DMA
     153DEVICE_8BIT_XTCF_MEMMAP                 EQU ((COUNT_OF_STANDARD_IDE_DEVICES+4)<<1)  ; XT-CF using Memory Mapped transfers (not I/O)
     154; Memory Mapped I/O
     155DEVICE_8BIT_JRIDE_ISA                   EQU ((COUNT_OF_STANDARD_IDE_DEVICES+5)<<1)  ; JR-IDE/ISA (Memory Mapped I/O)
     156; Virtual devices
    151157DEVICE_SERIAL_PORT                      EQU (COUNT_OF_ALL_IDE_DEVICES<<1)
    152158
  • trunk/XTIDE_Universal_BIOS/Inc/Version.inc

    r461 r473  
    4242
    4343%define TITLE_STRING            TITLE_STRING_START, TITLE_STRING_END
    44 %define ROM_VERSION_STRING      "v2.0.0",BETA,"2 (",__DATE__,")",NULL
    45 %define FLASH_SIGNATURE         "XTIDE201"  ; Do not terminate with NULL
     44%define ROM_VERSION_STRING      "v2.0.0",BETA,"2+ (",__DATE__,")",NULL
     45%define FLASH_SIGNATURE         "XTIDE203"  ; Do not terminate with NULL
    4646
    4747
  • trunk/XTIDE_Universal_BIOS/Src/Device/Device.asm

    r443 r473  
    8282;   Parameters:
    8383;       BH:     Drive Select byte for Drive and Head Select Register
     84;       DX:     Autodetected port (for devices that support autodetection)
    8485;       DS:     Segment to RAMVARS
    8586;       ES:SI:  Ptr to normalized buffer to receive 512-byte IDE Information
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm

    r445 r473  
    5656;   Parameters:
    5757;       BH:     Drive Select byte for Drive and Head Select Register
     58;       DX:     Autodetected port for XT-CF
    5859;       DS:     Segment to RAMVARS
    5960;       ES:SI:  Ptr to buffer to receive 512-byte IDE Information
     
    7071    eMOVZX  ax, bh
    7172    mov     [di+DPT.wFlags], ax
    72     mov     [di+DPT.bIdevarsOffset], bp
     73    call    CreateDPT_StoreIdevarsOffsetAndBasePortFromCSBPtoDPTinDSDI
     74    call    IdeDPT_StoreDeviceTypeToDPTinDSDIfromIdevarsInCSBP
    7375    mov     BYTE [di+DPT_ATA.bBlockSize], 1 ; Block = 1 sector
    74     call    IdeDPT_StoreDeviceTypeFromIdevarsInCSBPtoDPTinDSDI
    7576
    7677    ; Wait until drive motors have reached full speed
    77     cmp     bp, BYTE ROMVARS.ideVars0       ; First controller?
     78    cmp     bp, BYTE ROMVARS.ideVars0   ; First controller?
    7879    jne     SHORT .SkipLongWaitSinceDriveIsNotPrimaryMaster
    79     test    bh, FLG_DRVNHEAD_DRV            ; Wait already done for Master
     80    test    bh, FLG_DRVNHEAD_DRV        ; Wait already done for Master
    8081    jnz     SHORT .SkipLongWaitSinceDriveIsNotPrimaryMaster
    8182    call    AHDh_WaitUntilDriveMotorHasReachedFullSpeed
     
    8788
    8889%ifdef MODULE_8BIT_IDE
    89     ; Enable 8-bit PIO mode for Lo-tech XT-CF
     90    ; We set XT-CF to 8-bit PIO mode for Identify Device command.
     91    ; Correct XT-CF mode is later set on AH=09h (after all drives are detected).
     92    call    AccessDPT_IsThisDeviceXTCF
     93    jne     SHORT .SkipXTCFmodeChange
     94
     95    xor     al, al                      ; XTCF_8BIT_PIO_MODE
    9096    push    si
    91     call    AH9h_Enable8bitPioModeForXTCF
     97    call    AH1Eh_ChangeXTCFmodeBasedOnControlRegisterInAL
    9298    pop     si
    9399    jc      SHORT .FailedToSet8bitMode
    94 %endif
     100.SkipXTCFmodeChange:
     101%endif ; MODULE_8BIT_IDE
    95102
    96103    ; Prepare to output Identify Device command
     
    170177    cmp     bl, FLG_STATUS_DRQ              ; Data transfer started?
    171178    jne     SHORT .WaitUntilNonTransferCommandCompletes
    172 %ifdef MODULE_JRIDE
    173     cmp     BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_JRIDE_ISA
    174     je      SHORT JrIdeTransfer_StartWithCommandInAL
     179%ifdef MODULE_8BIT_IDE
     180    cmp     BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_DMA
     181    je      SHORT 0 ; IdeDma_StartTransferWithCommandInAL
     182    ja      SHORT JrIdeTransfer_StartWithCommandInAL    ; DEVICE_8BIT_XTCF_MEMMAP or DEVICE_8BIT_JRIDE_ISA
    175183%endif
    176184    jmp     IdeTransfer_StartWithCommandInAL
     
    205213    ; We use different timeout value when detecting drives.
    206214    ; This prevents unnecessary long delays when drive is not present.
    207     mov     bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRDY, FLG_STATUS_DRDY)
     215    mov     cx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRDY, FLG_STATUS_DRDY)
    208216    cmp     WORD [RAMVARS.wDrvDetectSignature], RAMVARS_DRV_DETECT_SIGNATURE
    209     eCMOVE  bh, TIMEOUT_SELECT_DRIVE_DURING_DRIVE_DETECTION
     217    eCMOVE  ch, TIMEOUT_SELECT_DRIVE_DURING_DRIVE_DETECTION
    210218
    211219    ; Select Master or Slave Drive
    212220    mov     al, [bp+IDEPACK.bDrvAndHead]
    213221    OUTPUT_AL_TO_IDE_REGISTER   DRIVE_AND_HEAD_SELECT_REGISTER
     222    mov     bx, cx
    214223    call    IdeWait_PollStatusFlagInBLwithTimeoutInBH
    215224
     
    248257
    249258    mov     al, ch
    250     JUMP_TO_OUTPUT_AL_TO_IDE_REGISTER   LBA_HIGH_REGISTER
     259    OUTPUT_AL_TO_IDE_REGISTER   LBA_HIGH_REGISTER
     260    ret
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeDPT.asm

    r410 r473  
    6464;--------------------------------------------------------------------
    6565.StoreDeviceType:
    66     call    IdeDPT_StoreDeviceTypeFromIdevarsInCSBPtoDPTinDSDI
     66    call    IdeDPT_StoreDeviceTypeToDPTinDSDIfromIdevarsInCSBP
    6767
    6868
     
    111111;--------------------------------------------------------------------
    112112.DetectAdvancedIdeController:
    113     call    AccessDPT_GetIdeBasePortToBX
     113    mov     bx, [di+DPT.wBasePort]
    114114    call    AdvAtaInit_DetectControllerForIdeBaseInBX
    115115    mov     [di+DPT_ADVANCED_ATA.wControllerID], ax ; Store zero if none detected
     
    138138
    139139;--------------------------------------------------------------------
    140 ; IdeDPT_StoreDeviceTypeFromIdevarsInCSBPtoDPTinDSDI
     140; IdeDPT_StoreDeviceTypeToDPTinDSDIfromIdevarsInCSBP
    141141;   Parameters:
    142142;       DS:DI:  Ptr to Disk Parameter Table
     
    147147;       AL
    148148;--------------------------------------------------------------------
    149 IdeDPT_StoreDeviceTypeFromIdevarsInCSBPtoDPTinDSDI:
     149IdeDPT_StoreDeviceTypeToDPTinDSDIfromIdevarsInCSBP:
    150150    mov     al, [cs:bp+IDEVARS.bDevice]
    151151    mov     [di+DPT_ATA.bDevice], al
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeIO.asm

    r443 r473  
    11; Project name  :   XTIDE Universal BIOS
    2 ; Description   :   IDE Register I/O functions.
     2; Description   :   IDE Register I/O functions when supporting 8-bit
     3;                   devices that need address translations.
    34
    45;
     
    2223
    2324;--------------------------------------------------------------------
     25; IdeIO_InputStatusRegisterToAL
     26;   Parameters:
     27;       DS:DI:  Ptr to DPT (in RAMVARS segment)
     28;   Returns:
     29;       AL:     IDE Status Register contents
     30;   Corrupts registers:
     31;       BX, DX
     32;--------------------------------------------------------------------
     33ALIGN JUMP_ALIGN
     34IdeIO_InputStatusRegisterToAL:
     35%ifndef MODULE_8BIT_IDE
     36    INPUT_TO_AL_FROM_IDE_REGISTER STATUS_REGISTER_in
     37    ret
     38
     39%else
     40    mov     dl, STATUS_REGISTER_in
     41    ; Fall to IdeIO_InputToALfromIdeRegisterInDL
     42
     43;--------------------------------------------------------------------
     44; IdeIO_InputToALfromIdeRegisterInDL
     45;   Parameters:
     46;       DL:     IDE Register
     47;       DS:DI:  Ptr to DPT (in RAMVARS segment)
     48;   Returns:
     49;       AL:     Inputted byte
     50;   Corrupts registers:
     51;       BX, DX
     52;--------------------------------------------------------------------
     53IdeIO_InputToALfromIdeRegisterInDL:
     54    xor     dh, dh  ; IDE Register index now in DX
     55
     56    mov     al, [di+DPT_ATA.bDevice]
     57    cmp     al, DEVICE_8BIT_XTIDE_REV2
     58    je      SHORT .ReverseA0andA3fromRegisterIndexInDX
     59    jb      SHORT .InputToALfromRegisterInDX    ; Standard IDE controllers and XTIDE rev 1
     60    cmp     al, DEVICE_8BIT_JRIDE_ISA
     61    jne     SHORT .ShlRegisterIndexInDX         ; All XT-CF modes
     62    ; Fall to .InputToALfromMemoryMappedRegisterInDX
     63
     64.InputToALfromMemoryMappedRegisterInDX:
     65    mov     bx, JRIDE_COMMAND_BLOCK_REGISTER_WINDOW_OFFSET
     66    add     bx, dx
     67    push    ds
     68    mov     ds, [di+DPT.wBasePort]  ; Segment for JR-IDE/ISA
     69    mov     al, [bx]
     70    pop     ds
     71    ret
     72
     73.ReverseA0andA3fromRegisterIndexInDX:
     74    mov     bx, dx
     75    mov     dl, [cs:bx+g_rgbSwapA0andA3fromIdeRegisterIndex]
     76    SKIP2B  bx  ; Skip shl dx, 1
     77
     78.ShlRegisterIndexInDX:
     79    shl     dx, 1
     80    ; Fall to .InputToALfromRegisterInDX
     81
     82.InputToALfromRegisterInDX:
     83    add     dx, [di+DPT.wBasePort]
     84    in      al, dx
     85    ret
     86
     87
     88;--------------------------------------------------------------------
    2489; IdeIO_OutputALtoIdeControlBlockRegisterInDL
    2590;   Parameters:
     
    3398;--------------------------------------------------------------------
    3499IdeIO_OutputALtoIdeControlBlockRegisterInDL:
    35     %ifdef MODULE_8BIT_IDE
    36         mov     dh, [di+DPT_ATA.bDevice]
    37         %ifdef MODULE_JRIDE
    38             test    dh, dh
    39             jnz     SHORT .OutputToIoMappedIde
    40        
    41             add     dx, JRIDE_CONTROL_BLOCK_REGISTER_WINDOW_OFFSET
    42             jmp     SHORT OutputToJrIdeRegister
    43         .OutputToIoMappedIde:
    44         %endif  ; MODULE_JRIDE
    45     %endif  ; MODULE_8BIT_IDE
     100    ; Note! We do not need to reverse A0 and A3 for XTIDE rev 2 since
     101    ; the only Control Block Register we access is DEVICE_CONTROL_REGISTER_out
     102    ; at offset 6 (0110b).
     103    xor     dh, dh  ; IDE Register index now in DX
    46104
    47     mov     bl, IDEVARS.wPortCtrl
    48     jmp     SHORT OutputALtoIdeRegisterInDLwithIdevarsOffsetToBasePortInBL
     105    mov     bl, [di+DPT_ATA.bDevice]
     106    cmp     bl, DEVICE_8BIT_XTIDE_REV2
     107    jbe     SHORT .OutputALtoControlBlockRegisterInDX   ; Standard IDE controllers and XTIDE rev 1
     108    cmp     bl, DEVICE_8BIT_JRIDE_ISA
     109    jne     SHORT .ShlRegisterIndexInDX     ; All XT-CF modes
     110    ; Fall to .OutputALtoMemoryMappedRegisterInDX
     111
     112.OutputALtoMemoryMappedRegisterInDX:
     113    mov     bx, JRIDE_CONTROL_BLOCK_REGISTER_WINDOW_OFFSET
     114    jmp     SHORT IdeIO_OutputALtoIdeRegisterInDL.OutputALtoMemoryMappedRegisterInDXwithWindowOffsetInBX
     115
     116.ShlRegisterIndexInDX:
     117    add     dl, OFFSET_TO_CONTROL_BLOCK_REGISTERS
     118    shl     dx, 1
     119    jmp     SHORT OutputALtoRegisterInDX
     120
     121.OutputALtoControlBlockRegisterInDX:
     122    call    AccessDPT_GetIdevarsToCSBX
     123    add     dx, [cs:bx+IDEVARS.wControlBlockPort]
     124    jmp     SHORT OutputALtoPortInDX
    49125
    50126
     
    62138ALIGN JUMP_ALIGN
    63139IdeIO_OutputALtoIdeRegisterInDL:
    64     %ifdef MODULE_8BIT_IDE
    65         mov     dh, [di+DPT_ATA.bDevice]
    66         %ifdef MODULE_JRIDE
    67             test    dh, dh
    68             jnz     SHORT OutputALtoIOmappedIdeRegisterInDL
    69        
    70         %if JRIDE_COMMAND_BLOCK_REGISTER_WINDOW_OFFSET & 0FFh = 0
    71             mov     dh, JRIDE_COMMAND_BLOCK_REGISTER_WINDOW_OFFSET >> 8
    72         %else
    73             add     dx, JRIDE_COMMAND_BLOCK_REGISTER_WINDOW_OFFSET
    74         %endif
    75         OutputToJrIdeRegister:
    76             mov     bx, dx
    77             mov     [cs:bx], al
    78             ret
    79         ALIGN JUMP_ALIGN
    80         OutputALtoIOmappedIdeRegisterInDL:
    81         %endif  ; MODULE_JRIDE
    82     %endif  ; MODULE_8BIT_IDE
     140    xor     dh, dh  ; IDE Register index now in DX
    83141
    84     mov     bl, IDEVARS.wPort
    85 OutputALtoIdeRegisterInDLwithIdevarsOffsetToBasePortInBL:
    86     call    GetIdePortToDX
     142    mov     bl, [di+DPT_ATA.bDevice]
     143    cmp     bl, DEVICE_8BIT_XTIDE_REV2
     144    je      SHORT .ReverseA0andA3fromRegisterIndexInDX
     145    jb      SHORT OutputALtoRegisterInDX    ; Standard IDE controllers and XTIDE rev 1
     146    cmp     bl, DEVICE_8BIT_JRIDE_ISA
     147    jne     SHORT .ShlRegisterIndexInDX     ; All XT-CF modes
     148    ; Fall to .OutputALtoMemoryMappedRegisterInDX
     149
     150.OutputALtoMemoryMappedRegisterInDX:
     151    mov     bx, JRIDE_COMMAND_BLOCK_REGISTER_WINDOW_OFFSET
     152.OutputALtoMemoryMappedRegisterInDXwithWindowOffsetInBX:
     153    add     bx, dx
     154    push    ds
     155    mov     ds, [di+DPT.wBasePort]  ; Segment for JR-IDE/ISA
     156    mov     [bx], al
     157    pop     ds
     158    ret
     159
     160.ReverseA0andA3fromRegisterIndexInDX:
     161    mov     bx, dx
     162    mov     dl, [cs:bx+g_rgbSwapA0andA3fromIdeRegisterIndex]
     163    SKIP2B  bx  ; Skip shl dx, 1
     164
     165.ShlRegisterIndexInDX:
     166    shl     dx, 1
     167    ; Fall to OutputALtoRegisterInDX
     168
     169ALIGN JUMP_ALIGN
     170OutputALtoRegisterInDX:
     171    add     dx, [di+DPT.wBasePort]
     172OutputALtoPortInDX:
    87173    out     dx, al
    88174    ret
    89175
    90176
    91 ;--------------------------------------------------------------------
    92 ; IdeIO_InputStatusRegisterToAL
    93 ;   Parameters:
    94 ;       DS:DI:  Ptr to DPT (in RAMVARS segment)
    95 ;   Returns:
    96 ;       AL:     IDE Status Register contents
    97 ;   Corrupts registers:
    98 ;       BX, DX
    99 ;--------------------------------------------------------------------
    100 ALIGN JUMP_ALIGN
    101 IdeIO_InputStatusRegisterToAL:
    102     mov     dl, STATUS_REGISTER_in
    103     ; Fall to IdeIO_InputToALfromIdeRegisterInDL
    104177
    105 ;--------------------------------------------------------------------
    106 ; IdeIO_InputToALfromIdeRegisterInDL
    107 ;   Parameters:
    108 ;       DL:     IDE Register
    109 ;       DS:DI:  Ptr to DPT (in RAMVARS segment)
    110 ;   Returns:
    111 ;       AL:     Inputted byte
    112 ;   Corrupts registers:
    113 ;       BX, DX
    114 ;--------------------------------------------------------------------
    115 IdeIO_InputToALfromIdeRegisterInDL:
    116     %ifdef MODULE_8BIT_IDE
    117         mov     dh, [di+DPT_ATA.bDevice]
    118         %ifdef MODULE_JRIDE
    119             test    dh, dh
    120             jnz     SHORT .InputToALfromIOmappedIdeRegisterInDL
    121        
    122         %if JRIDE_COMMAND_BLOCK_REGISTER_WINDOW_OFFSET & 0FFh = 0
    123             mov     dh, JRIDE_COMMAND_BLOCK_REGISTER_WINDOW_OFFSET >> 8
    124         %else
    125             add     dx, JRIDE_COMMAND_BLOCK_REGISTER_WINDOW_OFFSET
    126         %endif
    127             mov     bx, dx
    128             mov     al, [cs:bx]
    129             ret
    130         .InputToALfromIOmappedIdeRegisterInDL:
    131         %endif  ; MODULE_JRIDE
    132     %endif  ; MODULE_8BIT_IDE
    133     mov     bl, IDEVARS.wPort
    134     call    GetIdePortToDX
    135     in      al, dx
    136     ret
     178; A0 <-> A3 lookup table
     179g_rgbSwapA0andA3fromIdeRegisterIndex:
     180    db  0000b   ; <-> 0000b, 0
     181    db  1000b   ; <-> 0001b, 1
     182    db  0010b   ; <-> 0010b, 2
     183    db  1010b   ; <-> 0011b, 3
     184    db  0100b   ; <-> 0100b, 4
     185    db  1100b   ; <-> 0101b, 5
     186    db  0110b   ; <-> 0110b, 6
     187    db  1110b   ; <-> 0111b, 7
    137188
    138 
    139 ;--------------------------------------------------------------------
    140 ; GetIdePortToDX
    141 ;   Parameters:
    142 ;       BL:     Offset to port in IDEVARS (IDEVARS.wPort or IDEVARS.wPortCtrl)
    143 ;       DH:     Device Type (IDEVARS.bDevice)
    144 ;       DL:     IDE Register
    145 ;       DS:DI:  Ptr to DPT (in RAMVARS segment)
    146 ;   Returns:
    147 ;       DX:     Source/Destination Port
    148 ;   Corrupts registers:
    149 ;       BX
    150 ;--------------------------------------------------------------------
    151 ALIGN JUMP_ALIGN
    152 GetIdePortToDX:
    153 %ifdef MODULE_8BIT_IDE
    154     ; Point CS:BX to IDEVARS
    155     xor     bh, bh
    156     add     bl, [di+DPT.bIdevarsOffset]         ; CS:BX now points port address
    157 
    158     ; Load port address and check if A0 and A3 address lines need to be reversed
    159     cmp     dh, DEVICE_8BIT_XTIDE_REV1
    160     mov     dh, bh                              ; DX now has IDE register offset
    161     jae     SHORT .ReturnUntranslatedPortInDX   ; No need to swap address lines
    162 
    163     ; Exchange address lines A0 and A3 from DL
    164     add     dx, [cs:bx]                         ; DX now has port address
    165     mov     bl, dl                              ; Port low byte to BL
    166     and     bl, MASK_A3_AND_A0_ADDRESS_LINES    ; Clear all bits except A0 and A3
    167     jz      SHORT .ReturnTranslatedPortInDX     ; A0 and A3 both zeroes, no change needed
    168     cmp     bl, MASK_A3_AND_A0_ADDRESS_LINES
    169     je      SHORT .ReturnTranslatedPortInDX     ; A0 and A3 both ones, no change needed
    170     xor     dl, MASK_A3_AND_A0_ADDRESS_LINES    ; Invert A0 and A3
    171 .ReturnTranslatedPortInDX:
    172     ret
    173 
    174 .ReturnUntranslatedPortInDX:
    175     add     dx, [cs:bx]
    176     ret
    177 
    178 %else   ; Only standard IDE devices
    179     xor     bh, bh
    180     add     bl, [di+DPT.bIdevarsOffset]         ; CS:BX now points port address
    181     xor     dh, dh
    182     add     dx, [cs:bx]                         ; DX now has port address
    183     ret
    184 %endif
     189%endif ; MODULE_8BIT_IDE
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm

    r445 r473  
    206206ALIGN JUMP_ALIGN
    207207InitializePiovarsInSSBPwithSectorCountInAH:
    208     ; Store sizes
     208    ; Store sizes and Data Port
    209209    mov     [bp+PIOVARS.bSectorsLeft], ah
     210    mov     ax, [di+DPT.wBasePort]
     211    mov     [bp+PIOVARS.wDataPort], ax
    210212    eMOVZX  ax, [di+DPT_ATA.bBlockSize]
    211213    mov     [bp+PIOVARS.wSectorsInBlock], ax
     
    214216    ; Get transfer function based on bus type
    215217    xchg    ax, bx                              ; Lookup table offset to AX
    216     mov     bl, [di+DPT.bIdevarsOffset]         ; CS:BX now points to IDEVARS
    217     mov     dx, [cs:bx+IDEVARS.wPort]           ; Load IDE Data port address
    218218    mov     bl, [di+DPT_ATA.bDevice]
    219219    add     bx, ax
    220 
    221     mov     [bp+PIOVARS.wDataPort], dx
    222220    mov     ax, [cs:bx]                         ; Load offset to transfer function
    223221    mov     [bp+PIOVARS.fnXfer], ax
     
    225223
    226224
    227 ;--------------------------------------------------------------------
    228 ; ReadBlockFromXtideRev1        XTIDE rev 1
    229 ; ReadBlockFromXtideRev2        XTIDE rev 2 or rev 1 with swapped A0 and A3 (chuck-mod)
    230 ; ReadBlockFrom8bitDataPort     CF-XT when using 8-bit PIO
    231 ; ReadBlockFrom16bitDataPort    Normal 16-bit IDE
    232 ; ReadBlockFrom32bitDataPort    VLB/PCI 32-bit IDE
    233 ;   Parameters:
    234 ;       CX:     Block size in 512 byte sectors
    235 ;       DX:     IDE Data port address
    236 ;       ES:DI:  Normalized ptr to buffer to receive data
    237 ;   Returns:
    238 ;       Nothing
    239 ;   Corrupts registers:
    240 ;       AX, BX, CX
    241 ;--------------------------------------------------------------------
    242 %ifdef MODULE_8BIT_IDE
    243 
    244     ALIGN JUMP_ALIGN
    245     ReadBlockFromXtideRev1:
    246         UNROLL_SECTORS_IN_CX_TO_OWORDS
    247         mov     bl, 8       ; Bit mask for toggling data low/high reg
    248     ALIGN JUMP_ALIGN
    249     .InswLoop:
    250     %rep 8  ; WORDs
    251         XTIDE_INSW
    252     %endrep
    253         loop    .InswLoop
    254         ret
    255 
    256     ;--------------------------------------------------------------------
    257     %ifndef USE_186         ; 8086/8088 compatible WORD read
    258         ALIGN JUMP_ALIGN
    259         ReadBlockFromXtideRev2:
    260             UNROLL_SECTORS_IN_CX_TO_OWORDS
    261         ALIGN JUMP_ALIGN
    262         .ReadNextOword:
    263         %rep 8  ; WORDs
    264             in      ax, dx      ; Read WORD
    265             stosw               ; Store WORD to [ES:DI]
    266         %endrep
    267             loop    .ReadNextOword
    268             ret
    269     %endif
    270 
    271     ;--------------------------------------------------------------------
    272     %ifdef USE_186
    273         ALIGN JUMP_ALIGN
    274         ReadBlockFrom8bitDataPort:
    275             shl     cx, 9       ; Sectors to BYTEs
    276             rep insb
    277             ret
    278 
    279     %else ; If 8088/8086
    280         ALIGN JUMP_ALIGN
    281         ReadBlockFrom8bitDataPort:
    282             UNROLL_SECTORS_IN_CX_TO_OWORDS
    283         ALIGN JUMP_ALIGN
    284         .ReadNextOword:
    285         %rep 16 ; BYTEs
    286             in      al, dx      ; Read BYTE
    287             stosb               ; Store BYTE to [ES:DI]
    288         %endrep
    289             loop    .ReadNextOword
    290             ret
    291     %endif
    292 %endif  ; MODULE_8BIT_IDE
    293 
    294 ;--------------------------------------------------------------------
    295 %ifdef USE_186
    296     ALIGN JUMP_ALIGN
    297     ReadBlockFrom16bitDataPort:
    298         xchg    cl, ch      ; Sectors to WORDs
    299         rep insw
    300         ret
    301 %endif
    302 
    303 ;--------------------------------------------------------------------
    304 %ifdef USE_AT
    305     ALIGN JUMP_ALIGN
    306     ReadBlockFrom32bitDataPort:
    307         shl     cx, 7       ; Sectors to DWORDs
    308         rep
    309         db      66h         ; Override operand size to 32-bit
    310         db      6Dh         ; INSW/INSD
    311         ret
    312 %endif
    313 
    314 
    315 ;--------------------------------------------------------------------
    316 ; WriteBlockToXtideRev1         XTIDE rev 1
    317 ; WriteBlockToXtideRev2         XTIDE rev 2 or rev 1 with swapped A0 and A3 (chuck-mod)
    318 ; WriteBlockTo8bitDataPort      XT-CF when using 8-bit PIO
    319 ; WriteBlockTo16bitDataPort     Normal 16-bit IDE
    320 ; WriteBlockTo32bitDataPort     VLB/PCI 32-bit IDE
    321 ;   Parameters:
    322 ;       CX:     Block size in 512-byte sectors
    323 ;       DX:     IDE Data port address
    324 ;       ES:SI:  Normalized ptr to buffer containing data
    325 ;   Returns:
    326 ;       Nothing
    327 ;   Corrupts registers:
    328 ;       AX, BX, CX, DX
    329 ;--------------------------------------------------------------------
    330 %ifdef MODULE_8BIT_IDE
    331 
    332     ALIGN JUMP_ALIGN
    333     WriteBlockToXtideRev1:
    334         push    ds
    335         UNROLL_SECTORS_IN_CX_TO_QWORDS
    336         mov     bl, 8       ; Bit mask for toggling data low/high reg
    337         push    es          ; Copy ES...
    338         pop     ds          ; ...to DS
    339     ALIGN JUMP_ALIGN
    340     .OutswLoop:
    341     %rep 4  ; WORDs
    342         XTIDE_OUTSW
    343     %endrep
    344         loop    .OutswLoop
    345         pop     ds
    346         ret
    347 
    348     ;--------------------------------------------------------------------
    349     ALIGN JUMP_ALIGN
    350     WriteBlockToXtideRev2:
    351         UNROLL_SECTORS_IN_CX_TO_QWORDS
    352         push    ds
    353         push    es          ; Copy ES...
    354         pop     ds          ; ...to DS
    355     ALIGN JUMP_ALIGN
    356     .WriteNextQword:
    357     %rep 4  ; WORDs
    358         XTIDE_MOD_OUTSW
    359     %endrep
    360         loop    .WriteNextQword
    361         pop     ds
    362         ret
    363 
    364     ;--------------------------------------------------------------------
    365     %ifdef USE_186
    366         ALIGN JUMP_ALIGN
    367         WriteBlockTo8bitDataPort:
    368             shl     cx, 9       ; Sectors to BYTEs
    369             es                  ; Source is ES segment
    370             rep outsb
    371             ret
    372 
    373     %else ; If 8088/8086
    374         ALIGN JUMP_ALIGN
    375         WriteBlockTo8bitDataPort:
    376             UNROLL_SECTORS_IN_CX_TO_DWORDS
    377             push    ds
    378             push    es
    379             pop     ds
    380         ALIGN JUMP_ALIGN
    381         .WriteNextDword:
    382         %rep 4  ; BYTEs
    383             lodsb               ; Load BYTE from [DS:SI]
    384             out     dx, al      ; Write BYTE
    385         %endrep
    386             loop    .WriteNextDword
    387             pop     ds
    388             ret
    389     %endif
    390 %endif  ; MODULE_8BIT_IDE
    391 
    392 ;--------------------------------------------------------------------
    393 %ifdef USE_AT
    394 ALIGN JUMP_ALIGN
    395 WriteBlockTo16bitDataPort:
    396     xchg    cl, ch      ; Sectors to WORDs
    397     es                  ; Source is ES segment
    398     rep outsw
    399     ret
    400 
    401 ;--------------------------------------------------------------------
    402 ALIGN JUMP_ALIGN
    403 WriteBlockTo32bitDataPort:
    404     shl     cx, 7       ; Sectors to DWORDs
    405     es                  ; Source is ES segment
    406     rep
    407     db      66h         ; Override operand size to 32-bit
    408     db      6Fh         ; OUTSW/OUTSD
    409     ret
    410 %endif ; USE_AT
    411 
    412 
    413225
    414226; Lookup tables to get transfer function based on bus type
    415227ALIGN WORD_ALIGN
    416228g_rgfnPioRead:
     229%ifdef USE_AT
     230        dw      IdePioBlock_ReadFrom16bitDataPort   ; 0, DEVICE_16BIT_ATA
     231        dw      IdePioBlock_ReadFrom32bitDataPort   ; 1, DEVICE_32BIT_ATA
     232%else
     233        dd      0
     234%endif
    417235%ifdef MODULE_8BIT_IDE
    418         dw      0                           ; 0, DEVICE_8BIT_JRIDE_ISA
    419         dw      ReadBlockFrom8bitDataPort   ; 1, DEVICE_8BIT_XTCF
    420     %ifdef USE_186
    421         dw      ReadBlockFrom16bitDataPort  ; 2, DEVICE_8BIT_XTIDE_REV2
    422     %else
    423         dw      ReadBlockFromXtideRev2      ; 2, DEVICE_8BIT_XTIDE_REV2
     236        dw      IdePioBlock_ReadFromXtideRev1       ; 2, DEVICE_8BIT_XTIDE_REV1
     237    %ifndef USE_AT
     238        g_rgfnPioWrite:
    424239    %endif
    425         dw      ReadBlockFromXtideRev1      ; 3, DEVICE_XTIDE_REV1
    426 
    427 %else
    428         times   COUNT_OF_8BIT_IDE_DEVICES   dw  0
    429 %endif
     240        dw      IdePioBlock_ReadFromXtideRev2       ; 3, DEVICE_8BIT_XTIDE_REV2
     241        dw      IdePioBlock_ReadFrom8bitDataPort    ; 4, DEVICE_8BIT_XTCF_PIO8
     242%endif
     243
    430244%ifdef USE_AT
    431         dw      ReadBlockFrom16bitDataPort  ; 4, DEVICE_16BIT_ATA
    432         dw      ReadBlockFrom32bitDataPort  ; 5, DEVICE_32BIT_ATA
    433 %endif
    434 
    435 
    436245g_rgfnPioWrite:
     246        dw      IdePioBlock_WriteTo16bitDataPort    ; 0, DEVICE_16BIT_ATA
     247        dw      IdePioBlock_WriteTo32bitDataPort    ; 1, DEVICE_32BIT_ATA
     248%endif
    437249%ifdef MODULE_8BIT_IDE
    438         dw      0                           ; 0, DEVICE_8BIT_JRIDE_ISA
    439         dw      WriteBlockTo8bitDataPort    ; 1, DEVICE_8BIT_XTCF
    440         dw      WriteBlockToXtideRev2       ; 2, DEVICE_XTIDE_REV2
    441         dw      WriteBlockToXtideRev1       ; 3, DEVICE_XTIDE_REV1
    442 
    443 %else
    444         times   COUNT_OF_8BIT_IDE_DEVICES   dw  0
    445 %endif
    446 %ifdef USE_AT
    447         dw      WriteBlockTo16bitDataPort   ; 4, DEVICE_16BIT_ATA
    448         dw      WriteBlockTo32bitDataPort   ; 5, DEVICE_32BIT_ATA
    449 %endif
     250        dw      IdePioBlock_WriteToXtideRev1        ; 2, DEVICE_8BIT_XTIDE_REV1
     251        dw      IdePioBlock_WriteToXtideRev2        ; 3, DEVICE_8BIT_XTIDE_REV2
     252        dw      IdePioBlock_WriteTo8bitDataPort     ; 4, DEVICE_8BIT_XTCF_PIO8
     253%endif
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/JrIdeTransfer.asm

    r445 r473  
    2828endstruc
    2929
     30SECTOR_ACCESS_WINDOW_SIZE   EQU     512 ; 512 bytes
     31
    3032
    3133; Section containing code
     
    3739;       AL:     IDE command that was used to start the transfer
    3840;               (all PIO read and write commands including Identify Device)
    39 ;       ES:SI:  Ptr to normalized data buffer
     41;       ES:SI:  Ptr to normalized data buffer (SI 0...15)
    4042;       DS:DI:  Ptr to DPT (in RAMVARS segment)
    4143;       SS:BP:  Ptr to IDEPACK
     
    4951ALIGN JUMP_ALIGN
    5052JrIdeTransfer_StartWithCommandInAL:
    51     push    cs  ; We push CS here (segment of SAW) and later pop it to DS (reads) or ES (writes)
    52 
    53     ; Initialize PIOVARS
    54     xor     cx, cx
    55     mov     [bp+MEMPIOVARS.bSectorsDone], cl
    56     mov     cl, [bp+IDEPACK.bSectorCount]
    57     mov     [bp+MEMPIOVARS.bSectorsLeft], cl
    58     mov     cl, [di+DPT_ATA.bBlockSize]
    59     mov     [bp+MEMPIOVARS.wSectorsInBlock], cx
     53    ; Initialize MEMPIOVARS
     54    xchg    cx, ax          ; IDE command to CL
     55    xor     ax, ax
     56    mov     [bp+MEMPIOVARS.bSectorsDone], al
     57    mov     al, [bp+IDEPACK.bSectorCount]
     58    mov     [bp+MEMPIOVARS.bSectorsLeft], al
     59    mov     al, [di+DPT_ATA.bBlockSize]
     60    mov     [bp+MEMPIOVARS.wSectorsInBlock], ax
    6061    mov     [bp+MEMPIOVARS.fpDPT], di
    6162    mov     [bp+MEMPIOVARS.fpDPT+2], ds
    6263
     64    ; Get far pointer to Sector Access Window
     65    mov     dx, [di+DPT.wBasePort]
     66    cmp     BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_JRIDE_ISA
     67    jne     SHORT .GetSectorAccessWindowForXTCF
     68
     69    ; Get Sector Access Window for JR-IDE/ISA
     70    mov     di, JRIDE_SECTOR_ACCESS_WINDOW_OFFSET
     71    mov     ds, dx      ; Segment for JR-IDE/ISA
     72    jmp     SHORT .SectorAccessWindowLoadedToDSDI
     73
     74.GetSectorAccessWindowForXTCF:
     75    xor     di, di
     76    add     dl, XTCF_CONTROL_REGISTER
     77    in      al, dx                  ; Read high byte for Sector Access Window segment
     78    xchg    ah, al
     79    mov     ds, ax
     80
    6381    ; Are we reading or writing?
    64     test    al, 16  ; Bit 4 is cleared on all the read commands but set on 3 of the 4 write commands
     82.SectorAccessWindowLoadedToDSDI:
     83    test    cl, 16  ; Bit 4 is cleared on all the read commands but set on 3 of the 4 write commands
    6584    jnz     SHORT WriteToSectorAccessWindow
    66     cmp     al, COMMAND_WRITE_MULTIPLE
     85    cmp     cl, COMMAND_WRITE_MULTIPLE
    6786    je      SHORT WriteToSectorAccessWindow
    6887    ; Fall to ReadFromSectorAccessWindow
     
    7190; ReadFromSectorAccessWindow
    7291;   Parameters:
    73 ;       Stack:  Segment part of ptr to Sector Access Window
     92;       DS:DI:  Ptr to Sector Access Window
    7493;       ES:SI:  Normalized ptr to buffer to receive data
    7594;       SS:BP:  Ptr to MEMPIOVARS
     
    84103;--------------------------------------------------------------------
    85104ReadFromSectorAccessWindow:
    86     pop     ds      ; CS -> DS
    87     mov     di, si  ; ES:DI = destination
    88     mov     si, JRIDE_SECTOR_ACCESS_WINDOW_OFFSET   ; DS:SI = source
    89 
     105    xchg    si, di  ; DS:SI = source, ES:DI = Destination
    90106    call    WaitUntilReadyToTransferNextBlock
    91107    jc      SHORT ReturnWithMemoryIOtransferErrorInAH
     
    140156; WriteToSectorAccessWindow
    141157;   Parameters:
    142 ;       Stack:  Segment part of ptr to Sector Access Window
     158;       DS:DI:  Ptr to Sector Access Window
    143159;       ES:SI:  Normalized ptr to buffer containing data
    144160;       SS:BP:  Ptr to MEMPIOVARS
     
    155171WriteToSectorAccessWindow:
    156172    push    es
    157     pop     ds
    158     pop     es  ; CS -> ES
    159     mov     di, JRIDE_SECTOR_ACCESS_WINDOW_OFFSET
     173    push    ds
     174    pop     es      ; ES:DI = Sector Access Window (destination)
     175    pop     ds      ; DS:SI = Ptr to source buffer
    160176
    161177    ; Always poll when writing first block (IRQs are generated for following blocks)
     
    205221ALIGN JUMP_ALIGN
    206222.WriteBlock:
    207     mov     ch, JRIDE_SECTOR_ACCESS_WINDOW_SIZE >> 9
     223    mov     ch, SECTOR_ACCESS_WINDOW_SIZE >> 9
    208224    rep movsw
    209225    mov     di, bx  ; Reset for next sector
     
    232248ALIGN JUMP_ALIGN
    233249.ReadBlock:
    234     mov     ch, JRIDE_SECTOR_ACCESS_WINDOW_SIZE >> 9
     250    mov     ch, SECTOR_ACCESS_WINDOW_SIZE >> 9
    235251    rep movsw
    236252    mov     si, bx  ; Reset for next sector
     
    261277
    262278
    263 %if JRIDE_SECTOR_ACCESS_WINDOW_SIZE <> 512
    264     %error "JRIDE_SECTOR_ACCESS_WINDOW_SIZE is no longer equal to 512. JrIdeTransfer.asm needs changes."
     279%if SECTOR_ACCESS_WINDOW_SIZE <> 512
     280    %error "SECTOR_ACCESS_WINDOW_SIZE is no longer equal to 512. JrIdeTransfer.asm needs changes."
    265281%endif
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH1Eh_XTCF.asm

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

    r376 r473  
    7474    mov     bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_BSY, FLG_STATUS_BSY)
    7575    jmp     Idepack_StoreNonExtParametersAndIssueCommandFromAL
     76
     77
     78%ifdef MODULE_8BIT_IDE
     79;--------------------------------------------------------------------
     80; AH23h_Enable8bitPioMode
     81; AH23h_Disable8bitPioMode
     82;   Parameters:
     83;       DS:DI:  Ptr to DPT (in RAMVARS segment)
     84;       SS:BP:  Ptr to IDEPACK
     85;   Returns:
     86;       AH:     Int 13h return status
     87;       CF:     0 if successful, 1 if error
     88;   Corrupts registers:
     89;       AL, BX, CX, DX, SI
     90;--------------------------------------------------------------------
     91AH23h_Enable8bitPioMode:
     92    mov     si, FEATURE_ENABLE_8BIT_PIO_TRANSFER_MODE
     93    jmp     SHORT AH23h_SetControllerFeatures
     94AH23h_Disable8bitPioMode:
     95    mov     si, FEATURE_DISABLE_8BIT_PIO_TRANSFER_MODE
     96    jmp     SHORT AH23h_SetControllerFeatures
     97%endif ; MODULE_8BIT_IDE
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH24h_HSetBlocks.asm

    r376 r473  
    5959;--------------------------------------------------------------------
    6060AH24h_SetBlockSize:
     61    ; XT-CF does not support largest block size in DMA mode.
     62%ifdef MODULE_8BIT_IDE
     63    call    AccessDPT_IsThisDeviceXTCF
     64    cmp     ah, DEVICE_8BIT_XTCF_DMA
     65    jne     SHORT .NoNeedToLimitBlockSize
     66    cmp     al, XTCF_DMA_MODE_MAX_BLOCK_SIZE
     67    ja      SHORT AH1Eh_LoadInvalidCommandToAHandSetCF
     68.NoNeedToLimitBlockSize:
     69%endif ; MODULE_8BIT_IDE
     70
    6171    push    bx
    6272
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm

    r445 r473  
    104104    jmp     .ReturnWithErrorCodeInAH
    105105.ContinueInitializationSinceDriveSelectedSuccesfully:
     106
     107
     108;;; Set XT-CF mode
     109%ifdef MODULE_8BIT_IDE
     110    call    AccessDPT_IsThisDeviceXTCF
     111    jne     SHORT .DoNotSetXTCFmode
     112
     113    call    AccessDPT_GetIdevarsToCSBX
     114    mov     al, [cs:bx+IDEVARS.bXTCFcontrolRegister]
     115    call    AH1Eh_ChangeXTCFmodeBasedOnControlRegisterInAL
     116    STORE_ERROR_FLAG_TO_DPT     FLG_INITERROR_FAILED_TO_SET_XTCF_MODE
     117.DoNotSetXTCFmode:
     118%endif
    106119
    107120
     
    125138    STORE_ERROR_FLAG_TO_DPT     FLG_INITERROR_FAILED_TO_INITIALIZE_CHS_PARAMETERS
    126139.SkipInitializeDeviceParameters:
    127 
    128 
    129 %ifdef MODULE_8BIT_IDE
    130 ;;; Enable 8-bit PIO Transfer Mode for Lo-tech XT-CF (CF and Microdrives only)
    131     call    AH9h_Enable8bitPioModeForXTCF
    132     STORE_ERROR_FLAG_TO_DPT     FLG_INITERROR_FAILED_TO_ENABLE_8BIT_PIO_MODE
    133 %endif
    134140
    135141
     
    244250;       Nothing
    245251;--------------------------------------------------------------------
    246 DoNotEnable8bitMode:
    247252IgnoreInvalidCommandError:
    248253    xor     ah, ah  ; Clears CF
     
    256261.NoErrorFlagToSet:
    257262    ret
    258 
    259 
    260 %ifdef MODULE_8BIT_IDE
    261 ;--------------------------------------------------------------------
    262 ; AH9h_Enable8bitPioModeForXTCF
    263 ;   Parameters:
    264 ;       DS:DI:  Ptr to DPT
    265 ;       SS:BP:  Ptr to IDEPACK
    266 ;   Returns:
    267 ;       AH:     Int 13h return status
    268 ;       CF:     0 if successful, 1 if error
    269 ;   Corrupts registers:
    270 ;       AL, BX, CX, DX, SI
    271 ;--------------------------------------------------------------------
    272 AH9h_Enable8bitPioModeForXTCF:
    273     eMOVZX  bx, [di+DPT.bIdevarsOffset]
    274     cmp     BYTE [cs:bx+IDEVARS.bDevice], DEVICE_8BIT_XTCF
    275     jne     SHORT DoNotEnable8bitMode
    276 
    277     mov     si, FEATURE_ENABLE_8BIT_PIO_TRANSFER_MODE
    278     jmp     AH23h_SetControllerFeatures
    279 %endif ; MODULE_8BIT_IDE
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AHDh_HReset.asm

    r445 r473  
    7070
    7171    ; Initialize Master and Slave drives
    72     eMOVZX  ax, [di+DPT.bIdevarsOffset]         ; (AL) pointer to controller we are looking to reset
     72    call    AccessDPT_GetIdevarsToCSBX
     73    xchg    ax, bx                              ; (AL) pointer to controller we are looking to reset
    7374                                                ; (AH) initialize error code, assume success
    7475
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/AdvancedAta/Vision.asm

    r398 r473  
    179179    ; QD6500 has only one channel that can be Primary at 1F0h or Secondary at 170h.
    180180    ; QD6580 always has Primary channel at 1F0h. Secondary channel at 170h can be Enabled or Disabled.
    181     call    AccessDPT_GetIdeBasePortToBX
     181    mov     bx, [di+DPT.wBasePort]
    182182    cmp     bx, DEVICE_ATA_PRIMARY_PORT
    183183    je      SHORT .CalculateTimingTicksForQD6580    ; Primary Channel so no need to modify DX
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectDrives.asm

    r441 r473  
    150150;       None
    151151;   Corrupts registers:
    152 ;       AX, BX, CX, DX, SI, DI
     152;       AX, BL, CX, DX, SI, DI
    153153;--------------------------------------------------------------------
    154154StartDetectionWithDriveSelectByteInBHandStringInCX:
     
    157157    call    HotkeyBar_UpdateDuringDriveDetection
    158158%endif
     159    ; Fall to .AutodetectXTCFport or .ReadAtaInfoFromHardDisk
     160
     161
     162%ifdef MODULE_8BIT_IDE
     163;--------------------------------------------------------------------
     164; .AutodetectXTCFport
     165;   Parameters:
     166;       BH:     Drive Select byte for Drive and Head Register
     167;       CS:BP:  Ptr to IDEVARS for the drive
     168;       DS:     RAMVARS segment
     169;       ES:     Zero (BDA segment)
     170;   Returns:
     171;       DX:     Autodetected port (for devices that support autodetection)
     172;   Corrupts registers:
     173;       AX
     174;--------------------------------------------------------------------
     175.AutodetectXTCFport:
     176    ; Detect port for XTCF
     177    call    DetectDrives_DoesIdevarsInCSBPbelongToXTCF
     178    jne     SHORT .SkipXTCFportDetection
     179
     180    ; XT-CF do not support slave drives so we can safely update port
     181    ; for next drive (another XT-CF card on same system)
     182.DetectNextPort:
     183    call    BootVars_GetNextXTCFportToDetectToDX
     184    cmp     dx, XTCF_BASE_PORT_4
     185    ja      SHORT DetectDrives_DriveNotFound    ; XT-CF not found from any port
     186
     187    call    AH1Eh_DetectXTCFwithBasePortInDX
     188    jc      SHORT .DetectNextPort               ; XT-CF not found from this port
     189.SkipXTCFportDetection:
    159190    ; Fall to .ReadAtaInfoFromHardDisk
     191%endif ; MODULE_8BIT_IDE
     192
    160193
    161194;--------------------------------------------------------------------
     
    163196;   Parameters:
    164197;       BH:     Drive Select byte for Drive and Head Register
     198;       DX:     Autodetected port (for devices that support autodetection)
    165199;       CS:BP:  Ptr to IDEVARS for the drive
    166200;       DS:     RAMVARS segment
     
    176210    push    es
    177211    push    si
     212    push    dx
    178213    push    bx
    179214    call    Device_IdentifyToBufferInESSIwithDriveSelectByteInBH
    180215    pop     bx
     216    pop     dx
    181217    pop     si
    182218    pop     es
     
    208244;   Parameters:
    209245;       BH:     Drive Select byte for Drive and Head Register
     246;       DX:     Autodetected port (for devices that support autodetection)
    210247;       CS:BP:  Ptr to IDEVARS for the drive
    211248;       ES:SI   Ptr to ATA information for the drive
     
    226263    call    DriveDetectInfo_CreateForHardDisk
    227264    jmp     SHORT DetectPrint_DriveNameFromDrvDetectInfoInESBX
     265
     266
     267%ifdef MODULE_8BIT_IDE
     268;--------------------------------------------------------------------
     269; DetectDrives_DoesIdevarsInCSBPbelongToXTCF
     270;   Parameters:
     271;       CS:BP:  Ptr to IDEVARS for the drive
     272;   Returns:
     273;       ZF:     Set if IDEVARS belongs to XT-CF device
     274;               Cleared if some other device
     275;   Corrupts registers:
     276;       AL
     277;--------------------------------------------------------------------
     278DetectDrives_DoesIdevarsInCSBPbelongToXTCF:
     279    mov     al, [cs:bp+IDEVARS.bDevice]
     280    cmp     al, DEVICE_8BIT_XTCF_PIO8
     281    je      SHORT .DeviceIsXTCF
     282    cmp     al, DEVICE_8BIT_XTCF_DMA
     283    je      SHORT .DeviceIsXTCF
     284    cmp     al, DEVICE_8BIT_XTCF_MEMMAP
     285.DeviceIsXTCF:
     286    ret
     287%endif ; MODULE_8BIT_IDE
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectPrint.asm

    r400 r473  
    7979;       Nothing
    8080;   Corrupts registers:
    81 ;       AX, SI, DI, CX
     81;       AX, SI, DI, CX, DX
    8282;--------------------------------------------------------------------
    8383DetectPrint_StartDetectWithMasterOrSlaveStringInCXandIdeVarsInCSBP:
    84     mov     ax, [cs:bp+IDEVARS.wPort]       ; for IDE: AX=port address, DH=.bDevice
     84    mov     ax, [cs:bp+IDEVARS.wBasePort]   ; for IDE: AX=port address, DH=.bDevice
    8585    mov     dx, [cs:bp+IDEVARS.bDevice-1]   ; for Serial: AL=port address>>2, AH=baud rate
    8686                                            ;             DL=COM number character, DH=.bDevice
    87 %ifdef MODULE_JRIDE
    88     cmp     dh, DEVICE_8BIT_JRIDE_ISA
    89     eCMOVE  ax, cs                          ; Use segment address for JR-IDE/ISA
    90 %endif
    9187
    9288    push    bp                              ; setup stack for call to
  • trunk/XTIDE_Universal_BIOS/Src/Main.asm

    r471 r473  
    8888    at  ROMVARS.bIdleTimeout,   db  0                       ; Standby timer disabled by default
    8989
    90     at  ROMVARS.ideVars0+IDEVARS.wPort,         dw  DEVICE_ATA_PRIMARY_PORT         ; Controller Command Block base port
    91     at  ROMVARS.ideVars0+IDEVARS.wPortCtrl,     dw  DEVICE_ATA_PRIMARY_PORTCTRL     ; Controller Control Block base port
    92     at  ROMVARS.ideVars0+IDEVARS.bDevice,       db  DEVICE_16BIT_ATA
    93     at  ROMVARS.ideVars0+IDEVARS.bIRQ,          db  0
     90    at  ROMVARS.ideVars0+IDEVARS.wBasePort,         dw  DEVICE_ATA_PRIMARY_PORT         ; Controller Command Block base port
     91    at  ROMVARS.ideVars0+IDEVARS.wControlBlockPort, dw  DEVICE_ATA_PRIMARY_PORTCTRL     ; Controller Control Block base port
     92    at  ROMVARS.ideVars0+IDEVARS.bDevice,           db  DEVICE_16BIT_ATA
     93    at  ROMVARS.ideVars0+IDEVARS.bIRQ,              db  0
    9494    at  ROMVARS.ideVars0+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags,  dw  DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION)
    9595    at  ROMVARS.ideVars0+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags,   dw  DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION)
    9696
    97     at  ROMVARS.ideVars1+IDEVARS.wPort,         dw  DEVICE_ATA_SECONDARY_PORT
    98     at  ROMVARS.ideVars1+IDEVARS.wPortCtrl,     dw  DEVICE_ATA_SECONDARY_PORTCTRL
    99     at  ROMVARS.ideVars1+IDEVARS.bDevice,       db  DEVICE_16BIT_ATA
    100     at  ROMVARS.ideVars1+IDEVARS.bIRQ,          db  0
     97    at  ROMVARS.ideVars1+IDEVARS.bXTCFcontrolRegister,  db  0
     98    at  ROMVARS.ideVars1+IDEVARS.bDevice,               db  DEVICE_8BIT_XTCF_PIO8
     99    ;at ROMVARS.ideVars1+IDEVARS.wBasePort,     dw  DEVICE_ATA_SECONDARY_PORT
     100    ;at ROMVARS.ideVars1+IDEVARS.wControlBlockPort,     dw  DEVICE_ATA_SECONDARY_PORTCTRL
     101    ;at ROMVARS.ideVars1+IDEVARS.bDevice,       db  DEVICE_16BIT_ATA
     102    ;at ROMVARS.ideVars1+IDEVARS.bIRQ,          db  0
    101103    at  ROMVARS.ideVars1+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags,  dw  DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION)
    102104    at  ROMVARS.ideVars1+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags,   dw  DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION)
    103105
    104     at  ROMVARS.ideVars2+IDEVARS.wPort,         dw  DEVICE_ATA_TERTIARY_PORT
    105     at  ROMVARS.ideVars2+IDEVARS.wPortCtrl,     dw  DEVICE_ATA_TERTIARY_PORTCTRL
    106     at  ROMVARS.ideVars2+IDEVARS.bDevice,       db  DEVICE_16BIT_ATA
    107     at  ROMVARS.ideVars2+IDEVARS.bIRQ,          db  0
     106    at  ROMVARS.ideVars2+IDEVARS.wBasePort,         dw  DEVICE_ATA_TERTIARY_PORT
     107    at  ROMVARS.ideVars2+IDEVARS.wControlBlockPort, dw  DEVICE_ATA_TERTIARY_PORTCTRL
     108    at  ROMVARS.ideVars2+IDEVARS.bDevice,           db  DEVICE_16BIT_ATA
     109    at  ROMVARS.ideVars2+IDEVARS.bIRQ,              db  0
    108110    at  ROMVARS.ideVars2+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags,  dw  DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION)
    109111    at  ROMVARS.ideVars2+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags,   dw  DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION)
    110112
    111     at  ROMVARS.ideVars3+IDEVARS.wPort,         dw  DEVICE_ATA_QUATERNARY_PORT
    112     at  ROMVARS.ideVars3+IDEVARS.wPortCtrl,     dw  DEVICE_ATA_QUATERNARY_PORTCTRL
    113     at  ROMVARS.ideVars3+IDEVARS.bDevice,       db  DEVICE_16BIT_ATA
    114     at  ROMVARS.ideVars3+IDEVARS.bIRQ,          db  0
     113    at  ROMVARS.ideVars3+IDEVARS.wBasePort,         dw  DEVICE_ATA_QUATERNARY_PORT
     114    at  ROMVARS.ideVars3+IDEVARS.wControlBlockPort, dw  DEVICE_ATA_QUATERNARY_PORTCTRL
     115    at  ROMVARS.ideVars3+IDEVARS.bDevice,           db  DEVICE_16BIT_ATA
     116    at  ROMVARS.ideVars3+IDEVARS.bIRQ,              db  0
    115117    at  ROMVARS.ideVars3+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags,  dw  DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION)
    116118    at  ROMVARS.ideVars3+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags,   dw  DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION)
     
    128130        at  ROMVARS.wBootTimeout,   dw  BOOT_MENU_DEFAULT_TIMEOUT
    129131%endif
    130     at  ROMVARS.bIdeCnt,        db  1                       ; Number of supported controllers
     132    at  ROMVARS.bIdeCnt,        db  2                       ; Number of supported controllers
    131133    at  ROMVARS.bBootDrv,       db  80h                     ; Boot Menu default drive
    132134    at  ROMVARS.bMinFddCnt,     db  0                       ; Do not force minimum number of floppy drives
     
    134136    at  ROMVARS.bIdleTimeout,   db  0                       ; Standby timer disabled by default
    135137
    136     at  ROMVARS.ideVars0+IDEVARS.wPort,         dw  DEVICE_XTIDE_DEFAULT_PORT           ; Controller Command Block base port
    137     at  ROMVARS.ideVars0+IDEVARS.wPortCtrl,     dw  DEVICE_XTIDE_DEFAULT_PORTCTRL       ; Controller Control Block base port
    138     at  ROMVARS.ideVars0+IDEVARS.bDevice,       db  DEVICE_8BIT_XTIDE_REV1
     138    at  ROMVARS.ideVars0+IDEVARS.wBasePort,         dw  DEVICE_XTIDE_DEFAULT_PORT           ; Controller Command Block base port
     139    at  ROMVARS.ideVars0+IDEVARS.wControlBlockPort, dw  DEVICE_XTIDE_DEFAULT_PORTCTRL       ; Controller Control Block base port
     140    at  ROMVARS.ideVars0+IDEVARS.bDevice,           db  DEVICE_8BIT_XTIDE_REV1
    139141    at  ROMVARS.ideVars0+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags,  db  DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION)
    140142    at  ROMVARS.ideVars0+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags,   db  DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION)
    141143
     144    at  ROMVARS.ideVars1+IDEVARS.bXTCFcontrolRegister,  db  0
     145    at  ROMVARS.ideVars1+IDEVARS.bDevice,               db  DEVICE_8BIT_XTCF_PIO8
    142146    at  ROMVARS.ideVars1+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags,  db  DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION)
    143147    at  ROMVARS.ideVars1+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags,   db  DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION)
     
    223227%endif
    224228    %include "IdeCommand.asm"
    225 %ifdef MODULE_JRIDE
     229%ifdef MODULE_8BIT_IDE
    226230    %include "JrIdeTransfer.asm"    ; Must be included after IdeCommand.asm
    227231%endif
    228232    %include "IdeTransfer.asm"
     233    %include "IdePioBlock.asm"
    229234    %include "IdeWait.asm"
    230235    %include "IdeError.asm"         ; Must be included after IdeWait.asm
  • trunk/XTIDE_Universal_BIOS/Src/Menus/BootMenu/BootMenuPrintCfg.asm

    r422 r473  
    8888
    8989;--------------------------------------------------------------------
    90 ; PushBusType
     90; PushDeviceType
    9191;   Parameters:
    9292;       DS:DI:  Ptr to DPT
     
    9797;       AX, DX
    9898;--------------------------------------------------------------------
    99 .PushBusType:
    100     mov     al,g_szBusTypeValues_Displacement
    101     mul     BYTE [cs:bx+IDEVARS.bDevice]
     99.PushDeviceType:
     100    mov     al,g_szDeviceTypeValues_Displacement
     101%ifdef MODULE_SERIAL
     102    mov     ah, [cs:bx+IDEVARS.bDevice]
     103    test    BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE
     104    eCMOVZ  ah, [di+DPT_ATA.bDevice]    ; DPT_ATA contains up to date device information for IDE drives
     105    mul     ah
     106%else   
     107    mul     BYTE [di+DPT_ATA.bDevice]
     108%endif
    102109
    103110    shr     ax,1            ; divide by 2 since IDEVARS.bDevice is multiplied by 2
    104111
    105     add     ax,g_szBusTypeValues
     112    add     ax, g_szDeviceTypeValues
    106113    push    ax
    107114
  • trunk/XTIDE_Universal_BIOS/Src/Strings.asm

    r421 r473  
    117117%endif
    118118
    119 g_szBusTypeValues:
    120 g_szBusTypeValues_8JrIde:       db      "M8 ",NULL
    121 g_szBusTypeValues_8Fast:        db      "F8 ",NULL
    122 g_szBusTypeValues_8Reversed:    db      "X8 ",NULL
    123 g_szBusTypeValues_8Dual:        db      "D8 ",NULL
    124 g_szBusTypeValues_16:           db      " 16",NULL
    125 g_szBusTypeValues_32:           db      " 32",NULL
    126 g_szBusTypeValues_Serial:       db      "SER",NULL
    127 
    128 g_szBusTypeValues_Displacement equ (g_szBusTypeValues_8Fast - g_szBusTypeValues)
    129 ;
    130 ; Ensure that bus type strings are correctly spaced in memory
    131 ;
    132 %ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
    133     %if g_szBusTypeValues_8JrIde <> g_szBusTypeValues
    134         %error "g_szBusTypeValues Displacement Incorrect 1"
    135     %endif
    136     %if g_szBusTypeValues_8Fast <> g_szBusTypeValues + g_szBusTypeValues_Displacement
    137         %error "g_szBusTypeValues Displacement Incorrect 2"
    138     %endif
    139     %if g_szBusTypeValues_8Reversed <> g_szBusTypeValues_8Fast + g_szBusTypeValues_Displacement
    140         %error "g_szBusTypeValues Displacement Incorrect 3"
    141     %endif
    142     %if g_szBusTypeValues_8Dual <> g_szBusTypeValues_8Reversed + g_szBusTypeValues_Displacement
    143         %error "g_szBusTypeValues Displacement Incorrect 4"
    144     %endif
    145     %if g_szBusTypeValues_16 <> g_szBusTypeValues_8Dual + g_szBusTypeValues_Displacement
    146         %error "g_szBusTypeValues Displacement Incorrect 5"
    147     %endif
    148     %if g_szBusTypeValues_32 <> g_szBusTypeValues_16 + g_szBusTypeValues_Displacement
    149         %error "g_szBusTypeValues Displacement Incorrect 6"
    150     %endif
    151     %if g_szBusTypeValues_Serial <> g_szBusTypeValues_32 + g_szBusTypeValues_Displacement
    152         %error "g_szBusTypeValues Displacement Incorrect 7"
     119g_szDeviceTypeValues:
     120g_szDeviceTypeValues_16bit:     db      " 16",NULL
     121g_szDeviceTypeValues_32bit:     db      " 32",NULL
     122g_szDeviceTypeValues_XTIDEr1:   db      "D8 ",NULL  ; Dual 8-bit
     123g_szDeviceTypeValues_XTIDEr2:   db      "X8 ",NULL  ; A0<->A3 swapped 8-bit
     124g_szDeviceTypeValues_XTCFpio8:  db      "T8 ",NULL  ; True 8-bit
     125g_szDeviceTypeValues_XTCFdma:   db      "8MA",NULL  ; DMA 8-bit
     126g_szDeviceTypeValues_XTCFmem:   db      "M8 ",NULL  ; Memory Mapped 8-bit
     127g_szDeviceTypeValues_JrIde:     db      "M8 ",NULL
     128g_szDeviceTypeValues_Serial:    db      "SER",NULL
     129
     130g_szDeviceTypeValues_Displacement equ (g_szDeviceTypeValues_32bit - g_szDeviceTypeValues)
     131;
     132; Ensure that device type strings are correctly spaced in memory
     133;
     134%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
     135    %if g_szDeviceTypeValues_16bit <> g_szDeviceTypeValues
     136        %error "g_szDeviceTypeValues Displacement Incorrect 1"
     137    %endif
     138    %if g_szDeviceTypeValues_32bit <> g_szDeviceTypeValues + g_szDeviceTypeValues_Displacement
     139        %error "g_szDeviceTypeValues Displacement Incorrect 2"
     140    %endif
     141    %if g_szDeviceTypeValues_XTIDEr1 <> g_szDeviceTypeValues_32bit + g_szDeviceTypeValues_Displacement
     142        %error "g_szDeviceTypeValues Displacement Incorrect 3"
     143    %endif
     144    %if g_szDeviceTypeValues_XTIDEr2 <> g_szDeviceTypeValues_XTIDEr1 + g_szDeviceTypeValues_Displacement
     145        %error "g_szDeviceTypeValues Displacement Incorrect 4"
     146    %endif
     147    %if g_szDeviceTypeValues_XTCFpio8 <> g_szDeviceTypeValues_XTIDEr2 + g_szDeviceTypeValues_Displacement
     148        %error "g_szDeviceTypeValues Displacement Incorrect 5"
     149    %endif
     150    %if g_szDeviceTypeValues_XTCFdma <> g_szDeviceTypeValues_XTCFpio8 + g_szDeviceTypeValues_Displacement
     151        %error "g_szDeviceTypeValues Displacement Incorrect 6"
     152    %endif
     153    %if g_szDeviceTypeValues_XTCFmem <> g_szDeviceTypeValues_XTCFdma + g_szDeviceTypeValues_Displacement
     154        %error "g_szDeviceTypeValues Displacement Incorrect 7"
     155    %endif
     156    %if g_szDeviceTypeValues_JrIde <> g_szDeviceTypeValues_XTCFmem + g_szDeviceTypeValues_Displacement
     157        %error "g_szDeviceTypeValues Displacement Incorrect 8"
     158    %endif
     159    %if g_szDeviceTypeValues_Serial <> g_szDeviceTypeValues_JrIde + g_szDeviceTypeValues_Displacement
     160        %error "g_szDeviceTypeValues Displacement Incorrect 9"
    153161    %endif
    154162%endif
  • trunk/XTIDE_Universal_BIOS/Src/StringsCompressed.asm

    r421 r473  
    217217%endif
    218218
    219 g_szBusTypeValues:
    220 g_szBusTypeValues_8JrIde:       ; db        "M8 ",NULL
    221                                 ; db         4dh,  38h,  20h,  00h    ; uncompressed
    222                                   db         53h,  31h,  00h          ; compressed
    223 
    224 g_szBusTypeValues_8Fast:        ; db        "F8 ",NULL
    225                                 ; db         46h,  38h,  20h,  00h    ; uncompressed
    226                                   db         4ch,  31h,  00h          ; compressed
    227 
    228 g_szBusTypeValues_8Reversed:    ; db        "X8 ",NULL
    229                                 ; db         58h,  38h,  20h,  00h    ; uncompressed
    230                                   db         5eh,  31h,  00h          ; compressed
    231 
    232 g_szBusTypeValues_8Dual:        ; db        "D8 ",NULL
    233                                 ; db         44h,  38h,  20h,  00h    ; uncompressed
    234                                   db         4ah,  31h,  00h          ; compressed
    235 
    236 g_szBusTypeValues_16:           ; db        " 16",NULL
    237                                 ; db         20h,  31h,  36h,  00h    ; uncompressed
    238                                   db         20h,  2bh,  10h          ; compressed
    239 
    240 g_szBusTypeValues_32:           ; db        " 32",NULL
    241                                 ; db         20h,  33h,  32h,  00h    ; uncompressed
    242                                   db         20h,  2dh,  0ch          ; compressed
    243 
    244 g_szBusTypeValues_Serial:       ; db        "SER",NULL
    245                                 ; db         53h,  45h,  52h,  00h    ; uncompressed
    246                                   db         59h,  4bh,  98h          ; compressed
    247 
    248 
    249 g_szBusTypeValues_Displacement equ (g_szBusTypeValues_8Fast - g_szBusTypeValues)
    250 ;
    251 ; Ensure that bus type strings are correctly spaced in memory
     219g_szDeviceTypeValues:
     220g_szDeviceTypeValues_16bit:     ; db        " 16",NULL
     221                                ; db         20h,  31h,  36h,  00h    ; uncompressed
     222                                  db         20h,  2bh,  10h          ; compressed
     223
     224g_szDeviceTypeValues_32bit:     ; db        " 32",NULL
     225                                ; db         20h,  33h,  32h,  00h    ; uncompressed
     226                                  db         20h,  2dh,  0ch          ; compressed
     227
     228g_szDeviceTypeValues_XTIDEr1:   ; db        "D8 ",NULL  ; Dual 8-bit
     229                                ; db         44h,  38h,  20h,  00h    ; uncompressed
     230                                  db         4ah,  31h,  00h          ; compressed
     231
     232g_szDeviceTypeValues_XTIDEr2:   ; db        "X8 ",NULL  ; A0<->A3 swapped 8-bit
     233                                ; db         58h,  38h,  20h,  00h    ; uncompressed
     234                                  db         5eh,  31h,  00h          ; compressed
     235
     236g_szDeviceTypeValues_XTCFpio8:  ; db        "T8 ",NULL  ; True 8-bit
     237                                ; db         54h,  38h,  20h,  00h    ; uncompressed
     238                                  db         5ah,  31h,  00h          ; compressed
     239
     240g_szDeviceTypeValues_XTCFdma:   ; db        "8MA",NULL  ; DMA 8-bit
     241                                ; db         38h,  4dh,  41h,  00h    ; uncompressed
     242                                  db         31h,  53h,  87h          ; compressed
     243
     244g_szDeviceTypeValues_XTCFmem:   ; db        "M8 ",NULL  ; Memory Mapped 8-bit
     245                                ; db         4dh,  38h,  20h,  00h    ; uncompressed
     246                                  db         53h,  31h,  00h          ; compressed
     247
     248g_szDeviceTypeValues_JrIde:     ; db        "M8 ",NULL
     249                                ; db         4dh,  38h,  20h,  00h    ; uncompressed
     250                                  db         53h,  31h,  00h          ; compressed
     251
     252g_szDeviceTypeValues_Serial:    ; db        "SER",NULL
     253                                ; db         53h,  45h,  52h,  00h    ; uncompressed
     254                                  db         59h,  4bh,  98h          ; compressed
     255
     256
     257g_szDeviceTypeValues_Displacement equ (g_szDeviceTypeValues_32bit - g_szDeviceTypeValues)
     258;
     259; Ensure that device type strings are correctly spaced in memory
    252260;
    253261%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
    254 %if g_szBusTypeValues_8JrIde <> g_szBusTypeValues
    255 %error "g_szBusTypeValues Displacement Incorrect 1"
    256 %endif
    257 %if g_szBusTypeValues_8Fast <> g_szBusTypeValues + g_szBusTypeValues_Displacement
    258 %error "g_szBusTypeValues Displacement Incorrect 2"
    259 %endif
    260 %if g_szBusTypeValues_8Reversed <> g_szBusTypeValues_8Fast + g_szBusTypeValues_Displacement
    261 %error "g_szBusTypeValues Displacement Incorrect 3"
    262 %endif
    263 %if g_szBusTypeValues_8Dual <> g_szBusTypeValues_8Reversed + g_szBusTypeValues_Displacement
    264 %error "g_szBusTypeValues Displacement Incorrect 4"
    265 %endif
    266 %if g_szBusTypeValues_16 <> g_szBusTypeValues_8Dual + g_szBusTypeValues_Displacement
    267 %error "g_szBusTypeValues Displacement Incorrect 5"
    268 %endif
    269 %if g_szBusTypeValues_32 <> g_szBusTypeValues_16 + g_szBusTypeValues_Displacement
    270 %error "g_szBusTypeValues Displacement Incorrect 6"
    271 %endif
    272 %if g_szBusTypeValues_Serial <> g_szBusTypeValues_32 + g_szBusTypeValues_Displacement
    273 %error "g_szBusTypeValues Displacement Incorrect 7"
     262%if g_szDeviceTypeValues_16bit <> g_szDeviceTypeValues
     263%error "g_szDeviceTypeValues Displacement Incorrect 1"
     264%endif
     265%if g_szDeviceTypeValues_32bit <> g_szDeviceTypeValues + g_szDeviceTypeValues_Displacement
     266%error "g_szDeviceTypeValues Displacement Incorrect 2"
     267%endif
     268%if g_szDeviceTypeValues_XTIDEr1 <> g_szDeviceTypeValues_32bit + g_szDeviceTypeValues_Displacement
     269%error "g_szDeviceTypeValues Displacement Incorrect 3"
     270%endif
     271%if g_szDeviceTypeValues_XTIDEr2 <> g_szDeviceTypeValues_XTIDEr1 + g_szDeviceTypeValues_Displacement
     272%error "g_szDeviceTypeValues Displacement Incorrect 4"
     273%endif
     274%if g_szDeviceTypeValues_XTCFpio8 <> g_szDeviceTypeValues_XTIDEr2 + g_szDeviceTypeValues_Displacement
     275%error "g_szDeviceTypeValues Displacement Incorrect 5"
     276%endif
     277%if g_szDeviceTypeValues_XTCFdma <> g_szDeviceTypeValues_XTCFpio8 + g_szDeviceTypeValues_Displacement
     278%error "g_szDeviceTypeValues Displacement Incorrect 6"
     279%endif
     280%if g_szDeviceTypeValues_XTCFmem <> g_szDeviceTypeValues_XTCFdma + g_szDeviceTypeValues_Displacement
     281%error "g_szDeviceTypeValues Displacement Incorrect 7"
     282%endif
     283%if g_szDeviceTypeValues_JrIde <> g_szDeviceTypeValues_XTCFmem + g_szDeviceTypeValues_Displacement
     284%error "g_szDeviceTypeValues Displacement Incorrect 8"
     285%endif
     286%if g_szDeviceTypeValues_Serial <> g_szDeviceTypeValues_JrIde + g_szDeviceTypeValues_Displacement
     287%error "g_szDeviceTypeValues Displacement Incorrect 9"
    274288%endif
    275289%endif
     
    475489;; translated usage stats
    476490;; 33:1
    477 ;; 32:26
     491;; 32:27
    478492;; 181:1
    479493;; 53:2
     
    490504;; 34:3
    491505;; 49:1
    492 ;; 56:4
     506;; 56:6
    493507;; 45:1
    494508;; 175:1
     
    519533;; 63,?:
    520534;; 64,@:1
    521 ;; 65,A:4
     535;; 65,A:5
    522536;; 66,B:8
    523537;; 67,C:2
    524538;; 68,D:10
    525539;; 69,E:3
    526 ;; 70,F:4
     540;; 70,F:3
    527541;; 71,G:3
    528542;; 72,H:2
     
    531545;; 75,K:1
    532546;; 76,L:4
    533 ;; 77,M:5
     547;; 77,M:7
    534548;; 78,N:2
    535549;; 79,O:2
     
    538552;; 82,R:7
    539553;; 83,S:3
    540 ;; 84,T:
     554;; 84,T:1
    541555;; 85,U:2
    542556;; 86,V:
     
    576590;; 120,x:
    577591;; 121,y:2
    578 ;; alphabet used count: 44
     592;; alphabet used count: 45
    579593%endif ; STRINGSCOMPRESSED_TABLES
    580594
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AccessDPT.asm

    r443 r473  
    2020; Section containing code
    2121SECTION .text
    22 
    23 %ifdef MODULE_ADVANCED_ATA
    24 ;--------------------------------------------------------------------
    25 ; AccessDPT_GetIdeBasePortToBX
    26 ;   Parameters:
    27 ;       DS:DI:  Ptr to Disk Parameter Table
    28 ;   Returns:
    29 ;       BX:     IDE Base Port Address
    30 ;   Corrupts registers:
    31 ;       Nothing
    32 ;--------------------------------------------------------------------
    33 ALIGN JUMP_ALIGN
    34 AccessDPT_GetIdeBasePortToBX:
    35     eMOVZX  bx, [di+DPT.bIdevarsOffset]         ; CS:BX points to IDEVARS
    36     mov     bx, [cs:bx+IDEVARS.wPort]
    37     ret
    38 %endif  ; MODULE_ADVANCED_ATA
    39 
    4022
    4123;--------------------------------------------------------------------
     
    11395
    11496
     97%ifdef MODULE_8BIT_IDE
     98;--------------------------------------------------------------------
     99; AccessDPT_IsThisDeviceXTCF
     100;   Parameters:
     101;       DS:DI:  Ptr to Disk Parameter Table
     102;   Returns:
     103;       AH:     Device Type
     104;       ZF:     Set if XTCF
     105;               Cleared if some other device
     106;   Corrupts registers:
     107;       Nothing
     108;--------------------------------------------------------------------
     109AccessDPT_IsThisDeviceXTCF:
     110    mov     ah, [di+DPT_ATA.bDevice]
     111    cmp     ah, DEVICE_8BIT_XTCF_PIO8
     112    je      SHORT .DeviceIsXTCF
     113    cmp     ah, DEVICE_8BIT_XTCF_DMA
     114    je      SHORT .DeviceIsXTCF
     115    cmp     ah, DEVICE_8BIT_XTCF_MEMMAP
     116.DeviceIsXTCF:
     117    ret
     118%endif ; MODULE_8BIT_IDE
     119
     120
    115121%ifdef MODULE_EBIOS
    116122;--------------------------------------------------------------------
     
    142148;       Nothing
    143149;--------------------------------------------------------------------
    144 ALIGN JUMP_ALIGN
    145150AccessDPT_GetPointerToDRVPARAMStoCSBX:
    146     eMOVZX  bx, BYTE [di+DPT.bIdevarsOffset]    ; CS:BX points to IDEVARS
     151    call    AccessDPT_GetIdevarsToCSBX
    147152    add     bx, BYTE IDEVARS.drvParamsMaster    ; CS:BX points to Master Drive DRVPARAMS
    148153    test    BYTE [di+DPT.bFlagsLow], FLGL_DPT_SLAVE
     
    150155    add     bx, BYTE DRVPARAMS_size             ; CS:BX points to Slave Drive DRVPARAMS
    151156.ReturnPointerToDRVPARAMS:
     157    ret
     158
     159
     160;--------------------------------------------------------------------
     161; Needed many times during initialization so it is better to
     162; make it as a function to save bytes.
     163;
     164; AccessDPT_GetIdevarsToCSBX
     165;   Parameters:
     166;       DS:DI:  Ptr to Disk Parameter Table
     167;   Returns:
     168;       CS:BX:  Ptr to IDEVARS for the drive
     169;   Corrupts registers:
     170;       Nothing
     171;--------------------------------------------------------------------
     172AccessDPT_GetIdevarsToCSBX:
     173    eMOVZX  bx, BYTE [di+DPT.bIdevarsOffset]
    152174    ret
    153175
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/BootVars.asm

    r397 r473  
    3232;--------------------------------------------------------------------
    3333BootVars_Initialize:
     34%ifdef MODULE_8BIT_IDE
     35    mov     WORD [es:BOOTVARS.wNextXTCFportToScan], XTCF_BASE_PORT_1
     36%endif
     37
    3438    ; Clear to zero
    3539    mov     al, DRVDETECTINFO_size
     
    6670
    6771%endif ; MODULE_HOTKEYS
     72
     73
     74%ifdef MODULE_8BIT_IDE
     75;--------------------------------------------------------------------
     76; BootVars_GetNextXTCFportToDetectToDX
     77;   Parameters:
     78;       ES:     BDA Segment
     79;   Returns:
     80;       DX:     Next XT-CF port to detect
     81;   Corrupts registers:
     82;       AX
     83;--------------------------------------------------------------------
     84BootVars_GetNextXTCFportToDetectToDX:
     85    mov     dx, [es:BOOTVARS.wNextXTCFportToScan]
     86    test    dl, dl
     87    jz      SHORT .NextOneIs240hor340h
     88    add     WORD [es:BOOTVARS.wNextXTCFportToScan], XTCF_BASE_PORT_3 - XTCF_BASE_PORT_2
     89    ret
     90.NextOneIs240hor340h:
     91    mov     BYTE [es:BOOTVARS.wNextXTCFportToScan], XTCF_BASE_PORT_2 & 0FFh ; 40h
     92    ret     
     93%endif ; MODULE_8BIT_IDE
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CreateDPT.asm

    r445 r473  
    2828;   Parameters:
    2929;       BH:     Drive Select byte for Drive and Head Register
     30;       DX:     Autodetected port (for devices that support autodetection)
    3031;       ES:SI:  Ptr to 512-byte ATA information read from the drive
    3132;       CS:BP:  Ptr to IDEVARS for the controller
     
    4748;   Parameters:
    4849;       BH:     Drive Select byte for Drive and Head Register
     50;       DX:     Autodetected port (for devices that support autodetection)
    4951;       DS:DI:  Ptr to Disk Parameter Table
    5052;       CS:BP:  Ptr to IDEVARS for the controller
     
    5557;--------------------------------------------------------------------
    5658.InitializeDPT:
    57     mov     [di+DPT.bIdevarsOffset], bp     ; IDEVARS must start in first 256 bytes of ROM
     59    call    CreateDPT_StoreIdevarsOffsetAndBasePortFromCSBPtoDPTinDSDI
    5860    ; Fall to .StoreDriveSelectAndDriveControlByte
    5961
     
    230232
    231233;--------------------------------------------------------------------
     234; CreateDPT_StoreIdevarsOffsetAndBasePortFromCSBPtoDPTinDSDI
     235;   Parameters:
     236;       DX:     Autodetected port (for devices that support autodetection)
     237;       DS:DI:  Ptr to Disk Parameter Table
     238;       CS:BP:  Ptr to IDEVARS for the controller
     239;   Returns:
     240;       Nothing
     241;   Corrupts registers:
     242;       AX
     243;--------------------------------------------------------------------
     244CreateDPT_StoreIdevarsOffsetAndBasePortFromCSBPtoDPTinDSDI:
     245    mov     [di+DPT.bIdevarsOffset], bp     ; IDEVARS must start in first 256 bytes of ROM
     246
     247%ifdef MODULE_8BIT_IDE
     248    call    DetectDrives_DoesIdevarsInCSBPbelongToXTCF
     249    jne     SHORT .DeviceUsesPortSpecifiedInIDEVARS
     250    mov     [di+DPT.wBasePort], dx
     251    ret
     252.DeviceUsesPortSpecifiedInIDEVARS:
     253%endif ; MODULE_8BIT_IDE
     254
     255    mov     ax, [cs:bp+IDEVARS.wBasePort]
     256    mov     [di+DPT.wBasePort], ax
     257    ret
     258
     259
     260;--------------------------------------------------------------------
    232261; GetUserDefinedCapacityToBXAXandFlagsToCXandModeToDXfromROMVARS
    233262;   Parameters:
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/RamVars.asm

    r444 r473  
    208208    ret
    209209
     210
    210211%ifdef MODULE_SERIAL_FLOPPY
    211212;--------------------------------------------------------------------
    212213; RamVars_UnpackFlopCntAndFirstToAL
    213214;   Parameters:
    214 ;       Nothing
     215;       DS:     RAMVARS segment
    215216;   Returns:
    216217;       AL:     First floppy drive number supported
     
    226227    ret
    227228%endif
     229
     230
     231;--------------------------------------------------------------------
     232; RamVars_IsDriveDetectionInProgress
     233;   Parameters:
     234;       DS:     RAMVARS segment
     235;   Returns:
     236;       ZF:     Set if drive detection is in progress (ROM initialization)
     237;   Corrupts registers:
     238;       None
     239;--------------------------------------------------------------------
     240RamVars_IsDriveDetectionInProgress:
     241    cmp     WORD [RAMVARS.wSignature], RAMVARS_DRV_DETECT_SIGNATURE
     242    ret
  • trunk/XTIDE_Universal_BIOS/makefile

    r461 r473  
    1616# Following modules can be included or excluded:                                                   #
    1717# MODULE_8BIT_IDE             Support for 8-BIT IDE cards like XTIDE                               #
    18 # MODULE_JRIDE                Support for JR-IDE/ISA                                               #
    1918# MODULE_ADVANCED_ATA         Native support for some VLB IDE controllers                          #
    2019# MODULE_BOOT_MENU            Boot Menu for selection of drive to boot from                        #
     
    9897DEFINES_COMMON_LARGE = MODULE_BOOT_MENU
    9998
    100 DEFINES_XT = $(DEFINES_COMMON) ELIMINATE_CGA_SNOW MODULE_8BIT_IDE MODULE_JRIDE MODULE_SERIAL MODULE_SERIAL_FLOPPY
     99DEFINES_XT = $(DEFINES_COMMON) ELIMINATE_CGA_SNOW MODULE_8BIT_IDE MODULE_SERIAL MODULE_SERIAL_FLOPPY
    101100DEFINES_XTPLUS = $(DEFINES_COMMON) $(DEFINES_XT) USE_186
    102101DEFINES_AT = $(DEFINES_COMMON) USE_AT USE_286 RELOCATE_INT13H_STACK MODULE_IRQ MODULE_SERIAL MODULE_SERIAL_FLOPPY MODULE_ADVANCED_ATA
     
    104103DEFINES_XT_LARGE = $(DEFINES_XT) $(DEFINES_COMMON_LARGE)
    105104DEFINES_XTPLUS_LARGE = $(DEFINES_XTPLUS) $(DEFINES_COMMON_LARGE)
    106 DEFINES_AT_LARGE = $(DEFINES_AT) $(DEFINES_COMMON_LARGE)
     105DEFINES_AT_LARGE = $(DEFINES_AT) $(DEFINES_COMMON_LARGE) MODULE_8BIT_IDE
    107106
    108107DEFINES_XT_TINY = MODULE_STRINGS_COMPRESSED MODULE_8BIT_IDE
Note: See TracChangeset for help on using the changeset viewer.