1: ldfps = 170100^tst
   2: stfps = 170200^tst
   3: /
   4: .globl sin, _sin
   5: .globl cos, _cos
   6: /
   7: /	floating point sin/cos
   8: /	replaces the value in fr0 by its sin/cos
   9: /	there are no error exits
  10: /	coefficients are #3370 from Hart & Cheney
  11: /
  12: _sin:
  13:         mov     r5,-(sp)
  14:         mov     sp,r5
  15:         movf    4(r5),fr0
  16:         jsr     pc,sin
  17:         br      1f
  18: 
  19: _cos:
  20:         mov     r5,-(sp)
  21:         mov     sp,r5
  22:         movf    4(r5),fr0
  23:         jsr     pc,cos
  24: 1:
  25:         mov     (sp)+,r5
  26:         rts     pc
  27: 
  28: cos:
  29:         absf    fr0
  30:         mov     $1,-(sp)
  31:         br      1f
  32: sin:
  33:         clr     -(sp)
  34: 1:
  35:         stfps   -(sp)
  36:         ldfps   $200
  37:         movf    fr1,-(sp)
  38:         movf    fr2,-(sp)
  39:         mov     r0,-(sp)
  40: /
  41: /	quadrant reduction -  arg = (2/J)x
  42: /	-1 < arg < 1
  43: /
  44:         movf    fr0,-(sp)
  45:         absf    fr0
  46:         modf    frpi2,fr0
  47:         modf    $fourth,fr1
  48:         mulf    $four,fr1
  49:         movfi   fr1,r0
  50:         add     34(sp),r0
  51:         movf    $one,fr1
  52:         inc     r0
  53:         ror     r0
  54:         bcs     1f
  55:         subf    $one,fr0
  56: 1:
  57:         ror     r0
  58:         bcc     1f
  59:         negf    fr0
  60: 1:
  61:         tstf    (sp)+
  62:         cfcc
  63:         bpl     1f
  64:         negf    fr0
  65: 1:
  66:         movf    fr0,fr1
  67:         mulf    fr0,fr1         /arg^2
  68: /
  69:         movf    p4,fr2
  70:         mulf    fr1,fr2
  71:         addf    p3,fr2
  72:         mulf    fr1,fr2
  73:         addf    p2,fr2
  74:         mulf    fr1,fr2
  75:         addf    p1,fr2
  76:         mulf    fr1,fr2
  77:         addf    p0,fr2
  78:         mulf    fr2,fr0         / zP(z^2)
  79: /
  80:         movf    fr1,fr2
  81:         addf    q3,fr2
  82:         mulf    fr1,fr2
  83:         addf    q2,fr2
  84:         mulf    fr1,fr2
  85:         addf    q1,fr2
  86:         mulf    fr1,fr2
  87:         addf    q0,fr2          / Q(z^2)
  88: /
  89:         divf    fr2,fr0         / zP(z^2)/Q(z^2)
  90: /
  91:         mov     (sp)+,r0
  92:         movf    (sp)+,fr2
  93:         movf    (sp)+,fr1
  94:         ldfps   (sp)+
  95:         tst     (sp)+
  96: /	clc		/tst clears carry
  97:         rts     pc
  98: /
  99: fourth  = 37600
 100: one     = 40200
 101: four    = 40600
 102: /
 103: .data
 104: frpi2:  40042;174603; 67116; 42025
 105: /
 106: p0:     046117;031130;175220;165273
 107: p1:     145626;154170;031651;104637
 108: p2:     044726;162341;133224;052302
 109: p3:     143530;056427;005061;125021
 110: p4:     042021;174005;170441;175607
 111: q0:     046003;163716;123445;167144
 112: q1:     044707;047147;032436;120046
 113: q2:     043423;156142;064161;007314
 114: q3:     042004;123513;026637;160477
 115: /
 116: /p0 =  .13578 84097 87737 56690 92680 d8
 117: /p1 = -.49429 08100 90284 41611 58627 d7
 118: /p2 =  .44010 30535 37526 65019 44918 d6
 119: /p3 = -.13847 27249 98245 28730 54457 d5
 120: /p4 =  .14596 88406 66576 87222 26959 d3
 121: /q0 =  .86445 58652 92253 44299 15149 d7
 122: /q1 =  .40817 92252 34329 97493 95779 d6
 123: /q2 =  .94630 96101 53820 81805 71257 d4
 124: /q3 =  .13265 34908 78613 63589 11494 d3
 125: /q4 =  .1                             d1

Defined functions

_cos declared in line 5; defined in line 19; used 1 times
  • in line 5
_sin declared in line 4; defined in line 12; used 1 times
  • in line 4
cos declared in line 5; defined in line 28; used 8 times
four defined in line 101; used 1 times
  • in line 48
fourth defined in line 99; used 1 times
  • in line 47
one defined in line 100; used 2 times
sin declared in line 4; defined in line 32; used 10 times

Defined variables

frpi2 defined in line 104; used 1 times
  • in line 46
p0 defined in line 106; used 1 times
  • in line 77
p1 defined in line 107; used 1 times
  • in line 75
p2 defined in line 108; used 1 times
  • in line 73
p3 defined in line 109; used 1 times
  • in line 71
p4 defined in line 110; used 1 times
  • in line 69
q0 defined in line 111; used 1 times
  • in line 87
q1 defined in line 112; used 1 times
  • in line 85
q2 defined in line 113; used 1 times
  • in line 83
q3 defined in line 114; used 1 times
  • in line 81
Last modified: 1975-05-14
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 568
Valid CSS Valid XHTML 1.0 Strict