Changeset 60484 in vbox for trunk/src/VBox/Devices/BiosCommonCode/__I4D.asm
- Timestamp:
- Apr 14, 2016 9:25:51 AM (9 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/BiosCommonCode/__I4D.asm
r60406 r60484 20 20 ;* Exported Symbols * 21 21 ;******************************************************************************* 22 public __U4D23 public __U4M24 public __U8LS25 public __U8RS26 ifndef VBOX_PC_BIOS27 22 public __I4D 28 public __I4M 23 24 if VBOX_BIOS_CPU lt 80386 25 extrn NeedToImplementOn8086__I4D:near 29 26 endif 30 public _fmemset_31 public _fmemcpy_32 27 28 .8086 33 29 34 35 .386p36 30 37 31 _TEXT segment public 'CODE' use16 38 32 assume cs:_TEXT 39 33 40 41 ;;42 ; 32-bit unsigned division.43 ;44 ; @param dx:ax Dividend.45 ; @param cx:bx Divisor.46 ; @returns dx:ax Quotient.47 ; cx:bx Remainder.48 ;49 __U4D:50 pushf51 push eax52 push edx53 push ecx54 55 rol eax, 1656 mov ax, dx57 ror eax, 1658 xor edx, edx59 60 shr ecx, 1661 mov cx, bx62 63 div ecx ; eax:edx / ecx -> eax=quotient, edx=remainder.64 65 mov bx, dx66 pop ecx67 shr edx, 1668 mov cx, dx69 70 pop edx71 ror eax, 1672 mov dx, ax73 add sp, 274 pop ax75 rol eax, 1676 77 popf78 ret79 80 81 ifndef VBOX_PC_BIOS82 34 ;; 83 35 ; 32-bit signed division. … … 90 42 __I4D: 91 43 pushf 44 if VBOX_BIOS_CPU ge 80386 45 .386 92 46 push eax 93 47 push edx … … 115 69 pop ax 116 70 rol eax, 16 117 71 .8086 72 else 73 call NeedToImplementOn8086__I4D 74 endif 118 75 popf 119 ret120 endif ; VBOX_PC_BIOS121 122 123 ;;124 ; 32-bit unsigned multiplication.125 ;126 ; @param dx:ax Factor 1.127 ; @param cx:bx Factor 2.128 ; @returns dx:ax Result.129 ;130 __U4M:131 pushf132 push eax133 push edx134 push ecx135 136 rol eax, 16137 mov ax, dx138 ror eax, 16139 xor edx, edx140 141 shr ecx, 16142 mov cx, bx143 144 mul ecx ; eax * ecx -> edx:eax145 146 pop ecx147 148 pop edx149 ror eax, 16150 mov dx, ax151 add sp, 2152 pop ax153 rol eax, 16154 155 popf156 ret157 158 159 ifndef VBOX_PC_BIOS160 ;;161 ; 32-bit signed multiplication.162 ;163 ; @param dx:ax Factor 1.164 ; @param cx:bx Factor 2.165 ; @returns dx:ax Result.166 ; cx, es may be modified; di is preserved167 ;168 __I4M:169 pushf170 push eax171 push edx172 push ecx173 push ebx174 175 rol eax, 16176 mov ax, dx177 ror eax, 16178 xor edx, edx179 180 shr ecx, 16181 mov cx, bx182 183 imul ecx ; eax * ecx -> edx:eax184 185 pop ebx186 pop ecx187 188 pop edx189 ror eax, 16190 mov dx, ax191 add sp, 2192 pop ax193 rol eax, 16194 195 popf196 ret197 endif ; VBOX_PC_BIOS198 199 200 ;;201 ; 64-bit left shift.202 ;203 ; @param ax:bx:cx:dx Value.204 ; @param si Shift count.205 ; @returns ax:bx:cx:dx Shifted value.206 ; si is zeroed207 ;208 __U8LS:209 210 test si, si211 jz u8ls_quit212 u8ls_rot:213 shl dx, 1214 rcl cx, 1215 rcl bx, 1216 rcl ax, 1217 dec si218 jnz u8ls_rot219 u8ls_quit:220 ret221 222 223 ;;224 ; 64-bit unsigned right shift.225 ;226 ; @param ax:bx:cx:dx Value.227 ; @param si Shift count.228 ; @returns ax:bx:cx:dx Shifted value.229 ; si is zeroed230 ;231 __U8RS:232 233 test si, si234 jz u8rs_quit235 u8rs_rot:236 shr ax, 1237 rcr bx, 1238 rcr cx, 1239 rcr dx, 1240 dec si241 jnz u8rs_rot242 u8rs_quit:243 ret244 245 246 ;;247 ; memset taking a far pointer.248 ;249 ; cx, es may be modified; di is preserved250 ;251 ; @returns dx:ax unchanged.252 ; @param dx:ax Pointer to the memory.253 ; @param bl The fill value.254 ; @param cx The number of bytes to fill.255 ;256 _fmemset_:257 push di258 259 mov es, dx260 mov di, ax261 xchg al, bl262 rep stosb263 xchg al, bl264 265 pop di266 ret267 268 269 ;;270 ; memcpy taking far pointers.271 ;272 ; cx, es may be modified; si, di are preserved273 ;274 ; @returns dx:ax unchanged.275 ; @param dx:ax Pointer to the destination memory.276 ; @param cx:bx Pointer to the source memory.277 ; @param sp+2 The number of bytes to copy (dw).278 ;279 _fmemcpy_:280 push bp281 mov bp, sp282 push di283 push ds284 push si285 286 mov es, dx287 mov di, ax288 mov ds, cx289 mov si, bx290 mov cx, [bp + 4]291 rep movsb292 293 pop si294 pop ds295 pop di296 leave297 76 ret 298 77
Note:
See TracChangeset
for help on using the changeset viewer.