Aucbvax.2920
fa.unix-wizards
utzoo!decvax!ucbvax!unix-wizards
Thu Sep  3 05:27:14 1981

>From decvax!duke!reed!ross@Berkeley Thu Sep  3 05:18:55 1981
I guess I agree with mike@BRL about the choice of forum, but:
Here's a pfe I hacked up when I found to my dismay that V7 didn't
have one.  I think the only problem with the V6 version was that
it thought r1 would be OK after the "sys write".  Separate this
form on the dotted lines.
                               -Graham Ross
                                       (duke!reed!ross)
..........
.TH PFE 1
.SH NAME
pfe \- print floating-point exception
.SH SYNOPSIS
.B pfe
.SH DESCRIPTION
.I Pfe
examines the floating point exception register and
prints a diagnostic for the last
floating point exception.
.SH SEE ALSO
signal(2) for a description of SIGFPE.
.br
"PDP-11 Processor Handbook" for an explanation of the possible errors.
.SH BUGS
Written in "the ultimate dead language."
Since the diagnostic applies to the last exception
encountered by
.I anyone,
pfe doesn't always say what you'd like it to.
..........
/ pfe(1) - print floating exception

write = 4
exit = 1
stst = 170300^tst

.text
       stst    r2
       bic     $!016, r2
       mov     strgs(r2), r3
 1:
       movb    (r3)+, out
       beq     1f
       mov     $1, r0
       sys     write; out; 1
       br      1b
 1:
       mov     r2, r0
       sys     exit

.data
strgs:
       1f
       2f
       3f
       4f
       5f
       6f
       7f
       8f

1:      <NO ERROR\N\0 FLOATING>
2:      <OP-CODE ERROR\N\0>
3:      <DIVIDE BY ZERO\N\0>
4:      <BAD FLOAT-TO-INTEGER CONVERSION\N\0>
5:      <OVERFLOW\N\0>
6:      <UNDERFLOW\N\0>
7:      <UNDEFINED (-0)\N\0>
8:      <MAINTENANCE TRAP\N\0>
.even

.bss
out:    .=.+1

-----------------------------------------------------------------
gopher://quux.org/ conversion by John Goerzen <[email protected]>
of http://communication.ucsd.edu/A-News/


This Usenet Oldnews Archive
article may be copied and distributed freely, provided:

1. There is no money collected for the text(s) of the articles.

2. The following notice remains appended to each copy:

The Usenet Oldnews Archive: Compilation Copyright (C) 1981, 1996
Bruce Jones, Henry Spencer, David Wiseman.