i co* \

&--1 i NBS TECHNICAL NOTE 847

V*U o* *
NATIONAL BUREAU OF STANDARDS

The National Bureau of Standards 1 was established by an act of Congress March 3, 1901. The Bureau's overall goal is to strengthen and advance the Nation's science and technology and facilitate their effective application for public benefit. To this end, the Bureau conducts

research and provides: (1) a basis for the Nation's physical measurement system, (2) scientific and technological services for industry and government, (3) a technical basis for equity in trade, and (4) technical services to promote public safety. The Bureau consists of the Institute for Basic Standards, the Institute for Materials Research, the Institute for Applied Technology,

the Institute for Computer Sciences and Technology, and the Office for Information Programs. THE INSTITUTE FOR BASIC STANDARDS provides the central basis within the United

States of a complete and consistent system of physical measurement; coordinates that system

with measurement systems of other nations; and furnishes essential services leading to accurate and uniform physical measurements throughout the Nation's scientific community, industry, and commerce. The Institute consists of a Center for Radiation Research, an Office of Measurement Services and the following divisions: Applied Mathematics — Electricity — Mechanics — Heat — Optical Physics — Nuclear

Sciences 2 — Applied Radiation " — Quantum Electronics " — Electromagnetics 3 — Time

and Frequency " — Laboratory Astrophysics a — Cryogenics ". THE INSTITUTE FOR MATERIALS RESEARCH conducts materials research leading to improved methods of measurement, standards, and data on the properties of well-characterized

materials needed by industry, commerce, educational institutions, and Government; provides

advisory and research services to other Government agencies; and develops, produces, and

distributes standard reference materials. The Institute consists of the Office of Standard

Reference Materials and the following divisions: Analytical Chemistry — Polymers — Metallurgy — Inorganic Materials — Reactor

Radiation — Physical Chemistry.

THE INSTITUTE FOR APPLIED TECHNOLOGY provides technical services to promote

the use of available technology and to facilitate technological innovation in industry and Government; cooperates with public and private organizations leading to the development of

technological standards (including mandatory safety standards), codes and methods of test; and provides technical advice and services to Government agencies upon request. The Institute consists of a Center for Building Technology and the following divisions and offices: Engineering and Product Standards — Weights and Measures — Invention and Innovation — Product Evaluation Technology — Electronic Technology — Technical Analysis — Measurement Engineering — Structures, Materials, and Life Safety * — Building Environment * — Technical Evaluation and Application * — Fire Technology.

THE INSTITUTE FOR COMPUTER SCIENCES AND TECHNOLOGY conducts research and provides technical services designed to aid Government agencies in improving cost effec- tiveness in the conduct of their programs through the selection, acquisition, and effective

utilization of automatic data processing equipment; and serves as the principal focus within

the executive branch for the development of Federal standards for automatic data processing equipment, techniques, and computer languages. The Institute consists of the following

divisions: Computer Services — Systems and Software — Computer Systems Engineering — Information Technology.

THE OFFICE FOR INFORMATION PROGRAMS promotes optimum dissemination and

accessibility of scientific information generated within NBS and other agencies of the Federal Government; promotes the development of the National Standard Reference Data System and

a system of information analysis centers dealing with the broader aspects of the National Measurement System; provides appropriate services to ensure that the NBS staff has optimum

accessibility to the scientific information of the world. The Office consists of the following

organizational units: Office of Standard Reference Data — Office of Information Activities — Office of Technical

Publications — Library — Office of International Relations.

1 Headquarters and Laboratories at Gaithersburg, Maryland, unless otherwise noted; mailing address Washington, D.C. 20234.

2 Part of the Center for Radiation Research.

> Located at Boulder, Colorado 80302.

* Part of the Center for Building Technology.
ONAL EUREAU OF STANDARDS

OV 2 2 1974

Dataplot 70: Fortran-Callable Plotting Routines

Carol V. Young and

Philip G. Stein

Institute for Basic Standards

National Bureau of Standards Washington, D.C. 20234

Teai'UuciaJ aa+e n&> ?^7

U.S. DEPARTMENT OF COMMERCE, Frederick B. Dent, Secretary

NATIONAL BUREAU OF STANDARDS, Richard W. Roberts, Director

Issued October 1974
Library of Congress Catalog Card Number: 74-600142

National Bureau of Standards Technical Note 847

Nat. Bur. Stand. (U.S.), Tech. Note. 847, 32 pages (Oct. 1974) CODEN: NBTNAE

U.S. GOVERNMENT PRINTING OFFICE WASHINGTON: 1974

For sale by the Superintendent of Documents, U.S. Government Printing Office, Washington, D.C. 20402 (Order by SD Catalog No. 03.46:847). Price 80 cents.
TABLE OF CONTENTS

Section Title Page

1 INTRODUCTION

1.1 General 2 1.2 Hardware Requirements .'"..- 2 1.3 Software Requirement 3 1.4 Axis of Plot 3

2 DATA FORMATTING

2.1 General 4 2.2 Data Format 4 2.3 Range of Data " 4 2.4 Data Formatting Subroutines 4 2.4.1 OPEN 4 2.4.2 ORIG 5 2.4.3 VECT 5 2.4.4 CURR 5 2.4.5 CHAR 6 2.4.6 SYMBOL 7 2.4.7 NUMBER ..... 8 2.4.8 SCALE ..... 9 2.4.9 DATA 9 2.4.10 AXIS 11 2.4.11 CLOSE 12 2.5 Sample FORTRAN Calling Program 12 2.5.1 Problem Statement 12 2.5.2 Listing 12 2.5.3 Explanation of Calls 13

2.6 Loading Procedures 16

2.7 Execution 16

