Ignore:
Timestamp:
Aug 29, 2012, 12:59:23 PM (12 years ago)
Author:
krille_n_@…
google:author:
krille_n_@hotmail.com
Message:

Changes:

  • A speed optimization to the eSHL_IM macro for 386 and higher. This change breaks emulation in the sense that the macro will fail when given a memory operand as the first parameter.
  • Memory_SumCXbytesFromESSItoAL now returns with the zero flag set/cleared according to the result.
  • Unrolled all the 8 bit READ transfer loops to do 16 bytes per iteration. Added a new macro (UNROLL_SECTORS_IN_CX_TO_OWORDS) as part of it. Size wise this is expensive but I think it should be worth the ROM space. The WRITE transfer loops were left as is since writes are rare anyway (<10% of all disk I/O IIRC).
  • Minor optimizations and fixes here and there.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm

    r444 r445  
    33
    44;
    5 ; XTIDE Universal BIOS and Associated Tools 
     5; XTIDE Universal BIOS and Associated Tools
    66; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
    77;
     
    1010; the Free Software Foundation; either version 2 of the License, or
    1111; (at your option) any later version.
    12 ; 
     12;
    1313; This program is distributed in the hope that it will be useful,
    1414; but WITHOUT ANY WARRANTY; without even the implied warranty of
    1515; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16 ; GNU General Public License for more details.     
     16; GNU General Public License for more details.
    1717; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
    18 ;       
     18;
    1919
    2020; Structure containing variables for PIO transfer functions.
     
    119119    jc      SHORT ReturnWithTransferErrorInAH
    120120
    121     ; All sectors succesfully transferred
     121    ; All sectors successfully transferred
    122122    add     cx, [bp+PIOVARS.bSectorsDone]       ; Never sets CF
    123123    ret
     
    244244    ALIGN JUMP_ALIGN
    245245    ReadBlockFromXtideRev1:
    246         UNROLL_SECTORS_IN_CX_TO_QWORDS
     246        UNROLL_SECTORS_IN_CX_TO_OWORDS
    247247        mov     bl, 8       ; Bit mask for toggling data low/high reg
    248248    ALIGN JUMP_ALIGN
    249249    .InswLoop:
     250    %rep 8  ; WORDs
    250251        XTIDE_INSW
    251         XTIDE_INSW
    252         XTIDE_INSW
    253         XTIDE_INSW
     252    %endrep
    254253        loop    .InswLoop
    255254        ret
     
    259258        ALIGN JUMP_ALIGN
    260259        ReadBlockFromXtideRev2:
    261             UNROLL_SECTORS_IN_CX_TO_QWORDS
    262         ALIGN JUMP_ALIGN
    263         .ReadNextQword:
    264             in      ax, dx      ; Read 1st WORD
    265             stosw               ; Store 1st WORD to [ES:DI]
    266             in      ax, dx
    267             stosw               ; 2nd
    268             in      ax, dx
    269             stosw               ; 3rd
    270             in      ax, dx
    271             stosw               ; 4th
    272             loop    .ReadNextQword
     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
    273268            ret
    274269    %endif
     
    283278
    284279    %else ; If 8088/8086
    285             ALIGN JUMP_ALIGN
     280        ALIGN JUMP_ALIGN
    286281        ReadBlockFrom8bitDataPort:
    287             UNROLL_SECTORS_IN_CX_TO_DWORDS
    288         ALIGN JUMP_ALIGN
    289         .ReadNextDword:
    290             in      al, dx      ; Read 1st BYTE
    291             stosb               ; Store 1st BYTE to [ES:DI]
    292             in      al, dx
    293             stosb
    294 
    295             in      al, dx
    296             stosb
    297             in      al, dx
    298             stosb
    299             loop    .ReadNextDword
     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
    300290            ret
    301291    %endif
     
    349339    ALIGN JUMP_ALIGN
    350340    .OutswLoop:
     341    %rep 4  ; WORDs
    351342        XTIDE_OUTSW
    352         XTIDE_OUTSW
    353         XTIDE_OUTSW
    354         XTIDE_OUTSW
     343    %endrep
    355344        loop    .OutswLoop
    356345        pop     ds
     
    366355    ALIGN JUMP_ALIGN
    367356    .WriteNextQword:
     357    %rep 4  ; WORDs
    368358        XTIDE_MOD_OUTSW
    369         XTIDE_MOD_OUTSW
    370         XTIDE_MOD_OUTSW
    371         XTIDE_MOD_OUTSW
     359    %endrep
    372360        loop    .WriteNextQword
    373361        pop     ds
     
    392380        ALIGN JUMP_ALIGN
    393381        .WriteNextDword:
    394             lodsb               ; Load 1st BYTE from [DS:SI]
    395             out     dx, al      ; Write 1st BYTE
    396             lodsb
    397             out     dx, al
    398 
    399             lodsb
    400             out     dx, al
    401             lodsb
    402             out     dx, al
     382        %rep 4  ; BYTEs
     383            lodsb               ; Load BYTE from [DS:SI]
     384            out     dx, al      ; Write BYTE
     385        %endrep
    403386            loop    .WriteNextDword
    404387            pop     ds
Note: See TracChangeset for help on using the changeset viewer.