1: /
   2: /	APL assembly-language assist for floating-point
   3: /
   4: 
   5: .globl _fppinit, _error
   6: 
   7: SIGFPE = 8.                     / signal # for flt-point exception
   8: rtt = 6                         / opcode for RTT instruction
   9: stst = 170300^tst               / "stst" opcode
  10: bhs = bcc
  11: 
  12: /
  13: / Enable FPP traps and route floating-point execeptions
  14: / to special handler.
  15: /
  16: 
  17: _fppinit:
  18:         mov     r5,-(sp)
  19:         mov     sp,r5
  20:         sys     signal; SIGFPE; fpetrap
  21:         stfps   r0
  22:         bis     $7400,r0
  23:         ldfps   r0
  24:         mov     (sp)+,r5
  25:         rts     pc
  26: 
  27: 
  28: /
  29: /	Exception trap handler
  30: /
  31: / Attempt to figure out the reason for the floating-point
  32: / exception by immediately dumping the error register.
  33: / If another process generates a floating-point exception
  34: / before this service routine is called, the error register
  35: / will be meaningless.  We just take our lumps in that case.
  36: /
  37: 
  38: fpetrap:
  39:         stst    fpstatus        / note: static allocation
  40:         mov     r5,-(sp)
  41:         mov     sp,r5
  42:         mov     r1,-(sp)
  43:         mov     r0,-(sp)
  44:         sys     signal; SIGFPE; fpetrap
  45:         mov     mesg,-(sp)      / default message
  46:         mov     fpstatus,r0
  47:         cmp     r0,$nmesg
  48:         bhs     1f
  49:         add     $mesg,r0        / pointer to specific message
  50:         mov     (r0),(sp)
  51: 1:
  52:         jsr     pc, _error      / print error and APL traceback
  53:         tst     (sp)+           / "can't" ever execute this code
  54:         mov     (sp)+,r0
  55:         mov     (sp)+,r1
  56:         mov     (sp)+,r5
  57:         rtt
  58: 
  59: .data
  60: 
  61: mesg:   mesg0
  62:         mesg2
  63:         mesg4
  64:         mesg6
  65:         mesg8
  66:         mesg10
  67:         mesg12
  68:         mesg14
  69: nmesg = . - mesg
  70: 
  71: mesg0:  <floating exception\0>
  72: mesg2:  <floating opcode error\0>
  73: mesg4:  <floating divide by zero\0>
  74: mesg6:  <floating-to-integer conversion error\0>
  75: mesg8:  <floating overflow\0>
  76: mesg10: <floating underflow\0>
  77: mesg12: <undefined floating-point variable\0>
  78: mesg14: <floating-point maintenance trap\0>
  79: .even
  80: 
  81: .bss
  82: 
  83: fpstatus: .=.+4

Defined functions

SIGFPE defined in line 7; used 2 times
_fppinit declared in line 5; defined in line 17; used 1 times
  • in line 5
bhs defined in line 10; used 1 times
  • in line 48
fpetrap defined in line 38; used 2 times

Defined variables

fpstatus defined in line 83; used 2 times
mesg defined in line 61; used 3 times
mesg0 defined in line 71; used 1 times
  • in line 61
mesg10 defined in line 76; used 1 times
  • in line 66
mesg12 defined in line 77; used 1 times
  • in line 67
mesg14 defined in line 78; used 1 times
  • in line 68
mesg2 defined in line 72; used 1 times
  • in line 62
mesg4 defined in line 73; used 1 times
  • in line 63
mesg6 defined in line 74; used 1 times
  • in line 64
mesg8 defined in line 75; used 1 times
  • in line 65
nmesg defined in line 69; used 1 times
  • in line 47
Last modified: 1986-10-21
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 688
Valid CSS Valid XHTML 1.0 Strict