2.8 Error Messages 17 2.8.1 I/O Errors 17 2.8.2 Data Errors 17

3 PLOTTER ROUTINES

3.1 General .............. 18

3.2 Data Format 19

3.2.1 Vector 19

3.2.2 Character 20

3.3 Size of Data Buffer 22

3.4 Sort 22

3.5 Operating Considerations ..... 22

3.5.1 OS Modification (BOSS) Method 23

3.5.2 Program Method 23

3.6 Procedures for Loading 23

III
3.7 Execution 24

3.7.1 With Mass Storage Device 24

3.7.2 With Paper Tape Device 24

3.7.3 Sorted Files 25

3.8 Error Messages 25

3.8.1 I/O Errors 25

3.8.2 Plot Errors 26

IV
DATAPLOT 70:

FORTRAN-CALLABLE PLOTTING ROUTINES

by

Carol V. Young

and

Philip G. Stein

Office of Measurement Services

Institute for Basic Standards

National Bureau of Standards

A description is given of Dataplot 70, a program which enables plotting

(1) lines between pairs of X-Y coordinates, and (2) a string of ASCII

characters at a given X-Y coordinate on the electrostatic printer/plotter.

Detailed instructions are provided enabling the user to (1) convert data

to plotter format, (2) draw axis, (3) label axis, (4) scale data,

(5) handle arrays, (6) produce symbols at end points, and (7) offset

the origin. Hardware and software requirements as well as loading and

operating instructions are given.

A sample .FORTRAN calling program is included and each instruction 1s

explained in detail. The output of the calling program is shown. Error

messages produced by Dataplot 70 are explained.

Key Words: Digital plotter; graph; graphics; minicomputer; plotter

DISCLAIMER: Mention of commercially produced equipment

or programs by brand name may not be construed as an endorsement or approval of such products by the

National Bureau of Standards. No tests or evaluations

of these products have been conducted.

This plotting program was adapted or derived from a VDM

copyrighted plotting program DATAPLOT- I

I

for the VDM 620

series computer.

Approval has been granted for use in this publication.
1. INTRODUCTION

1.1 General

The Dataplot 70 package enables plotting of (1) lines between

pairs of X-Y coordinates and (2) a string of ASCII characters

at a given X-Y coordinate, on an electrostatic printer/plotter.

Provisions are made to draw and label axes, scale data, handle

arrays (sets of X,Y locations of data points), produce symbols

at end-points and offset the origin.

The package consists of two parts: (1) a special run-time

library for data formatting made up of 5 FORTRAN and 6 ASSEMBLER subroutines, and (2) a load module containing

the assembler language plotter and driving routines.

The user writes a FORTRAN program to call the data

formatting subroutines. These convert his floating

point data coordinates and ASCII labels and titles to properly formatted data for input to the plotter routines.

This formatted data is output to a mass storage device.

The plotter routines will read this file from the mass storage device, sort and process the data, and produce

a plot on the electrostatic printer/plotter.

Paper tape punch and reader can be substituted for the

mass-storage device.

Files to be input directly into the plotter can be prepared

on other computers but must be in the proper format (see

Section 3.2). The plotter is capable of accepting files

which are unsorted, or are sorted in either ascending or descending order.

1.2 Hardware Requirements

The hardware required to support the Dataplot 70 consists of:

A. Any one of Interdata models 5, 70, 80, 85, 74,

7/16, 7/32 with high speed ALU of software supports

for floating point.
B. 8 KB of core (mini mum)

C. Some binary data storage peripheral device (paper tape

reader and punch, disc, tape, or cassette)

D. Operators console to print error messages

E. Varian Statos 31 plotter with Varian interface to Interdata I/O multiplexor bus

1.3 Software Requirements

BOSS or other Interdata operating system, modified to allow

user direct I/O as described in section 3.5 is required to support the Dataplot 70 package. The package is not designed

for use in a real-time environment.

1.4 Axis of Plot

The origin of the plot is in the lower left-hand corner of

the plot area. The X direction is in the direction of the

paper movement. The Y direction is across the width of the

paper. See Figure 1 .4.

