--------------------------------------------------------------------------------
***** PLOT3D Vector/Raster Graphic System ******
Version 3.00, 1983-1996
(Calcomp and Plot88 compatible)
Programed by C. T. Lee
Institute of Applied Geology, Nation Central University, Taiwan, R.O.C.
--------------------------------------------------------------------------------
SUBROUTINE PLOTS(MEMORY,IOPORT,MODEL)
*Set initial value and start of plotting.

** MEMORY to store bitmap and internal arrays:

MEMORY=0: Conventional Memory + Disk
MEMORY=1: Expanded Memory (EMS 4.0 and later)
-MEMORY=2: Extended Memory
MEMORY=3: Video Memory (ET4000 with 1 MB Memory and more)
MEMORY=5: Disk (1 MB+)
MEMORY=6: Contineous memory in windows system.
**MEMORY 0 to 3 is only valid for DOS mode.

** IOPORT for Printer/Plotter

IOPROT=0: PRN
IOPROT=1: LPT1
IOPROT=2: LPT2
IOPROT=3: LPT3
IOPROT=4: FLPT1 (Fast dump to LPT1)

IOPROT=10: Disk file output
IOPROT=11: Disk file output

** IOPORT for Video Display:

IOPORT=89: Video display, direct access to video RAM
IOPORT=90-149: Video display via BIOS

** MODEL for Dot Matrix Printers:

MODEL=0: EPSON 9 pin Printer _ 60x72 dpi
MODEL=3: EPSON 9 pin Printer _ 240x216 dpi
MODEL=20: CANON Bubble Jet (Color) _ 60x60 dpi (LQ mode 8 bits)
MODEL=21: CANON Bubble Jet (Color) _ 180x180 dpi (LQ mode 24 bits)
MODEL=22: CANON Bubble Jet (Color) _ 360x360 dpi (LQ mode 48 bits)
MODEL=25: CANON Bubble Jet Printer _ 60x60 dpi (LQ mode 8 bits)
MODEL=26: CANON Bubble Jet Printer _ 180x180 dpi (LQ mode 24 bits)
MODEL=27: CANON Bubble Jet Printer _ 360x360 dpi (LQ mode 48 bits)
MODEL=45: EPSON 24 pin Printer _ 60x60 dpi
MODEL=46: EPSON 24 pin Printer _ 180x180 dpi
MODEL=60: HP Laser Jet Printer _ 75x75 dpi
MODEL=62: HP Laser Jet Printer _ 150x150 dpi
MODEL=64: HP Laser Jet Printer _ 300x300 dpi
MODEL=66: HP Laser Jet Printer _ 600x600 dpi

** MODEL for Video Displays:

MODEL=90: VGA 640*480 dots, 2 colors
MODEL=91: VGA 640*480 dots, 16 colors
MODEL=92: VGA 640*480 dots, 256 colors
MODEL=93: HERC 720*348 dots, 2 colors
MODEL=94: EGA 320*200 dots, 16 colors
MODEL=95: EGA 640*200 dots, 16 colors
MODEL=96: EGA 640*350 dots, 4 colors
MODEL=97: EGA 640*350 dots, 16 colors
MODEL=100: SVGA 800*600 dots, 2 colors
MODEL=101: SVGA 800*600 dots, 16 colors
MODEL=102: SVGA 800*600 dots, 256 colors
MODEL=105: SVGA 1024*768 dots, 2 colors
MODEL=106: SVGA 1024*768 dots, 16 colors
MODEL=107: SVGA 1024*768 dots, 256 colors
-MODEL=110: SVGA 1280*1024 dots, 2 colors
MODEL=111: SVGA 1280*1024 dots, 16 colors
-MODEL=112: SVGA 1280*1024 dots, 256 colors
MODEL=150: This is used for window display
MODEL=199: Automatic selection of a video mode

** MODEL for Plotter and vectorized Printers:

MODEL=200: HP-GL/2 commands(.GL2)
MODEL=250: ROLAND plotter commands(.RND)
MODEL=300: AutoCAD drawing interchange file format(.DXF)
-MODEL=350: Windows metafile(.WMF)
MODEL=400: Mapinfo interchange file format(.MIF) (Local coordinate)
MODEL=402: Mapinfo interchange file format(.MIF) (2_deg TM)
MODEL=403: Mapinfo interchange file format(.MIF) (3_deg TM)
MODEL=406: Mapinfo interchange file format(.MIF) (UTM)
MODEL=410: Mapinfo interchange file format(.MIF) (logititude_lattitude)

** MODEL for Image Files:

