EURO_FXD.ASM 766 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. .model large
  2. .486
  3. ; .386
  4. ;
  5. ; SMART ;Optimise all code
  6. ;
  7. ; LOCALS ;allow local symbols
  8. ;
  9. ; WARN
  10. ;
  11. ;_data segment para public use16 'data'
  12. ;
  13. ;_data ends
  14. ;
  15. ;
  16. ; assume cs:a_code,ds:_data
  17. ;
  18. ; Parameters passed as follows:
  19. ; 1st in EAX
  20. ; 2nd in EDX
  21. ; 3rd in EBX
  22. ; 4th in ECX
  23. ;
  24. a_code segment word public use32 'code'
  25. public mul_64bit_
  26. mul_64bit_ proc near
  27. imul edx ;edx:eax = edx*eax
  28. shl edx,20
  29. shr eax,12
  30. or eax,edx
  31. ret
  32. mul_64bit_ endp
  33. ; pass (f0,0,f1) for f0/f1
  34. public div_64bit_
  35. div_64bit_ proc near
  36. idiv ebx ;result in eax
  37. mov ecx,eax
  38. ; fraction = (remainder*4096)/f1
  39. shl edx,12 ;times 4096
  40. mov eax,edx
  41. xor edx,edx
  42. idiv ebx
  43. and eax,4095
  44. shl ecx,12
  45. or eax,ecx
  46. ret
  47. div_64bit_ endp
  48. a_code ends
  49. end
  50.