FIGURE 1.4.
A plotter unit of X corresponds to one step (0.01") of paper

movement in the printer. A plotter unit of Y corresponds to 0.01" across the page and represents the smallest stylus

interval

.

DATA FORMATTING

2.1 General

A user's FORTRAN program first reads in or generates data to

be plotted. Next, it calls the data formatting subroutines.

These process the user's data producing data in the proper

format for input to the plotter routines. The first call

must be "CALL OPEN" and the last call must be "CALL CLOSE."

Each set of formatted data (vector or character) produced by

the data formatting subroutines requires 8 bytes (see

Section 3.2). The subroutines use a 512 byte 'buffer which

holds 64 sets of formatted data. The subroutines process

64 sets of data and then output the entire buffer as one record to a mass storage device. This is repeated until all

the data has been processed and output.

2.2 Data Format

All X and Y coordinate data are input to the data formatting

subroutines as single precision floating point numbers

representing displacement (in inches) from the origin.

The subroutines output the data to a mass storage device

as positive integers (15 bits) in plotter units (100 plotter

units/inch)

.

2.3 Range of Data

The value of the X coordinate must be positive. The value

of the Y coordinate must be positive and less than 14.08

inches. If any of the floating point coordinate data are outside these ranges, then either the data must be scaled,

(see Section 2.4.8) the origin offset, (see Section 2.4.2)

or both.

2.4 Data Formatting Subroutines

2.4.1 OPEN

Subroutine OPEN initializes pointers and rewinds

the mass storage device.
Calling Sequence: CALL OPEN

2.4.2 ORIG

0RI6 offsets the origin.

Calling Sequence: CALL ORIG (X,Y)

Where:

X Is the distance (in inches) along the X axis by

which the new (relative) origin will be offset

from the old. (Floating point)

Y Is the distance (in inches) along the y axis by

which the new (relative)"origin will be offset

from the old. (Floating point)

Each coordinate processed by the data formatting subroutine after this call will be relative to the new

origin.

2.4.3 VECT

VECT generates the vector end point data which, when

input to the plotter routines will draw a line

between the given pairs of X-Y coordinates.

Calling Sequence: CALL VECT (XI, Yl , X2, Y2)

Where XI, Yl , X2, Y2 are single precision floating

pointing numbers representing inches of displacement

from the origin.

Provision is made for plotting a continuous series

of points. The second X-Y coordinate from the most

recent VECT call are saved as continuation points. If in a VECT call XI = 999. and Yl = 999., the current

continuation points are used as XI and Yl . The

initial continuation point can be set by the subroutine

CURR (see Section 2.4.4).

2.4.4 CURR

CURR initializes the beginning point when plotting

a continuous series of points (see VECT above).

Calling Sequence: CALL CURR (X,Y)
Where X and Y are single precision floating point

numbers representing distance in inches from the origin.

Example:

CALL CURR (X(1),Y(1))

DO 10 I = 2,N

10 CALL VECT (999., 999., X(I),Y(I))

2.4.5 CHAR

The subroutine CHAR generates the code which when

input to the plotter writes the ASCII string starting

at the given X-Y coordinate. The characters are software generated dot matrix characters in two sizes:

small (0.05" x 0.07") and large (0.10" x 0.14") and two

orientations: Upright (0 degrees rotated from the

Y axis) and sideways (-90 degrees rotated from the Y axis). The standard spacing for small characters is

0.03 inches and for large characters is 0.04 inches.

Calling Sequence: CALL CHAR (X, Y, STRING, ISAOR,

NCHAR, ISPAC)

Parameters:

X, Y X and Y coordinates (in inches) of the first

letter (upper left-hand corner of an upright

character, lower left-hand corner of a sideways character). (Floating point)

STRING Address of the first word containing the ASCII

character string to be plotted. It can be given

as a variable name, or as per the example below.

ISAOR Size and orientation:

= small, degrees rotation from Y direction

1 = small, -90 degrees rotation from Y direction

2 = large, degrees rotation from Y direction

3 = large, -90 degrees rotation from Y direction

(Integer)

NCHAR The total number of characters to be plotted in

the string. (Integer)

ISPAC Spacing constant in styli or scans from the

starting coordinate of the previous character.
A negative number causes default standard

spacing. (Integer)

Example: CALL CHAR (1.0, 1.0, 6HSTAT0S, 2,6, -1)

2.4.6 SYMBOL

SYMBOL generates code which, when input to the plotter

routines will produce a symbol centered at the given

X-Y coordinate.

Calling Sequence: CALL SYMBOL (X, Y, IEQ)

X, Y Single precision floating point coordinates

IEQ Positive integer designating symbol to be

produced. (1, 2, 3, 4, or 5.)

The types of symbols indicated by these integers are shown in Figure 2.1

.

4

FIGURE 2.1.

7
2.4.7 NUMBER

NUMBER converts single precision floating point

numbers to ASCII code and generates code which when

input to the plotter routines will print the number

starting at the given X-Y coordinate.

Calling Sequence: CALL NUMBER (X, Y, FPN, ISAOR, NDEC)

This call will plot the floating point, single precision

number FPN at the point X, Y.

Parameters:

X, Y Coordinates (in inches) of the first number in

the string (upper left-hand corner of

upright number, lower left-hand corner

of sideways number). (Floating point)

FPN Floating point number to be plotted. If negative,

will be prefixed with a minus sign. Leading

zeros will be suppressed, except the zero to the

left of the decimal point. The floating point

number is rounded by adding 5 to the digit to

the right of the last digit to be plotted, then

truncating the result. (Floating point)

ISAOR Size and Orientation:

= small, degrees rotation from Y direction

1 = small, -90 degrees rotation from Y direction

2 = large, degrees rotation from Y direction

3 = large, -90 degrees rotation from Y direction

(Integer)

NDEC Number of decimal places to be plotted to the

right of the decimal point. (Integer)

If 0<NDEC < 4, NDEC digits will be plotted

to the right of the decimal

.

If NDEC = 0, only the decimal will be plotted to the right of the integer portion of the floating

point number.

If NDEC = -1, the decimal point is omitted along

with the fraction.
If NDEC < -1, NDEC-1 numbers are truncated from

the right side of the integer portion of the

floating point number. The number of characters

plotted, regardless of NDEC, is always greater

than or equal to 1

.

If NDEC > 4, only the first four digits will

have any meaning. This subroutine will handle

floating point numbers whose integer part is

less than 32768 and will write up to 4 digits

to the right of the decimal point.

2.4.8 SCALE

This subroutine calculates a scale factor and a displacement

factor.

Calling Sequence: CALL SCALE (ARR,NPTS,PGSZ,INC)

ARR The name of the (floating point) array to be

scaled.

NPTS The number of points to be scaled in the array.

Normally, all points are scaled. (Integer)

PGSZ The size of the page (linear interval in inches)

within which the data must fall. (Floating

point)

INC The increment at which the array is to be sampled.

(Integer)

The calling FORTRAN program dimensions the array to have

NPTS + 2 dimensions. The SCALE subroutine stores the

displacement factor in ARR (NPTS+1) and the scale factor

as ARR (NPTS+2). The scale factor and displacement

factor are used by the subroutine DATA. (See below.)

2.4.9 DATA

The subroutine DATA with one call takes two arrays of

equal size, one containing the X values and the second

containing the corresponding Y values and produces the

formatted data which when input to the plotter routines

will plot each point.

Calling Sequence: CALL DATA (XARR, YARR, NPTS, INC,

LTY, IEQ)
Parameters

XARR The name of the array from which X values are

to be extracted. (Floating point)

YARR The name of the array from which the Y values

are to be extracted. (Floating point)

NPTS The number of data points to be plotted from

each array to the end of the array. (Integer)

INC The increment at which the arrays are to be

sampled. INC = 1 means every X, Y pair is plotted;

INC = 2 means e^ery other pair, etc. (Integer)

LTY Indicates the type of line desired.

LTY<0: A symbol will be plotted at each selected

point, but no lines will connect the

symbols.

LTY=0: A line will be drawn connecting each

selected point. No symbols will be

drawn.

LTY>0: A symbol will be plotted at each

selected point and a line will connect

all symbols.

IEQ Positive integer designating symbol to be produced

(1, 2, 3, 4, or 5). (Integer) (See Figure

2.1.)

If LTY = 0, IEQ has no meaning.

Prior to the call, the two arrays must be dimensioned

to provide two extra locations at the end of each array.

These locations must contain the displacement and the

scale factor in that order.

The subroutine DATA will use these factors to operate

on each floating point datum as follows:

X' = X(I) - Displacement

Scale Factor

OR

X' = X(I) - X(NPTS+1)

X(NPTS+2)

10
The subroutine SCALE (see above) will calculate these

factors and store them in the proper locations. However, note that the scale factor for the X array and

the scale factor for the Y array are independent of

each other. The programmer can calculate these

factors and store them in the proper location. Care

should be taken with 'thesign of the displacement since

it is a value to be subtracted from each datum.

2.4.10 AXIS

Subroutine AXIS produces an axis on the plot with tic

marks e^ery inch, an axis label and number labels for

each tic mark.

Calling Sequence: CALL AXIS (X, Y, AXLH, IDIR, BCD,

NCHAR, VLO, SF)

Parameters:

X, Y The starting point on the page of the axis to be drawn. (Floating point)

AXLH The length of the axis in inches. The value

given will be truncated to the next smallest

integer value. (Floating point)

IDIR Axis direction. Zero for X direction. Non-zero

for Y direction. (Integer)

BCD The first word address of a character string

to be plotted as a label for the axis. If there

is no label, use a dummy space.

NCHAR NCHAR is the number of letters contained in the

character string to be plotted as a title.

(Integer)

If NCHAR _> 0, the title, tic marks, and interval

labels will be plotted to the left of the

vertical axis and above the horizontal axis.

If NCHAR < 0, the title, tic marks and interval

labels will be plotted to the right of the

vertical axis and below the horizontal axis.

11
VLO The number to be plotted at the starting point

of the axis. By making VLO = ARR(NPTS+1),

the axis and data will have the same starting point. (Floating point)

SF The scale factor (units/inch) to be used in

labeling the 1 inch intervals. By making SF = ARR(NPTS+2) (see Scale routine), the axis and

data will have the same scale factor.

(Floating point)

NOTES:

1. The intervals labels will be scaled by powers of 10

if they are too large or small to fit into 2 decimal

place accuracy. Thus, assuming a scale factor of

1000. /inch, 12000. would be printed 12.00 on the

interval tic mark, but a note would be added to the axis label: "*103 ."

2. The SCALE routine should be used prior to using AXIS

if SF = ARR(NPTS+2) and VLO = ARR(NPTS+1).

2.4.11 CLOSE

The subroutine CLOSE will output the last partial record

which contains the software end-of-file mark and will

rewind the mass storage device.

Calling Sequence: CALL CLOSE

This call must be the last statement in each data generation FORTRAN calling program.

2.5 Sample FORTRAN Calling Program

See Figure 2.2.

2.5.1 Problem Statement: Produce a plot of X = SIN Y as Y varies from to 8tt.

2.5.2 Program Listing

DIMENSION X(723),Y(723)

DATA X(722),X(723)/-1.,.5/

J=0

DO 1 1=1,1441,2

J=J+1

12
Y(J)=(FL0AT(I-1))*3. 141 59/180.

1 X(J)=SIN(Y(J))

CALL OPEN

CALL 0RIG(1.,.9)

CALL SCALE(Y, 721,13.,!)

CALL DATA(X,Y, 721, 1,0,1)

CALL AXIS(0.,0.,4.,0,6HSIN(Y),6,-1.,X(723))

CALL AXIS (2., 0., 12., 1, 1H , -1, Y(722), Y(723))

CALL CHAR(-.5,6.5,1HY,2,1,-1)

CALL CLOSE

STOP

END

2.5.3 Explanation of Calls

DATA X(722),X(723)/-1.,.5/

Set up the X displacement and the X scale factor.

The displacement of -1 units is necessary to insure all

X values output for plotter will be positive. The scale

factor of 1/2 units/inch is arbitrary.

CALL OPEN

Initializing routine

CALL 0RIG(1.,.9)

Offsets the origin by 1 inch in the X direction and 0.9

inches in the Y direction. This allows room to the left

of the plot and below the plot for axis labels. All

data processed will be with respect to this new origin.

CALL SCALE(Y, 721,13.,!)

Scales all 721 values in the Y array to fall between

and 13 inches by calculating a displacement and scale

factor and storing these values in Y(722) and Y(723)

respectfully. The Y values vary from to about 25.1

yielding a scale factor of 2 units/inch and a displacement

of zero.

CALL DATA(X,Y,721, 1,0,1)

Processes each value in each array by subtracting the

displacement and dividing by the scale factor, and then

generates and outputs the formatted data for input to the plotter routines for each of the 721 points.

CALL AXIS (0., 0., 4., 0, 6H SIN(Y), 6, -1., X(723))

Generates and outputs formatted data for the plotter routines

to draw the X axis tic marks, axis label, and interval

labels. The axis is to be started at the relative

13
origin (0.,0.) to be 4 inches long, and to be labeled

SIN(Y). The number of characters argument is positive

causing the labeling to be done to the left of the axis.

The label for the starting point of the axis is -1 . and

the same scale factor is used as is used in the DATA

call.

CALL AXIS (2 ,0.,13.,1,1H ,-l,Y(722), Y(723))

Generates and outputs formatted data for the pi otter

routines to draw the Y axis, tic marks, and the interval

labels. The axis is started at the origin of the sine

plot. Since the displacement is -1 units in the X direction

and the scale factor is 1/2 unit/inch, the origin of the

sine plot is 2 inches above the relative origin of the

plot area. In the Y direction there is no difference

between the sine plot origin and the relative origin

of the plot area since the Y displacement, Y(722), is zero.

No axis label is desired since the axis subroutine would

print the label close to the axis which in this case would interfere with the graph. In some cases when

no label is desired, the "number of characters" argument

can equal zero and the ASCII argument can be a dummy

argument. However in this case, in order to print the

tic marks and the interval labels below the axis, the

"number of characters" argument must be negative.

A label of one ASCII blank is therefore called for with

the "number of characters" argument being -1.

The scale factor is the same as used in the DATA call.

CALL CHAR (-.5, 6.5, 1HY, 2, 1, -1)

Produced a label for the Y axis below the graph

area. Since the relative origin of the graph area

in the X direction is offset one inch above the

origin of the plot area, the X coordinate Y -.5

will position the label 1/2 inch below the graph

area but will fall within the plot area.

CALL CLOSE

Outputs the last partial buffer to the mass storage

device.

14
SAMPLE OUTPUT

FIGURE 2.2.

10.00 -5.00 10.00

ciNCV) »: 1

