RFC 401 (rfc401) - Page 1 of 2


Conversion of NGP-0 Coordinates to Device Specific Coordinates



Alternative Format: Original Text Document



Network Working Group                                 Jim Hansen
Request for Comment #401                              Center for Advanced
NIC #11923                                              Computation
Category:  D.6                                        University of Illinois
Updates:  RFC #387                                    October 23, 1972
Obsoletes: None


               Conversion of NGP-0 Coordinates to Device
               -----------------------------------------
                          Specific Coordinates
                          --------------------

Conversion of NGP-0 coordinates to floating point PDP-10 coordinates
was discussed in RFC #387.  In general, however, it is undesirable to
convert NGP coordinates to floating point coordinates because real
devices require integer addressing.  To this end, a means is described
to convert NGP coordi- nates to integer coordinates in the range zero
to M, where M is the maximum address of the device screen on a machine
using 2's complement arithmetic.  It would not, however, be difficult
to modify this algorithm to operate on machines using one's complement
or sign-magnitude arithmetic.

First consider the NGP coordinate format:

                   +--+-----------+
                   |  |   n       |
                   +--+-----------+
                    s ^  FRACTION
                    i
                    g
                    n

Where the sign occupies the most significant bit of the coordinate
followed by bits of numerical information (initial implementation of
NGP requires N=15).  Negative numbers are represented by 2's
complement.  Conversion to device coordinates is accomplished by:

                    D = S * f + S

Where D =>integer device coordinate
      S =>scaling factor (typically M/2)
      f =>NGP fractional coordinate

Let us rewrite this as:

                            n     n
                    D = S*(2 *f)/2 +S