/

/COPYRIGHT (C) 1975

/DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.

/

/THIS SOFTWARE IS FURNISHED UNDER A LICENSE FOR USE ONLY

/ON A SINGLE COMPUTER SYSTEM AND MAY BE COPIED ONLY WITH

/THE INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS

/SOFTWARE, OR ANY OTHER COPIES THEREOF, MAY NOT BE PRO-

/VIDED OR OTHERWISE MADE AVAILABLE TO ANY OTHER PERSON

/EXCEPT FOR USE ON SUCH SYSTEM AND TO ONE WHO AGREES TO

/THESE LICENSE TERMS.  TITLE TO AND OWNERSHIP OF THE

/SOFTWARE SHALL AT ALL TIMES REMAIN IN DEC.

/

/THE INFORMATION IN THIS DOCUMENT IS SUBJECT TO CHANGE

/WITHOUT NOTICE AND SHOULD NOT BE CONSTRUED AS A COM-

/MITMENT BY DIGITAL EQUIPMENT CORPORATION.

/

/DEC ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY

/OF ITS SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DEC.

	.EJECT

/

/

/  ASSEMBLY PARAMETER  ARBVEC, NONXVM

/

/  WHEN HARDWARE STROKE VECTOR IS AVAILABLE ON THE VT-15

/  DEFINE  ARBVEC=0  AT ASSEMBLY TIME TO SAVE SPACE

/

/  TO RUN ON A NON-XVM SYSTEM IT IS NECESSARY

/  TO DEFINE NONXVM=0 AS ASSEMBLY TIME

/

/

/SYMBOLS USED TO FORM INSTRUCTIONS.

/

PY=140000			/POSITION, Y DIRECTION

PX=144000			/POSITION, X DIRECTION

STRK=100000			/STROKE VECTOR, X OR Y DIRECTION

DJMP=600000			/DISPLAY JUMP

DJMPI=620000			/DISPLAY JUMP INDIRECT

DJMSI=660000			/DISPLAY JMS*

V1=402000			/BASIC VECTOR, DIRECTION 1

V4=410000			/BASIC VECTOR, DIRECTION 4

V6=414000			/BASIC VECTOR, DIRECTION 6

CHARSI=060000			/CHARACTER STRING INSTRUCTION

SC=20				/SCALE ENABLE

INT=2000			/INTENSITY ENABLE

LP=10				/LIGHT PEN ENABLE

BK=1000				/BLINK ENABLE

DSH=4				/DASH ENABLE

OFST=2				/OFFSET ENABLE

ROT=40				/ROTATE ENABLE

LODN=400			/LOAD NAME REGISTER ENABLE

PRM1=200000			/PARAMETER WORD 1 OP CODE

DNOP=200000			/DISPLAY NOP

DNOPB=200001			/BEGINNING OF PARAM GROUP MARKER

DNOPE=200004			/END OF GROUP MARKER

PRM2=210000			/PARAMETER WORD 2 OP CODE

PRM3=220000			/PARAMETER WORD 3 OP CODE

SKP2=234000			/SKIP2 OP CODE

DSKP=235000			/UNCONDITIONAL SKIP

SAVE=240000			/SAVE INSTRUCTION 

REST=260000			/RESTORE INSTRUCTION

GY=162000			/GRAPHPLOT, Y DIRECTION

RS3=703142			/READ STATUS 3 IOT

DATVT=10			/VT15 USES DAT SLOT 10

STPD=703044			/STOP DISPLAY IOT

LSD=703004			/START DISPLAY

ENTRES=13			/NUMBER OF TABLE ENTRIES

/

/

	.GLOBL	LINE,TEXT,COPY,GRAPH,PRAMTR,BLANK,UNBLNK

	.GLOBL	DINIT,SETPT,PLOT,REPLOT,RSETPT,DCLOSE,DELETE

/

/  INFO ENTRIES FOR OTHER GRAPHICS MODULES

/

	.GLOBL	MF.101,MF.102,LNSIZE

	.IODEV	DATVT

/

/

/  TABLE ORDER

/

/ 0  COPY

/ 1  LINE

/ 2  PARAMETER

/ 3  TEXT

/ 4  SETPT

/ 5  GRAPH

/ 6  DELETE

/ 7  DINIT

/ 8  BLANK

/ 9  UNBLNK

/ 10 LNSIZE

/

/

/  OPTIONAL ARGUMENT FETCH TABLE

/

/  FOR SETTTING UP PNAME OR CNAME AS REQUIRED

/

/  THIS TABLE IS XCT'ED

/

OPT	LAC	ARG3	/COPY

	LAC	ARG4	/LINE

	JMS	OPTPAR	/VARIES WITH # OF BITS

	LAC	ARG3	/TEXT

	LAC	ARG3	/POINT

	LAC	ARG4	/GRAPH

	LAC	ARG1	/FOR DELETE FETCH CNAME

	CLA		/NONE FOR DINIT

	CLA		/NONE FOR BLANK

	CLA		/OR UNBLNK

	CLA		/FOR LNSIZE

/

/

/

/  CODE GENERATION TABLE

/

/  AT VERY END, TO GENERATE CODE

/

/  XCT WITH AC=-1, LINK=1

/

CODE	JMS	CPY

	JMS	VECTOR

	JMS	PRM

	JMS	CHR

	JMS	PNT

	JMP	GRPH	/SUBPIC ONLY NEED NOT JMS

LNOP	NOP		/DELETE GENERATES NO CODE

	JMP	DNT	/DINIT DOESN'T ADD CODE TO MAIN

	JMP	BLN

	JMP	UBL

	JMP	LNS

/

/  NEEDS TABLE

/

/  TO OBTAIN NEEDED # OF LOC'S FOR A REPLOT

/

/  EXECUTE WITH AC=0, LINK=0

/

NEEDS	JMP	NEDCOP	/3 OR 6 DEPENDING

	JMS	VECTOR	/1 OR 2 OR MANY

	JMP	NEDPAR	/1-6

	LAC	L3	/TEXT IS ALWAYS 3

	LAC	L2	/RSETPT IS ALWAYS 2

LTEMP2	TEMP2		/CAN'T REPLOT GRAPH

	CLA		/DELETE NEEDS 0

/

/  LITERALS AND LOCATIONS CORRECPONDING

/

LENT	ENTRES		/NUMBER OF ENTRIES

LOPT	OPT		/ADDR OF EXECUTE TABLE

/

	.EJECT

/

/

/  ENTRY POINTS

/

/  ORDER IRRELEVANT

/

/  THE FORMAT OF THE DATA WORD FOLLOWING THE CALL TO GETARG

/

/  THE LOW TEN BITS OF THE WORD IS A GRAPHICS CODE DECRIBING

/  WHICH ACTION ROUTINES TO CALL

/

/  BITS THREE THRU SEVEN MUST BE ZERO

/

/  BITS 0-2 ARE AS FOLLOWS

/

/  0 (OCTAL)	SUBPICTURE CALL

/  1		MAIN FILE CALL

/  2		EDIT CALL  (CODE MODIFICATION DELETE, RSETPT)

/  3		ILLEGAL

/  4		ILLEGAL

/  5		MAIN FILE CALL, BUT MOVE ARGUMENTS BY ONE (PLOT)

/		IN THIS CASE LOW TEN BITS ARE A NOP

/		REAL DATA COMING FROM THE FIRST ARGUMENT IN CALL

/  6		EDIT CALL, MOVE ARGUMENTS (REPLOT), HERE

/		ALSO, THE LOW TEN BITS ARE A NOP

/  7		ILLEGAL

/

/

LINE	0

	JMS	GETARG

L1	1		/ALSO USE THESE AS LITERALS

TEXT	0

	JMS	GETARG

L3	3

COPY	0

	JMS	GETARG

L0	0

PRAMTR	0

	JMS	GETARG

L2	2

GRAPH	0

	JMS	GETARG

L5	5

SETPT	0

	JMS	GETARG

	100004		/MAIN FILE, AND POINT

RSETPT	0

	JMS	GETARG

	200004		/EDIT, AND POINT

DELETE	0

	JMS	GETARG

	200006		/DELETE GENERATES A NULL EDIT

PLOT	0

	JMS	GETARG

	500000		/MAIN, BUT SHIFT ARGUMENTS

REPLOT	0

	JMS	GETARG

	600000		/EDIT, BUT SHIFT ARGUMENTS

BLANK	0

	JMS	GETARG

L10	10

UNBLNK	0

	JMS	GETARG

L11	11

DINIT	0

	JMS	GETARG

L7	7		/DINIT IS A SUB, SINCE NO CODE ADDED

/			/THRU MAIN FILE POINTERS

LNSIZE	0

	JMS	GETARG

L12	12

/