15
2.6 Loading Procedures

The data formatting calling program is loaded with the OS

library loader.

1. Compile the FORTRAN calling program.

2. Assign logical units to

a. FORTRAN calling program (object) (LU)

b. User's subroutine (object) if any (LU 1 ) c. Special run time library (LU'')

d. FORTRAN run-time library (LU'")

3. Load the OS library loader

4. Start loader

5. Set bias

BIAS bbbb

where bbbb is the desired program origin expressed

in hexadecimal notation.

6. Load FORTRAN calling program (object)

LOAD LU

7. Link FORTRAN user subroutines, if any

LINK LU' (as required)

8. Edit special run-time library

EDIT LU"

9. Edit the FORTRAN run- time library

EDIT LU"

10. Produce a memory map

MAP LU

Memory map is output on logical unit LU.

11. Return control to operating system.

END

2.7 Execution

1. Assign logical unit A to a scratch area on a

16
mass storage device or to a paper tape punch

device.

NOTE: Operating system must be generated to include at leas.t 12 logical units to allow logical

unit A to be used.

2. Start at the program origin.

The program will output the unsorted data formatted

for input to the plotter routines on logical unit A.

2.8 Error Messages

2.8.1 I/O Errors

These messages are produced if an I/O error is

encountered during an attempt to output to logical

unit A. The xxxx is the status byte.

1. DEVICE UNAVAILABLE xxxx

Cause: Device not on line

Program response: Pause

Operator response: Turn on device, type CONTINUE

2. BEGIN/END OF DEVICE xxxx

Cause: End-of -medium encountered

Program Response: Terminate run and return control

to operating system

Operator response: Assign a larger scratch area

to logical unit A and restart

program at origin.

3. I/O ERROR xxxx

Cause: Unrecoverable error

Program response: Terminate run and return control

to operating system

2.8.2 Data Errors

A data error message is produced when the value of a floating point coordinate is outside the range handled

by the data formatting subroutines

DATA ERROR xxxx

The value of xxxx indicates which coordinate and in

which subroutine the error occurred.

17
ERROR MESSAGE COORDINATE SUBROUTINE RESPONSE

Data Error 0103 X CHAR Data ignored*

Data Error 0104 Y CHAR Data ignored*

Data Error 0203 X VECT Data ignored*

Data Error 0204 Y VECT Data ignored*

Data Error 0303 X CURR Program terminated.

Control returned to operating system.

Data Error 0304 Y CURR Program terminated.

Control returned to operating system.

Data Error 0403 X ORIG Program terminated.

Control returned to operating system.

Data Error 0404 Y ORIG Program terminated.

Control returned to operating system.

* After 20 data error messages from either CHAR

or VECT, the program is terminated and control

is returned to the operating system. This

feature can be altered by changing the maximum

error count. The constant is at location X'28 1 relative to the entry point OPEN.

3. PLOTTER ROUTINES

3.1 General

The plotter routines, started at the origin will

1

3.

4.

Calculate and request as much core as is

available for use as the data buffer.

Read the entire data file from the mass storage device into the data buffer.

Sort the entire file in descending order.

Output the entire sorted file to the mass storage device.

Read the sorted data from the mass storage

device, one record at a time.

Convert from vector format to raster format.

Output the raster data to the printer/plotter

through driver routines.

Read and process consecutive records until

end-of-file is reached.

18
Release buffer storage and return control to the operating system.

3.2 Data Formats

Data to be read by the plotter routines must be in either

Vector Format or Character Format. Each set of data are contained in 8 bytes.

3.2.1 Vector

A set of vector data (see Figure 3.1) consists

of end point X and Y co-ordinates represented as positive integers in plotter units (100 plotter

units per inch)

.

K 16 bits H

X1

Y1

X2

Y2

FIGURE 3.1

19
The plotter routines will sort in descending

order and therefore XI will be greater or equal

to X2. This is also true if data files are generated on other computers and presorted in

descending order. However, if the files are presorted in ascending order, then X2 must be

greater or equal to XI

.

3.2.2 Characters

Character format (see Figure 3.2) consists of

X and Y co-ordinates as positive integers in

plotter units (100 plotter units per inch), a code indicating that the data is character data,

the ASCII code of the character, and information

indicating the size and orientation of the

character.

h- 16 bits

Xc

Yc

7FF416

i ASCII CODE

6 7 8 15

FIGURE 3.2.

20
Bit number 6 of the fourth word determines the

size of the character:

BIT 6=0 for small characters

BIT 6 = 1 for large characters

Bit number 7 of the fourth word determines the

orientation of the character:

BIT 7=0 for upright characters

BIT 7 = 1 for sideways characters

The X and Y coordinate refer to the upper lefthand corner of an upright character and the lower

left-hand corner of a sideways character as shown

in Figure 3.3

FIGURE 3.3.

21
Co in Fig. 3.3 refers to bit 7 = in Fig. 3.2.

C] in Fig. 3.3 refers to bit 7 = 1 in Fig. 3.2.