MODEL=701: BMP file format, 1bit (black & white)
-MODEL=704: BMP file format, 4bit ( 16 colors)
MODEL=708: BMP file format, 8bit (256 colors)
MODEL=724: BMP file format, 24bit (true colors)
MODEL=808: TGA file format, 8bit (256 colors)
MODEL=824: TGA file format, 24bit (true colors)
MODEL=901: TIF file format, 1bit (black & white)
-MODEL=904: TIF file format, 4bit ( 16 colors)
MODEL=908: TIF file format, 8bit (256 colors)
-MODEL=909: TIF file format, 8bit (gray scale)
MODEL=924: TIF file format, 24bit (true colors)
-------------------------------------------------------------------------------
SUBROUTINE BEGIN
*Initiation of graphics. After calling of this routing, it will read
graphic control data form PLOT3D.INI and start plotting job.
*This routine has the same effect as PLOTS, but call this routine
instead of call PLOTS is strongly suggested.
*Other usage of BEGIN is described in the last of this document.
-------------------------------------------------------------------------------
SUBROUTINE VIEW3D(BEARING,PLUNGE,ROTATION,XC,YC,ZC)
BEARING: Bearing or azimuth of view direction in degree.
PLUNGE: Plunge of view angle in degree, positive downward.
XC: |
YC: |- View center; fixed point for rotation.
ZC: |
*After calling of this routine, all the subsequent call will be rotated.
-------------------------------------------------------------------------------
SUBROUTINE PERSPECT(DISTANCE,FOCUS,XP,YP,ZP)
DISTANCE:Distance between object and eye, same unit as drawing.
FOCUS: Focus of lense, same unit as DISTANCE.
XP: |
YP: |- Eye position returned.
ZP: |
-------------------------------------------------------------------------------
SUBROUTINE PLOT(XP,YP,IP)
SUBROUTINE PLOT3D(XP,YP,ZP,IP)
XP: X_coordinate for plotting. (unit=cm)
YP: Y_coordinate for plotting.
ZP: Z_coordinate for plotting.
IP: IP=2 Draw from current pen position to (XP,YP,ZP).
IP=3 Move from current pen position to (XP,YP,ZP).
IP=-2 Draw from current pen position to (XP,YP,ZP),
and defind a new origin at the pen stop position.
IP=-3 Move from current pen position to (XP,YP,ZP),
and defind a new origin at the pen stop position.
IP=999 Normal terminatation of graphics.
IP=-999 Reset parameter and start a new page, but
MEMORY, IOPORT AND MODEL remain the same.
*After -999 is used, we do not need to CALL PLOTS any more,
when starting a new page.
-------------------------------------------------------------------------------
SUBROUTINE FINISH
*This routine has the same effect as PLOT(XP,YP,999)
or PLOT3D(XP,YP,ZP,999).
-------------------------------------------------------------------------------
SUBROUTINE SYMBOL(XP,YP,H,STRING,ANGLE,NCHAR)
SUBROUTINE SYMBOL3D(XP,YP,ZP,H,STRING,ANGLE,ELEVAT,ROTATE,NCHAR)
XP: X_coordinate of the lower left cornor of the first character.
YP: Y_coordinate of the lower left cornor of the first character.
ZP: Z_coordinate of the lower left cornor of the first character.
STRING: The character string to be plotted.
H: Height of the character string. (unit=cm)
ANGLE: The rotate angle in X-Y plane, in degree from the X_axis,
counter-clock wise positive.
ELEVAT: The character string path angle with X-Y plane in degree,
up positive.
ROTATE: The rotate angle using character string path as axis,
counter-clock wise positive.
NCHAR: The number of characters to be plotted.
-------------------------------------------------------------------------------
SUBROUTINE SYMBOL(XP,YP,H,char(INTEQ),ANGLE,ICODE) (for special call)
XP: |_
YP: | Center coordinates of the symbol.
H: Height of the character string. (unit=cm)
INTEQ: The number of symbol to be plotted. (INTEQ<15, or =15)
ANGLE: The rotate angle, in degree from the X_axis.
ICODE=-1:The pen is up during the move, after which a single
symbol is produced.
ICODE=-2:The pen is down during the move, after which a single
symbol is produced.
-------------------------------------------------------------------------------
SUBROUTINE FONTS(FontName)
*FontName may be one of the following character strings:
'KM3' KANSAWA Fine Ming 'KK3' KANSAWA Fine KaiSsu
'KM5' KANSAWA Median Ming 'KK5' KANSAWA Median KaiSsu
'KM7' KANSAWA Thich Ming 'KK7' KANSAWA Thick KaiSsu
'KM9' KANSAWA Extra Ming 'KKY' KANSAWA Yen KaiSsu
'KMB' KANSAWA Super Ming
'KB3' KANSAWA Fine Hei 'KR3' KANSAWA Fine Yuan
'KB5' KANSAWA Median Hei 'KR5' KANSAWA Median Yuan
'KB7' KANSAWA Thich Hei 'KR7' KANSAWA Thick Yuan
'KB9' KANSAWA Extra Hei 'KR9' KANSAWA Yen Yuan
'KBB' KANSAWA Super Hei 'KRB' KANSAWA Yen Yuan
'KL3' KANSAWA Fine LeeSsu 'KF3' KANSAWA Fine FanSong
'KL5' KANSAWA Median LeeSsu 'KF5' KANSAWA Median FanSong
'KL7' KANSAWA Thich LeeSsu 'KF7' KANSAWA Thick Fansong
'KL6' KANSAWA Med_Thick LeeSsu 'KTV' KANSAWA KanTingLiu
'KG5' KANSAWA TsaoSsu 'KIV' KANSAWA TsongYie
'KMN3' KANSAWA New Fine Ming 'KOV' KANSAWA KuYing
'KMN5' KANSAWA New Median Ming 'KPO' KANSAWA HeiBao
'KBN5' KANSAWA New Hei 'KOD' KANSAWA KongDieYuan
'KRN5' KANSAWA New Yuan 'KWE' KANSAWA WeiBei

