%END %OF %LIST !STAMPS - Programme One J.G.H. Summer 1978 ! The ETCH ! ! ! ! This programme provides a set of routines to produce output for ! a Feranti Master Plotter. ! ! The form of the use (on the departmental M/C's) is - ! In the programme which is using the routines to have the instruction ! %INCLUDE "EDWIN.ETCH" ! between the declarations and the start of the code. ! The programme is then compiled using the command - ! C , , EDWIN.ETCH / , ! ! Where is a programme containing a sequence of the following ! routine calls. ! ! The output from the programme produces code with no newlines ! so that Input Buffer Store may be used on the plotter. ! ! !************************************************************** !* * !* THE FOLLOWING MNEMONICS ARE AVAILIBLE TO THE PROGRAMME. * !* * !************************************************************** ! %CONST %BYTE %INTEGER FULL = 0, HALF=1, QRTR=2, SLOW=3 ! These give the speeds that are allowed. ! %CONST %BYTE %INTEGER INVISIBLE=0, CONTINUOUS=2, DOTTED=6 %CONST %BYTE %INTEGER DASHED=10 , FLASH=13, CHAIN=14 ! These give the different types of line that may be drawn. ! ! %CONST %BYTE %INTEGER LINE R = 0, C ARC R = 1, LINE A = 2 %CONST %BYTE %INTEGER C ARC A = 3, AC ARCR = 5, AC ARC A = 7 %CONST %BYTE %INTEGER CIRCLE = 8 ! These give the different types of drawing mode possible. ! ! %CONST %BYTE %INTEGER NORMAL =0, REDUCED =1 ! These give the scales possible. ! ! %OWN %BYTE %INTEGER MAX SPEED = FULL %OWN %BYTE %INTEGER SCALE = NORMAL %OWN %BYTE %INTEGER PLOT MODE = 0 ! The above allows us to suppress redundant ESC characters in Plot Mode. ! ! %CONST %BYTE %INTEGER ESC='\' ! ! !********************************************************** !* * !* ROUTINES USED BY THE PACKAGE ROUTINES * !* * !********************************************************** ! ! %ROUTINE PRINT NUMBER (%INTEGER NUM) ! This routine outputs a number as 4 hex digits. %INTEGER I %for I=0,1,3 %cycle PRINT SYMBOL (NUM &15 +'0') NUM = NUM >>4 %REPEAT %END ! ! %ROUTINE MOVE (%INTEGER X,Y,CC1) ! This causes the plotter head to move to the given point. ! CC1 determines wheather the move is absolute or relative. PRINT SYMBOL (ESC) %IF PLOT MODE # 1 PLOT MODE = 1 PRINT SYMBOL (CC1) PRINT SYMBOL ('@') PRINT NUMBER (X) PRINT NUMBER (Y) %END ! ! %ROUTINE %SPEC SUPPRESS UNUSED NAMES ! ! !********************************************************** !* * !* NOW ARE THE USER ROUTINES * !* * !********************************************************** ! ! %ROUTINE HEADER (%STRING (255) COMMENT) ! This outputs a header onto the output stream SUPPRESS UNUSED NAMES PRINT STRING (COMMENT) %END ! ! %ROUTINE ASSIST (%STRING (255) COMMENT) ! This puts the plotter into assist mode. PRINT SYMBOL (ESC) PLOT MODE = 0 PRINT SYMBOL ('S') HEADER (COMMENT) %END ! ! %ROUTINE END PLOT ! We enter Assist mode and we then stop the plot. %CONST %BYTE %INTEGER EOT=4 ASSIST (SNL) PRINT SYMBOL (EOT) %END ! ! %ROUTINE SPEED (%BYTE %INTEGER LEVEL) ! This sets the current speed at which you want to plot at. %UNLESS 0 <= LEVEL <= 3 %START SELECT OUTPUT (0) PRINT STRING ("Speed Selection Not Valid".SNL) SELECT OUTPUT (1) %RETURN %FINISH MAX SPEED = LEVEL %END ! ! %ROUTINE SELECT PEN (%INTEGER I) ! This allows you to choose a pen if you have an EP177 Turret. %CONST %BYTE %INTEGER %ARRAY OSC (1:8) = '@','H','P','X',' ','(','0','8' %UNLESS 0 <= I <= 8 %START SELECT OUTPUT (0) PRINT STRING ("Pen choice not valid".SNL) SELECT OUTPUT (1) %RETURN %FINISH PRINT SYMBOL (ESC) PLOT MODE = 0 PRINT SYMBOL ('P') PRINT SYMBOL ('@') PRINT SYMBOL (OSC(I)) %END ! ! %ROUTINE SELECT SYMBOL (%BYTE %INTEGER SLOT) PRINT SYMBOL (ESC) PLOT MODE = 0 PRINT SYMBOL ('P') PRINT SYMBOL ('@') SLOT = SLOT + 64 %IF SLOT < 31 PRINT SYMBOL (SLOT) %END ! ! %ROUTINE INVERT BASE LINE PRINT SYMBOL (ESC) PLOT MODE = 0 PRINT STRING ("RI") %END ! ! %ROUTINE NORMAL BASE LINE PRINT SYMBOL (ESC) PLOT MODE = 0 PRINT STRING ("RN") %END ! ! %ROUTINE SET BASE LINE (%INTEGER X,Y) ! This sets the base line to the angle which is arctan Y/X PRINT SYMBOL (ESC) PLOT MODE = 0 PRINT STRING ("RS") PRINT NUMBER (X) PRINT NUMBER (Y) %END ! ! %ROUTINE SET SCALE (%BYTE %INTEGER TYPE) SCALE = TYPE & 1 %END ! ! %ROUTINE DRAW (%BYTE %INTEGER SHAPE,LTYPE, %INTEGER P1,P2,P3,P4) ! This causes the plotter to plot the shape specified. %BYTE %INTEGER CC, SPEED %SWITCH SW(0:15) PRINT SYMBOL (ESC) %IF PLOT MODE # 1 PLOT MODE = 1 ! ! We first calculate the first control character. CC = 1 CC = CC << 1 ! SCALE CC = CC << 1 CC = CC << 4 ! SHAPE PRINT SYMBOL (CC) ! We now do the second CC. %IF LTYPE = INVISIBLE %THEN PRINT SYMBOL ('@') %ELSE %START %IF LTYPE = FLASH %THEN PRINT SYMBOL ('M') %ELSE %START SPEED = MAX SPEED %IF LTYPE = CONTINUOUS %THEN CC=1 %ELSE %START CC = 0 SPEED = QRTR %IF SPEED < QRTR %FINISH CC = CC <<2 ! SPEED CC = CC <<4 ! LTYPE PRINT SYMBOL (CC) %FINISH %FINISH ! We now output the parameters. PRINT NUMBER (P1) PRINT NUMBER (P2) -> SW(SHAPE) SW(CIRCLE): SW(LINEA): SW(LINER): ! 2 Numbers to be output. %RETURN SW(CARCA): SW(CARCR): SW(ACARCA): SW(ACARCR): ! 4 Numbers to output. PRINT NUMBER (P3) PRINT NUMBER (P4) %RETURN SW(*): SELECT OUTPUT (0) PRINT STRING ("Attempt to draw a non-valid shape ") WRITE (SHAPE,1) NEWLINE %STOP %END ! ! %ROUTINE MOVEA (%INTEGER X,Y) ! This gives an Absolute move. MOVE (X,Y,'B') %END ! ! %ROUTINE MOVER (%INTEGER DX,DY) ! This gives a relative move. MOVE (DX,DY,'@') %END ! ! %ROUTINE CODE (%STRING (255) CST) ! This allows you to give the plotter any special instructions directly PRINT SYMBOL (ESC) PLOT MODE = 0 PRINT STRING (CST) %END ! ! %ROUTINE SUPPRESS UNUSED NAMES ! This routine pretends to use all the package routines and varibles, ! in order to suppress unused name messages at the end of the calling ! programmes listing. %INTEGER NULL SELECT OUTPUT (1) %RETURN %IF SLOW # FULL ; ! We always return. NULL = SLOW + HALF + CONTINUOUS + DOTTED + DASHED +FLASH + CHAIN NULL = LINER + CARCR+ CARCA + ACARCR + ACARCA + CIRCLE + REDUCED SPEED (FULL) SET SCALE (NORMAL) CODE ("") DRAW (LINEA,INVISIBLE,0,0,0,0) MOVE A (0,0) MOVE R (0,0) SET BASE LINE (0,0) INVERT BASE LINE NORMAL BASE LINE SELECT PEN (1) SELECT SYMBOL (40) %END ! ! ! %LIST ! ETCH PACKAGE ROUTINES ADDED (V:1.0) %END %OF %FILE