3.3 Size of Data Buffer

Each record is 512 bytes long. The number of records, N,

that can be handled is defined as

N = integer ( available core - 2 ) bytes

5T2

Each set of data (vectors or characters) require 8

bytes (see Section 3.2). The file is terminated with

a software end-of-file mark (X'7FFF'). The amount of

data that can be contained in the buffer for the sort

is 64*N sets. Data in excess of this amount will be

lost. The number of records of sorted data output to

a mass storage device will equal the number of records

read except when the buffer is full in which case N+l

records are output.

There is no limit to the number of records that can be

read in for conversion from vector to raster format.

However, the number of sets which can be handled on any

given plotted line is

512(N-1) + 2 12

3.4 SORT

The sort routine will sort the entire file on the

first halfword of each 4 halfword sets of data in

descending order. The sort is therefore on X for

character sets and on XI for vector sets. The vector

data was formatted during the data formatting subroutines so that XI 21 X2 in each set.

3.5 Operating Considerations

The plotter reads the formatted input data produced (for

example) by the data formatting routines. It sorts the

data and writes it out again. It then rereads the data

one records at a time for plotting. All of these operations

are done using supervisor calls compatible with Interdata

operating systems (see sections 3.7.1 and 3.7.2).

22
Communications with the printer/plotter are done using standalone drivers as supplied by the manufacturer and modified at