'FM3' DynaFont Fine Ming 'T16' ET 16*15 fonts
'FB5' DynaFont Median Hei 'T24' ET 24*24 fonts
'FF5' DynaFont FanSong 'FST24' UNITECH 24*24 fonts
'FK5' DynaFont Median KaiSsu 'FMT48' UNITECH Ming 48*48 fonts
'FM5' DynaFont Median Ming 'FKT48' UNITECH KaiSsu 48*48 fonts
'FM7' DynaFont Thick Ming 'FLT48' UNITECH LeeSsu 48*48 fonts
'FB7' DynaFont Thick Hei 'FBT48' UNITECH Hei 48*48 fonts
'FL5' DynaFont LeeSsu 'FGT48' UNITECH TsaoSsu 48*48 fonts
'FR7' DynaFont Thick Yuan
Note:
1. KANSAWA fonts and UNITECH fonts must be placed in the directory
F:\FONT or that specified in PLOT3D.INI.
2. ET Fonts may be placed in directory of F:\ET2 or that specified
in PLOT3D.INI.
2. When using DynaFont, Font driver must be loaded before execution
of the program.
-------------------------------------------------------------------------------
SUBROUTINE STSYMBOL(ASPECT,CLINE,ANGLEC,ELEVATC,ROTATEC,SPACING,ICPT,
IOUTLINE,IREVERSE,ISHALLOW)
ASPECT: Aspect ratio or wide enlargement of a character.
CLINE: Inclinatin of a character in degree.
ANGLEC: Rotate angle of a character,
ANGLEC=999. means use default value.
ELEVATC: Elevate angle of a character from character string path,
ELEVATC=999. means use default value.
ROTATEC: Rotate angle of a character around character sting path,
ROTATEC=999. means use default value.
SPACING: Spacing between two characters. This value has no unit.
SPACING=0.2 means character spacing is 0.2 character height.
ICPT: Control point of a character string:
7----------8----------9 9 means upper right corner
| |
4 5 6 5 means center
| |
1----------2----------3 0 or 1 means lower left corner
. .
-4 -5 -6
. .
-7.........-8.........-9

