home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast.iso / pcmag / vol9n01.zip / DIMUL87.ASM < prev    next >
Assembly Source File  |  1989-09-26  |  2KB  |  55 lines

  1.         title   DIMUL87.ASM 80x87-based Signed Divide
  2.         page    55,132
  3.  
  4. ; DIMUL87.ASM   Double Precision Signed Integer Multiply
  5. ;               for 80x87 coprocessor and 8086, 8088, 80286, or
  6. ;               80386 in real mode/16-bit protected mode
  7. ;
  8. ;               Be sure to call INIT87 routine first to test for 
  9. ;               coprocessor existence and to set rounding mode, 
  10. ;               precision, and exception masks!
  11. ;
  12. ; Copyright (C) 1989 Ziff Davis Communications
  13. ; PC Magazine * Ray Duncan
  14. ;
  15. ; Call with:    DX:AX           = double-precision argument 1
  16. ;               CX:BX           = double-precision argument 2           
  17. ;
  18. ; Returns:      DX:CX:BX:AX     = quad-precision product
  19. ;
  20. ; Destroys:     nothing
  21.  
  22. _TEXT   segment word public 'CODE'
  23.  
  24.         assume  cs:_TEXT
  25.  
  26.         public  dimul
  27. dimul   proc    near
  28.  
  29.         push    dx                      ; put argument 1 on stack
  30.         push    ax      
  31.  
  32.         push    cx                      ; put argument 2 on stack
  33.         push    bx
  34.  
  35.         mov     bx,sp                   ; make arguments addressable
  36.  
  37.         fild    dword ptr ss:[bx]       ; load one argument
  38.         fimul   dword ptr ss:[bx+4]     ; multiply it by the other
  39.  
  40.         fistp   qword ptr ss:[bx]       ; unload the result
  41.         fwait                           ; wait for it to arrive
  42.  
  43.         pop     ax                      ; retrieve result
  44.         pop     bx
  45.         pop     cx
  46.         pop     dx
  47.         ret                             ; and exit
  48.  
  49. dimul   endp
  50.  
  51. _TEXT   ends
  52.  
  53.         end
  54.  
  55.