NBS. As such, the protect mode of the CPU as enabled by the

OS prevents this communication.

To remedy this deficiency, it is necessary to turn off the

protect bit.

3.5.1 OS MODIFICATION (BOSS) METHOD

Change the contents of location UPSW from X'3D00'

to X '3C00 ' . This modifies the user PSW provided

by the START command so that protect mode is

disabled.

Similar procedures will work, for other OS but will cause difficulty in a real-time environment. Use of

this package implies dedication of the CPU to the

Statos 31 for the duration of the run.

3.5.2 PROGRAM METHOD

The following program will turn off the protect bit

and jump to the plotter routines. If an SVC is used

anywhere else in the system, care must be taken to restore it.

PROFF LH 0,X'9A' Get new PSW for SVC's

NHI O.X'FEFF 1 Kill protect bit

STH 0,X'9A' Put new PSW back

LHI 0, (absolute address of Get start addr. of plotter

origin of plotter)

STH 0,X'9C Put in new PSW (loc) for SVC

SVC 0,0 Do the SVC

This program will disable protect mode, but the OS

will restore it the next time the START command is

executed unless the modification of section 3.5.1 has

been made.

3.6 Procedure for Loading

The load-module is loaded with the OS resident loader.

(This example is for BOSS.)

BIAS xxxx

23
where xxxx is the desired program origin expressed

in hexadecimal notation.

LOAD pa

where pa is the physical address of the device from

which the program is to be loaded.

3.7 Execution

3.7.1 With Mass Storage Device

1. Assign logical unit A to the input file.

2. Assign logical unit 9 to a scratch area where the sorted data can be written.

3. Turn on the Varian printer/plotter

4. Start plotter routines at origin.

The program will read the entire data file from

logical unit A, sort the data, write the sorted

file on logical unit 9, read and process con- secutive records from logical unit 9, position

paper in printer to top of page, output raster

data to the plotter and return control to the

operating system.

3.7.2 With Paper Tape Device

1. Assign logical unit A to the paper tape punch/

reader.

2. Assign logical unit 9 to the paper tape punch/

reader.

3. Load input tape into the paper tape reader.

4. Turn on printer/plotter, paper tape

reader and paper tape punch.

5. Start plotter routines at origin.

The program will read the input tape, sort the data

and output the sorted data to the paper tape punch

device.

6. Turn off the paper tape reader as soon as the

read operation is complete and before the punch

operation is complete.

24
The program will produce the messages:

DEVICE UNAVAILABLE xxxx

PAUSE

7. Load the tape of sorted data into the paper

tape reader, turn on reader.

8. Type CONTINUE

The program will read and process consecutive records

from this tape, output raster data to the plotter and

return control to the operating system.

3.7.3 SORTED FILES

1. Assign logical unit 9 to the sorted file.

2. Start at ORIGIN + 8

If the file was sorted on another computer in ascending

order, the program will print a message to the operator

indicating an ascending sort and will plot the complement of the data.

3.8 Error Messages

3.8.1 I/O Errors