-IOUTLINE:
-IREVERSE:IREVERSE=0 means normal font
IREVERSE=1 means reverse font, this is for solid font only.
-ISHALLOW:
ENTRY CH_ASPECT(ASPECT)
ENTRY CH_INCLINE(CLINE)
ENTRY CH_ATTITUDE(ANGLEC,ELEVATC,ROTATEC)
-ENTRY CH_SPACE(SPACE)
ENTRY FONTCPT(ICPT)
-ENTRY REVERSE(IREVERSE)
-ENTRY OUTLINE(IOUTLINE)
-ENTRY SHALLOW(DIRCTION,THICK)
-------------------------------------------------------------------------------
SUBROUTINE CHPATH(ID)
ID=0: Character string path is in normal condition.
ID=1: Character string path is rotated for 90 degrees.
-------------------------------------------------------------------------------
SUBROUTINE NUMBER(XP,YP,H,FPN,ANGLE,NDEC)
XP: X_coordinate of the lower left cornor of the first character.
YP: Y_coordinate of the lower left cornor of the first character.
H: Height of the character string. (unit=cm)
FPN: The floating-point number that is to be converted and plotted.
ANGLE: The rotating angle, in degree from the X_axis.
NDEC: NDEC>0: It specifies the number of digits to the right of the
decimal point that are to be converted and plotted,
after proper rounding.
NDEC=0: Only the integer portion and a decimal point are
plotted, after rounding.
NDEC=-1: Only the integer portion are plotted, after rounding.
NDEC<-1: (NDEC-1) digits are truncated from the integer portion
, after routing.
-------------------------------------------------------------------------------
SUBROUTINE SCALE(ARRAY,AXLEN,NPTS,INC)
ARRAY: The array of data points to be examined.
AXLEN: The length of axis to which the data is to be scaled.
NPTS: The number of data values to be scaned in the array.
INC=1: The selected starting value (FIRSTV) approximates a
minimum, and the scale factor (DELTAV) is positive.
INC=-1: The selected starting value (FIRSTV) approximates a
maximum, and the scale factor (DELTAV) is negative.
*The FORTRAN DIMENSION statement should specify at least two elements
more than the number of value being scaling, to allow room for SCALE
to store the computed starting value and scaling factor at the end
of the array.
-------------------------------------------------------------------------------
SUBROUTINE AXIS(XP,YP,STRING,NCHAR,AXLEN,ANGLE,FIRSTV,DELTAV)
SUBROUTINE AXIS3D(XP,YP,ZP,STRING,NCHAR,AXLEN,ANGLE,ELEVAT,ROTATE,
FIRSTV,DELTAV)
XP: X_coordinate of the axis line starting point.
YP: Y_coordinate of the axis line starting point.
ZP: Z_coordinate of the lower left cornor of the first character.
STRING: The character string of the title to be plotted.
NCHAR: The number of characters to be plotted.
If NCHAR is positive, then string is plotted at the positive
side (counterclockwise) of the axis line.
If NCHAR is negative, then string is plotted at the negative
side (clockwise) of the axis line.
ANGLE: The rotate angle in X-Y plane, in degree from the X_axis,
counter-clock wise positive.
The value is 0 for the X_axis and 90 for the Y_axis.
ELEVAT: The character string path angle with X-Y plane in degree,
up positive.
The value IS 90 for the Z_axis.
ROTATE: The rotate angle using character string path as axis,
counter-clock wise positive.
FIRSTV: The starting value of the axis.
DELTAV: The scale factor for the axis.
*FIRSTV and DELTAV may be determined by SCALE or by the user.
-------------------------------------------------------------------------------
SUBROUTINE STAXIS(HT_NUM,HT_TITLE,HT_TIC,NDII,NYO)
HT_NUM: Height of axis number
HT_TITLE:Height of title text
HT_TIC: Height of tic
SP_TIC: Spacing of tic
NDII: Number of digits for axis number
NYO: NYO= 0: auto_determination
NYO= 1: plot only odd number
NYO= 2: plot only even number
NYO= 3: plot all number
NYO=-1: plot only odd number, and delete first number
NYO=-2: plot only even number
NYO=-3: plot all, and delete first number
-------------------------------------------------------------------------------
SUBROUTINE LINE(XA,YA,NPTS,INC,LINTYP,char(INTEQ))
XA: The array contain the abscissa (X) values and scaling para-
meters, FIRSTV and DELTAV.
YA: The array contain the ordinate (Y) values and scaling para-
meters, FIRSTV and DELTAV.
NPTS: The number of data values in each of the two arrays.
INC: The increment that the routine is to use in gathering data
from the two arrays.
LINTYP: LINTYP=0: The data points are connected by straight lines
but no symbols are plotted.
LINTYP=+n: The data are selected at every n_th points and
straight lines are connected.
LINTYP=-n: The data are selected at every n_th points and
but no lines are connected.
INTEQ: The number of symbol to be plotted. (INTEQ<15, or =15)
-------------------------------------------------------------------------------
SUBROUTINE FACTOR(FT)
FT: It is the ratio of the desired plot size to the normal plot
size.
-------------------------------------------------------------------------------
SUBROUTINE FACTOR3D(XFT,YFT,ZFT)
XFT: It is the X ratio of the desired plot size to the
normal plot size.
YFT: It is the Y ratio of the desired plot size to the
normal plot size.
ZFT: It is the Z ratio of the desired plot size to the
normal plot size.
-------------------------------------------------------------------------------
SUBROUTINE WHERE(XP,YP,FT)
*This routine returns the current pen position (XP,YP) and factor FT.
-------------------------------------------------------------------------------
SUBROUTINE WHERE3D(XP,YP,ZP,XFT,YFT,ZFT,XO,YO,ZO)
*This routine returns the current pen position (XP,YP,ZP), and plotting
factors (XFT,YFT,ZFT) and origin (XO,YO,ZO).
-------------------------------------------------------------------------------
SUBROUTINE NEWPEN(IPEN)
*The actual pen width drawn is FLOAT(IPEN)*0.1 cm.
-------------------------------------------------------------------------------
SUBROUTINE COLOR(INDEX,IDUMMY)
INDEX: Color palette number to be used.
IDUMMY: Dummy argument, an constant or variable of 0 must be used.
This dummy argument is only for PLOT88 compatible.
-------------------------------------------------------------------------------
SUBROUTINE PALETE(INDEX,IRED,IGREEN,IBLUE)
INDEX: Color palette number.
IRED: Intensity of red. (0 to 255)
IGREEN: Intensity of green.(0 to 255)
IBLUE: Intensity of blue. (0 to 255)
-------------------------------------------------------------------------------
SUBROUTINE GETBC(IRED,IGREEN,IBLUE)
*Get background color.
IRED: Intensity of red. (0 to 255)
IGREEN: Intensity of green.(0 to 255)
IBLUE: Intensity of blue. (0 to 255)
-------------------------------------------------------------------------------
SUBROUTINE PLOTD(XP,YP,IPEN)
SUBROUTINE PLOTD3D(XP,YP,ZP,IPEN)
*Routine to plot a dash line.
XP: X_coordinate for plotting. (unit=cm)
YP: Y_coordinate for plotting.
ZP: Z_coordinate for plotting.
IPEN: Same as in PLOT.
-------------------------------------------------------------------------------
SUBROUTINE STDASH(DLINE,DSPACE)
DLINE: Length of the dash in cm.
DSPACE: Length of the gap between line segments of the dash line.
-------------------------------------------------------------------------------
SUBROUTINE DOTLINE(N)
N: Dotted line which is separated by N dotes.
*This routine is only for dot matrix and laser printer.
*It is valid only for IPEN less or equal 5.
-------------------------------------------------------------------------------
SUBROUTINE MASKPT(IP)
*Routine for homogeneouse raster mask pattern.
IP=0: No mask.
IP=1: 50% mask.
IP=2: 25% mask.
IP=3: 1/8 mask.
IP=4: 1/16 mask.
IP=5: 1/32 mask.
IP=6: 1/64 mask.
*This routine is only for dot matrix and laser printer.
-------------------------------------------------------------------------------
-SUBROUTINE GRAYPT(IGRAY,ISHAPE)
IGRAY: Gray scale. (0 to 255)
ISHAPE: ISHAPE=1: Rounded,
ISHAPE=2: Rhombic,
ISHAPE=3: Rectangular,
ISHAPE=4: Random,
*This routine is only for dot matrix and laser printer.
-------------------------------------------------------------------------------
SUBROUTINE USERPT(FNAME)
*Routine for vecter and raster pattern determined by user.
FNAME: File name describe user pattern. (see DATA.PAT for example)
-------------------------------------------------------------------------------
SUBROUTINE FILLPT(WIDTH,SPACE,ANGLE)
*Routine for vecter based fill pattern; also valid for raster printer.
WIDTH: Width of band to be filled.
SPACE: Space of band filled.
ANGLE: Rotation angle of band.
-------------------------------------------------------------------------------
SUBROUTINE FILL(XA,YA,NP)
SUBROUTINE FILL3D(XA,YA,ZA,NP)
*Routine for filling of polygonal area.
(Vector coordinate, origin at lower left cornor.)
XA: Array contain X values of the polygon.
YA: Array contain Y values of the polygon.
ZA: Array contain Z values of the polygon.
NP: Number of data points of the polygon.
*Many polygons may be used in one time when calling this routine,
but, a value of 9999. must be put in between two polygons.
*You may call COLOR, MASKPT or FILLPT before filling.
-------------------------------------------------------------------------------
SUBROUTINE RECFIL(X1,Y1,X2,Y2)
*Routine for filling of recangular area.
(Vector coordinate, origin at lower left cornor.)
X1: |
Y1: |_ Any two opposite points of the recangle.
X2: |
Y2: |
-------------------------------------------------------------------------------
SUBROUTINE TRIFIL(X1,Y1,X2,Y2,X3,Y3)
*Routine for filling of triangular area.
(Vector coordinate, origin at lower left cornor.)
X1: |
Y1: |
X2: |_ Three points in any order.
Y2: |
X3: |
Y3: |
-------------------------------------------------------------------------------
x SUBROUTINE IMAGE(IX0,IY0,IX1,IY1,FNAME)
x SUBROUTINE IMAGE(IX0,IY0,XFC,YFC,FNAME)
SUBROUTINE IMAGE(FNAME,XW1,YW1,XW2,YW2,ISEL)
SUBROUTINE PL_TGA(FNAME,XW1,YW1,XW2,YW2,ISEL)
? SUBROUTINE PL_TIF(FNAME,XW1,YW1,XW2,YW2,ISEL)
? SUBROUTINE PL_BMP(FNAME,XW1,YW1,XW2,YW2,ISEL)
*Routine to copy an external raster file into current drawing.
FNAME: Raster file name to be read.
XW1: |_ Lower left corner of window where the graph is placed.
YW1: |
XW2: |_ Upper right corner of window where the graph is placed.
YM2: |
ISEL=1: fit to window.
? ISEL=2: fit to window and keep aspect.
? ISEL=0: use XW1,YW1 as origin and XW2,YW2 as factor.
-------------------------------------------------------------------------------
SUBROUTINE DRAWING(FNAME,XW1,YW1,XW2,YW2,ISEL)
SUBROUTINE PL_DXF(FNAME,XW1,YW1,XW2,YW2,ISEL)
SUBROUTINE PL_GL2(FNAME,XW1,YW1,XW2,YW2,ISEL)
SUBROUTINE PL_RND(FNAME,XW1,YW1,XW2,YW2,ISEL)
*Routine to display a DXF( or GL2 or RND) file in the current drawing.
FNAME: Vector file name to be read.
XW1: |_ Lower left corner of window where the graph is placed.
YW1: |
XW2: |_ Upper right corner of window where the graph is placed.
YM2: |
ISEL=1: fit to window.
ISEL=2: fit to window and keep aspect.
ISEL=0: use XW1,YW1 as origin and XW2,YW2 as factor.
*DXF means AutoCAD DXF output file format.
*GL2 means HP-GL/2 commands.
*RND means ROLAND plotter commands.
-------------------------------------------------------------------------------
SUBROUTINE GRID3D(Z,NX,NY,IDIR,IEDGE,ICUT,IFRAME,ZLOW)
Z: Array storing elevation data,
NX: Number of data points in X direction,
NY: Number of data points in Y direction,
IDIR: Line paralell to:
0= no action, 1=X_direction, 2=Y_dirction, 3= both direction,
IEDGE: Front edging trim lines:
0= no lines, 1=X_direction, 2=Y_dirction, 3= both direction,
ICUT: Under side view: 0= no, not cut, 1,2,3= yes, cut.
IFRAME: 0= no frame, 1= with frame
ZLOW: Lowest value of bottom of frame.
*subroutine VIEW3D must be called before calling SHADE3D!
------------------------------------------------------------------------------
*NOTE:
1. Program compiling please use the batch file FORC.
fm: FORC PROG [PROG1] [PROG2] [...]
ex: FORC DEMO1

