Changeset 150 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Inc/IDE_8bit.inc
- Timestamp:
- Apr 29, 2011, 7:04:13 PM (14 years ago)
- google:author:
- aitotat
- 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 6 2 ; Description : Macros for accessing data port(s) on 8-bit 7 3 ; IDE controllers. 8 4 %ifndef IDE_8BIT_INC 9 5 %define IDE_8BIT_INC 10 11 ;--------------------------------------------------------------------12 ; Emulates REP INSW for XTIDE dual (8-bit) data port.13 ;14 ; eREP_DUAL_BYTE_PORT_INSW15 ; Parameters:16 ; CX: Loop count17 ; DX: Port address (must be IDE Data Register)18 ; ES:DI: Ptr to destination buffer19 ; Returns:20 ; CX: Zero21 ; DI: Incremented/decremented22 ; Corrupts registers:23 ; AX, FLAGS24 ;--------------------------------------------------------------------25 %macro eREP_DUAL_BYTE_PORT_INSW 026 push bx27 times 2 shr cx, 1 ; Loop unrolling28 mov bx, 8 ; Bit mask for toggling data low/high reg29 ALIGN JUMP_ALIGN30 %%InswLoop:31 eDUAL_BYTE_PORT_INSW32 eDUAL_BYTE_PORT_INSW33 eDUAL_BYTE_PORT_INSW34 eDUAL_BYTE_PORT_INSW35 loop %%InswLoop36 pop bx37 %endmacro38 6 39 7 ;-------------------------------------------------------------------- … … 66 34 %endmacro 67 35 68 69 ;--------------------------------------------------------------------70 ; Emulates REP OUTSW for XTIDE dual (8-bit) data port.71 ;72 ; eREP_DUAL_BYTE_PORT_OUTSW73 ; Parameters:74 ; CX: Loop count75 ; DX: Port address (must be IDE Data Register)76 ; ES:SI: Ptr to source buffer77 ; Returns:78 ; SI: Incremented/decremented79 ; Corrupts registers:80 ; AX, CX81 ;--------------------------------------------------------------------82 %macro eREP_DUAL_BYTE_PORT_OUTSW 083 push ds84 push bx85 times 2 shr cx, 1 ; Loop unrolling86 mov bx, 8 ; Bit mask for toggling data low/high reg87 push es ; Copy ES...88 pop ds ; ...to DS89 ALIGN JUMP_ALIGN90 %%OutswLoop:91 eDUAL_BYTE_PORT_OUTSW92 eDUAL_BYTE_PORT_OUTSW93 eDUAL_BYTE_PORT_OUTSW94 eDUAL_BYTE_PORT_OUTSW95 loop %%OutswLoop96 pop bx97 pop ds98 %endmacro99 36 100 37 ;-------------------------------------------------------------------- … … 130 67 131 68 132 ;--------------------------------------------------------------------133 ; Emulates REP INSW for IDE controllers with single 8-bit Data Port.134 ;135 ; eREP_SINGLE_BYTE_PORT_INSW136 ; Parameters:137 ; CX: Number of WORDs to transfer138 ; DX: IDE Data Port address139 ; ES:DI: Ptr to destination buffer140 ; Returns:141 ; DI: Incremented/decremented142 ; Corrupts registers:143 ; AL, CX144 ;--------------------------------------------------------------------145 %macro eREP_SINGLE_BYTE_PORT_INSW 0146 %ifdef USE_186 ; INS instruction available147 shl cx, 1 ; WORD count to BYTE count148 rep insb149 %else ; If 8088/8086150 shr cx, 1 ; WORD count to DWORD count151 ALIGN JUMP_ALIGN152 %%InsdLoop:153 in al, dx154 stosb ; Store to [ES:DI]155 in al, dx156 stosb157 in al, dx158 stosb159 in al, dx160 stosb161 loop %%InsdLoop162 %endif163 %endmacro164 165 166 ;--------------------------------------------------------------------167 ; Emulates REP OUTSW for IDE controllers with single 8-bit Data Port.168 ;169 ; eREP_SINGLE_BYTE_PORT_OUTSW170 ; Parameters:171 ; CX: Number of WORDs to transfer172 ; DX: IDE Data Port address173 ; ES:SI: Ptr to source buffer174 ; Returns:175 ; SI: Incremented/decremented176 ; Corrupts registers:177 ; AL, CX178 ;--------------------------------------------------------------------179 %macro eREP_SINGLE_BYTE_PORT_OUTSW 0180 %ifdef USE_186 ; OUTS instruction available181 shl cx, 1 ; WORD count to BYTE count182 eSEG es ; Source is ES segment183 rep outsb184 %else ; If 8088/8086185 shr cx, 1 ; WORD count to DWORD count186 push ds ; Store DS187 push es ; Copy ES...188 pop ds ; ...to DS189 ALIGN JUMP_ALIGN190 %%OutsdLoop:191 lodsb ; Load from [DS:SI] to AL192 out dx, al193 lodsb194 out dx, al195 lodsb196 out dx, al197 lodsb198 out dx, al199 loop %%OutsdLoop200 pop ds ; Restore DS201 %endif202 %endmacro203 204 205 69 %endif ; IDE_8BIT_INC
Note:
See TracChangeset
for help on using the changeset viewer.