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

  1.  ! C68 4 byte floating point compare routine
  2.  !-----------------------------------------------------------------------------
  3.  ! ported to 68000 by Kai-Uwe Bloem, 12/89
  4.  !  #1  Based on 8 byte routine        Dave Walker            05/92
  5.  !  #2  Changed entry/exit code for C68 v4.3 compatibility        09/93
  6.  !-----------------------------------------------------------------------------
  7.  
  8.     .sect .text
  9.  
  10.     .define .Xsfcmp
  11.  
  12. !----------------------------------------
  13. !    sp    Return address
  14. !    sp+4    address of second operand
  15. !    sp+8    address of first operand
  16. !----------------------------------------
  17. .Xsfcmp:
  18.     move.l    4(sp),a0    ! address of second operand
  19.     move.l    8(sp),a1    ! address of first operand
  20.     move.l    (a0),d1
  21.     move.l    (a1),d2
  22.  
  23.     tst.l    d1        ! check sign bit of first operand
  24.     bpl    3f        ! ... and jump if not negative
  25.     neg.l    d1        ! negate
  26.     eor.l    #0x80000000,d1    ! toggle sign bit
  27. 3:
  28.     tst.l    d2        ! check sign bit of second operand
  29.     bpl    6f        ! ... and jump if not negative
  30.     neg.l    d2        ! negate
  31.     eor.l    #0x80000000,d2    ! toggle sign bit
  32. 6:
  33.     cmp.l    d2,d1        ! compare operands
  34.     bgt    gt
  35.     beq    eq
  36.  
  37. lt:    move    #-1,d0
  38.     bra    finish
  39.  
  40. gt:    move    #1,d0
  41.     bra    finish
  42.  
  43. eq:     move    #0,d0
  44.  
  45. finish:
  46.     move.l    (sp)+,a0    ! get return address
  47.     add.l    #8,sp        ! remove 2 parameters from stack
  48.     jmp    (a0)        ! ... and return
  49.  
  50.