Changeset 623 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS


Ignore:
Timestamp:
Jun 15, 2022, 2:48:59 PM (3 years ago)
Author:
Krister Nordvall
Message:

Changes:

  • Reversed the change to IdeDPT.asm in r622 as it didn't work as intended.
  • Reordered some procedures to reduce alignment padding.
  • Added two new defines (EXTRA_LOOP_UNROLLING_SMALL and EXTRA_LOOP_UNROLLING_LARGE) that should improve transfer speeds for some hardware combinations, specifically 808x CPUs with any IDE controller using port I/O and any CPU with XT-IDE controllers.
  • Added a new define (USE_086) for use with 8086 and V30 CPUs only. Unlike the other USE_x86 defines, this define will not change the instruction set used and is therefore compatible with all CPUs. However, it will apply padding to make jump destinations WORD aligned which should improve performance on 8086/V30 CPUs but on 8088/V20 CPUs there is no benefit and, in addition to wasting ROM space, it might in fact be slower on these machines. Since the vast majority of XT class machines are using 8088/V20 CPUs this define is not used in the official XT builds - it's primarily intended for custom BIOS builds.
  • XTIDECFG: The URL to the support forum has been updated.
Location:
trunk/XTIDE_Universal_BIOS
Files:
7 edited

Legend:

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

    r618 r623  
    146146%endmacro
    147147
     148%macro UNROLL_SECTORS_IN_CX_TO_16WORDS 0
     149%ifdef USE_186
     150    shl     cx, 4
     151%else
     152    mov     ch, cl
     153    mov     cl, 4
     154    shr     cx, cl
     155%endif
     156%endmacro
     157
     158%macro UNROLL_SECTORS_IN_CX_TO_32WORDS 0
     159%ifdef USE_186
     160    shl     cx, 3
     161%else
     162    shl     cx, 1
     163    shl     cx, 1
     164    shl     cx, 1
     165%endif
     166%endmacro
     167
    148168
    149169%endif ; IDE_IO_INC
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeDPT.asm

    r622 r623  
    133133    mov     [di+DPT_ADVANCED_ATA.wMinPioCycleTime], bx
    134134
    135     ; We have detected 32-bit controller so change Device Type since
    136     ; it might have been set to 16-bit on IDEVARS
    137     ;
    138     ; Change to 32-bit on 386 builds only. We leave AT builds unchanged for faster troubleshooting
    139     ; and for uncommon systems, like IBM 486SLC2 processors that can have VLB motherboard even though
    140     ; the IBM 486SLC2 is externally 16-bit CPU
     135    ; We have detected 32-bit controller so change Device Type
     136    ; since it might have been set to 16-bit on IDEVARS
    141137.ChangeTo32bitDevice:
    142 %ifdef USE_386
     138    ; *FIXME* We might need to add code to detect the IBM 486SLC2 CPU (and possibly other
     139    ; 386+ class CPUs with a 16-bit external bus?) to avoid changing to DEVICE_32BIT_ATA.
    143140    mov     BYTE [di+DPT_ATA.bDevice], DEVICE_32BIT_ATA
    144 %endif
    145141.NoAdvancedControllerDetected:
    146142%endif  ; MODULE_ADVANCED_ATA
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdePioBlock.asm

    r601 r623  
    4343ALIGN JUMP_ALIGN
    4444IdePioBlock_ReadFromXtideRev1:
    45     UNROLL_SECTORS_IN_CX_TO_OWORDS
     45%ifdef EXTRA_LOOP_UNROLLING_LARGE
     46    UNROLL_SECTORS_IN_CX_TO_32WORDS
     47%elifdef EXTRA_LOOP_UNROLLING_SMALL
     48    UNROLL_SECTORS_IN_CX_TO_16WORDS
     49%else
     50    UNROLL_SECTORS_IN_CX_TO_OWORDS
     51%endif
    4652    mov     bl, 8       ; Bit mask for toggling data low/high reg
    4753ALIGN JUMP_ALIGN
    48 .InswLoop:
    49     %rep 8  ; WORDs
     54.NextIteration:
     55%ifdef EXTRA_LOOP_UNROLLING_LARGE
     56    %rep 32 ; WORDs
    5057        XTIDE_INSW
    5158    %endrep
    52     loop    .InswLoop
     59    dec     cx
     60%ifdef USE_386
     61    jnz     .NextIteration
     62%else
     63    jz      SHORT .BlockTransferred
     64    jmp     .NextIteration
     65
     66ALIGN JUMP_ALIGN
     67.BlockTransferred:
     68%endif
     69%elifdef EXTRA_LOOP_UNROLLING_SMALL
     70    %rep 16 ; WORDs
     71        XTIDE_INSW
     72    %endrep
     73%ifdef USE_186
     74    loop    .NextIteration
     75%else
     76    dec     cx
     77    jz      SHORT .BlockTransferred
     78    jmp     .NextIteration
     79
     80ALIGN JUMP_ALIGN
     81.BlockTransferred:
     82%endif
     83%else
     84    %rep 8  ; WORDs
     85        XTIDE_INSW
     86    %endrep
     87    loop    .NextIteration
     88%endif
    5389    ret
    5490
     
    67103ALIGN JUMP_ALIGN
    68104IdePioBlock_ReadFromXtideRev2_Olivetti:
    69     UNROLL_SECTORS_IN_CX_TO_OWORDS
    70 ALIGN JUMP_ALIGN
    71 .InswLoop:
    72     %rep 8  ; WORDs
     105%ifdef EXTRA_LOOP_UNROLLING_LARGE
     106    UNROLL_SECTORS_IN_CX_TO_32WORDS
     107%elifdef EXTRA_LOOP_UNROLLING_SMALL
     108    UNROLL_SECTORS_IN_CX_TO_16WORDS
     109%else
     110    UNROLL_SECTORS_IN_CX_TO_OWORDS
     111%endif
     112ALIGN JUMP_ALIGN
     113.NextIteration:
     114%ifdef EXTRA_LOOP_UNROLLING_LARGE
     115    %rep 32 ; WORDs
    73116        XTIDE_MOD_OLIVETTI_INSW
    74117    %endrep
    75     loop    .InswLoop
     118    dec     cx
     119%ifdef USE_386
     120    jnz     .NextIteration
     121%else
     122    jz      SHORT .BlockTransferred
     123    jmp     .NextIteration
     124
     125ALIGN JUMP_ALIGN
     126.BlockTransferred:
     127%endif
     128%elifdef EXTRA_LOOP_UNROLLING_SMALL
     129    %rep 16 ; WORDs
     130        XTIDE_MOD_OLIVETTI_INSW
     131    %endrep
     132    loop    .NextIteration
     133%else
     134    %rep 8  ; WORDs
     135        XTIDE_MOD_OLIVETTI_INSW
     136    %endrep
     137    loop    .NextIteration
     138%endif
    76139    ret
    77140
     
    96159    rep insb
    97160    ret
     161
    98162%else ; 808x
    99     UNROLL_SECTORS_IN_CX_TO_OWORDS
    100 ALIGN JUMP_ALIGN
    101 .ReadNextOword:
     163%ifdef EXTRA_LOOP_UNROLLING_LARGE
     164    UNROLL_SECTORS_IN_CX_TO_32WORDS
     165%elifdef EXTRA_LOOP_UNROLLING_SMALL
     166    UNROLL_SECTORS_IN_CX_TO_16WORDS
     167%else
     168    UNROLL_SECTORS_IN_CX_TO_OWORDS
     169%endif
     170ALIGN JUMP_ALIGN
     171.NextIteration:
     172%ifdef EXTRA_LOOP_UNROLLING_LARGE
     173    %rep 64 ; BYTEs
     174        in      al, dx  ; Read BYTE
     175        stosb           ; Store BYTE to [ES:DI]
     176    %endrep
     177    dec     cx
     178    jz      SHORT .BlockTransferred
     179    jmp     .NextIteration
     180
     181ALIGN JUMP_ALIGN
     182.BlockTransferred:
     183%elifdef EXTRA_LOOP_UNROLLING_SMALL
     184    %rep 32 ; BYTEs
     185        in      al, dx  ; Read BYTE
     186        stosb           ; Store BYTE to [ES:DI]
     187    %endrep
     188    loop    .NextIteration
     189%else
    102190    %rep 16 ; BYTEs
    103191        in      al, dx  ; Read BYTE
    104192        stosb           ; Store BYTE to [ES:DI]
    105193    %endrep
    106     loop    .ReadNextOword
     194    loop    .NextIteration
     195%endif
    107196    ret
    108197%endif
     
    132221
    133222%else ; 808x
    134     UNROLL_SECTORS_IN_CX_TO_OWORDS
    135 ALIGN JUMP_ALIGN
    136 .ReadNextOword:
    137     %rep 8  ; WORDs
     223%ifdef EXTRA_LOOP_UNROLLING_LARGE
     224    UNROLL_SECTORS_IN_CX_TO_32WORDS
     225%elifdef EXTRA_LOOP_UNROLLING_SMALL
     226    UNROLL_SECTORS_IN_CX_TO_16WORDS
     227%else
     228    UNROLL_SECTORS_IN_CX_TO_OWORDS
     229%endif
     230ALIGN JUMP_ALIGN
     231.NextIteration:
     232%ifdef EXTRA_LOOP_UNROLLING_LARGE
     233    %rep 32 ; WORDs
    138234        in      ax, dx  ; Read WORD
    139235        stosw           ; Store WORD to [ES:DI]
    140236    %endrep
    141     loop    .ReadNextOword
     237%elifdef EXTRA_LOOP_UNROLLING_SMALL
     238    %rep 16 ; WORDs
     239        in      ax, dx  ; Read WORD
     240        stosw           ; Store WORD to [ES:DI]
     241    %endrep
     242%else
     243    %rep 8  ; WORDs
     244        in      ax, dx  ; Read WORD
     245        stosw           ; Store WORD to [ES:DI]
     246    %endrep
     247%endif
     248    loop    .NextIteration
    142249    ret
    143250%endif
     
    174281ALIGN JUMP_ALIGN
    175282IdePioBlock_WriteToXtideRev1:
     283%ifdef EXTRA_LOOP_UNROLLING_LARGE
     284    UNROLL_SECTORS_IN_CX_TO_16WORDS
     285%elifdef EXTRA_LOOP_UNROLLING_SMALL
     286    UNROLL_SECTORS_IN_CX_TO_OWORDS
     287%else
    176288    UNROLL_SECTORS_IN_CX_TO_QWORDS
     289%endif
    177290    mov     bl, 8       ; Bit mask for toggling data low/high reg
    178291ALIGN JUMP_ALIGN
    179 .OutswLoop:
     292.NextIteration:
     293%ifdef EXTRA_LOOP_UNROLLING_LARGE
     294    %rep 16 ; WORDs
     295        XTIDE_OUTSW
     296    %endrep
     297%ifdef USE_186
     298    loop    .NextIteration
     299%else
     300    dec     cx
     301    jz      SHORT .BlockTransferred
     302    jmp     .NextIteration
     303
     304ALIGN JUMP_ALIGN
     305.BlockTransferred:
     306%endif
     307%elifdef EXTRA_LOOP_UNROLLING_SMALL
     308    %rep 8  ; WORDs
     309        XTIDE_OUTSW
     310    %endrep
     311    loop    .NextIteration
     312%else
    180313    %rep 4  ; WORDs
    181314        XTIDE_OUTSW
    182315    %endrep
    183     loop    .OutswLoop
     316    loop    .NextIteration
     317%endif
    184318    ret
    185319
     
    198332ALIGN JUMP_ALIGN
    199333IdePioBlock_WriteToXtideRev2:
     334%ifdef EXTRA_LOOP_UNROLLING_LARGE
     335    UNROLL_SECTORS_IN_CX_TO_16WORDS
     336%elifdef EXTRA_LOOP_UNROLLING_SMALL
     337    UNROLL_SECTORS_IN_CX_TO_OWORDS
     338%else
    200339    UNROLL_SECTORS_IN_CX_TO_QWORDS
    201 ALIGN JUMP_ALIGN
    202 .WriteNextQword:
     340%endif
     341ALIGN JUMP_ALIGN
     342.NextIteration:
     343%ifdef EXTRA_LOOP_UNROLLING_LARGE
     344    %rep 16 ; WORDs
     345        XTIDE_MOD_OUTSW
     346    %endrep
     347%ifdef USE_186
     348    loop    .NextIteration
     349%else
     350    dec     cx
     351    jz      SHORT .BlockTransferred
     352    jmp     .NextIteration
     353
     354ALIGN JUMP_ALIGN
     355.BlockTransferred:
     356%endif
     357%elifdef EXTRA_LOOP_UNROLLING_SMALL
     358    %rep 8  ; WORDs
     359        XTIDE_MOD_OUTSW
     360    %endrep
     361    loop    .NextIteration
     362%else
    203363    %rep 4  ; WORDs
    204364        XTIDE_MOD_OUTSW
    205365    %endrep
    206     loop    .WriteNextQword
     366    loop    .NextIteration
     367%endif
    207368    ret
    208369
     
    227388
    228389%else ; 808x
     390%ifdef EXTRA_LOOP_UNROLLING_LARGE
     391    UNROLL_SECTORS_IN_CX_TO_16WORDS
     392%elifdef EXTRA_LOOP_UNROLLING_SMALL
     393    UNROLL_SECTORS_IN_CX_TO_OWORDS
     394%else
    229395    UNROLL_SECTORS_IN_CX_TO_QWORDS
    230 ALIGN JUMP_ALIGN
    231 .WriteNextQword:
     396%endif
     397ALIGN JUMP_ALIGN
     398.NextIteration:
     399%ifdef EXTRA_LOOP_UNROLLING_LARGE
     400    %rep 32 ; BYTEs
     401        lodsb           ; Load BYTE from [DS:SI]
     402        out     dx, al  ; Write BYTE
     403    %endrep
     404%elifdef EXTRA_LOOP_UNROLLING_SMALL
     405    %rep 16 ; BYTEs
     406        lodsb           ; Load BYTE from [DS:SI]
     407        out     dx, al  ; Write BYTE
     408    %endrep
     409%else
    232410    %rep 8  ; BYTEs
    233411        lodsb           ; Load BYTE from [DS:SI]
    234412        out     dx, al  ; Write BYTE
    235413    %endrep
    236     loop    .WriteNextQword
     414%endif
     415    loop    .NextIteration
    237416    ret
    238417%endif
     
    260439
    261440%else ; 808x
     441%ifdef EXTRA_LOOP_UNROLLING_LARGE
     442    UNROLL_SECTORS_IN_CX_TO_16WORDS
     443%elifdef EXTRA_LOOP_UNROLLING_SMALL
     444    UNROLL_SECTORS_IN_CX_TO_OWORDS
     445%else
    262446    UNROLL_SECTORS_IN_CX_TO_QWORDS
    263 ALIGN JUMP_ALIGN
    264 .WriteNextQword:
     447%endif
     448ALIGN JUMP_ALIGN
     449.NextIteration:
     450%ifdef EXTRA_LOOP_UNROLLING_LARGE
     451    %rep 16 ; WORDs
     452        lodsw           ; Load WORD from [DS:SI]
     453        out     dx, ax  ; Write WORD
     454    %endrep
     455%elifdef EXTRA_LOOP_UNROLLING_SMALL
     456    %rep 8  ; WORDs
     457        lodsw           ; Load WORD from [DS:SI]
     458        out     dx, ax  ; Write WORD
     459    %endrep
     460%else
    265461    %rep 4  ; WORDs
    266462        lodsw           ; Load WORD from [DS:SI]
    267463        out     dx, ax  ; Write WORD
    268464    %endrep
    269     loop    .WriteNextQword
     465%endif
     466    loop    .NextIteration
    270467    ret
    271468%endif
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/AdvancedAta/AdvAtaInit.asm

    r622 r623  
    188188; as I/O delay.
    189189;
    190 ; AdvAtaInit_InWithDelay
     190; AdvAtaInit_InputWithDelay
    191191;   Parameters:
    192192;       DX:     Port to read from
     
    195195;   Corrupts registers:
    196196;       Nothing
    197 ;--------------------------------------------------------------------   
     197;--------------------------------------------------------------------
    198198AdvAtaInit_InputWithDelay:
    199199    in      al, dx
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/FindDPT.asm

    r621 r623  
    6565
    6666    cmp     ah, dl                              ; Check second drive if two, first drive if only one
    67     jz      SHORT .CalcDPTForDriveNumber
     67    je      SHORT .CalcDPTForDriveNumber
    6868    cmp     al, dl                              ; Check first drive in all cases, redundant but OK to repeat
    69     jnz     SHORT .DiskIsNotHandledByThisBIOS
     69    jne     SHORT .DiskIsNotHandledByThisBIOS
    7070%else
    7171    cmp     dl, ah                              ; Above last supported?
     
    100100
    101101    test    dl, dl
    102     js      .harddisk
     102    js      SHORT .Harddisk
    103103
    104104    call    RamVars_UnpackFlopCntAndFirstToAL
     
    106106
    107107ALIGN JUMP_ALIGN
    108 .harddisk:
     108.Harddisk:
    109109    sub     dl, al                      ; subtract off beginning of either hard disk or floppy list (as appropriate)
    110110%else
     
    114114.CalcDPTForNewDrive:
    115115    mov     al, LARGEST_DPT_SIZE
    116 
    117116    mul     dl
    118117    add     ax, RAMVARS_size            ; Clears CF (will not overflow)
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/RamVars.asm

    r592 r623  
    135135
    136136
    137 ;--------------------------------------------------------------------
    138 ; RamVars_GetCountOfKnownDrivesToAX
    139 ;   Parameters:
    140 ;       DS:     RAMVARS segment
    141 ;   Returns:
    142 ;       AX:     Total hard disk count
    143 ;   Corrupts registers:
    144 ;       None
    145 ;--------------------------------------------------------------------
    146 ALIGN JUMP_ALIGN
    147 RamVars_GetCountOfKnownDrivesToAX:
    148     mov     ax, [RAMVARS.wFirstDrvAndCount]
    149     add     al, ah
    150     and     ax, BYTE 7fh
    151     ret
    152 
    153 ;--------------------------------------------------------------------
    154 ; RamVars_GetIdeControllerCountToCX
    155 ;   Parameters:
    156 ;       Nothing
    157 ;   Returns:
    158 ;       CX:     Number of IDE controllers to handle
    159 ;   Corrupts registers:
    160 ;       Nothing
    161 ;--------------------------------------------------------------------
    162 ALIGN JUMP_ALIGN
    163 RamVars_GetIdeControllerCountToCX:
    164     eMOVZX  cx, [cs:ROMVARS.bIdeCnt]
    165     ret
    166 
    167 
    168137%ifdef MODULE_SERIAL_FLOPPY
    169138;--------------------------------------------------------------------
     
    184153    ret
    185154%endif
     155
     156
     157;--------------------------------------------------------------------
     158; RamVars_GetIdeControllerCountToCX
     159;   Parameters:
     160;       Nothing
     161;   Returns:
     162;       CX:     Number of IDE controllers to handle
     163;   Corrupts registers:
     164;       Nothing
     165;--------------------------------------------------------------------
     166ALIGN JUMP_ALIGN
     167RamVars_GetIdeControllerCountToCX:
     168    eMOVZX  cx, [cs:ROMVARS.bIdeCnt]
     169    ret
     170
     171
     172;--------------------------------------------------------------------
     173; RamVars_GetCountOfKnownDrivesToAX
     174;   Parameters:
     175;       DS:     RAMVARS segment
     176;   Returns:
     177;       AX:     Total hard disk count
     178;   Corrupts registers:
     179;       None
     180;--------------------------------------------------------------------
     181ALIGN JUMP_ALIGN
     182RamVars_GetCountOfKnownDrivesToAX:
     183    mov     ax, [RAMVARS.wFirstDrvAndCount]
     184    add     al, ah
     185    and     ax, BYTE 7Fh
     186    ret
  • trunk/XTIDE_Universal_BIOS/makefile

    r622 r623  
    3131# MODULE_POWER_MANAGEMENT     Power Management support                                             #
    3232# MODULE_WIN9X_CMOS_HACK      Hack for Windows 9x compatibility                                    #
    33 # MODULE_MFM_COMPATIBILITY    Restores BDA drive count for MFM controllers that expect to be the   #
    34 #                             only hard drive controller on the system                             #
     33# MODULE_MFM_COMPATIBILITY    Restores BDA drive count for MFM/SCSI controllers that expect to be  #
     34#                             the only hard drive controller in the system                         #
    3535#                                                                                                  #
    3636# Not modules but these affect the assembly:                                                       #
     
    3939# NO_ATAID_VALIDATION ***     Excludes code that tries to ensure proper communication with drives  #
    4040# NO_ATAID_CORRECTION         Excludes code that corrects illegal CHS values from some CF cards    #
     41# USE_086                     Applies WORD alignment padding for use with 8086/V30 CPUs only       #
    4142# USE_186                     Use instructions supported by 80188/80186 and V20/V30 and later      #
    4243# USE_286                     Use instructions supported by 286 and later (defines USE_UNDOC_INTEL)#
    4344# USE_386                     Use instructions supported by 386 and later (defines USE_286)        #
    4445# USE_AT                      Use features supported on AT and later systems (not available on XT) #
    45 # USE_UNDOC_INTEL             Optimizations for Intel CPU:s - do NOT use on NEC V20/V30/Sony CPU:s #
    46 # USE_NEC_V                   Optimizations for use with NEC V20/V30 processors only               #
     46# USE_UNDOC_INTEL             Optimizations for Intel CPUs - do NOT use on NEC V20/V30/Sony CPUs  #
     47# USE_NEC_V                   Optimizations for use with NEC V20/V30 CPUs only                     #
    4748# CLD_NEEDED                  Only needed for compatibility with buggy software/BIOSes             #
     49# EXTRA_LOOP_UNROLLING_SMALL  Improves transfer speed on some CPU + IDE controller combinations    #
     50# EXTRA_LOOP_UNROLLING_LARGE  Same as above but faster and uses more ROM space                     #
    4851#                                                                                                  #
    4952# ** AT Builds only (when USE_AT is defined)                                                       #
     
    108111# Assembler preprocessor defines #
    109112##################################
    110 DEFINES_COMMON = MODULE_STRINGS_COMPRESSED MODULE_HOTKEYS MODULE_8BIT_IDE MODULE_EBIOS MODULE_SERIAL MODULE_SERIAL_FLOPPY MODULE_POWER_MANAGEMENT NO_ATAID_VALIDATION CLD_NEEDED
    111 DEFINES_COMMON_LARGE = MODULE_BOOT_MENU MODULE_8BIT_IDE_ADVANCED MODULE_COMPATIBLE_TABLES
     113DEFINES_COMMON = MODULE_STRINGS_COMPRESSED MODULE_HOTKEYS MODULE_8BIT_IDE MODULE_EBIOS MODULE_SERIAL MODULE_SERIAL_FLOPPY MODULE_POWER_MANAGEMENT NO_ATAID_VALIDATION CLD_NEEDED EXTRA_LOOP_UNROLLING_SMALL
     114DEFINES_COMMON_LARGE = MODULE_BOOT_MENU MODULE_8BIT_IDE_ADVANCED MODULE_COMPATIBLE_TABLES EXTRA_LOOP_UNROLLING_LARGE
    112115
    113116DEFINES_XT = $(DEFINES_COMMON) ELIMINATE_CGA_SNOW MODULE_8BIT_IDE_ADVANCED
Note: See TracChangeset for help on using the changeset viewer.