2. Program linking please use the batch file LINK3D.
fm: LINK3D MAIN [+SUB1] [+SUB2] [+...] [EXEfile] [additional_LIB]
ex: LINK3D DEMO1

3. To use EMS, we must specify a proper command in CONFIG.SYS, like:
DEVICE=C:\DOS\EMM386.EXE FRAME=E000 RAM
(Please refer to DOS manual)

4. IOPORT(HANDLE), MODEL, and MEMORY rehandling:
No matter what parameters were set in PLOT3D.INI, when runing a
program and replying to ' PLOT FILE NAME=? ', we may input:
firstly, a HANDLE name,
secondarily, a MODEL code, and
thirdly, a MEMORY code; they are separated with a semicolon.

ex: PLOT FILE NAME=? LPT1:0:0
This means output the graph to EPSON 9 pin printer(60*72 dpi)
via LPT1 and using conventional memory+disk to storage bitmap.

ex: PLOT FILE NAME=? PPP:64:1
This means save the plotting data in file PPP and using
MODEL 64 and MEMORY 1. File PPP may be plotted later; we just
need to keyin 'COPY PPP TO LPT1'.

ex: PLOT FILE NAME=? LPT1 |_ This means we use default or
ex: PLOT FILE NAME=? PPP | initial value for MODEL and MEMORY.

** Resolution of a image file may be put right after the MODEL code
with a seperation of '.',
ex: PPP.BMP:701.100 This means BMP 1 bit with 100 dpi resolution.

