Changeset 142 in xtideuniversalbios for trunk/Assembly_Library/Src
- Timestamp:
- Mar 14, 2011, 5:17:47 PM (14 years ago)
- google:author:
- aitotat
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Assembly_Library/Src/Util/Size.asm
r141 r142 32 32 ALIGN JUMP_ALIGN 33 33 Size_GetSizeToAXAndCharToDLfromBXDXAXwithMagnitudeInCX: 34 %ifndef USE_186 ; If 8086/8088 35 push di 36 %endif 34 37 push si 35 38 36 39 ALIGN JUMP_ALIGN 37 40 .MagnitudeConversionLoop: 38 ePUSH_T si, .MagnitudeConversionLoop39 test bx, bx ; Bits 32...47 in use?41 ePUSH_T di, .MagnitudeConversionLoop; DI corrupted only on 8086/8088 build 42 test bx, bx ; Bits 32...47 in use? 40 43 jnz SHORT Size_DivideSizeInBXDXAXby1024andIncrementMagnitudeInCX 41 test dx, dx ; Bits 16...31 in use?44 test dx, dx ; Bits 16...31 in use? 42 45 jnz SHORT Size_DivideSizeInBXDXAXby1024andIncrementMagnitudeInCX 43 cmp ax, 10000 ; 5 digits needed?46 cmp ax, 10000 ; 5 digits needed? 44 47 jae SHORT Size_DivideSizeInBXDXAXby1024andIncrementMagnitudeInCX 45 add sp, BYTE 2 ; Clean return address from stack46 xchg si, cx ; CX = Remainder (0...1023), SI = Magnitude48 add sp, BYTE 2 ; Clean return address from stack 49 xchg si, cx ; CX = Remainder (0...1023), SI = Magnitude 47 50 48 51 ; Convert remainder to tenths 49 xchg bx, ax ; Store AX52 xchg bx, ax ; Store AX 50 53 mov ax, 10 51 mul cx ; DX:AX = remainder * 1052 eSHR_IM ax, 10 ; Divide AX by 102453 xchg cx, ax ; CX = tenths54 mul cx ; DX:AX = remainder * 10 55 eSHR_IM ax, 10 ; Divide AX by 1024 56 xchg cx, ax ; CX = tenths 54 57 xchg ax, bx 55 58 … … 58 61 59 62 pop si 63 %ifndef USE_186 64 pop di 65 %endif 60 66 ret 61 67 .rgbMagnitudeToChar: db " kMGTP"
Note:
See TracChangeset
for help on using the changeset viewer.