home *** CD-ROM | disk | FTP | other *** search
- P386N
-
- Dividend EQU dword ptr [bp+10]
- Divisor EQU dword ptr [bp+6]
-
- _TEXT SEGMENT BYTE USE16 PUBLIC 'CODE'
- ASSUME cs:_TEXT
-
- PUBLIC FixedDiv
- PROC FixedDiv FAR
- push bp
- mov bp,sp
- mov edx,Dividend
- sub eax,eax
- shrd eax,edx,16 ; position so that result ends up
- sar edx,16 ; in EAX
- idiv Divisor
- shld edx,eax,16 ; whole part of result in DX
- ; fractional part is already in AX
- pop bp
- ret
- ENDP FixedDiv
-
- _TEXT ENDS
-
- END