** a HANDLE name may be one of the following:
(a) PRN
(b) LPT1
(c) LPT2
(d) LPT3
(e) FLPT1
(f) CON console(text output)
(g) CRT or CRT0 video display via BIOS(graphic output)
(h) CRT1 video display, direct to video RAM
(i) Fname.BMP output to disk in BMP file format(raster)
(k) Fname.TGA output to disk in TGA file format(raster)
(l) Fname.TIF output to disk in TIF file format(raster)
(m) Fname.DXF output to disk in DXF file format(vecter)
(n) Fname.GL2 output to disk in GL2 file format(vecter)
(o) Fname.RND output to disk in RND file format(vecter)
(p) Other Filename save in disk.
* .GL2 means the file is using HP-GL2 plotting commands.
* .RND means the file is using ROLAND plotting commands.

***Overlay two or more graph to one:
When we like to output several graphs to one sheet, we may output each
graph to a file, then use OVBMP or OVGL2 or other utility progam to
combine several files to one and plot it to an output device.

***The symbol '#' means default value.

***The symbol '-' means that routine or option is not available yet,
please wait. They may be released later.

***This document is not completed yet, if you have any problem during
linking or running of your program, please contact with Lee, C. T.
(03)4253334, NCUAPG.
-------------------------------------------------------------------------------


********************************************************************************
FORTRAN 90 EXTENSION

***** subroutines included in PLOT95 graphic library *****