These messages are produced if an I/O error is encountered

during the read or the write operations.

xxxx is the status byte.

1. DEVICE UNAVAILABLE xxxx

(See Section 2.8.1)

2. BEGIN/END OF DEVICE xxxx

(See Section 2.8.1)

3. I/O ERROR xxxx

(See Section 2.8.1)

4. EOF ENCOUNTERED IN VECTOR FILE xxxx

Cause: A file mark has been read during binary

input.

Program response: Terminate run and return control

to operating system.

25
3.8.2 Plot Error

VECTOR FILE TOO LARGE

Cause: Data file input from logical unit A is

too large.

Program response: Continues to process all data

in buffer. Additional data is

lost.

CURRENT VECTOR FILE OVERFLOW

Cause: The number of sets of data to be plotted

on the current line is too large.

Program response: Continues to process all data

in buffer. Additional sets of

data for that current line are lost.

PLOT ERROR xxxx where xxxx indicates the cause of the plot error.

Plot errors occur when there is no data in the file

or when the data is either out of range or in

incorrect order.

ERROR MESSAGE

Plot Error 0000

Plot Error 0001

Plot Error 0002

Plot Error 0003

Plot Error 0004

CAUSE

No data in file

No positive X data in file

Data out of order

X value out of

range

Y value out of

range

P ROGRAM RESP&ONSE

Terminates run and returns

control to operating system.

Terminates run and returns

control to operating system.

Data ignored and run continues*

Data ignored and run continues*

Data ignored and run continues*

The operator should check logical unit assignments. Failure

to assign a physical address to logical unit A produces

PLOT ERROR 0000. Assigning meaningless files to logical

unit A or logical unit 9 will cause many error messages.

After 20 PLOT ERRORS the run is terminated and control

returned to the operating system.

26
REFERENCES

1. User's Guide for Dataplot-II With Varian 620 Series

Computers, Varian Publication No. 03-996137

2. User's Guide for Statos 31 With the Interdata 70 Series

Computer, Varian Publication No. 03-996160B

3. Interdata Model 70 User's Manual, Interdata Publication

20-261

4. Interdata Operating System (BOSS) Reference Manual,

Interdata Publication 29-292

5. Interdata FORTRAN IV Reference Manual, Interdata Pub-

• li cation B29-220R01

6. Interdata BOSS FORTRAN User's Guide, Interdata Publication 29-246

7. Interdata Run Time Library Manual, Interdata Publication

29-242

8. Computer Hardware and Software , Abrams, M.D. & Stein, P. G.,

Addi son-Wesley, 197T"

27
NBS-114A (REV. 7-73)

U.S. DEPT. OF COMM. BIBLIOGRAPHIC DATA

SHEET

1. PUBLICATION OR REPORT NO. NBS Technical Note 847

2. Gov't Accession

No.

3. Recipient's Accession No.

4. TITLE AND SUBTITLE

Dataplot 70: Fortran-Callable Plotting Routines

5. Publication Date October 1974

6. Perfotming Organization Code

7. AUTHOR(S)

Carol V. Young and Philip G. Stein

8. Perfotming Organ. Repoit No.

9. PERFORMING ORGANIZATION NAME AND ADDRESS NATIONAL BUREAU OF STANDARDS

DEPARTMENT OF COMMERCE

WASHINGTON, D.C. 20234

10. Project/Task/Work Unit No.

11. Conttact/Gtant No.

12. Sponsoring Otganization Name and Complete Address (Street, City, State, ZIP) 13. Type of Report & Period Covered

14. Sponsoring Agency Code

15. SUPPLEMENTARY NOTES

Library of Congress Catalog Card Number: 74-600142

16. ABSTRACT (A 200-word or less factual summary of most significant information. If document includes a significant bibliography or literature survey, mention it here.) A description is given of Dataplot 70, a program which enables plotting 1) lines

between pairs of X-Y coordinates and 2) a string of ASCII characters at a given

X-Y coordinate on the electrostatic printer/plotter. Detailed instructions are provided enabling the user to 1) convert data to plotter format, 2) draw axis,

3) label axis, 4) scale data, 5) handle arrays, 6) produce symbols at end points,

and 7) offset the origin. Hardware and software requirements as well as loading

and operating instructions are given.

A sample FORTRAN calling program is included and each instruction is explained in

detail. The output of the calling program is shown. Error messages produced by

Dataplot 70 are explained.

17. KEY WORDS (six to twelve entries; alphabetical order; capitalize only the first letter of the first key word unless a proper name; separated by semicolons)

Digital plotter; graph; graphics; minicomputer; plotter

18. AVAILABILITY ^~1 Unlimited

]J For Official Distribution. Do Not Release to NTIS

|X I Order From Sup. of Doc, U.S. Government Printing Office Washington, D.C. 20402, SD Cat. No. C13l 46:847

~^\ Order From National Technical Information Service (NTIS)

Springfield, Virginia 22151

19. SECURITY CLASS

(THIS REPORT)

UNCLASSIFIED

20. SECURITY CLASS

(THIS PAGE)

UNCLASSIFIED

21. NO. OF PAGES I

32

22. Price

U5COMU.DC 29042-P7f
NBS TECHNICAL PUBLICATIONS

PERIODICALS JOURNAL OF RESEARCH reports National Bureau

of Standards research and development in physics, mathematics, and chemistry. Comprehensive scientific papers give complete details of the work, including laboratory data, experimental procedures, and theoretical and mathematical analyses. Illustrated with photographs, drawings, and charts. Includes listings of other NBS papers as issued. Published in two sections, available separately:

• Physics and Chemistry (Section A)

