SFGL70 - Small Fast Graphics Library Last Revision: April 28, 1980 CHAPTER 1 INTRODUCTION SFGL70 is a UTRC developed software library. This library is intended to provide graphics capability for the Tektronix 4010, 4006, and 4014 terminals. The library was designed to be small (under 2K words), while providing the user with essential graphic capabilities. Those user's familiar with the PDP-6 memoscope graphics library, will find that the SFGL70 has similiar but greater capabilities. Because the graphics package is a library, only those routines referenced by the users program will be linked as a part of the executable task image. Since the library has been created at UTRC, the systems programming group welcomes your comments regarding it's performance. Any suggestions as to how the SFGL70 can be improved are always welcome. If the content of any portion of this documentation package is not clear, please inform us. You can call us at: extension 7241. CHAPTER 2 PROGRAMMING CONSIDERATIONS The Tektronix terminals have an absolute coordinate system ranging from 0-1023 on the X axis and from 0-780 on the Y axis. However, the coordinate system(window) established by GRID or WINDOW has a range from 0-920 on the X axis and from 0-735 on the Y axis. The window is shifted right 103 coordinates and up 45 coordinates to allow labels below and to the left of the window. Ascii text may be displayed anywhere within the absolute coordinate system. However, if a text string is attempted to be displayed outside the range of the absolute coordinate system, the Tektronix termial hardware will insert a carriage return and line feed into the text string. Ascii characters are 14 coordinates in width and 22 coordinates in height. The coordinates reference the bottom left corner of each character. The operating mode of the Tektronix terminals may be either Alpha or Graphic. The SFGL70 routines will put the terminal in the correct mode before they attempt to do textural or graphic output. However, you must put the terminal in Alpha mode if you wish to do Fortran output after having just performed graphic output. We have designed the package for faster plot execution by reducing system I/O overhead. This is accomplished by buffering all graphic output. However, the graphic output buffer may be left partially full by any routine which returns to the calling program while still in Graphic mode. To ensure that all graphic output is physically sent to the terminal, the user must call any routine which returns the terminal to Alpha mode. The Fortran program must not use a "STOP" statement to exit. To ensure that all buffered graphic output is sent to the terminal correctly, the program should exit with a "CALL EXIT" statement. Any user linking assembly language routines to their program should note that the SFGL70 routines use local event flags 10 and 11. Terminals operating with the SFGL70 package must run at 9600 baud or slower. This speed dependency is due to the delays which must be generated as a result of terminal control functions such as hardcopy and erase. If you are using the SFGL70 at a Tektronix 4014, you should set the character size to 74 characters per line and 35 lines per page. CHAPTER 3 AVAILABLE SUBROUTINES GRID - This routine establishes the limits of the user defined coordinate system. The range of the X and Y axis may be between + and - 1.7 * 10**38. This routine also displays an X and Y grid with labels. It establishes the screen's virtual window. PDP - 6 Equivalent - CLAXES Returns in Alpha Mode Calling Format: CALL GRID(LABELX,XMAX,XMIN,YGRDLO,LABELY,YMAX,YMIN,XGRDLO,MMFLG) Where: LABELX - is the ascii label displayed below the X grid. XMAX - is the floating point maximum value of the X axis. It may be positive, negative, or zero. It may be less than XMIN. XMIN - is the floating point minimum value of the X axis. It may be positive, negative, or zero. It may be greater than XMAX. XGRDLO - is the floating point Y coordinate position of the X grid. If it is out of range, the X grid will appear at YMAX or YMIN depending on which limit it is closer to. LABELY - is the ascii label displayed to the left of the Y grid. YMAX - is the floating point mayimum value of the Y axis. It may be positive, negative, or zero. It may be less than YMIN. YMIN - is the floating point minimum value of the Y axis. It may be positive, negative, or zero. It may be greater than YMAX. YGRDLO - is the floating point X coordinate position of the Y grid. If it is out of range, the Y grid will appear at XMAX or XMIN depending on which limit it is closer to. MMFLG - is a flag to specify whether the minimum and maximum values of each AVAILABLE SUBROUTINES PAGE 3-2 grid should be displayed. a mmflg integer value of -1 will cause the grid's value not to be displayed. ******************** WINDOW - This routine establishes the limits of the user defined coordinate system. The range of the X and Y axis may be between + and - 1.7 * 10**38. This routine also displays an X and Y grid with labels. It establishes the screen's virtual window. It calls GRID to perform those functions. However, unlike GRID, WINDOW will not perform correctly if a grid minimum is greater than the corresponding grid maximum. in addition, it computes an appropriate number of tics to display on the X and Y grid and the distance between those tics. This algorithm to automatically display tic marks with labels is a compromise between making your programming easier and keeping the library small. PDP - 6 Equivalent - None Returns in Alpha Mode Calling Format: CALL WINDOW(LABELX,XMAX,XMIN,YGRDLO,LABELY,YMAX,YMIN,XGRDLO,MMFLG) Where: LABELX - is the ascii label displayed below the X grid. XMAX - is the floating point maximum value of the X axis. It may be positive, negative, or zero. It may be less than XMIN. XMIN - is the floating point minimum value of the X axis. It may be positive, negative, or zero. It may be greater than XMAX. XGRDLO - is the floating point Y coordinate position of the X grid. If it is out of range, the X grid will appear at YMAX or YMIN depending on which limit it is closer to. LABELY - is the ascii label displayed to the left of the Y grid. YMAX - is the floating point mayimum value of the Y axis. It may be positive, negative, or zero. It may be less than YMIN. YMIN - is the floating point minimum value of the Y axis. It may be positive, negative, or zero. It may be greater than YMAX. YGRDLO - is the floating point X coordinate position of the Y grid. If it is out of range, the Y grid will appear at XMAX or XMIN depending on which limit it is closer to. MMFLG - is a flag to specify whether the minimum and maximum values of each grid should be displayed. a mmflg integer value of -1 will cause the grid's value not to be displayed. ******************** AVAILABLE SUBROUTINES PAGE 3-3 PLOT - Routine to plot a continuous or dashed curve(line), within the virtual window established by GRID. PDP - 6 Equivalent - CLCURV Returns in Graphic Mode Calling Format: CALL PLOT(NUMPTS,XARRAY,YARRAY) Where: NUMPTS - is the integer number of points to be connected to plot the curve(line). If less than zero every other point is connected. XARRAY - are the virtual floating point X coordinates. YARRAY - are the virtual floating point Y coordinates. ******************** PLOTC - The same as plot except the first point of the curve(line) is connected to the last point of the last call to PLOT or PLOTC. PDP - 6 Equivalent - CLPNTM Returns in Graphic Mode ******************** AVAILABLE SUBROUTINES PAGE 3-4 POINT - Routine to display a point(s) within the virtual window established by GRID. PDP - 6 Equivalent - None Returns in Graphic Mode Calling Format: CALL POINT(NUMPTS,XARRAY,YARRAY) Where: NUMPTS - is the integer number of points to be displayed XARRAY - are the virtual floating point X coordinates. YARRAY - are the virtual floating point Y coordinates. ******************** POINTI - Routine to display a point(s) within the absolute window of the display. PDP - 6 Equivalent - None Returns in Graphic Mode Calling Format: CALL POINTI(NUMPTS,IXARRY,IYARRY) Where: NUMPTS - is the integer number of points to be displayed XARRAY - are the absolute integer X coordinates. YARRAY - are the absolute integer Y coordinates. ******************** AVAILABLE SUBROUTINES PAGE 3-5 TICWIN - Routine to display tic marks(crosses) within the complete virtual window established by GRID. The spacing between tics is in virtual coordinates. PDP - 6 Equivalent - CLGRID Returns in Graphic Mode Calling Format: CALL TICWIN(XSPACE,YSPACE) Where: XSPACE - is the virtual floating point number of x coordinates between tics. YSPACE - is the virtual floating point number of y coordinates between tics. ******************** TICGRD - Routine to display tic marks along the x and y grid. The spacing between tics is in virtual coordinates, as established by GRID. PDP - 6 Equivalent - None Returns in Graphic Mode Calling Format: CALL TICGRD(XSPACE,YSPACE) Where: XSPACE - is the virtual floating point number of x coordinates between tics. YSPACE - is the virtual floating point number of y coordinates between tics. ******************** AVAILABLE SUBROUTINES PAGE 3-6 HTEXT - Routine to display text horizontally, using the coordinate system (window) established by GRID. PDP - 6 Equivalent - CLAN Returns in Alpha Mode Calling Format: CALL HTEXT(TEXT,XCOORD,YCOORD) Where: TEXT - is the ascii string to be displayed XCOORD - is the virtual floating point X coordinate position to begin the text display. YCOORD - is the virtual floating point Y coordinate position to begin the text display. ******************* VTEXT - Routine to display text vertically using the coordinate system (window) established by the call to GRID. PDP - 6 Equivalent - None Returns in Alpha Mode Calling Format: CALL VTEXT(TEXT,XCOORD,YCOORD) Where: TEXT - is the ascii text to be displayed. XCOORD - is the virtual floating point X coordinate position to begin the text display. YCOORD - is the virtual floating point Y coordinate position to begin the text display. ******************** AVAILABLE SUBROUTINES PAGE 3-7 FLTXT - Routine to display a floating point number (in G17.6 Format) within the coordinate system(window) established by the call to GRID. PDP - 6 Equivalent - CLFP Returns in Alpha Mode Calling Format: CALL FLTXT(FLTNUM,XCOORD,YCOORD) Where: FLTNUM - is the floating point number to be displated. XCOORD - is the virtual floating point X coordinate position to begin the display. YCOORD - is the virtual floating point Y coordinate position to begin the display. ******************** PLTSYM - Routine to display any keyboard character(symbol) in the virtual window established br GRID. PDP - 6 Equivalent - CLCARP Returns in Alpha Mode Calling Format: CALL PLTSYM(NUMSYM,XARRAY,YARRAY,SYMBOL) Where: NUMSYM - is the number of times to display the symbol XARRAY - is the array(variable) containing the virtual floating point X coordinate position(s) to display the symbol YARRAY - is the array(variable) containing the virtual floating point Y coordinate position(s) to display the symbol SYMBOL - is the ascii symbol(character) to be displayed ******************** AVAILABLE SUBROUTINES PAGE 3-8 HTEXTI - Routine to display text horizontally, using the display's absolute integer coordinate system. PDP - 6 Equivalent - WRITMZ Returns in Alpha Mode Calling Format: CALL HTEXTI(TEXT,IXCORD,IYCORD) Where: TEXT - is the ascii string to be displayed IXCORD - is the absolute integer X coordinate position to begin the text display. IYCORD - is the absolute integer Y coordinate position to begin the text display. ******************* VTEXTI - Routine to display text vertically using absolute integer coordinate system. PDP - 6 Equivalent - None Returns in Alpha Mode Calling Format: CALL VTEXTI(TEXT,IXCORD,IYCORD) Where: TEXT - is the ascii text to be displayed. IXCORD - is the absolute integer X coordinate position to begin the text display. IYCORD - is the absolute integer Y coordinate position to begin the text display. ******************** AVAILABLE SUBROUTINES PAGE 3-9 FLTXTI - Routine to display a floating point number (in G17.6 Format) within the absolute integer coordinate system. PDP - 6 Equivalent - DVMM Returns in Alpha Mode Calling Format: CALL FLTXTI(FLTNUM,IXCORD,IYCORD) Where: FLTNUM - is the floating point number to be displated. IXCORD - is the absolute integer X coordinate position to begin the display. IYCORD - is the absolute integer Y coordinate position to begin the display. ******************** SCURSR - Routine to activate the graphic cursor(cross-hair), allowing the user to position it. The cursor position is transmitted to to the computer when a keyboard character is struck. This character along with the cursor position is returned as arguments. PDP - 6 Equivalent - None Returns in Alpha Mode Calling Format: CALL SCURSR(ICHAR,IX,IY) WHERE: ICHAR - is the keyboard character typed (right adjusted if not declared as a byte) IX - is the absolute integer X screen coordinate of the graphic cursor. IY - is the absolute integer Y screen coordinate of the graphic cursor. ******************** AVAILABLE SUBROUTINES PAGE 3-10 VCURSR - Routine to activate the graphic cursor(cross-hair), allowing the user to position it. The cursor position is transmitted to to the computer when a keyboard character is struck. This character along with the cursor position is returned as arguments. VCURSR transforms the returned coordinates into virtual floating point coordinates according to the window established by GRID. PDP - 6 Equivalent - None Returns in Alpha Mode Calling Format: CALL VCURSR(ICHAR,X,Y) WHERE: ICHAR - is the keyboard character typed (right adjusted if not declared as a byte) X - is the virtual floating point X screen coordinate of the graphic cursor. Y - is the virtual floating point Y screen coordinate of the graphic cursor. ******************** ERASE - Routine to erase the screen. PDP - 6 Equivalent - CLERAS Returns in Alpha Mode Calling Format: CALL ERASE ******************** AVAILABLE SUBROUTINES PAGE 3-11 COPY - Routine to make a hardcopy of the screen. PDP - 6 Equivalent - NONE Returns in Alpha Mode Calling Format: CALL COPY ******************* BELL - Routine to ring the terminal bell. PDP - 6 Equivalent - None Returns in Alpha Mode Calling Format: CALL BELL(N) WHERE: N - is the integer number of times to ring the bell. ******************* BAUD - Routine to inform sfgl70 of the baud rate of the user's terminal. it is only needed if the routines copy, erase, or bell are used. The default baud rate is 9600. PDP - 6 Equivalent - None Returns in Previous Mode Calling Format: CALL BAUD(N) WHERE: N - is the integer baud rate of the terminal. ******************* AVAILABLE SUBROUTINES PAGE 3-12 MVCURI - Routine to move the cursor to the desired screen coordinates, using the absolute integer coordinates of the display. PDP - 6 Equivalent - None Returns in Alpha Mode Calling Format: CALL MVCURI(IX,IY) WHERE: IX - is the absolute integer x coordinate position to move the cursor to. IY - is the absolute integer y coordinate position to move the cursor to. ******************* MVCUR - Routine to move the cursor to the desired screen coordinates, using the virtual window established by GRID. PDP - 6 Equivalent - None Returns in Alpha Mode Calling Format: CALL MVCUR(X,Y) WHERE: X - is the virtual floating point coordinate position to move the cursor to. Y - is the virtual floating point y coordinate position to move the cursor to. ******************* AVAILABLE SUBROUTINES PAGE 3-13 GTCURI - Routine to obtain the current cursor screen coordinates, using the absolute integer coordinates of the display. PDP - 6 Equivalent - None Returns in Alpha Mode Calling Format: CALL GTCURI(IX,IY) WHERE: IX - is the absolute integer x coordinate position of the cursor. IY - is the absolute integer y coordinate position of the cursor. ******************* GTCUR - Routine to obtain the current cursor screen coordinates, using the virtual window established by GRID. PDP - 6 Equivalent - None Returns in Alpha Mode Calling Format: CALL GTCUR(X,Y) WHERE: X - is the virtual floating point coordinate position of the cursor. Y - is the virtual floating point y coordinate position of the cursor. ******************* AVAILABLE SUBROUTINES PAGE 3-14 BACK - Routine to move the cursor back n spaces. PDP - 6 Equivalent - None Returns in Alpha Mode Calling Format: CALL BACK(N) WHERE: N - is the integer number of times to backspace. ******************* UP - Routine to move the cursor up n lines. PDP - 6 Equivalent - None Returns in Alpha Mode Calling Format: CALL UP(N) WHERE: N - is the integer number of lines to move the cursor up. ******************* DOWN - Routine to move the cursor down n lines. PDP - 6 Equivalent - None Returns in Alpha Mode Calling Format: CALL DOWN(N) WHERE: N - is the integer number of lines to move the cursor down. ******************** AVAILABLE SUBROUTINES PAGE 3-15 HOME - Routine to move the cursor to the home position (top left corner of the screen). PDP - 6 Equivalent - None Returns in Alpha Mode Calling Format: CALL HOME ******************** ALPHA - Routine to return the terminal to Alpha mode. PDP - 6 Equivalent - None Returns in Alpha Mode Calling Format: CALL ALPHA ******************** BLKBOX - Routine to inform the graphics package that the graphics terminal is on a shared line with the hardcopy device. PDP - 6 Equivalent - None Returns in Previous Mode Calling Format: CALL BLKBOX ******************** INDEX ALPHA . . . . . . . . . . . . . . . . . 3-15 BACK . . . . . . . . . . . . . . . . . . 3-13 BAUD . . . . . . . . . . . . . . . . . . 3-11 BELL . . . . . . . . . . . . . . . . . . 3-11 BLKBOX . . . . . . . . . . . . . . . . . 3-15 COPY . . . . . . . . . . . . . . . . . . 3-10 DOWN . . . . . . . . . . . . . . . . . . 3-14 ERASE . . . . . . . . . . . . . . . . . 3-10 FLTXT . . . . . . . . . . . . . . . . . 3-6 FLTXTI . . . . . . . . . . . . . . . . . 3-8 GRID . . . . . . . . . . . . . . . . . . 3-1 GTCUR . . . . . . . . . . . . . . . . . 3-13 GTCURI . . . . . . . . . . . . . . . . . 3-12 HOME . . . . . . . . . . . . . . . . . . 3-15 HTEXT . . . . . . . . . . . . . . . . . 3-5 HTEXTI . . . . . . . . . . . . . . . . . 3-7 MVCUR . . . . . . . . . . . . . . . . . 3-12 MVCURI . . . . . . . . . . . . . . . . . 3-11 PLOT . . . . . . . . . . . . . . . . . . 3-3 PLOTC . . . . . . . . . . . . . . . . . 3-3 PLTSYM . . . . . . . . . . . . . . . . . 3-7 POINT . . . . . . . . . . . . . . . . . 3-4 POINTI . . . . . . . . . . . . . . . . . 3-4 SCURSR . . . . . . . . . . . . . . . . . 3-9 TICGRD . . . . . . . . . . . . . . . . . 3-5 TICWIN . . . . . . . . . . . . . . . . . 3-4 UP . . . . . . . . . . . . . . . . . . . 3-14 VCURSR . . . . . . . . . . . . . . . . . 3-9 VTEXT . . . . . . . . . . . . . . . . . 3-6 VTEXTI . . . . . . . . . . . . . . . . . 3-8 WINDOW . . . . . . . . . . . . . . . . . 3-2 INDEX PAGE I-2