Programed by C. T. Lee, 1984-1995
Institute of Applied Geology, Nation Central University, Taiwan, R.O.C.
********************************************************************************
A. SYSTEM FUNCTIONS
********************************************************************************
SUBROUTINE SYSTEM(COMMAND)
*Routine to execute a DOS command or a child program in a parent program.
COMMAND: Character string of any DOS command or program name to be
executed.
--------------------------------------------------------------------------------
SUBROUTINE PSPSTRING(STRING)
*Routine to get character string following a command.
STRING: Character string got.
--------------------------------------------------------------------------------
SUBROUTINE ENVSTRING(STRING)
*Routine to get environments character strings.
STRING: Character string got.
--------------------------------------------------------------------------------
SUBROUTINE GETDATE(IYEAR,IMONTH,IDATE,IWEEK)
*Routine to system date.
IYEAR: Year got.
IMONTH: Month got.
IDATE: Date got.
IWEEK: Week got.
--------------------------------------------------------------------------------
SUBROUTINE SETDATE(IYEAR,IMONTH,IDATE)
*Routine to system date.
IYEAR: Year got.
IMONTH: Month got.
IDATE: Date got.
IWEEK: Week got.
--------------------------------------------------------------------------------
SUBROUTINE GETTIME(IHOUR,IMIN,ISEC,ISEC1)
*Routine to system time.
IHOUR: Hour got.
IMIN: Minute got.
ISEC: Second got.
ISEC1: 1% second got.
--------------------------------------------------------------------------------
SUBROUTINE SETTIME(IHOUR,IMIN,ISEC,ISEC1)
*Routine to system time.
IHOUR: Hour got.
IMIN: Minute got.
ISEC: Second got.
ISEC1: 1% second got.
--------------------------------------------------------------------------------
SUBROUTINE EXIT(STRING)
*Routine to exit a program, especially for exiting a graphic system,
when error happen.
STRING: Character string to display.
--------------------------------------------------------------------------------
SUBROUTINE RANDOM(RANVAL)
SUBROUTINE SEED(ISEED)
*Routine to generate random value.
RANVAL: Random value between -1. and 1.
ISEED: It is an INTEGER*2 argument, which can be got from GETTIME.
*SEED must be called at the first time of calling RAMDOM.
*********************************************************************************
B. FILE OPERATIONS
********************************************************************************
SUBROUTINE CREATE(IHANDLE,FNAME)
*Routine to create a new file for write.
IHANDLE: File handle created.
FNAME: File name created.
--------------------------------------------------------------------------------
SUBROUTINE OPENFL(IHANDLE,FNAME)
*Routine to open an existing file for read.
IHANDLE: File handle created.
FNAME: File name created.
--------------------------------------------------------------------------------
SUBROUTINE CHECKF(IHANDLE,FNAME,IEXT)
*Routine to check then existance of a file.
*If exists, open the file for read.
IHANDLE: File handle created.
FNAME: File name created.
IEXT: Return code. IEXT=1: file exist; IEXT=0: file not exist.
--------------------------------------------------------------------------------
SUBROUTINE CLOSE(IHANDLE)
*Routine to close an existing file.
IHANDLE: File handle.
--------------------------------------------------------------------------------
SUBROUTINE DELETE(IHANDLE)
*Routine to delete an existing file.
IHANDLE: File handle.
--------------------------------------------------------------------------------
SUBROUTINE RENAME(FNAME1,FNAME2)
*Routine to rename a file.
FNAME1: File name to be renamed.
FNAME2: File name renamed.
--------------------------------------------------------------------------------
SUBROUTINE RD(IHANDLE,NBYTES,BUFF)
*Routine to read a file by handle.
IHANDLE: File handle.
NBYTES: Number of bytes to read.
BUFF: Buffer to store character string. Must be dimensiond in
calling program.
--------------------------------------------------------------------------------
SUBROUTINE READF(IHANDLE,NBYTES,BUFF,NB)
*Routine to read a file by handle.
IHANDLE: File handle.
NBYTES: Number of bytes to read.
BUFF: Buffer to store character string. Must be dimensiond in
calling program.
NB: Actual number of bytes read.
--------------------------------------------------------------------------------
SUBROUTINE WT(IHANDLE,NBYTES,BUFF)
*Routine to write from buffer to handle.
IHANDLE: File handle.
NBYTES: Number of bytes to write.
BUFF: Buffer to store character string. Must be dimensiond in
calling program.
--------------------------------------------------------------------------------
SUBROUTINE SEEK(IHANDLE,IOFFSET)
*Routine to move pointer in a file.
IHANDLE: File handle.
IOFFSET: Offset in a file. IOFFSET must be declared as INTEGER*4.
--------------------------------------------------------------------------------
SUBROUTINE FILESIZE(IHANDLE,ISIZE)
*Routine to find file size.
IHANDLE: File handle.
ISIZE: File size. ISIZE must be declared as INTEGER*4.
--------------------------------------------------------------------------------
!SUBROUTINE GETFLTIME(IHANDLE,IMONTH,IDAY,IYEAR,IHOUR,IMIN,ISEC)
*Routine to get file date and time.
IHANDLE: File handle.
IYEAR: Year got.
IMONTH: Month got.
IDATE: Date got.
IHOUR: Hour got.
IMIN: Minute got.
ISEC: Second got.
--------------------------------------------------------------------------------
!SUBROUTINE SETFLTIME(IHANDLE,IMONTH,IDAY,IYEAR,IHOUR,IMIN,ISEC)
*Routine to set file date and time.
IHANDLE: File handle.
IYEAR: Year set.
IMONTH: Month set.
IDATE: Date set.
IHOUR: Hour set.
IMIN: Minute set.
ISEC: Second set.
--------------------------------------------------------------------------------
&SUBROUTINE DSKNAME(STRING) ;Called by PLOTS.
*Routine to get current disk name.
STRING: Disk name.
--------------------------------------------------------------------------------
!SUBROUTINE GETDIR(STRING)
*Routine to get current directory.
STRING: Directory name.
********************************************************************************
C. VIDEO GRAPHICS
********************************************************************************
SUBROUTINE SETMOD(MODE)
*Routine to set video mode(text and graphics).
MODE: Video mode set, value referred to video BIOS or TSENG's
data book.
Note: Mode 56 is 1024*768 256 color graphic mode.
Mode 48 is 800*600 256 color graphic mode.
Mode 46 is 640*480 256 color graphic mode.
Mode 3 is VGA text mode.
Mode 7 is specially for HERC mono color mode.
Mode 2 is specially for HERC text mode.
-------------------------------------------------------------------------------
SUBROUTINE PIXEL(IX,IY,ICOLOR)
*Routine to write pixel on screen.
IX: Screen column to write pixel at.
IY: Screen row to write pixel at.
ICOLOR: Color index to draw pixel in.
-------------------------------------------------------------------------------
SUBROUTINE RPIXEL(IX,IY,ICOLOR)
*Routine to read pixel on screen.
IX: Screen column to read pixel from.
IY: Screen row to read pixel from.
ICOLOR: Color index value (attribute of pixel) read.
-------------------------------------------------------------------------------
SUBROUTINE PALETE(INDEX,IRED,IGREEN,IBLUE)
INDEX: Color palette number.
IRED: Intensity of red. (0 to 63)
IGREEN: Intensity of green.(0 to 63)
IBLUE: Intensity of blue. (0 to 63)
-------------------------------------------------------------------------------
SUBROUTINE VRAM(IVAL)
*Routine to select method of accessing video memory.
IVAL: IVAL=89 access video memory via BIOS.
IVAL=90-149 access video memory directly.
Note: This routine is not valid for 32767 and greater color
mode.
-------------------------------------------------------------------------------
SUBROUTINE SETBNK(IRW,IBANK)
Switch bank of video memory.
IRW: IRW=0: Read; IRW=1: Write.
IBANK: IBANK=0-15.
-------------------------------------------------------------------------------
&SUBROUTINE SAVEVB(HANDLE,IOFFST,NBYTES) ;Called by PLOTS
Save video memory to Handle. (IOFFST+NBYTES<64K)
HANDLE: Handle to store data.
IOFFST: Offest of start byte to save.
NBYTES: Number of bytes to save.
--------------------------------------------------------------------------------
!SUBROUTINE RESTVB(HANDLE,IOFFST,NBYTES)
Restore Handle to video memory. (IOFFST+NBYTES<64K)
HANDLE: Handle to storing data.
IOFFST: Offest of start byte to restore.
NBYTES: Number of bytes to restore.
-------------------------------------------------------------------------------
SUBROUTINE SAVEVH(HANDLE,I1,J1,I2,J2)
Save video memory to Handle.
HANDLE: Handle to store data.
I1: |_ Start byte in raster coordinate.
J1: |
I2: |_ End byte in raster coordinate.
J2: |
--------------------------------------------------------------------------------
SUBROUTINE RESTVH(HANDLE,I1,J1,I2,J2)
Restore handle to video memory.
HANDLE: Handle to storing data.
I1: |_ Start byte in raster coordinate.
J1: |
I2: |_ End byte in raster coordinate.
J2: |
--------------------------------------------------------------------------------
SUBROUTINE FILLBC(IC)
Fill background with color IC.
--------------------------------------------------------------------------------
SUBROUTINE FILLSC(IC)
Fill video memory with color IC.
--------------------------------------------------------------------------------
SUBROUTINE CLEARVM(I1,J1,I2,J2)
Clear video memory in rectangular area of
I1,J1(upper left), and I2,J2(lower right).
--------------------------------------------------------------------------------
SUBROUTINE CLEAR_SC ;Clear screen for plotting.
********************************************************************************
D. MEMORY OPERATION
********************************************************************************
#SUBROUTINE RDMEM(StartSeg,NBYTES,BUFF)
Read memory to BUFF. (NBYTES<64K)
StartSeg: Start segment address in memory (offset=0).
NBYTES: Number of bytes to read.
BUFF: Buffer to store data read. This must be dimensioned in calling
program.
--------------------------------------------------------------------------------
#SUBROUTINE WTMEM(StartSeg,NBYTES,BUFF)
Write BUFF to memory. (NBYTES<64K)
StartSeg: Start segment address in memory (offset=0).
NBYTES: Number of bytes to read.
BUFF: Buffer storing data.
********************************************************************************
E. BIT MANIPULATION
********************************************************************************
FUNCTION ICHAND(A1,A2)
FUNCTION ICHOR (A1,A2)
FUNCTION ICHXOR(A1,A2)
FUNCTION ICHNOT(A1)
character FUNCTION CHAND(A1,A2)
character FUNCTION CHOR (A1,A2)
character FUNCTION CHXOR(A1,A2)
character FUNCTION CHNOT(A1)
*A1,A2 may be character or integer.
********************************************************************************
F. READ & WRITE IMAGE FILES
********************************************************************************
SUBROUTINE RD_BMP_HEADER(IH,I_PXL,J_PXL,IBITS)
SUBROUTINE RD_BMP_CTABLE(IH,CTABLE)
SUBROUTINE RD_BMP_PIXELS(IH,I,J,NPIXELS,BUFF)
SUBROUTINE WT_BMP_HEADER(IH,I_PXL,J_PXL,IBITS)
SUBROUTINE WT_BMP_CTABLE(IH,CTABLE)
SUBROUTINE WT_BMP_PIXELS(IH,I,J,NPIXELS,BUFF)
SUBROUTINE RD_TGA_HEADER(IH,I_PXL,J_PXL,IBITS)
SUBROUTINE RD_TGA_CTABLE(IH,CTABLE)
SUBROUTINE RD_TGA_PIXELS(IH,I,J,NPIXELS,BUFF)
SUBROUTINE WT_TGA_HEADER(IH,I_PXL,J_PXL,IBITS)
SUBROUTINE WT_TGA_CTABLE(IH,CTABLE)
SUBROUTINE WT_TGA_PIXELS(IH,I,J,NPIXELS,BUFF)
SUBROUTINE RD_TIF_HEADER(IH,I_PXL,J_PXL,IBITS)
SUBROUTINE RD_TIF_CTABLE(IH,CTABLE)
SUBROUTINE RD_TIF_PIXELS(IH,I,J,NPIXELS,BUFF)
SUBROUTINE WT_TIF_HEADER(IH,I_PXL,J_PXL,IBITS)
SUBROUTINE WT_TIF_CTABLE(IH,CTABLE)
SUBROUTINE WT_TIF_PIXELS(IH,I,J,NPIXELS,BUFF)
IH: File Handle
I_PXL: Image width or column of pixels.
I_PXL: Image hight or Line of pixels
IBITS: Bits per pixel.
CTABLE: Color table (CHARACTER ARRAY).
I: Start coordinate for read/write.(Pixel coordinate I)
J: Start coordinate for read/write.(Pixel coordinate J)
NPIXELS:Number of pixel to read/write.
BUFF: Buffer to store byte string of image.
********************************************************************************
G. READ & WRITE DTM
********************************************************************************
SUBROUTINE RD_IMG_HEADER(IH,I,J,GRID,CORD)
SUBROUTINE RD_IMG(IH,IX,IY,NDATA,Z)
SUBROUTINE WT_IMG_HEADER(IH,I,J,GRID,CORD)
SUBROUTINE WT_IMG(IH,IX,IY,NDATA,Z)
SUBROUTINE RD_GRD_HEADER(IH,I,J,GRID,CORD)
SUBROUTINE RD_GRD(IH,IX,IY,NDATA,Z)
SUBROUTINE WT_GRD_HEADER(IH,I,J,GRID,CORD)
SUBROUTINE WT_GRD(IH,IX,IY,NDATA,Z)
IH: File Handle
NX: Image width
NY: Image hight
GRID: Array to store grid size.
GRID(1): grid size in X direction.
GRID(2): grid size in Y direction.
CORD: Array to store coordinates.
CORD(1): top left X coordinate.
CORD(2): top left Y coordinate.
CORD(3): lower right X coordinate.
CORD(4): lower right Y coordinate.
I: Start coordinate for read/write.(Pixel coordinate I)
J: Start coordinate for read/write.(Pixel coordinate J)
NDATA: Number of data to read/write.
Z: Buffer to store data (real*4 array).
********************************************************************************
H. MISCELLANEOUS
********************************************************************************
SUBROUTINE CLEARBF(NBYTES,BUFF)
*Routine to clear buffer. (The buffer is a long character string.)
NBYTES: Number of bytes to be cleared.
NBYTES must be INTEGER*2 and must be an even number.
BUFF: Buffer to be cleared. It must be dimensioned in calling
program.
--------------------------------------------------------------------------------
SUBROUTINE BYTOBI(STRING,NBYTES,BUFF)
*Transfer byte STRING of NBYTES to bite array and stored in BUFF.
STRING: Character string to be translated.
NBYTES: Number of bytes to be translated.
BUFF : Buffer to store bite array. (character array)
********************************************************************************
Note:
'!' means the routine is not included in PLOT3D.LIB.
'&' means the routine is included in PLOT3D.LIB but is not valided
to be announced.
'#' means the routine is important.
'-' means the routine is not available yet.
********************************************************************************