DCLOSE	0

	DZM	MFPTR	/KILL RUN SWITCH

	.CLOSE	DATVT	/DCLOSE SO SMALL HAS OWN CODE

	JMP*	DCLOSE

/

	.EJECT

/

/  ROUTINE GETARG

/

/  THIS IS THE MAIN PROCESSING CODE

/

/  OBTAIN ARGUMENTS, SET UP TABLE XCT'S, ESTABLISH

/  SUB, MAIN, REPLOT ETC.

/

/  CALLING SEQUENCE

/

/LINE	0

/	JMS	GETARG	/MUST BE LOC FOLLOWING ENTRY POINT

/	CONST		/CONST FORM IS DESCRIBED ABOVE

/

/  CONTROL NEVER RETURNS FOLLOWING THE JMS

/

GETARG	0

	LAW	-2	/SET UP TO ESTABLISH EXIT POINT

	DAC	TYPE	/SET UP LOC TO REMEMBER MAIN-SUB SPLIT

	TAD	GETARG	/POINTS TO ENTRY POINT

	DAC	TEMP4	/FOR EXTRA INDIRECT

	LAC*	TEMP4	/

	DAC	RETAD2	/RETURN ADDR FOR EXIT

	DAC	TEMP4	/FETCH ARGUMENT POINTER

	CMA

	TAD*	TEMP4

	AND	(7777	/IN CASE PAGE MODE

	CMA		/-COUNT-1

	DAC	TEMP3	/CONTROL FOR FETCH LOOP

/

	LAC*	GETARG	/GET DESCRIPTOR WORD

	SPA!CLA		/SKIP IF ORDINARY ARG. FETCH, LEAVIN G AC=0

LM1	LAW	-1	/PLOT OR REPLOT, MOVE BACK ARG'S

	TAD	LARG1	/ADDRESS OF ARG1 STORAGE

	DAC	TEMP1	/FOR ARGUMENT PLACEMENT

	JMP	GTRG05	/JOIN FETCH LOOP

/

GTRG03	LAC*	TEMP4	/AN ARGUMENT

	SMA		/SKIP IF EXTRA INDIRECT

	JMP	GTRG04	/NO

	DAC	TEMP2

	LAC*	TEMP2

GTRG04	DAC*	TEMP1	/TO OUR CORE

	ISZ	TEMP1	/MOVE PUT

GTRG05	ISZ	TEMP4	/MOVE FETCH

	ISZ	TEMP3	/MORE

	JMP	GTRG03	/YUP

	DZM*	TEMP1	/ZERO ANY POSSIBLE OPTIONAL ARGUMENT!

	LAC*	GETARG	/FETCH GRAPHICS CODE (IN LOW 10 BITS

	SPA		/SKIP IF WE REALLY HAVE THE CODE

	LAC*	ARG0	/WE DON'T, PLOT OR REPLOT GAVE IT TO US, GET IT

	AND	(1777	/STRIP HIGH STUFF FROM GETARG POINTED ARG.

	DAC	ARG0	/SAVE GRAPHICS CODE FOR LATER CHECK

	TAD	LOPT	/MAKE UP ADDR FOR XCT* OF TABLE

	DAC	XOPT	/XCT OPTIONAL ARGUMENT TABLE

	TAD	LENT	/

	DAC	XCODE	/XCT CODE GENERATE TABLE

	TAD	LENT	/

	DAC	XNEED	/XCT NEED TABLE IN CASE EDIT

/

	LAC*	GETARG	/SPLIT ON SUB, MAIN, EDIT

	RTL		/EDIT BIT INTO LINK

	SZL!CLL		/SKIP IF NOT EDIT, ENTER ALL WITH LINK=0

	JMP	EDIT	/GO TO EDIT PROCESSING (DON'T REJOIN)

	SMA!CLA		/SKIP ON MAIN FILE

	JMP	SUBPC	/SUBPICTURE PROCESSING, RETURN AT JOINSM

/

	.EJECT

/

MAINIT	SAD	MFPTR	/ARE WE RUNNING

	ISZ	TYPE	/NO, SO DON'T PLACE MFPTR

	LAC	MAINFL	/PRESENT MAINFILE IS

	DAC	FILE	/THE ACTION FILE

	XCT*	XOPT	/FETCH OPTIONAL ARG (CNAME)

	SZA		/SKIP IF NO CNAME

	ISZ	PARBAK	/SET UP FOR FOLLOWING DNOP IN CASE PRAM

	SNA		/SKIP IF CNAME TO MAKE FILLING POINTER

JOINSM	LAC	LTEMP2	/DISABLE CNAME RETURN

	DAC	TEMP4	/POINTER TO CNAME OR TEMP2

	LAC*	FILE	/LENGTH POINTER FROM FILE

	SNA!CLL!CML	/SKIP IF OLD FILE, LEAVING LINK1=OLD

	RTL		/NEW FILE, LENGTH=2, LINK0=NEW

	TAD	FILE	/+FILE ADDR = SCENE OF ACTION

	DAC	POINT	/PLACEMENT POINTER

	DAC	POINTS	/STATIONARY POINTER

	DAC*	TEMP4	/TO CNAME IF PRESENT, IF NOT, TEMP2

	TAD	LM1	/MAKE A COPY AT .-1. FLIP LINK!!

	DAC	POINT1

	SZL!CLL!CML	/SKIP IF OLD FILE, LINK NEEDED PRESENTLY

	JMP	NEWFIL	/GO SETUP NEW FILE; AC=FILE+1

	LAC*	POINT1	/CHECK OUT RECLAIM OF DNOPE

	XOR	LDNOPE	/MAKE AC=0 IF A DNOPE ENDS THIS FILE

	SNA!RTL		/IF NOT, SKIP, THEN TO MSTOR5, NO BACK-UP

/			/IF EQUAL, MAKE A 2 FOR COMPARE ON GRAPHICS TYPE

	SAD	ARG0	/DNOPE, NOW CHECK IF WE ARE A PARAMETER

	JMP	MSTOR5	/NO BACK-UP

	LAC*	POINT	/NOT A PARAMETER, BACK UP END OF FILE

	DAC*	POINT1	/JMP* OVER TOP OF DNOPE

	LAC	POINT1	/NOW BACK UP THE POINTERS

	DAC	POINT

	DAC	POINTS

MSTOR5	CLA!CMA!CLL!CML	/REAL CODE GENERATE, CALL AC=-1,LIN=1

	DAC	PUTCNT	/SET UP PUT TO SAVE FIRST INSTR.

	XCT*	XCODE	/GENERATE CODE THRU POINT

MRETUR	LAC*	POINTS	/PREVIOUS END OF FILE

	JMS	PUT	/REGULAR PLACEMENT MECHANISM TO PRESENT END

	LAC	HOLD	/PLACE FIRST INST OVER OLD EOF

	DAC*	POINTS

	LAC	POINT	/ADDR OF NEW END OF FILE

SHUNT	ISZ	TYPE	/SKIP UNLESS MAIN & RUNNING

	DAC	MFPTR	/MAIN AND RUNNING, UPDATE POINTER

	CMA		/COMPUTE TOP-OF-FILE LENGTH POINTER

	TAD	FILE	/ADDR OF TOP

	CMA

	DAC*	FILE	/LEGTH POINTR IS BOTT ADDR-TOP ADDR

	JMP	EXX2	/OK -1 TO AC AND RETURN

/

/  SUBPICTURE SETUP

/

SUBPC	XCT*	XOPT	/FETCH OPTIONAL ARG, IF ANY

	SNA		/SKIP ON REAL ONE

	LAC	PNAME	/WASN'T, GET LAST PNAME

	DAC	PNAME

	DAC	FILE	/FILE USING, FOR MAIN AND SUB

	XOR	MAINFL	/IS SUBPIC SAME AS MAIN?!?

	SNA		/SKIP IF NOT, DON'T CHANGE MFPTR.

	SAD	MFPTR	/=,NOW SKIP IF MAINFILE RUNNING

	ISZ	TYPE	/NASTY, MAKE TYPE=-1 SO IT WILL SKIP AT 'SHUNT'

/			/MISS THE ISZ ONLY IF SUB=MAIN, AND RUNNING.

	JMP	JOINSM	/JOIN MAIN PROCESSING

/

	.EJECT

/

/

/  EDIT CODE

/

EDIT	XCT*	XOPT	/FETCH 'OPTIONAL' ARGUMENT

/			/WHICH IS CNAME

	DAC	TEMP1	/BUT WE WANT CONTENTS, NOT ADDR LIKE M+S

	LAC*	TEMP1	/CNAME ADDR

	DAC	POINT1	/ONCE FOR POINTER TO DNOP GROUP

	DAC	POINT2	/ONCE FOR COUNT OF GROUP

	DAC	POINTS	/ONCE FOR CODE MAKERS

	TAD	LM1	/BACK UP ONE FOR CODE PLACEMENT POINTER

	DAC	POINT

/

/  PART OF CODE TO DETERMINE SIZE OF PREVIOUS GROUP

/

	LAC*	POINTS	/FIRST DISPLAY INSTR. OF GROUP

	SAD	LDSKP	/CHECK SPECIAL CASE OF SKP, COUNT

	JMP	SIZAPP	/YES, OBTAIN COUNT FROM NEXT WORD

	SAD	LDNOP	/GROUP TO BE DELETED?

	CLL!RAL		/NASTY, CALL IT A BASIC VECTOR

	AND	LNOP	/RETAIN 4 BITS OF OP (LNOP=740000)

	SAD	LDNOP	/IS IT A PARAMETER INSTR

	JMP	SIZPAR	/YES, SPECIAL CASE

	RAL!CLL		/MOVE FOUR BITS TO RIGHT OF AC

	RTL

	RTL

	TAD	(SIZETB	/ADDR OF TABLE OF SIZES BY OP CODE

	DAC	POINT2	/INIT VALUE OF POINT2 NOT NOW NEEDED

SIZTST	LAC*	POINT2	/SIZE TO AC

	SNA		/0 SIZE IS ILLEGAL, EXIT TO USER

	JMP*	RETAD2

	TAD	POINT	/POINT TO LAST LOC IN GROUP

SIZJ1	DAC	POINT2	/SIZPAR REJOINS HERE

	CMA		/MAKE COUNTER FOR DNOP OF GROUP

	TAD	POINTS

	DAC	PUTCNT	/-# OF DNOP'S TO PLACE

	LAC	LDNOP	/NOW COUNT DNOP'S BEYOND GROUP

/

/  FIND COUNT OF DNOP'S BEYOND GROUP

/

SIZLOO	ISZ	POINT2	/MOVE POINTER TO CHECK NEXT LOC

	SAD*	POINT2	/ANOTHER DNOP?

	JMP	SIZLOO	/YES

/

/  POINT2 NOW POINTS 1 BEYOND TOTAL SPACE; FIND OUT NEED

/

	CLL!CLA		/NEED ROUTINES ASSUME AC,LINK=0

	XCT*	XNEED	/RETURN # NEEDED IN AC

NRETUR	TAD	POINT	/LAST ADDR NEEDED

	CMA		/-LAST-1 NEEDED

	TAD	POINT2	/COMPARE

	SPA!CLA		/SKIP IF ENUF

	JMP*	RETAD2	/NO, EXIT WITH AC=0

	STPD		/STOP DISPLAY FOR EDIT

	LAC	LDNOP	/CLEAR OUT PREVIOUS GROUP

EDICLR	DAC*	POINT1	/

	ISZ	POINT1

	ISZ	PUTCNT	/DONE

	JMP	EDICLR	/NO

/

/  FALL THRU LEAVING PUTCNT=0, WHICH IS CORRECT FOR PUT!

/

	CLA!CMA!CLL!CML	/SAY WE ARE REALLY DOING CODE THIS TIME

	XCT*	XCODE	/MAKE CODE

EXX0	LAC	MFPTR	/GET ON-OFF SWITCH

	SZA		/SKIP IF OFF

EXX1	LSD		/RESTART DISPLAY IF ON

EXX2	LAW	-1	/OK EXIT FLAG IN AC

	JMP*	RETAD2	/ TO CALLER

/

	.EJECT

/

/  VARIOUS ROUTINES AND SUBROUTINES

/

/  PUT SUBROUTINE

/

/  ENTER WITH AC CONTAINING INSTRUCTION TO BE PLACED

/

/  STANDARD OPERATION; MOVE 'POINT', PLACE INDIRECT THRU 'POINT'

/

/  IF PUTCNT IS -1, THE AC IS PLACED IN 'HOLD' INSTEAD;

/  IN THIS CASE, 'POINT' IS NOT MODIFIED.

/  THIS LAST MODE IS FOR ADDITION TO MAIND+SUB FILES.

/

PUT	0

	ISZ	PUTCNT	/SKIP IF SPECIAL CASE AC-TO-HOLD

	JMP	PUTPUT	/NOPE, JUST PLACE

	DAC	HOLD	/SAVE FIRST PLACE MAIN AND SUB

	JMP*	PUT

/

PUTPUT	ISZ	POINT	/MOVE POINTER TO NEXT

	DAC*	POINT	/PLACE, LEAVING POINTER AT LAST ONE

	JMP*	PUT	/OUT

/

/

/

/

/  NEW FILE SET-UP FOR MAIN AND SUBP.

/

NEWFIL	AND	(17777	/AC HAS FILE+1, STRIP TO VT-15 ADDR FIELD

	TAD	(DJMPI	/OP CODE MAKING JMP* FILE+1

	DAC*	POINTS	/PLACE AT FILE+2

	JMP	MSTOR5	/GO TO GENERATE CODE, CAN'T BACK UP POINTERS

/

/

/  SIZE

/

/  ADDITIONAL CODE TO DETERMINE SIZE OF PREVIOUS GROUP

/

SIZAPP	ISZ	POINT2	/LINE APPROX SIZE LIVES IN GROUP+1

	JMP	SIZTST	/REJOIN MAIN LOOP

/

SIZPAR	DAC	ARG0	/INDICATE PREVIOUS GROUP PARAM

SIZPRL	ISZ	POINT2	/MOVE TO NEXT

	LAC*	POINT2	/FIGURE OUT IF GROUP IS DONE

	SAD	LDNOP	/IT IS IF NEXT OF LDNOP

	JMP	SIZND	/GO BACK UP POINT2 AND REJOIN

	SAD	LDNOPB	/AND IF BEGINNING OF NEXT GROUP

	JMP	SIZND

	SAD	LDNOPE	/AND IF END OF THIS GROUP

	JMP	SIZND1	/FETCH POINT2, DON'T BACK UP

	AND	LNOP	/STRIP TO 4 BITS OF OP CODE

	SAD	LDNOP	/IS IT A PRAMETER INSTR.

	JMP	SIZPRL	/YES, KEEP GOING

SIZND	SKP!CLA!CMA	/BACK UP POINT2 TO GROUP END

SIZND1	CLA		/KEEP POINT2 SET

	TAD	POINT2	/RETURN POINT HAS POINT2 IN AC

	JMP	SIZJ1

/

/

/

/ TABLE OF GROUP SIZES BY OP CODE

/

SIZETB	0	/SINGLE CHAR ILLEGAL

	3	/CHAR STRING (ASSUMED INDIRECT

	2	/ARBITRARY VECTOR LINE

	2	/POINT INSTRUCTION, SET POINT

	0	/PARAMETER HANDLED AS A SPECIAL CASE

L6	6	/SAVE-RESTORE, COPY WITH SAVE RESTORE

	0	/BUNCH OF ILLEGALS, DON'T REMEMBER OP CODE

	0	/ORDER EXACTLY

	1	/BASIC VECTOR

	0

	0

	0

	0

	3	/DJMS (ASSUME INDIR) COPY

	0

	0

/

/

/  SUBROUTINE  OPTPAR

/

/  FETCHES OPTIONAL ARGUMENT FOR A PARAMETER TYPE CALL

/  RETURNS ARGUMENT IN AC

/

/

/ ENTERS WITH LINK=0

/

OPTPAR	0

	DZM	PARBAK	/DEFAULT FOR LATER, NO TRAILING DNOPE

	DZM	PARFRN	/AND NO LEADING DNOPB

	LAC	LARG1	/ADDR OF FIRST ARG

	DAC	TEMP1

	LAC*	ARG1	/GET THE BITS 

OPTP1	ISZ	TEMP1	/MOVE ARG POINTER

OPTP2	SZL!CLL		/SKIP IF NO BIT

	JMP	OPTP1	/BIT, MOVE POINTER

	SZA!RAR		/SKIP IF ALL DONE

	JMP	OPTP2	/NOPE, KEEP GOING

	LAC*	TEMP1	/ARGUMNT

	JMP*	OPTPAR

/

/

/  NEED ROUTINES

/

/  THESE ROUTINES RETURN THE NUMBER OF LOCATIONS

/  REQUIRED TO EDIT IN THIS GROUP, IN THE AC.

/  REJOIN THE MAIN-LINE A NRETUR.

/

/

/  OBTAIN THE NUMBER FOR COPY CODE

/  ENTER WITH AC=0

/

NEDCOP	SAD*	ARG1	/WITH RESTORE?

	LAW	-3	/NO, MAKE TOTAL =3

	TAD	L6	/YES, MAKE TOTAL =6

	JMP	NRETUR

/

/

/

/  OBTAIN THE NUMBER FOR PARAMETER CODE

/

NEDPAR	LAC*	POINTS	/CHECK FOR SPECIAL CASE PARAM/PARAM AND 

	SAD	LDNOPB	/ALSO NO LEADING DNOPB

	JMP	NEDFRN	/GOT A DNOPB, NOT THAT CASE

	LAC	ARG0	/NOW CHECK PARAM/PARAM

	SAD	LDNOP	/SIZPAR PUTS DNOP IN ARG0 !!!!

	JMP	NEDP1	/SPECIAL CASE, NO LEADING DNOPB NEEDED!!

NEDFRN	LAC*	POINT	/FETCH PRECEDING

	SAD	LDNOPE	/AN END PARAMETER

	JMP	NEDP1	/IF SO, WE DON'T NEED A BEGINNING PARM

	SAD	LDNOP	/A REGULAR DNOP

	JMP	NEDP1	/YES, ALSO WE DON'T NEED 1

	AND	LNOP	/STRIP TO OP; LNOP=740000

	SAD	LDNOP	/IS A PARAMTER

	ISZ	PARFRN	/YES, SO WE NEED A DILIMITER

NEDP1	LAC	PARFRN	/KEEP THE COUNT GOING

	DAC	TEMP4	/BUT SAVE PARFRN FOR GENERATION TIME

	LAC	(MASK	/POINTER TO MASK LIST

	DAC	TEMP2

	LAW	-4	/LOOP CONTROL

	DAC	TEMP3

NEDP2	LAC*	ARG1	/BITS

	AND*	TEMP2	/ANY FOR THIS PARAMETER WORD

	SZA		/SKIP IF NOT

	ISZ	TEMP4	/AND COUNT 1 IF SO

	ISZ	TEMP2	/MOVE TO NEXT MASK

	ISZ	TEMP3	/LOOP CONTROL

	JMP	NEDP2

	LAC	POINTS	/MAKE POINTER TO INSTR AFTER GROUP

	TAD	TEMP4

	DAC	TEMP1

	LAC*	TEMP1	/INSTRUCTION FOLLOWING GROUP

	SAD	LDNOPB	/DOES IS STRART WITH A NOP

	JMP	NEDP3	/YES, WE DON'T NEED ONE

	SAD	LDNOP	/IS A REGULAR DNOP

	JMP	NEDP3	/ALSO WE DONT NEED

	AND	LNOP	/CHECK IF PARAMETER

	SAD	LDNOP	/PARAMTER

	ISZ	PARBAK	/YES, WE NEED DNOPE

NEDP3	LAC	PARBAK

	TAD	TEMP4	/MAKING TOTAL COUNT

	JMP	NRETUR

/

	.EJECT

/

/  CODE GENERATION SUBROUTINES

/

/  CHARACTER STRING

/

CHR	0

	LAC	POINTS	/GROUP STARTING ADDR

	AND	(17777	/KEEP 13 BITS

	TAD	(CHARSI+2 /STRING INDIRECT TO .+2

	JMS	PUT	/PLACE IT

	TAD	(DJMP-CHARSI+1 /ADD NEW INST-OLD INST

	JMS	PUT

	LAC	ARG1	/STRING ADDR

	.IFDEF	NONXVM

	AND	L77777	/MSK OFF ARRAY TYPE BITS FROM ADDR!!

	.ENDC

	JMS	PUT

/

/

/TEST N AND INSERT ALT IF .NE. ZERO.

/

LM2	LAW	-2	/MAX LOOP CONTROL FOR WORD MODIFY

	DAC	TEMP4	/FOR ALT-MODE INSERTION

	LAC*	N	/GET NO. OF CHARS.

	SNA!SPA!CMA	/SKIP IF MUST INSERT ALT-MODE

	JMP*	CHR	/NOPE

	JMP	TST2	/JOIN DIVIDE BY 5 LOOP

/

TST1	ISZ	STR	/MOVE IOPS ASCII POINTER BY 1 PAIR

	ISZ	STR

TST2	TAD	L5	/ADD 5 UNTIL >=0

	SPA		/CHECK DONE

	JMP	TST1	/NOPE

	TAD	LM2	/CHAR POSITIONS 1,2,3,4,5 HAVE AC VALUE

/			/OF 2,1,0,-1,-2

	SMA!RAL!CLL	/VALUES 4,2,0,-2,-4

	JMP	TST3	/VALUES 4,2,0 FOR POSITIONS 1,2,3

	ISZ	STR	/POSITIONS 4,5 ARE IN SECOND WORD

	TAD	L12	/VALUES 10,6 FOR POSITIONS 4,5

TST3	SZA!CMA		/VALUES -5,-3,-1,-11,-7

	ISZ	TEMP4	/LOOP CONTROL -1 XCPT POSITION 3

	TAD	ALTPNT	/MAKE POINTER FOR CORRECT MASK

	DAC	TEMP3

TST4	LAC*	STR	/GET WORD OF IOPS PAIR FOR MODIFY

	AND*	TEMP3	/STRIP OUT CHAR 

	ISZ	TEMP3	/MOVE POINTER TO CORRECT ALT-MODE

	XOR*	TEMP3	/INSERT ALT

	ISZ	TEMP3	/MOVE POINTER IN CASE SECOND PASS

	DAC*	STR	/REPLACE

	ISZ	STR	/IN CASE SECOND PASS

	ISZ	TEMP4	/LOOP CONTROL

	JMP	TST4	/DO A SECOND WORD MODIFY

	JMP*	CHR	/WHEW! DONE

/

/  MASKS FOR INSERTION OF ALT-MODE IN EACH POSITION

/

	700377		/POSITION 4

	076400		/ITS ALT-MODE

	777401		/POSITION 5

	000372		/ITS ALTMODE

	003777		/POSITION 1

	764000		/ALT

	774017		/POSITION 2

	003720		/ALT

LM20	777760		/POSITION 3, FIRST PART

L17	000017		/PAST OF ALT MODE

L77777	077777		/SECOND PART

LT5	500000		/END OF ALT MODE

ALTPNT	L17		/ADD TO AC VALUE TO OBTAIN CORRECT POINTER

/

	.EJECT

/

/

/PRM  -  SETUP DISPLAY PARAMETER INSTRUCTIONS FOR BOTH

/        MAIN AND SUBPICTURE ENTRIES

/

PRM	0

	LAC	LARG1			/ADDR OF ARG1

	DAC	REGT1			/FEATURES THAT NEED SETTING.

	DZM	TEMP1			/CLEAR WORDS TO BE 

	DZM	TEMP2			/INSERTED IN DISPLAY FILE.

	DZM	TEMP3

	DZM	TEMP4

	LAC*	ARG1			/BITS INDICATING WHICH

PRM10	SNA!RCR				/DONE IF AC=0

	JMP	PRM25			/GO FINISH UP.

	DAC	REGT0			/SAVE REST.

	SNL!CLL				/TEST FEATR BIT IN L.

	JMP	PRM20			/NOT ON.

	ISZ	REGT1			/GET NEXT SETTING VALUE.

	LAC*	REGT1

	DAC	ARG1

	LAC*	ARG1			/ACTUAL VALUE IN AC.

PRM15	JMP*	PRMTBL			/DISPATCH.

PRM20	LAC	REGT0			/FETCH REMAINING BITS

	ISZ	PRM15			/POINT TO NEXT ROUTINE.

	JMP	PRM10			/RECYCLE.

PRM25	LAC	JINST			/RESET DISPATCHER.

	DAC	PRM15

	LAC	(PARFRN	/POINTER TO DATA FOR SIX INSTRUCTIONS

	DAC	REGT0

	TAD	L6	/POINTER TO OP CODES FOR THOSE 6 INSTRUCTIONS

	DAC	REGT2

	LAW	-6	/LOOP CONTROL

	DAC	REGT1

PARLOP	LAC*	REGT0	/INSTRUCTION DATA

	SNA		/SKIP IF THERE IS INDEED DATA FOR THIS ONE

	JMP	PARL1	/NO DATA, DON'T PLACE IT

	XOR*	REGT2	/OP CODE WITH DATA=FULL GRAPHICS INSTR.

	JMS	PUT	/PLACE IN FILE

PARL1	ISZ	REGT0	/MOVE DATA FETCH POINTER

	ISZ	REGT2	/MOVE OP CODE FETCH POINTER

	ISZ	REGT1	/CONTROL

	JMP	PARLOP	/MORE

	JMP*	PRM	/NO MORE

JINST	JMP*	PRMTBL

/

/DISPATCH TABLE FOR PARAMETER SETTINGS

/

PRMTBL	SCALE

	INTENS

	LTPN

	BLINK

	DASH

	OFSET

	ROTAT

	NAME

	SYNC

/

/GENERATE SCALE SETTING FROM VALUE IN AC.

/

SCALE	AND	L17		/MASK SETTING.

	XOR	L20		/ENABLE SCALE CHANGE.

T1R	XOR	TEMP1		/FORM SETTING(S) FOR PARAM. WD. 1.

	DAC	TEMP1		/KEEP FOR DISPLAY FILE.

	JMP	PRM20		/RETURN TO DISPATCHER

/

/GENERATE INTENSITY SETTING FROM VALUE IN AC.

/

INTENS	AND	L7		/KEEP ONLY DATA BITS

	TAD	L10		/ENABLE BIT

	CLL!RAL

	RTL; RTL; RTL		/MOVE SETTING INTO POSITION

	JMP	T1R		/INCLUDE IN PARAM. WD. 1.

/

/GENERATE LIGHT PEN SETTING FROM VALUE IN AC.

/

LTPN	SZA			/1=ON, 0=OFF.

	LAC	(4		/ON BIT.

	TAD	L10		/ENABLE LIGHT PEN SETTING.

T2R	XOR	TEMP2		/FORM SETTING(S) FOR PARAM. WD. 2.

	DAC	TEMP2		/KEEP FOR DISPLAY FILE

	JMP	PRM20		/RETURN TO DISPATCHER.

/

/

/GENERATE BLINK SETTING FROM VALUE IN AC.

/

BLINK	SZA			/1=ON, 0=OFF

	LAC	(400		/ON BIT.

	TAD	(BK		/ENABLE BLINK

	JMP	T2R		/INCLUDE IN PARAMETER WORD 2.

/

/GENERATE DASH SETTING FROM VALUE IN AC

/

DASH	AND	L3		/MASK SETTING.

	XOR	(DSH		/ENABLE DASH.

	DAC	TEMP3		/KEEP FOR DISPLAY FILE.

	JMP	PRM20		/RETURN TO DISPATCHER

/

/GENERATE OFFSET SETTING FROM VALUE IN AC.

/

OFSET	SZA

	LAC	L1		/MASK SETTING.

	XOR	L2		/ENABLE OFFSET

	JMP	T2R		/INCLUDE IN PARAMETER WORD 2.

/

/GENERATE ROTATE SETTING FROM VALUE IN AC.

/

ROTAT	SZA			/1=ON, 0=OFF.

	LAC	L20		/ON BIT.

	TAD	(ROT		/ENABLE ROTATE.

	JMP	T2R		/INCLUDE IN PARAMETER WORD 2.

/

/SET NAME REGISTER FROM VALUE IN AC.

/

NAME	AND	(177		/MASK NAME SETTING.

	XOR	(LODN		/ENABLE LOAD NAME.

T4R	XOR	TEMP4		/FORM SETTING(S)FOR SKIP2 WORD.

	DAC	TEMP4		/KEEP FOR DISPLAY FILE.

	JMP	PRM20		/RETURN TO DISPATCHER.

/

/SET SYNC FROM VALUE IN AC

/

SYNC	SZA			/1=ON, 0=OFF.

	LAC	(2000		/ON BIT.

	JMP	T4R		/INCLUDE IN SKIP2 WORD.

/

/  LIST OF DATA HOLDERS FOR MAX OF SIX INSTRUC

/

/  THE NEXT 12 LOCATIONS MUST STAY IN PRESENT ORDER!

/

PARFRN	0		/FRONT NOP, 1 IF NEEDED, 0 IF NOT

TEMP1	0		/DATA FOR PRM1

TEMP2	0		/PRM2

TEMP3	0		/PRM3

TEMP4	0		/SKP2 (TEMP1-4 SOMETIMES USED AS TEMP)

PARBAK	0		/BACK NOP, 1 IF NEEDED, 0 IF NOT

/

/  LIST OF OP CODES FOR POSSIBLE PARAMTER INSTRUCTIONS

/

PAROPS	DNOP		/DNOP.XOR.1=DNOPB

LDNOP	PRM1		/REGULAR PARAMETER 1 INSTRUC

	PRM2

	PRM3

	SKP2

	DNOPE\1		/XOR'ED INTO 1 GIVES DNOPE

/

	.EJECT

/

/  GENERATE CODE FOR COPY

/

CPY	0

	ISZ	ARG2	/CALLED FILE, MAKE IT FILE+1

	TAD*	RST	/AC=-1, CLEAR LINK IF RST NON0

	LAC	POINTS	/SET UP 13 BITS OF ADDR

	AND	(17777	/FOR PLACEMENT IN ADDRESSES

	SNL		/SKIP IF RESTORE ARGUMENT WAS 0

	JMP	CPY1	/RESTORE ON, GO DO ITS CODE

	TAD	(DJMSI+2 /JMS THRU GROUP+2

	JMS	PUT	/PLACE INSTRUCTIONS THRU PUT

	TAD	(DJMP-DJMSI+1 /ADD NEW INST-OLD INST

	JMS	PUT

	LAC	ARG2	/FETCH DISPLAY SUBROUTINE ADDR

CPY2	JMS	PUT

	JMP*	CPY

/

CPY1	TAD	(SAVE+4	/SAVE INSTRUCTION, GROUP+4

	DAC	TEMP1	/SAVE TO MAKE LATER RESTORE INSTRUC

	JMS	PUT

	TAD	(DJMSI-SAVE-1 /NET DIFFERENCE BETWEEN INST'S

	JMS	PUT

	TAD	(DJMP-DJMSI+2

	JMS	PUT

	LAC	ARG2	/ADDR OF SUBPICTURE CALLED

	JMS	PUT

	JMS	PUT	/LEAVE HOLE FOR RESTORED WORD

	LAC	TEMP1	/FETCH SAVE+4

	TAD	(REST-SAVE	/MAKE RESTORE GROUP+4

	JMP	CPY2	/JOIN FOR LAST 2 INST'S

/

/  GENERATE CODE FOR GRAPH

/

GRPH	TAD*	ARG2	/AC=-1 GIVES COUNT-1

	CMA		/WHICH GIVES -COUNT

	DAC	TEMP2	/HOLD FOR LOOP CONTROL

	LAC*	ARG3	/GET AXIS SETTING

	SZA

	LAC	(4000

	XOR	(GY

	DAC	TEMP1	/OP CDOE THRUOUT

GRPH5	LAC*	ARG1	/GET A POINT

	AND	(1777	/MAKE SURE NO XTRA BITS

	XOR	TEMP1	/OP CODE

	JMS	PUT	/PLACE POINT

	ISZ	ARG1	/MOVE INPUT POINTER

	ISZ	TEMP2	/CHECK COUNT

	JMP	GRPH5	/KEEP GOING

	JMP	MRETUR	/RETURN TO MAIN-SUB CODE

/

/

/  CODE FOR BLANK AND UNBLANK

/

BLN	CLL!CLA		/INDICATE BLN BY LINK OFF

UBL	DAC	TEMP4	/SAVE AC (SAME AS LINK)

/			/UBL CALL HAVING AC, LINK ALREADY -1

	TAD	LTEMP2	/BLN POINTS TEMP2;UBL POINTS TEMP1

	DAC	TEMP3	/USED TO PLACE EOF POINTER

	LAC	ARG1	/FILE ADDR

	TAD	L2	/MAKE POINTER TO FILE+2

	DAC	TEMP1	/PLACE TWICE; ONCE OVERWRITE

	DAC	TEMP2

	LAC*	ARG1	/LENGTH POINTER

	SNA		/BETTER NOT BE ZERO

	JMP*	RETAD2	/JUST RETURN TO CALLER

	TAD	ARG1	/POINT TO END OF FILE

	DAC*	TEMP3	/PLACE EOF IN ONE OR OTHER

	LAC*	TEMP1	/GET A NON-JUMP

	DAC	TEMP3	/SAVE IN TEMPORARY

	AND	(760000	/CHECK IF NON-JUMP IS ALREADY A JUMP

	SAD	(DJMPI	/IF SO, NO WORK TO DO

	JMP*	RETAD2	/OUT

	LAC*	TEMP2	/GET A JUMP

	DAC*	TEMP1	/PLACE OVER THE OTHER END

/

/  THIS GIVES A TRANSITION STATE WITH A JUMP AT EACH END

/

	SNL		/SKIP IF UNBLANK

	STPD		/STOP DISPLAY

	LAC	TEMP3	/PLACE NON-JUMP OVER JUMP

	DAC*	TEMP2

	ISZ	TEMP4	/NEED TO TURN ON TUBE AGAIN?

	JMP	EXX0	/YES

	JMP	EXX2	/NO

/

/  GENERATE POINT CODE

/

/

PNT	0

	LAC*	ARG2	/GET Y POINT

	AND	(1777	/KEEP ONLY 10 BITS

	XOR	(PY	/MAKE UP OP CODE

	JMS	PUT	/PLACE IN DISPLAY LISE

	LAC*	ARG1	/AND TH X POINT

	AND	(1777

	XOR	(PX

	JMS	PUT

	JMP*	PNT

/

/  DINIT CODE TO START UP DISPLAY

/

DNT	STPD		/STOP TUBE IN CASE RUNNING

	.INIT	DATVT,1,SICW	/CLER FLAGS, ENABL LP,PB

	LAC	ARG1	/NEW MAINFL ADDR

	DAC	MAINFL	/SAVE FOR MAIN ROUTINE USE

	DAC	POINT	/GRAB PUT MECHANISM, TOP OF MAIN

	JMS	PUT	/DUMMY, SINCE SUBP STORES FIRST ARG

	TAD	L2	/ADDR FILE+2

	JMS	PUT	/PUT IN FILE+1

	LAC*	MAINFL	/FIND OUT IF NEW MAIN FILE

	SZA		/SKIP IF YES

	JMP	MANCOM	/NOPE

/

/  SET UP NEW FILE

/

	LAC	(215052	/TURN OFF BLINK, OFFSET, ETC.

	JMS	PUT	/FILE+2

	LAC	MAINFL	/MAKE JMP* FILE+1

	AND	(17777	/13 BIT VT-15 ADDRESSING

	TAD	(DJMPI+1

	JMS	PUT	/TO FILE+3

	LAC	L3	/LENGTH POINTER OF THREE

	DAC*	MAINFL	/PLACE AS LENGTH POINTER

MANCOM	TAD	MAINFL	/MAKE END POINTER

	DAC	MFPTR	/USED BY TRACKING ROUTINE

	JMP	EXX1	/START,-1 TO AC, EXIT

/

SICW	257740		/CLEAR FLAGS, ENABLE PB, LP INTERRUPTS

/

/

/  ACTION FOR LINESIZE CALL

/

LNS	LAW	-2	/TOUGH. THIS MAKES CKNDSW NOT SKIP

/			/SO ON REGULAR EXIT FROM VECTOR

/			/SIZE IS RETURNED, BUT NO CODE GENER.

	JMS	VECTOR	/BUT ON 0,0 EXIT, SEE ZEROX

	DAC*	ARG3	/SIZE FROM AC TO CALLER

	JMP*	RETAD2	/OUT

/

ZEROX	ISZ	CKNDSW	/LINE 0,0

	ISZ	CKNDSW

	JMP*	RETAD2	/ALL BUT LNS, EXIT TO CALLER

	JMP*	VECTOR	/BUT LNS MUST RETURN, TO SEND

/			/CALLER THE ARGUMENT!!!

	.EJECT

/

/  GENERATE CODE FOR LINE

/

/  CALL WITH AC=0 TO RETURN IN AC THE NUMBER

/  OF LOC'S THAT THE LINE WILL TAKE IN THE DIPLAY FILE

/

/  CALL WITH AC=-1 TO ACTUAL MAKE THE LINE

/  CALL WITH AC=-2 TO RETURN VIA VECTOR ON 0,0 LINE

/

/

	.IFUND	ARBVEC

/

/  (PREVIOUS CODE TO HANDLE APPROX, AND

/  POSSIBLE APPROX)

/

/

VECTOR	0

	DAC	CKNDSW	/SO IT SKIPS IF REALLY TO MAKE LINES!

	DZM	APPRSW		/CLEAR APPROXIMATION SWITCH.

	LAC*	ARG1+1		/GET DELTA Y,

	JMS	SIGNM		/CHECK SIGN AND MAG.,

	AND	(1777		/MASK TO TEN BITS,

	DAC	DELTAY		/AND SAVE.

	SZL!CLA

	CMA			/SIGN OF DELTAY; 0=PLUS, -1=MINUS.

	DAC	SOY

	LAC*	ARG1		/GET DELTAX,

	JMS	SIGNM		/CHECK SIGN AND MAG.,

	AND	(1777		/MASK TO TEN BITS,

	DAC	DELTAX		/AND SAVE.

	SZL!CLA

	CMA			/SIGN OF DELTAX; 0=PLUS, -1=MINUS.

	DAC	SOX

	LAC	DELTAY		/START TESTS FOR BASIC VECTOR.

	SNA

	JMP	YZERO		/DELTAY .EQ. ZERO

	LAC	DELTAX		/DELTAY .NE. ZERO

	SNA

	JMP	XZERO		/DELTAX .EQ. ZERO

	SAD	DELTAY		/DELTAX .NE. ZERO

	JMP	YEQX		/ABS (DELTAY) .EQ. ABS (DELTAX)

	CLA

	RS3			/ABS (DELTAY) .NE. ABS (DELTAX)

	AND	(10000		/CHECK RV OPTION AVAILABLE.

	SNA			/RV AVAILABLE, INSERT COMMANDS.

	JMP	APPROX

	LAC	L2

	ISZ	CKNDSW		/SKIP IF TO DO REAL WORK

	JMP*	VECTOR		/ON, RETURN.

	.EJECT

	LAC	SOX

	SZA			/SET SIGN FOR Y VECTOR

	LAC	(4000

	XOR	DELTAX

	XOR	(STRK		/STROKE OP CODE

	JMS	LSTOR		/AND STORE IT.

	LAC	SOY

	SZA			/SET SIGN FOR X VECTOR

	LAC	(4000

	XOR	DELTAY

	XOR	(STRK		/FORM SECOND INSTRUCTION

	JMS	LSTOR		/AND STORE IT.

	JMP*	VECTOR

YZERO	SAD	DELTAX		/DELTAX .EQ. ZERO TOO?

	JMP	ZEROX		/GO FIND TO WHOM TO RETURN

	SAD	SOX		/NO, CHECK SIGN OF DELTAX.

	TAD	(-10000		/PLUS, VECTOR DIREC. 0

	TAD	(V4		/MINUS, VECTOR DIREC. 4

YZER5	XOR	DELTAX		/FORM REST OF INSTRUCTION,

	DAC	TEMP1		/SAVE IT.

	LAC	L1		/1 LOC NEEDED

	ISZ	CKNDSW		/SKIP IF TO DO REAL WORK

	JMP*	VECTOR

	LAC	TEMP1

	JMS	LSTOR		/STORE IN DISPLAY FILE,

	JMP*	VECTOR

XZERO	SAD	SOY		/X .EQ. 0, CHECK SIGN OF DELTAY.

	TAD	(-10000		/PLUS, VECTOR DIREC. 2

	TAD	(V6		/MINUS, VECTOR DIREC. 6

	XOR	DELTAY		/FORM REST OF INSTRUCTION,

	JMP	YZER5+1		/STORE IT AND RETURN.

YEQX	CLA			/ABS DELTAY .EQ. ABS DELTAX

	SAD	SOX		/CHECK SIGN OF X.

	JMP	YEQX5		/PLUS.

	SAD	SOY		/MINUS, CHECK SIGN OF Y.

	JMP	DTAB+2		/DELTAX=MINUS, DELTAY=PLUS.

	JMP	DTAB+1		/DELTAX=MINUS, DELTAY=MINUS.

YEQX5	SAD	SOY		/DELTAX=PLUS, CHECK DELTAY.

	JMP	DTAB+3		/PLUS, VECTOR DIREC. 1

DTAB	TAD	(4000		/MINUS, VECTOR DIREC 7.

	TAD	(4000		/VECTOR DIREC. 5

	TAD	(4000		/VECTOR DIREC. 3

	TAD	(V1		/VECTOR DIREC. 1

	JMP	YZER5		/GO FORM INST, STORE, AND RETURN.

	JMP*	VECTOR		/RETURN

	.EJECT

/

/SIGNM - SEPERATE SIGN AND MAGNITUDE.  ENTER WITH DELTA IN

/	AC, EXIT WITH ABS (DELTA) IN AC, L=0 FOR PLUS,

/	L=1 FOR MINUS.

/

SIGNM	0

	CLL!SMA

	JMP*	SIGNM		/CLEAR L AND EXIT IF POS.

	CMA!STL			/TWOS COMPLEMENT AC

	TAD	L1		/AND SET L IF NEG.

	JMP*	SIGNM

/

/LSTOR - SET INTENSIFY BIT IF NECESSARY, AND STORE VECTOR INST.

/

LSTOR	0

	DAC	TEMP1		/SAVE TEMPORARILY

	LAC*	LT

	SZA!CLA			/CHECK INTENSITY ARG.

	LAC	(20000		/ON, SET INTENSIFY BIT.

	XOR	TEMP1

	JMS	PUT	/PLACE IT

	JMP*	LSTOR

/

/

/

/

	.EJECT

/

/APPROX - APPROXIMATE RV TYPE LINE USING BASIC VECTORS AND

/	THE BRESENHAM ALGORITHM.  (UNIT MOVE IS 2 RASTER UNITS)

/

/

APPROX	LAC	DELTAX		/DETERMINE MAJOR DELTA

	CMA

	TAD	L1

	TAD	DELTAY

	SPA

	JMP	APPR5		/DELTAX IS MAJOR DELTA

	LAC	DELTAY		/DELTAY IS MAJOR DELTA

	CLL!RAR

	DAC	UVAR		/SAVE DELTAY/2 AS MAJOR DELTA

	LAC	DELTAX

	CLL!RAR

	DAC	VAR		/SAVE DELTAX/2 AS MINOR DELTA

	LAC	SOY		/TEST SIGN OF Y TO DETERMINE

	SZA!CLA			/DIRECTION FOR MOVE1

	JMP	M1TAB		/D6

	JMP	M1TAB+2		/D2

APPR5	LAC	DELTAX		/DELTAX IS MAJOR DELTA

	CLL!RAR

	DAC	UVAR		/SAVE DELTAX/2 AS MAJOR DELTA

	LAC	DELTAY

	CLL!RAR

	DAC	VAR		/SAVE DELTAY/2 AS MINOR DELTA

	LAC	SOX		/TEST SIGN OF X TO DETERMINE

	SZA!CLA			/DIRECTION FOR MOVE1

	JMP	M1TAB+1		/D4

	JMP	M1TAB+3		/D0

/

/M1TAB, M2TAB - DETERMINE AND STORE VECTORS FOR MOVE1 AND MOVE2.

/

M1TAB	TAD	(4000		/D6

	TAD	(4000		/D4

	TAD	(4000		/D2

	TAD	(400002		/D0 (UNIT VECTOR=2 RU)

	DAC	MOVE1		/SAVE MOVE1

	LAC	SOX

	TAD	SOY		/TEST SIGN OF X AND Y TO

	SNA			/DETERMINE DIRECTION OF MOVE2.

	JMP	M2TAB+3		/(++)=D1

	TAD	L1

	SPA!CLA

	JMP	M2TAB+1		/(--)=D5

	SAD	SOY		/(+-)=D7

	JMP	M2TAB+2		/(-+)=D3

M2TAB	TAD	(4000		/D7

	TAD	(4000		/D5

	TAD	(4000		/D3

	TAD	(402002		/D1 (UNIT VECTOR=2RU)

	DAC	MOVE2		/SAVE MOVE2

	.EJECT

/

/COMPUTE VARIABLES A, B, AND D FOR APPROXIMATION LOOP.

/

	LAC	VAR

	CMA

	TAD	L1

	TAD	UVAR		/U-V

	CLL!RAL			/2(U-V)

	DAC	UMV

	LAC	VAR

	CLL!RAL

	DAC	B		/B=2V

	CMA

	TAD	L1

	TAD	UVAR

	TAD	UVAR

	DAC	A		/A=2U-B

	LAC	UVAR

	CMA

	TAD	L1

	DAC	UVAR		/SAVE -U FOR COUNT

	TAD	B

	DAC	D		/D=B-U

/

/TEST SIGN OF D TO DETERMINE WHICH IS LESSER,U-V OR V.

/IF D IS MINUS, V IS LESSER; IF PLUS, U-V IS LESSER.

/COMPUTE NO. OF LOCS. REQD. AS 2(LESSER) +3, -1 IF D = 0.

/

	SMA

	JMP	APPR6

	LAC	VAR		/V IS LESSER.

	CLL!RAL			/2V

	TAD	L3		/2V+3

	JMP	APPR7

APPR6	SZA!CLA			/(U-V)IS LESSER

	LAC	L1		/2(U-V)+3, IF D .NE. 0

	TAD	UMV		/+2, IF D .EQ. 0

	TAD	L2

APPR7	ISZ	CKNDSW		/# IN AC, SKIP IF REAL WORK

	JMP*	VECTOR		/0, RETURN.

	DAC	TEMP4		/SAVE COUNT

	LAC	LDSKP

	JMS	PUT		/PLACE SKIP OVER COUNT

	LAC	TEMP4		/GET BACK COUNT

	JMS	PUT		/PLACE IT IN LINE

	.EJECT

/

/APPROXIMATION LOOP

/

APPR20	LAC	D

	SPA			/IS D LESS THAN ZERO?

	JMP	APPR25		/YES.

	LAC	SAMSW		/GET SAME SWITCH.

	SAD	L1		/WAS LAST MOVE = MOVE2?

	JMP	APPR30		/YES.

	LAC	MOVE2		/NO. GET MOVE2 VECTOR

	JMS	LSTOR		/AND STORE IN DISPLAY FILE.

APPR21	LAC	A

	CMA

	TAD	L1

	TAD	D

	DAC	D		/D=D-A

	LAC	L1

	DAC	SAMSW		/SET SAME SWITCH.

	JMP	APPRND		/GO CHECK IF DONE.

APPR25	LAC	SAMSW		/D .LT.0, GET SAME SWITCH.

	SAD	LM1		/WAS LAST MOVE = MOVE1?

	JMP	APPR30		/YES.

	LAC	MOVE1		/NO, GET MOVE1 VECTOR.

	JMS	LSTOR		/STORE MOVE1 VECTOR IN DISPLAY FILE.

APPR26	LAC	B

	TAD	D

	DAC	D		/D=D+B

	LAW	-1

	DAC	SAMSW		/SET SAME SWITCH

	JMP	APPRND		/GO CHECK IF DONE.

APPR30	ISZ*	POINT		/THIS MOVE SAME AS LAST MOVE,

	ISZ*	POINT		/BUMP EXISTING VECTOR BY 2.

	SPA

	JMP	APPR26

	JMP	APPR21

APPRND	ISZ	UVAR		/FINISHED?

	JMP	APPR20		/NO. GET NEXT MOVE.

	LAW	-1		/SET SWITCH TO

	DAC	APPRSW		/INDICATE APPROXIMATION.

	JMP*	VECTOR

/

	.ENDC			/END OF CONDITIONAL ASSEMBLY 

/

	.EJECT

/

	.IFDEF	ARBVEC

/

/  SHORTER ROUTINE WHEN ARBVEC GAURANTEED

/

/  CALL WITH AC=0 FOR # OF LOC'S RETURNED IN AC

/  CALL WITH AC=-1 FOR REAL CODE GENERATION

/  CALL WITH AC=-2 (LNS) LIKE AC=0 EXCEPT

/  ON 0,0 LINE RETURNS VIA VECTOR, NOT VIA RETAD2

/

VECTOR	0

	DAC	CKNDSW	/EXIT CONTROLLER

	LAC*	LT	/INTENSIFIED?

	SZA		/SKIP IF NOT

	LAC	(20000	/INTENSITY BIT BOTH INSTR. TYPES

	DAC	TEMP4	/HOLD

	LAC*	ARG1	/GET DX

	JMS	VECSUB	/RETURN FULL STROKE VECT INST IN AC

	DAC	TEMP1	/IN CASE WE DO DO STROKE VECTOR

	AND	(1777	/KEEP MAGNITUDE

	DAC	DELTAX

	LAC*	ARG2	/GET DY

	JMS	VECSUB	/FULL STROKE Y

	DAC	TEMP2	/AGAIN MAY NEED LATER

	AND	(1777	/KEEP ONLY MAGNITUDE OF DY

	SAD	DELTAX	/DIAGONAL LINE??

	JMP	VDIAG	/YES, BASIC VECTOR, DIAGONAL

	SNA!CLA		/SKIP IF DY NON-0

	JMP	VY0	/BASIC VECTOR, DY=0

	SAD	DELTAX	/IS DELTAX MINUS?

	JMP	VX0	/BASIC VECTOR, DX=0

	LAC	L2	/# OF LOC'S IN CASE THAT ALL REQUIRED

VECT2	ISZ	CKNDSW	/SKIP IF REAL CODE TO BE DONE

	JMP*	VECTOR	/NOPE

	LAC	TEMP1	/EITHER TYPE

	JMS	PUT	/PLACE AN INSTRUCTION

	LAC	TEMP2	/SECOND STROKE, OR NOTHING

	SZA		/SKIP ON NOTHING

	JMS	PUT

	JMP*	VECTOR	/THAT'S IT

/

/  VECSUB

/

/  CALL WITH DX OR DY IN AC

/

/  MAKES THE STROKE VECTOR INSTRUCTION RETURNS IN AC

/

VECSUB	0

	SMA!CMA!CLL	/SKIP 1, COMPLEMENT, DEFAULT LINK OFF

	SKP!CMA!CML	/+ ORIGINAL, MAKE + AGAIN, 1 LINK BIT

	TAD	L1	/MAKE TWO'S COMPLEMENT

	AND	(1777	/KEEP TO 10 BITS

	SNL		/SKIP ON POSITIVE SIGN

	TAD	(4000	/SIGN BIT FOR NEGATIVE

	TAD	TEMP4	/INTENSITY

	TAD	(STRK	/STROKE VECTOR OP CODE

	JMP*	VECSUB

/

/  BASIC VECTOR SECTION

/

VY0	LAC	TEMP1	/DY=0; BUILD FROM STROKE X

	AND	(4000	/SHIFT UP SIGN BIT BY ONE

	TAD	TEMP1	/LEAVING ALL ELSE IN PLACE

	JMP	BASCOM	/COMMON FINISH UP

/

VDIAG	SNA!CLA		/DIAG; CHECK FOR 0,0 LINE

	JMP	ZEROX	/IT WAS, SPECIAL EXIT

	SNL		/SKIP IF Y POSITIVE

	TAD	(14000	/CONJURE UP THE DIRECTION CODE

	XOR	TEMP1	/BRING UP MAGNITUDE, INTES, ETC.

	TAD	(2000	/MAKE IT A DIAGONAL CODE

	JMP	BASCOM	/REJOIN

/

VX0	LAC	TEMP2	/DX=0; BUILD FROM STROKE Y

	AND	(4000	/SHIFT UP SIGN BIT BY ONE

	TAD	TEMP2	/ALL ELSE THE SAME

	TAD	(4000	/DIFFERS FROM DY=0 BY THIS AMOUNT

BASCOM	XOR	LT5	/STROKE OP 100000 TO BASIC OP 400000

	DAC	TEMP1	/FULL INSTRUCTION

	DZM	TEMP2	/NO SECOND 1

	LAC	L1	/ONE INSTRUCTION FOR CKNDSW EXIT

	JMP	VECT2	/COMMON FINISH UP

/

	.ENDC

/

	.EJECT

/

/

/CONSTANTS AND STORAGE

/

MF.101			/GLOBAL FOR FIRST LOC. OF CURRENT FILE.

MF.102			/GLOBL. END OF MAIN 0 IF NOT RUNNG

MFPTR=MF.102		/POINTER TO CURRENT END OF DISPLAY FILE.

MAINFL=MF.101		/POINTER TO BEGINNING OF CURRENT DISP.FILE.

LARG1	ARG1		/PREVENT FORWARD LITERAL SPACE PROBLEM

ARG0	0		/S+M; GRAPHICS CODE:EDI; 200000 IF PREV. PARAM

ARG1	0

ARG2	0

ARG3	0

ARG4	0

ARG5	0

ARG6	0

ARG7	0

ARG10	0

ARG11	0

ARG12	0

ARG13	0

ARG14	0

PNAME	L6		/ADDR OF SUBPIC NAME;L6 IN CASE DINIT

/			/IS CALLED BEFORE ANY SUBPIC ROUTINES

MASK	3		/FOUR MASKS FOR COMPUTING WORDS

	154		/NEEDED FOR PARAMTER GROUP

L20	20		/DASH

	600		/NAME AND SYNC

LDNOPE	DNOPE

LDNOPB	DNOPB

LDSKP	DSKP

/

/  MNEMONIC EQUATES FOR ARGUMENT FETCH

/

RST=ARG1		/SAVE-RESTORE OPTION FLAG FOR COPY AND PLOT 0.

STR=ARG1		/ADDR. OF 5/7 ASCII ARRAY FOR TEXT AND PLOT 3.

DTA=ARG1		/ADDR. OF DATA POINTS FOR GRAPH.

AX=ARG1+2		/POINTED AXIS FOR GRAPH.

N=ARG1+1		/# OF DATA POINTS FOR GRAPH,ORCHARS. FOR TEXT.

PNAME1=ARG1+1		/ADDR. OF SUBPIC TO BE COPIED.

LT=ARG1+2		/LINE INTENSITY ARGUMNT

/

/  FOR LINE APPROX, USE HIGHER ARG'S FOR WORK SPACE

/

UVAR=ARG1+6		/MAJOR DELTA (VECTOR APPROX.)

VAR=ARG1+7		/MINOR DELTA (VECTOR APPROX.)

UMV=ARG1+10		/2(UVAR-VAR) (VECTOR APPROX.)

B=ARG1+11		/B VARIABLE FOR VECTOR APPROX.

A=ARG1+12		/A VARIABLE FOR VECTOR APPROX.

D=ARG1+13		/D VARIABLE FOR VECTOR APPROX.

/

	.EJECT

/

/  ENTRY POINTS ARE ALSO AVAILABLE FOR STORAGE AND TEMP

/

MOVE1=BLANK		/MOVE1 VECTOR FOR APPROX.

MOVE2=UNBLNK		/MOVE2 VECTOR FOR APPROX.

SOX=CPY			/SIGN OF DELTA X (VECTOR SUBR).

SOY=PRM			/SIGN OF DELTA Y (VECTOR SUBR).

CKNDSW=GRAPH		/CHECK-NEED-SWITCH (VECTOR SUBR).

REGT0=GRAPH		/TEMPORARY  (PRM SUBR)

REGT1=DELETE		/TEMPORARY  (PRM SUBR)

REGT2=CHR		/TEMMPORARY  (PRM SUBR)

SAMSW=PNT		/SAME-SWITCH (VECTOR APPROX.)

APPRSW=PNT		/APPROX. SWITCH 8VECTOR SUBR).

DELTAX=DELETE		/DELTA X (VECTOR SUBR).

DELTAY=CHR		/DELTA Y (VECTOR SUBR).

POINT=PLOT		/RUNNING POINTER TO PLACE CODE IN FILE

/			/START: POINT=POINTS M+S:POINT=POINTS-1 E.

POINTS=REPLOT		/ADDR. OF BEGINNING OF GROUP, UNCHANGED!

HOLD=LINE		/EDIT:GROUP DNOP COUNT

FILE=TEXT		/PRESENT FILE FOR SUB+MAIN

XOPT=LNSIZE		/XCT POINTER OPTIONAL ARGUMENT

XNEED=COPY		/XCT POINTER NEEDED # OF LOC'S

XCODE=DINIT		/XCT POINTER FOR CODE GENERATE

RETAD2=PRAMTR		/COMMON RETURN.

TYPE=DCLOSE		/SUB, MAIN, EDIT FLAG

PUTCNT=SETPT		/SET TO -1 TO FORCE CALL TO PUT

/			/TO PLACE INSTR. IN LOC. 'HOLD'

POINT1=PUT		/EDIT, ADDITIONAL GROUP POINTER

POINT2=RSETPT		/EDIT, ADDITIONAL GROUP POINTER

/

	.EJECT

/

/  NOTES ON TREATMENT OF PARAMETER GROUPS

/

/  PARAMETER GROUPS HAVE A VARIABLE SIZE, SO THAT DELIMITERS

/  DNOPB (BEGIN) AND DNOPE (END) HAVE BEEN INVENTED TO HELP

/  COUNT PARAMETER GROUPS FOR EDITS (REPLOTS).

/

/  ON CODE GENERATION (SUBPIC + MAIN (PLOT)) , NO DNOPB'S ARE PLACED.

/  A DNOPE IS PLACED ONLY IF CNAME IS SPECIFIED, I.E. THE GROUP

/  CAN BE SUBJECTED TO A FUTURE EDIT.

/

/  ON CODE EDITTING

/

/  ANYTHING OTHER THAN A PARAMETER OVER A PARAMETER WILL RECLAIM ANY

/  DNOPB OR DNOPE ASSOCIATED WITH THAT GROUP.

/

/  GENERAL PARAMETER OVER ANYTHING WILL REQUIRE A DNOPB IF THE

/  PREVIOUS GRAPHICS INSTRUCTION IS PART OF A PARAMETER GROUP, AND

/  NOT A DNOPE OR DNOP. SIMILARLY, IF THE FOLLOWING GRAPHICS INSTRUC.

/  IS A PARAMETER AND NOT A DNOPB OR DNOP, AND FOLLOWING DNOPE

/  WILL BE REQUIRED. THE REPLOT CAN FAIL BECAUSE OF INSUFFICIENT SPCAE

/  FOR THESE DELIMITERS.

/

/  SPECIAL CASE PARAMETER OVER PARAMETER WHEN THERE IS NO LEADING DNOPB,

/  WILL REQUIRE NO LEADING DNOPB. THIS ALLOWS A EDITABLE PARAMETER GROUP

/  TO FOLLOW AN NON-EDITABLE PARAMETER GROUP WITHOUT COSTING A DNOP.

/  THIS WILL HOLD AS LONG AS THE PARAMETER GROUP IS NOT CHANGED TO

/  ANYTHING ELSE!

/

/  THESE CONVENTIONS MINIMIZE THE IMPACT ON THE DISPLAY FILE SIZE OF

/  EXISTING PROGRAMS.

/

	.END
