home *** CD-ROM | disk | FTP | other *** search
- public LongMul386,LongDivMod386,LongShr386,LongShl386,TailPtr
-
- Code segment byte public 'code'
- assume cs:Code, ds:Code, ss:Code, es:Code
- .386p
- ideal
- proc LongMul386 far
- xchg ax,dx ; Swap high and low words
- rol eax,16 ; Move high word to top of register
- mov ax,dx ; eax := dx:ax
- xchg cx,bx
- rol ecx,16
- mov cx,bx ; ecx := bx:cx
- imul ecx
- shld edx,eax,16 ; dx:ax := eax
- ret
- endp
- proc LongDivMod386 far
- xchg ax,dx ; Swap high and low words
- rol eax,16 ; Move high word to top of register
- mov ax,dx ; eax := dx:ax
- cdq ; Sign extend!
- xchg cx,bx
- rol ecx,16
- mov cx,bx ; ecx := bx:cx
- idiv ecx ; edx:eax := eax mod/div ecx
- mov ecx,edx ; The modulus
- shld edx,eax,16 ; dx:ax := eax {quotient}
- shld ebx,ecx,16 ; bx:cx := ecx {modulus}
- ret
- endp
- proc LongShr386 far
- shrd ax,dx,cl
- shr dx,cl
- ret
- endp
- proc LongShl386 far
- shld dx,ax,cl
- shl ax,cl
- ret
- endp
- TailPtr:
- ends
- end
-