Papers of interest primarily to scientists working in these fields. This section covers a broad range of physical and chemical research, with major emphasis on standards of physical measurement, fundamental constants, and properties of matter. Issued six times a

year. Annual subscription: Domestic, $17.00; Foreign,

$21.25. • Mathematical Sciences (Section B)

Studies and compilations designed mainly for the mathematician and theoretical physicist. Topics in mathematical statistics, theory of experiment design, numerical analysis, theoretical physics and chemistry, logical design and programming of computers and computer

systems. Short numerical tables. Issued quarterly. Annual subscription: Domestic, $9.00; Foreign, $11.25. DIMENSIONS/NBS (formerly Technical News Bulletin) —This monthly magazine is published to inform

scientists, engineers, businessmen, industry, teachers,

students, and consumers of the latest advances in science and technology, with primary emphasis on the work at NBS. DIMENSIONS/NBS highlights and reviews such

issues as energy research, fire protection, building technology, metric conversion, pollution abatement,

health and safety, and consumer product performance.

In addition, DIMENSIONS/NBS reports the results of Bureau programs in measurement standards and techniques, properties of matter and materials, engineering standards and services, instrumentation, and automatic

data processing. Annual subscription: Domestic, $6.50; Foreign, $8.25.

N0NPERI0DICALS Monographs—Major contributions to the technical liter- ature on various subjects related to the Bureau's scientific and technical activities. Handbooks—Recommended codes of engineering and

industrial practice (including safety codes) developed

in cooperation with interested industries, professional organizations, and regulatory bodies. Special Publications—Include proceedings of high-level national and international conferences sponsored by NBS, precision measurement and calibration volumes, NBS annual reports, and other special publications appropriate to this grouping such as wall charts and

bibliographies. Applied Mathematics Series—Mathematical tables, manuals, and studies of special interest to physicists, engineers, chemists, biologists, mathematicians, computer programmers, and others engaged in scientific and technical work.

National Standard Reference Data Series—Provides

quantitative data on the physical and chemical properties of materials, compiled from the world's literature and critically evaluated. Developed under a world-wide program coordinated by NBS. Program under authority

of National Standard Data Act (Public Law 90-396). See also Section 1.2.3.

Building Science Series—Disseminates technical infor- mation developed at the Bureau on building materials, components, systems, and whole structures. The series presents research results, test methods, and performance criteria related to the structural and environmental functions and the durability and safety characteristics of building elements and systems.

Technical Notes—Studies or reports which are complete

in themselves but restrictive in their treatment of a

subject. Analogous to 'monographs but not so comprehensive in scope or definitive in treatment of the subject area. Often serve as a vehicle for final reports of work performed at NBS under the sponsorship of other government agencies. Voluntary Product Standards—Developed under pro- cedures published by the Department of Commerce in Part 10, Title 15, of the Code of Federal Regulations. The purpose of the standards is to establish nationally recognized requirements for products, and to provide

all concerned interests with a basis for common understanding of the characteristics of the products. The

National Bureau of Standards administers the Voluntary Product Standards program as a supplement to the activities of the private sector standardizing

organizations. Federal Information Processing Standards Publications (FIPS PUBS)—Publications in this series collectively constitute the Federal Information Processing Standards Register. The purpose of the Register is to serve

as the official source of information in the Federal Gov- ernment regarding standards issued by NBS pursuant

to the Federal Property and Administrative Services Act of 1949 as amended, Public Law 89-306 (79 Stat. 1127), and as implemented by Executive Order 11717

(38 FR 12315, dated May 11, 1973) and Part 6 of Title 15 CFR (Code of Federal Regulations). FIPS PUBS

will include approved Federal information processing standards information of general interest, and a complete index of relevant standards publications. Consumer Information Series—Practical information, based on NBS research and experience, covering areas

of interest to the consumer. Easily understandable language and illustrations provide useful background

knowledge for shopping in today's technological marketplace. NBS Interagency Reports—A special series of interim

or final reports on work performed by NBS for outside sponsors (both government and non-government). In

general, initial distribution is handled by the sponsor;

public distribution is by the National Technical Infor- mation Service (Springfield, Va. 22151) in paper copy

or microfiche form. Order NBS publications (except Bibliographic Subscription Services) from: Superintendent of Documents, Government Printing Office, Washington, D.C. 20402. BIBLIOGRAPHIC SUBSCRIPTION SERVICES

The following current-awareness and literature-survey bibliographies are issued periodically by the Bureau

:

Cryogenic Data Center Current Awareness Service

(Publications and Reports of Interest in Cryogenics). A literature survey issued weekly. Annual subscription: Domestic, $20.00; foreign, $25.00. Liquefied Natural Gas. A literature survey issued quarterly. Annual subscription: $20.00. Superconducting Devices and Materials. A literature survey issued quarterly. Annual subscription: $20.00. Send subscription orders and remittances for the preceding bibliographic services to the U.S. Department

of Commerce, National Technical Information Service, Springfield, Va. 22151. Electromagnetic Metrology Current Awareness Service (Abstracts of Selected Articles on Measurement

Techniques and Standards of Electromagnetic Quantities from D-C to Millimeter-Wave Frequencies).

Issued monthly. Annual subscription: $100.00 (Special rates for multi-subscriptions). Send subscription order and remittance to the Electromagnetic Metrol- ogy Information Center, Electromagnetics Division, National Bureau of Standards, Boulder, Colo. 80302.
U.S. DEPARTMENT OF COMMERCE

National Bureau of Standards

Washington, D.C. 20234

OFFICIAL BUSINESS

Penalty for Private Use. $300

POSTAGE AND FEES PAID

U.S. DEPARTMENT OF COMMERCE COM-215

..pV-UT/O/j,

/;>6-l9l6