home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / lib / mntc6846.zoo / patch / sfltosf.s < prev    next >
Encoding:
Text File  |  1994-11-14  |  1.2 KB  |  39 lines

  1.  ! C68 32 bit integer => 4-byte-floating point conversion routine
  2.  !-----------------------------------------------------------------------------
  3.  ! ported to 68000 by Kai-Uwe Bloem, 12/89
  4.  !  #1  original author: Peter S. Housel 3/28/89
  5.  !  #2  Redid register usage, and then added wrapper routine
  6.  !    to provide C68 IEEE compatibility    Dave & Keith Walker    02/92
  7.  !  #3  Changed entry/exit code for C68 v4.3 compatibility
  8.  !    Removed ACk entry points                -djw-    09/93
  9.  !-----------------------------------------------------------------------------
  10.  
  11. BIAS4    =    0x7F - 1
  12.  
  13.     .sect .text
  14.     .define    .Xsfltosf
  15.  
  16. !----------------------------------------
  17. !    sp    Return address
  18. !    sp+4    value to convert
  19. !    sp+8    address of float/double
  20. !----------------------------------------
  21. .Xsfltosf:
  22.     move.l    4(sp),a1    ! address for result
  23.     lea    8(sp),a0    ! address for source
  24.  
  25.     move.l    (a0),d1        ! get the 4-byte integer
  26.     move.w    #BIAS4+32-8,d0    ! radix point after 32 bits
  27.     move.w    (a0),d2        ! check sign of number
  28.     bge    1f        ! nonnegative
  29.     neg.l    d1        ! take absolute value
  30. 1:
  31.     move.l    d1,(a1)        ! write mantissa onto stack
  32.     clr.w    d1        ! set rounding = 0
  33.     jsr    .Xnorm4
  34.  
  35.     move.l    (sp)+,a0    ! get return address
  36.     add.l    #8,sp        ! remove parameters from stack
  37.     jmp    (a0)        ! ... and return
  38.  
  39.