Changeset 150 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Inc/IDE_8bit.inc


Ignore:
Timestamp:
Apr 29, 2011, 7:04:13 PM (13 years ago)
Author:
aitotat
google:author:
aitotat
Message:

Changes to XTIDE Universal BIOS:

  • Redesigned Disk Parameter Tables.
  • Code generalizations for supporting non-IDE devices in the future.
File:
1 edited

Legend:

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

    r3 r150  
    1 ; File name     :   IDE_8bit.inc
    2 ; Project name  :   IDE BIOS
    3 ; Created date  :   4.4.2010
    4 ; Last update   :   13.4.2010
    5 ; Author        :   Tomi Tilli
     1; Project name  :   XTIDE Universal BIOS
    62; Description   :   Macros for accessing data port(s) on 8-bit
    73;                   IDE controllers.
    84%ifndef IDE_8BIT_INC
    95%define IDE_8BIT_INC
    10 
    11 ;--------------------------------------------------------------------
    12 ; Emulates REP INSW for XTIDE dual (8-bit) data port.
    13 ;
    14 ; eREP_DUAL_BYTE_PORT_INSW
    15 ;   Parameters:
    16 ;       CX:     Loop count
    17 ;       DX:     Port address (must be IDE Data Register)
    18 ;       ES:DI:  Ptr to destination buffer
    19 ;   Returns:
    20 ;       CX:     Zero
    21 ;       DI:     Incremented/decremented
    22 ;   Corrupts registers:
    23 ;       AX, FLAGS
    24 ;--------------------------------------------------------------------
    25 %macro eREP_DUAL_BYTE_PORT_INSW 0
    26     push    bx
    27     times 2 shr cx, 1           ; Loop unrolling
    28     mov     bx, 8               ; Bit mask for toggling data low/high reg
    29 ALIGN JUMP_ALIGN
    30 %%InswLoop:
    31     eDUAL_BYTE_PORT_INSW
    32     eDUAL_BYTE_PORT_INSW
    33     eDUAL_BYTE_PORT_INSW
    34     eDUAL_BYTE_PORT_INSW
    35     loop    %%InswLoop
    36     pop     bx
    37 %endmacro
    386
    397;--------------------------------------------------------------------
     
    6634%endmacro
    6735
    68 
    69 ;--------------------------------------------------------------------
    70 ; Emulates REP OUTSW for XTIDE dual (8-bit) data port.
    71 ;
    72 ; eREP_DUAL_BYTE_PORT_OUTSW
    73 ;   Parameters:
    74 ;       CX:     Loop count
    75 ;       DX:     Port address (must be IDE Data Register)
    76 ;       ES:SI:  Ptr to source buffer
    77 ;   Returns:
    78 ;       SI:     Incremented/decremented
    79 ;   Corrupts registers:
    80 ;       AX, CX
    81 ;--------------------------------------------------------------------
    82 %macro eREP_DUAL_BYTE_PORT_OUTSW 0
    83     push    ds
    84     push    bx
    85     times 2 shr cx, 1           ; Loop unrolling
    86     mov     bx, 8               ; Bit mask for toggling data low/high reg
    87     push    es                  ; Copy ES...
    88     pop     ds                  ; ...to DS
    89 ALIGN JUMP_ALIGN
    90 %%OutswLoop:
    91     eDUAL_BYTE_PORT_OUTSW
    92     eDUAL_BYTE_PORT_OUTSW
    93     eDUAL_BYTE_PORT_OUTSW
    94     eDUAL_BYTE_PORT_OUTSW
    95     loop    %%OutswLoop
    96     pop     bx
    97     pop     ds
    98 %endmacro
    9936
    10037;--------------------------------------------------------------------
     
    13067
    13168
    132 ;--------------------------------------------------------------------
    133 ; Emulates REP INSW for IDE controllers with single 8-bit Data Port.
    134 ;
    135 ; eREP_SINGLE_BYTE_PORT_INSW
    136 ;   Parameters:
    137 ;       CX:     Number of WORDs to transfer
    138 ;       DX:     IDE Data Port address
    139 ;       ES:DI:  Ptr to destination buffer
    140 ;   Returns:
    141 ;       DI:     Incremented/decremented
    142 ;   Corrupts registers:
    143 ;       AL, CX
    144 ;--------------------------------------------------------------------
    145 %macro eREP_SINGLE_BYTE_PORT_INSW 0
    146 %ifdef USE_186  ; INS instruction available
    147     shl     cx, 1               ; WORD count to BYTE count
    148     rep insb
    149 %else           ; If 8088/8086
    150     shr     cx, 1               ; WORD count to DWORD count
    151 ALIGN JUMP_ALIGN
    152 %%InsdLoop:
    153     in      al, dx
    154     stosb                       ; Store to [ES:DI]
    155     in      al, dx
    156     stosb
    157     in      al, dx
    158     stosb
    159     in      al, dx
    160     stosb
    161     loop    %%InsdLoop
    162 %endif
    163 %endmacro
    164 
    165 
    166 ;--------------------------------------------------------------------
    167 ; Emulates REP OUTSW for IDE controllers with single 8-bit Data Port.
    168 ;
    169 ; eREP_SINGLE_BYTE_PORT_OUTSW
    170 ;   Parameters:
    171 ;       CX:     Number of WORDs to transfer
    172 ;       DX:     IDE Data Port address
    173 ;       ES:SI:  Ptr to source buffer
    174 ;   Returns:
    175 ;       SI:     Incremented/decremented
    176 ;   Corrupts registers:
    177 ;       AL, CX
    178 ;--------------------------------------------------------------------
    179 %macro eREP_SINGLE_BYTE_PORT_OUTSW 0
    180 %ifdef USE_186  ; OUTS instruction available
    181     shl     cx, 1               ; WORD count to BYTE count
    182     eSEG    es                  ; Source is ES segment
    183     rep outsb
    184 %else           ; If 8088/8086
    185     shr     cx, 1               ; WORD count to DWORD count
    186     push    ds                  ; Store DS
    187     push    es                  ; Copy ES...
    188     pop     ds                  ; ...to DS
    189 ALIGN JUMP_ALIGN
    190 %%OutsdLoop:
    191     lodsb                       ; Load from [DS:SI] to AL
    192     out     dx, al
    193     lodsb
    194     out     dx, al
    195     lodsb
    196     out     dx, al
    197     lodsb
    198     out     dx, al
    199     loop    %%OutsdLoop
    200     pop     ds                  ; Restore DS
    201 %endif
    202 %endmacro
    203 
    204 
    20569%endif ; IDE_8BIT_INC
Note: See TracChangeset for help on using the changeset viewer.