Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-12 - 43,50547/sprout.cor
There is 1 other file named sprout.cor in the archive. Click here to see a list.
 INS 4/1
		CSM01$==^D400	;Plotter has 3 pens, ON-LINE indicator, 400 SPI
		CSM02$==-1	;Compressed plot files
		CSM03$==-1	;Red and Black in banner
		CSM04$==-1	;Do CSM accounting (minutes and inches used)
		CSM05$==-1	;Add SLEEP time to $DSCHD macro for TTY response wait
		CSM06$==^D1200	;Support the TAB Products Card Terminal at 1200 baud
		CSM07$==-1	;Change some QUEUE defaults
		CSM08$==^D2400	;PTC-6 Plotter Terminal Controller at 2400 baud
	IF2,<IFN CSM02$,<PRINTX	[CSM02$ uses TOLP.REL]>>
	IF2,<IFN CSM06$,<PRINTX	[CSM06$ uses TABCDP.REL]>>
	IF2,<IFN CSM08$,<PRINTX	[CSM08$ uses PTC6.REL]>>

	REPEAT	0,<	;To completely remove the CSM changes, make this a REPEAT 1
		CSM01$==0	;Normal XY-10 plotter
		CSM02$==0	;Plot files are 1 byte per increment (very big)
		CSM03$==0	;Do not exercise the black and red pens
		CSM04$==0	;Account disk reads instead of forms type
		CSM05$==0	;No TTY I/O, therefore no sleep requests
		CSM06$==0	;Card punch is on I/O bus or front-end 11
		CSM07$==0	;Use whatever QUEUE says
		CSM08$==0	;Plotter is not connected to a TTY line
		DEFINE	CSMEDT($EDIT,$PART),<>	;Dummy macro
		CSMED$==0	;No additional edits
	>  ;End of REPEAT 0
 INS 26/1
			PAGE
		SALL		;Also searches UUOSYM and ACTSYM.UNV
 INS 30/1
	IFNDEF CSMEDT,<	SEARCH	CSMEDT	>	;CSM edit macro
		.XCREF	S1,S2,T1,T2,T3,T4,C,J,P	;[CSM] Save some trees

 REP 35/1
		SPOWHO==0			;WHO LAST PATCHED

		%SPO==<BYTE (3)SPOWHO(9)SPOVER(6)SPOMIN(18)SPOEDT>
 WIT
		SPOWHO==2			;Who last patched (JMS @ CSM)

		%SPO==<BYTE (3)SPOWHO(9)SPOVER(6)SPOMIN(18)SPOEDT>+CSMED$
 REP 1/2
	SUBTTL	Table of contents


	;               TABLE OF CONTENTS FOR SPROUT
	;
	;
	;                        SECTION                                   PAGE
	;    1. Table of contents.........................................   2
	;    2. Revision History..........................................   3
	;    3. Constants  (Conditional and Unconditional)................   4
	;    4. MACROS....................................................   5
	;    5. Special Forms Handling Parameters.........................   6
	;    6. Flag Definitions..........................................   8
	;    7. Job Parameter Area........................................   9
	;    8. Random Impure Storage.....................................  12
	;    9. Resident JOB DaTABase.....................................  13
	;   10. Non-zero daTABase.........................................  14
	;   11. $TEXT Utilities and common Messages.......................  15
	;   12. Program Initialization....................................  16
	;   13. Idle Loop.................................................  17
	;   14. Deschedule Process........................................  18
	;   15. Do the Job................................................  19
	;   16. Process a File............................................  20
	;   17. End of Job................................................  21
	;   18. FILDIS  Routine to KEEP/DELETE requested files............  21
	;   19. CHKQUE  Routine to process IPCF messages..................  22
	;   20. CHKOBJ  Routine to validate QUASAR/ORION/OPR MSG Object block  23
	;   21. FNDOBJ  Routine to establish STREAM context...............  24
	;   22. GETBLK  Routine to return next argument from an OPR/ORION message  25
	;   23. NEXTJOB Message from QUASAR...............................  26
	;   24. User CANCEL Request.......................................  27
	;   25. UPDATE Routine to send status update......................  28
	;   26. CHKPNT Routine to send checkpoint message.................  29
	;   27. SETUP/SHUTDOWN Message....................................  30
	;   28. Response to setup message.................................  31
	;   29. Operator CANCEL command...................................  32
	;   30. Operator STOP command.....................................  33
	;   31. Operator CONTINUE command.................................  33
	;   32. Operator RESPONSE command.................................  33
	;   33. Operator REQUEUE command..................................  34
	;   34. CLRMSG and SNDQSR routines................................  35
	;   35. Accounting routines.......................................  37
	;   36. FORMS - Setup Forms for a job.............................  40
	;   37. Forms switch Subroutines..................................  44
	;   38. Plotter only switches.....................................  45
	;   39. I/O Subroutines for SPFORM.INI............................  46
	;   40. INPOPN - Routine to open the input file...................  48
	;   41. INPBUF - Read a buffer from the input file................  49
	;   42. INPBYT - Read a byte from the input file..................  49
	;   43. INPERR - Handle an input failure..........................  49
	;   44. INPFEF - Force end-of-file on next input..................  49
	;   45. INPREW - Rewind the input file............................  49
	;   46. OUTGET - OPEN the output device...........................  50
	;   47. OUTBYT - Deposit a byte in the output buffer..............  53
	;   48. OUTOUT - Routine to output a buffer.......................  54
	;   49. DEVERR - Handle Output Device Errors......................  55
	;   50. OUTREL - Release output device............................  56
	;   51. OUTWON - Wait for on-line.................................  57
	;   52. OUTFLS Routine to flush output buffers....................  58
	;   53. Card punch service
	;        53.1   Dispatch table....................................  59
	;        53.2   Checkpoint text generation........................  60
	;        53.3   File processing...................................  61
	;        53.4   File headers......................................  67
	;        53.5   File trailers.....................................  68
	;        53.6   Banners...........................................  69
	;        53.7   Word punching.....................................  70
	;        53.8   Letters...........................................  71
	;        53.9   Byte output.......................................  72
	;   54. Plotter service
	;        54.1   Dispatch table....................................  73
	;        54.2   Checkpoint text generation........................  74
	;        54.3   File processing...................................  75
	;        54.4   Devout output errors..............................  77
	;        54.5   Banners...........................................  78
	;        54.6   File headers......................................  79
	;        54.7   File trailers.....................................  80
	;        54.8   Job trailers......................................  81
	;        54.9   Solid lines.......................................  82
	;        54.10  Dashed lines......................................  83
	;        54.11  Job information plotting..........................  84
	;        54.12  Alignment and testing.............................  85
	;        54.13  Pen calibration...................................  86
	;        54.14  Compute chracter size.............................  87
	;        54.15  Letters...........................................  88
	;        54.16  Line segments.....................................  89
	;        54.17  Rotation and XY20 translation.....................  91
	;        54.18  Pen movement generation...........................  92
	;        54.19  Character set.....................................  94
	;   55. Paper tape punch service
	;        55.1   Dispatch table....................................  99
	;        55.2   Checkpoint text generation........................ 100
	;        55.3   File processing................................... 101
	;        55.4   Banners........................................... 106
	;        55.5   File headers...................................... 107
	;        55.6   File trailers..................................... 108
	;        55.7   Trailers.......................................... 109
	;        55.8   Blank folds....................................... 110
	;        55.9   Letters........................................... 111
	;        55.10  Byte output....................................... 112
	;   56. Character Bit Array for 5 X 7 Character Matrix............ 113
	;   57. Common Utilities.......................................... 115
	;   58. Interrupt Module.......................................... 118
	;   59. IPCF and DEVICE Interrupt service for TOPS10.............. 122
	;   60. IPCF and DEVICE interrupt service for TOPS20.............. 123
 WIT
	SUBTTL	Table of Contents

	;                  Table of Contents for SPROUT
	;
	;
	;			   Section			      Page
	;
	;    1. Table of Contents  . . . . . . . . . . . . . . . . . .   1
	;    2. Revision History . . . . . . . . . . . . . . . . . . .   2
	;    3. CSM Revision History . . . . . . . . . . . . . . . . .   2
	;    4. Constants  (Conditional and Unconditional) . . . . . .   4
	;    5. MACROS . . . . . . . . . . . . . . . . . . . . . . . .   5
	;    6. Special Forms Handling Parameters  . . . . . . . . . .   6
	;    7. Flag Definitions . . . . . . . . . . . . . . . . . . .   7
	;    8. Job Parameter Area . . . . . . . . . . . . . . . . . .   8
	;    9. Random Impure Storage  . . . . . . . . . . . . . . . .  11
	;   10. Resident JOB DaTABase  . . . . . . . . . . . . . . . .  12
	;   11. Non-zero daTABase  . . . . . . . . . . . . . . . . . .  13
	;   12. $TEXT Utilities  . . . . . . . . . . . . . . . . . . .  14
	;   13. Program Initialization . . . . . . . . . . . . . . . .  15
	;   14. Idle Loop  . . . . . . . . . . . . . . . . . . . . . .  16
	;   15. Deschedule Process . . . . . . . . . . . . . . . . . .  17
	;   16. CHKTIM - Routine to see if it's time to schedule a s .  17
	;   17. Do the Job . . . . . . . . . . . . . . . . . . . . . .  18
	;   18. Process a File . . . . . . . . . . . . . . . . . . . .  19
	;   19. End of Job . . . . . . . . . . . . . . . . . . . . . .  20
	;   20. FILDIS . . . . . . . . . . . . . . . . . . . . . . . .  21
	;   21. CHKQUE . . . . . . . . . . . . . . . . . . . . . . . .  22
	;   22. CHKOBJ . . . . . . . . . . . . . . . . . . . . . . . .  23
	;   23. FNDOBJ . . . . . . . . . . . . . . . . . . . . . . . .  24
	;   24. GETBLK . . . . . . . . . . . . . . . . . . . . . . . .  25
	;   25. NEXTJOB Message from QUASAR  . . . . . . . . . . . . .  26
	;   26. User CANCEL Request  . . . . . . . . . . . . . . . . .  27
	;   27. UPDATE Routine to send status update . . . . . . . . .  28
	;   28. CHKPNT Routine to send checkpoint message  . . . . . .  29
	;   29. SETUP/SHUTDOWN Message . . . . . . . . . . . . . . . .  30
	;   30. Response to setup message  . . . . . . . . . . . . . .  31
	;   31. Operator CANCEL command  . . . . . . . . . . . . . . .  32
	;   32. Operator STOP command  . . . . . . . . . . . . . . . .  33
	;   33. Operator CONTINUE command  . . . . . . . . . . . . . .  33
	;   34. Operator RESPONSE command  . . . . . . . . . . . . . .  33
	;   35. Operator REQUEUE command . . . . . . . . . . . . . . .  34
	;   36. CLRMSG and SNDQSR routines . . . . . . . . . . . . . .  35
	;   37. FRMLEX - Forms limit exceeded routine  . . . . . . . .  36
	;   38. Accounting routines  . . . . . . . . . . . . . . . . .  37
	;   39. FORMS - Setup Forms for a job  . . . . . . . . . . . .  40
	;   40. Forms switch Subroutines . . . . . . . . . . . . . . .  44
	;   41. Plotter only switches  . . . . . . . . . . . . . . . .  45
	;   42. I/O Subroutines for SPFORM.INI . . . . . . . . . . . .  46
	;   43. INPOPN - Routine to open the input file  . . . . . . .  48
	;   44. INPBUF - Read a buffer from the input file . . . . . .  49
	;   45. INPBYT - Read a byte from the input file . . . . . . .  49
	;   46. INPERR - Handle an input failure . . . . . . . . . . .  49
	;   47. INPFEF - Force end-of-file on next input . . . . . . .  49
	;   48. INPREW - Rewind the input file . . . . . . . . . . . .  49
	;   49. OUTGET - OPEN the output device  . . . . . . . . . . .  49
	;   50. OUTBYT - Deposit a byte in the output buffer . . . . .  53
	;   51. OUTOUT - Routine to output a buffer  . . . . . . . . .  53
	;   52. DEVERR - Handle Output Device Errors . . . . . . . . .  55
	;   53. OUTREL - Release output device . . . . . . . . . . . .  56
	;   54. OUTWON - Wait for on-line  . . . . . . . . . . . . . .  57
	;   55. OUTFLS Routine to flush output buffers . . . . . . . .  58
	;   56. TTY I/O
	;        56.1   Input character from TTY, no wait  . . . . . .  59
	;        56.2   Input character, wait up to 30 seconds . . . .  60
	;   57. Card punch service
	;        57.1   Dispatch table . . . . . . . . . . . . . . . .  61
	;        57.2   Checkpoint text generation . . . . . . . . . .  62
	;        57.3   File processing  . . . . . . . . . . . . . . .  63
	;        57.4   File headers . . . . . . . . . . . . . . . . .  69
	;        57.5   File trailers  . . . . . . . . . . . . . . . .  70
	;        57.6   Banners  . . . . . . . . . . . . . . . . . . .  71
	;        57.7   Word punching  . . . . . . . . . . . . . . . .  72
	;        57.8   Letters  . . . . . . . . . . . . . . . . . . .  73
	;        57.9   Byte output  . . . . . . . . . . . . . . . . .  74
	;   58. Plotter service
	;        58.1   Dispatch table . . . . . . . . . . . . . . . .  75
	;        58.2   Checkpoint text generation . . . . . . . . . .  76
	;        58.3   File processing  . . . . . . . . . . . . . . .  77
	;        58.4   Expand CSM's compressed plot format  . . . . .  79
	;        58.5   READ36, OPRTXT, PAUSEP, TITLE for TOLP . . . .  81
	;        58.6   NEWPEN for 3-pen plotter . . . . . . . . . . .  82
	;        58.7   DEVOUT output errors . . . . . . . . . . . . .  83
	;        58.8   Banners  . . . . . . . . . . . . . . . . . . .  84
	;        58.9   File headers . . . . . . . . . . . . . . . . .  85
	;        58.10  File trailers  . . . . . . . . . . . . . . . .  86
	;        58.11  Job trailers . . . . . . . . . . . . . . . . .  87
	;        58.12  Solid lines  . . . . . . . . . . . . . . . . .  88
	;        58.13  Dashed lines . . . . . . . . . . . . . . . . .  89
	;        58.14  Job information plotting . . . . . . . . . . .  90
	;        58.15  Alignment and testing  . . . . . . . . . . . .  91
	;        58.16  Pen calibration  . . . . . . . . . . . . . . .  92
	;        58.17  Compute character size . . . . . . . . . . . .  93
	;        58.18  Letters  . . . . . . . . . . . . . . . . . . .  94
	;        58.19  Line segments  . . . . . . . . . . . . . . . .  95
	;        58.20  PTC-6 interface  . . . . . . . . . . . . . . .  97
	;        58.21  Rotation and XY20 translation  . . . . . . . .  98
	;        58.22  Pen movement generation  . . . . . . . . . . .  99
	;        58.23  Character set  . . . . . . . . . . . . . . . . 101
	;   59. Paper tape punch service
	;        59.1   Dispatch table . . . . . . . . . . . . . . . . 106
	;        59.2   Checkpoint text generation . . . . . . . . . . 107
	;        59.3   File processing  . . . . . . . . . . . . . . . 108
	;        59.4   Banners  . . . . . . . . . . . . . . . . . . . 113
	;        59.5   File headers . . . . . . . . . . . . . . . . . 114
	;        59.6   File trailers  . . . . . . . . . . . . . . . . 115
	;        59.7   Trailers . . . . . . . . . . . . . . . . . . . 116
	;        59.8   Blank folds  . . . . . . . . . . . . . . . . . 117
	;        59.9   Letters  . . . . . . . . . . . . . . . . . . . 118
	;        59.10  Byte output  . . . . . . . . . . . . . . . . . 119
	;   60. Character Bit Array for 5 X 7 Character Matrix . . . . 120
	;   61. Common Utilities . . . . . . . . . . . . . . . . . . . 122
	;   62. Interrupt Module . . . . . . . . . . . . . . . . . . . 124
	;   63. IPCF and DEVICE Interrupt service for TOPS10 . . . . . 128
	;   64. IPCF and DEVICE interrupt service for TOPS20 . . . . . 129
 REP 205/3
	;BEGIN CODE MAINTENANCE
 WIT

	;BEGIN CODE MEINTENANCE

 REP 209/3
	End of revision history
	\
 WIT

	End of revision history
	\
	PAGE
	SUBTTL	CSM Revision History
					;
	; Edit	  Date	   Who	Description
	;======	=========  ===	===========
					;
	;CSM01$	14-Nov-80  JMS	Plotter has 3 pens and an ON-LINE indicator.  Add
	;			routines to change pens and proper positioning after
	;			the plot.  Make sure the plotter is on-line at OUTOUT.
		CSMEDT	01	;Show value of CSM01$
		INCS=<CSM01$>	;400 increments per inch = 620 octal
	IFN CSM01$,<ND	CKPTIM,^D60>	;Checkpoint every minute.
					;
	;CSM02$	14-Nov-80  JMS	Use the compressed plot file format as defined
	;			in PLOT.REL (from CSM's FORLIB).  Instead of one
	;			byte per increment, most halfwords in the file
	;			contains 9-bits of delta-X and 9 of delta-Y.
	;			Use TOLP.REL to translate the disk file back
	;			into calls to subroutine PLOT.
		CSMEDT	02	;Show value of CSM02$
	IFN CSM02$,<IFE CSM01$,<PRINTX ?Must have CSM01$ on for CSM02$>>
					;
	;CSM03$	14-Nov-80  JMS	Change the plot banner to exercise the red and
	;			black pens.  Plot error message even if no
	;			/TRAILER and set blue pen at P$EOF.
		CSMEDT	03	;Show value of CSM03$
					;
	;CSM04$	25-Mar-81  JMS	Put the forms name in place of DISK-WRITES,
	;			amount of paper in PAGES-PRINTED, cards, feet,
	;			or plot time in DISK-READS.
		CSMEDT	04	;Show value of CSM04$
					;
	;CSM05$	 8-Jan-81  JMS	Add a sleep request to $DSCHD.  RH of flags is
	;			number of seconds to wait.  This is needed for
	;			non-blocking TTY I/O routines.
		CSMEDT	05	;Show value of CSM05$
					;
	;CSM06$	 8-Jan-81  JMS	Add support for the TAB Products Card Terminal.
	;			It is a Reader/Punch that acts like a TTY.
		CSMEDT	06	;Show baud rate (^D1200=^O2260)
	IFN CSM06$,<IFE CSM05$,<PRINTX ?Must have CSM05$ on for CSM06$>>
					;
	;CSM07$	 8-Mar-83  JMS	Remove DSPMOD so that cards are punched in ASCII,
	;			paper tape is punched in ASCII, and plots are
	;			done in 18-bit BINARY mode unless explicitly
	;			requested otherwise.  This is so that output
	;			from SOS or SED is not punched in image-binary.
	;			Remove "BEGIN:", "JOB", "jobnam", "USER:" from
	;			card punch banner, ignore QUEUE's default of
	;			/NOHEADER and always punch file header on cards.
		CSMEDT	07	;Show value of CSM07$
					;
	;CSM08$	28-Jun-83  JMS	Add support for the Houston Instruments PTC-6
	;			Plotter Terminal Controller on a TTY line.
		CSMEDT	08	;Show value of CSM08$
	IFN CSM08$,<	EXTERN	PTCINI,PTCMOV,PTCOUT,PTCFIN
	IFE CSM05$,<PRINTX ?Must have CSM05$ on for CSM08$>>
					;

	CSMED$==10	;Increment this to change .JBVER

	;End of CSM Revision History
 INS 60/4
	COMMENT ~
	  From the OPERATOR's point of view, the supply spool on the plotter is
	above the pen holder, and the takeup spool is below the pen holder.
	Therefore, to move the pen in the +Y direction, the pen holder moves to
	the left.  To move the pen in the +X direction, the pen stays still and
	the paper is moved down (towards the takeup spool).  The following
	definitions are based on this point of view.
	;End of COMMENT ~

 REP 65/4
		XP	XYU,10			;-X   MOVE UP
		XP	XYD,4			;+X   MOVE DOWN
		XP	XYL,2			;+Y   MOVE LEFT
		XP	XYR,1			;-Y   MOVE RIGHT
 WIT
		XP	XYU,10			;-X   move the paper up
		XP	XYD,4			;+X   move the paper down
		XP	XYL,2			;+Y   move pen holder left
		XP	XYR,1			;-Y   move pen holder right
		PLUSX== XYD		;[CSM]	;Move in positive X direction   0
		PLUSY== XYL		;[CSM]	;Move in positive Y direction  90
		MINUSX==XYU		;[CSM]	;Move in negative X direction 180
		MINUSY==XYR		;[CSM]	;Move in negative Y direction 270
 REP 73/4
		XP	PLTPEN,^D9		;# TICS FOR PLOT PEN UP/DOWN
 WIT

		CSMEDT	01,0	;3-pen plotter, definitions
	IFE CSM01$,<XP	PLTPEN,^D9>		;# TICS FOR PLOT PEN UP/DOWN
	IFN CSM01$,<XP	PLTPEN,^D<1800*30/1000>	;30 millisec compared to 1800 per second

 REP 3/5
	DEFINE LP(SYM,VAL,FLAG),<
 WIT
	DEFINE LP(SYM,VAL,FLAG),<;;Flag="Z" marks a variable to be zeroed per job
 REP 29/5
		SYM==J...X
		>  ;END IF2
	>  ;END DEFINE LP

 WIT
		SYM==J...X>;;END IF2>;;END DEFINE LP
	;[CSM] Removed 2 CRLFs so that MACRO will show value in listing
 REP 3/6
	;FORMS SWITCHES:

	;FOR ALL DEVICES

	;	BANNER:NN	NUMBER OF JOB HEADERS
	;	TRAILER:NN	NUMBER OF JOB TRAILERS
	;	HEADER:NN	NUMBER OF FILE HEADERS (PICTURE PAGES)
	;	NOTE:AA		TYPE NOTE TO THE OPERATOR


	;FOR PLOTTER ONLY

	;	SPU:NN		STEPS PER UNIT (FACTOR OF ALL XX AND YY)
	;	SIZE:XX:YY	NUMBER OF STEPS IN X AND Y AXIS
	;	MAXIMUM:XX:YY	STEP FOR FORMS LIMIT IN X AND Y AXIS
	;	MINIMUM:XX:YY	STEP FOR FROMS LIMIT IN X AND Y AXIS

	;IN THE ABOVE AND BELOW EXPLANATIONS:
	;	NN	IS A DECIMAL NUMBER
	;	SS	IS A 1-6 CHARACTER STRING
	;	AA	IS A STRING OF 1 TO 50 CHARACTERS
	;	OO	IS AN OCTAL NUMBER
	;	XX	INTEGER STEP NUMBER IN X AXIS
	;	YY	INTEGER STEP NUMBER IN Y AXIS



	;LOCATION SPECIFIERS
	;	ALL		ALL DEVICES
	;	CENTRAL		ALL DEVICES AT THE CENTRAL SITE
	;	REMOTE		ALL REMOTE DEVICES

	;NOTE:  SPROUT WILL USE THE FIRST ENTRY WHICH MEETS THE LOCATION
	;	SPECIFICATION FOR ITS DEVICE.

	;	SPROUT ACCEPTS FORMS SPECIFICATIONS FOR ALL THREE DEVICES
	;	ALTHOUGH SOME SWITCHES ARE LEGAL ONLY FOR PLOTTERS

	;TYPICAL SPFORM.INI FORMS SPECIFICATION

	;	CDP NORMAL/BANNER:6/HEADER:1/TRAILER:6-
	;	/NOTE:Load NORMAL Cards in Card Punch
	;
	;	PLT NORMAL/BANNER:200/HEADER:200/TRAILER:200-
	;	/MINIMUM:0:0/MAXIMUM:0:5900-
	;	/NOTE:Set Plotter Controls to 200 Steps per inch

 WIT
	;Format of SYS:SPFORM.INI

	;  DEV FORM/SWITCH	This line applies to all devices of this type
	;  DEV FORM:ALL/SWITCH	This line applies to all devices of this type
	;  DEV FORM:LOC/SWITCH	This line applies to devices at the central site
	;  DEV FORM:REM/SWITCH	This line applies to devices on remote nodes

	;	"DEV" can be one of PLT, CDP, or PTP
	;	"FORM" is the name of the forms type, 6 characters or less

	;Note:  SPROUT will use the first entry which meets the location
	;	specification for its device.  Therefore, if ALL is used with
	;	LOC or REM, ALL should be after the LOC or the REM.


	;Switches legal for all devices

	;	/BANNER		Output the job header
	;	/HEADER		Output file headers
	;	/TRAILER	Output the job trailer
	;	/NOTE:AA	Type NOTE to the OPR when forms are mounted


	;Switches legal for plotters only

	;	/SPU:NN		Steps per unit (a factor of all XX and YY)
	;	/SPS:NN		Steps per second (for calculating run time)
	;	/MAXIMUM:XX:YY	Maximum pen position
	;	/MINIMUM:XX:YY	Minimum pen position after file header


	;In the above and below explanations:

	;	NN	is a decimal number
	;	AA	is a string of 1 to 50 characters, terminated by next "/"
	;	XX	is a limit for the X axis
	;	YY	is a limit for the Y axis


	;Typical SPFORM.INI forms specification

	;	CDP NORMAL/BANNER/HEADER -
	;		  /NOTE:Load NORMAL Cards in Card Punch
	;
	;	PLT NORMAL/BANNER/HEADER/TRAILER/SPS:900
	;		  /SPU:1/MINIMUM:0:0/MAXIMUM:0:5900-
	;		  /NOTE:Set Plotter Controls to 200 Steps per inch
	;
	;	PTP NORMAL/BANNER/HEADER/TRAILER
	;	PTP BLACK /BANNER/HEADER/TRAILER/NOTE:Black oiled paper tape

	PAGE
	COMMENT |	CSM interpretation of plotter parameters

							;
	Example for a drum plotter:
							;
	PLT NORMAL /SPS:1800/SPU:4/MINIMUM:0:0/MAXIMUM:0:1100 -
		   /BANNER/HEADER/TRAILER
							;
	PLT		= This line applies to the plotter (not CDP or PTP).
	NORMAL		= The forms name.
	/SPS:1800	= Do accounting based on speed of 1800 steps per second.
	/SPU:4		= This plotter uses 400 steps per inch, the following
	                  numbers are in 1/100ths of an inch.
	/MINIMUM:0:0	= Pen cannot go to left or below the starting point.
	/MAXIMUM::1100	= There is no maximum limit in the +X direction, +Y movement
			  is limited to 11.00 inches.  The height of characters used
			  in the /BANNER/HEADER/TRAILER is 11.00/90 = 0.12 inches.
	-		= Hypen indicates a continued line.
	/BANNER		= Plot "* Start job XXX" 0.12 inches high, plot user's name
			  and PPN 0.36 inches high, and a line across the paper.
	/HEADER		= Plot file name 0.12 inches high and a dashed line.
	/TRAILER	= Plot a dashed line and the summary 0.12 inches high.
	/NOTE		= No note is specified, so that "OPR>START PLOT 0" will
			  not require a "RESPOND 'PROCEED' WHEN READY".
							;
	End of COMMENT |

 REP 14/7
	DEFINE FF(A),<
		XLIST
		<<SIXBIT /A/>&777777B17>+S$'A
		LIST
		SALL
	>

	FFNAMS:	SWITCHES
		F$NSW==.-FFNAMS			;NUMBER OF SWITCHES
 WIT
	DEFINE FF(A),<	<<SIXBIT /A/>&777777B17>+S$'A	>;;All on 1 line to look nice

		XALL		;[CSM] Show definition in the listing
	FFNAMS:	SWITCHES
		F$NSW==.-FFNAMS			;NUMBER OF SWITCHES
		SALL		;[CSM] Normal macro expansions
 REP 46/9
		LP	J$FPLT,1		;FORMS TYPE FOR PLOTTER
 WIT
		LP	J$FPLT,1		;-1 = Plotter-only switches are legal
 INS 65/9

		CSMEDT	05,1	;TTY I/O and SLEEP, part 1 just before PLOTTER VARIABLES
	IFN CSM05$,<	;Flags and variables
		LP	J$TTY,1			;'CDP' in LH, UDX in RH
		LP	J$WUDT,1		;UDT when to wakeup
		LP	J$NACK,1		;Count of Negative ACKs
	>  ;End of IFN CSM05$
 REP 3/10
		LP	J$PAUS,1		;PAUSE FOR EVERY FORM
 WIT
	;[CSM]	LP	J$PAUS,1		;PAUSE FOR EVERY FORM
 INS 22/10
		CSMEDT	01,1	;3-Pen plotter, part 1 in "PLOTTER VARIABLES"
	IFN CSM01$,<	;Flags and variables for plotter
		LP	J$PENN,1		;Pen number, from 1 to 3
		LP	J$XLOW,1		;Lowest XSTEP seen while pen was down
	>  ;End of IFN CSM01$


 REP 10/11
		LP	J$DSPX,1		;SPOOLED FILE EXTENTION
 WIT
		LP	J$DSPX,1		;SPOOLED FILE EXTENSION
 REP 15/11

 WIT
		INTERN	J$$END		;[CSM]	;For .ASSIGNing data areas
 REP 9/12
	L.CON:	BLOCK	1			;SPROUT conntect time in seconds
 WIT
	L.CON:	BLOCK	1			;SPROUT connect time in seconds
 INS 24/13
		CSMEDT	05,2	;TTY I/O and SLEEP, part 2 before "LOWEND=="
	IFN CSM05$,<
	SLEEPT:	BLOCK	1			;Time to sleep
	>  ;End of IFN CSM05$

 INS 5/16

	IFN CSM02$,<	;Check to see where LINK .ASSIGNed the buffers
		SKIPLE	[TOLP..##-1777]		;Make sure data area is only one page
		 OUTSTR	[ASCIZ	/?Data area for TOLP extends past 1777/]
	>  ;End of IFN CSM02$
	IFN CSM06$,<
		SKIPLE	[TABC..##-1777]		;Make sure data area is only one page
		 OUTSTR	[ASCIZ	/?Data area for TABCDP extends past 1777/]
	>  ;End of IFN CSM06$
	IFN CSM08$,<
		SKIPLE	[PTC6..##-1777]		;Make sure data area is only one page
		 OUTSTR	[ASCIZ	/?Data area for PTC6 extends past 1777/]
	>  ;End of IFN CSM08$

 REP 36/16
		JRST	MAIN			;AND GO!!!!
 WIT
		JRST	MAIN			;AND GO!
 REP 11/17
	MAIN.2:	SKIPN	JOBACT(P1)		;IS THIS STREAM ACTIVE ???
 WIT
	MAIN.2:	SKIPN	JOBACT(P1)		;IS THIS STREAM ACTIVE?
 REP 16/17
		SKIPN	JOBSTW(P1)		;IS THE STREAM BLOCKED ???
 WIT

		CSMEDT	05,2	;TTY I/O and SLEEP, part 2 at MAIN.2:+5
	IFN CSM05$,<	;Watch for sleep time
		PUSHJ	P,CHKTIM		;Time to run this stream?
		JUMPF	MAIN.3			;Not yet
	>  ;End of IFN CSM05$

		SKIPN	JOBSTW(P1)		;IS THE STREAM BLOCKED?
 REP 25/17
		MOVEI	S1,0			;SNOOZE FOR INTERRUPT
		$CALL	I%SLP			;GO WAIT
		$CALL	CHKQUE			;PROCESS MESSAGES
 WIT
	IFE CSM05$,< MOVEI  S1,0	>	;SNOOZE FOR INTERRUPT
	IFN CSM05$,< MOVE  S1,SLEEPT	>	;Get sleep time in seconds
		$CALL	I%SLP			;GO WAIT
		$CALL	CHKQUE			;PROCESS MESSAGES
	IFN CSM05$,< SETZM  SLEEPT	>	;Clear timer request
 REP 19/18
		MOVE	S1,@0(S1)		;GET THE FLAGS
		HRRZ	S2,STREAM		;GET STREAM NUMBER
		IORM	S1,JOBSTW(S2)		;SET THE FLAGS
		JRST	MAIN			;AND GO LOOP
 WIT

		CSMEDT	05,2	;TTY I/O and SLEEP, part 2 at DSCHD:+6
	IFE CSM05$,< MOVE  S1,@0(S1) >		;GET THE FLAGS
	IFN CSM05$,<
		HRRZ	T1,@0(S1)		;Get the seconds to sleep
		HLLZ	S1,@0(S1)		;Get the flags
	>  ;End of IFN CSM05$

		HRRZ	S2,STREAM		;GET STREAM NUMBER
		IORM	S1,JOBSTW(S2)		;SET THE FLAGS

	IFE CSM05$,< JRST  MAIN >		;AND GO LOOP
	IFN CSM05$,<	;This code taken from LPTSPL
		JUMPE	T1,MAIN			;Loop if no sleep time

	CONT. (SCHEDULER)
		SKIPE	SLEEPT			;Is a sleep time set?
		CAMG	T1,SLEEPT		;And current amount smaller?
		 MOVEM	T1,SLEEPT		;Yes, save shorter interval
		$CALL	I%NOW			;Get the current time
		IMULI	T1,3			;Seconds to UDT ticks
		ADD	T1,S1			;Build wake-up time
		MOVEM	T1,J$WUDT(J)		;Save for CHKTIM
		JRST	MAIN			;Loop

	SUBTTL	CHKTIM - Routine to see if it's time to schedule a stream

	;CALL:	J/  Pointer to job page
	;
	;REG:	TRUE if stream can be scheduled now (timewise)
	;	FALSE if stream needs to wait

	CHKTIM:	$CALL	I%NOW			;Get the current time
		MOVE	S2,S1			;Get the UDT in S2
		MOVE	S1,J$WUDT(J)		;Get the stream wakeup time
		SUB	S1,S2			;Get time left in UDT ticks
		IDIVI	S1,3			;Convert to seconds
		SKIPG	S1			;Any seconds left?
		 JRST	[SETZM	SLEEPT		  ;No, clear old sleep time
			 $RETT		]	  ;Return TRUE
		SKIPE	SLEEPT			;Is a sleep time set?
		CAMG	S1,SLEEPT		;And current amount smaller?
		 MOVEM	S1,SLEEPT		;Yes, save the shorter interval
		$RETF				;Return FALSE

	;End of code taken from LPTSPL>  ;End of IFN CSM05$
 REP 23/19
		$CALL	FILE			;NO, Process THE FILE
		TXNE	S,RQB+ABORT		;HAVE WE BEEN REQUEUED OR WORSE?
		JRST	ENDJOB			;YES, END NOW!!
 WIT
		$CALL	FILE			;Process the file
		TXNE	S,RQB+ABORT		;HAVE WE BEEN REQUEUED OR WORSE?
		JRST	ENDJOB			;YES, END NOW!
 REP 7/21
	TOPS10 <
		$CALL	OUTWAT			;OUTPUT AND WAIT UNTIL DONE
	> ;;END TOPS10

	TOPS20 <
		$CALL	OUTOUT			;FORCE EVERYTHING OUT
	> ;;END TOPS20
 WIT
	TOPS10<	$CALL	OUTWAT	>		;OUTPUT AND WAIT UNTIL DONE

	TOPS20<	$CALL	OUTOUT	>		;FORCE EVERYTHING OUT
 REP 21/21
	TOPS20 <
		PUSHJ	P,OUTOUT		;FORCE OUTPUT
	> ;;END TOPS20
 WIT
	TOPS20<	$CALL	OUTOUT	>		;FORCE OUTPUT
 REP 48/21

 WIT
 REP 61/21
	;**;[2533]REVAMP CODE AT FILD.1:+7L	CTK/16-DEC-82
		TXNE	T2,FP.DEL		;[2533]/DELETE SPECIFIED ???
		TXNE	S,ABORT			;[2533]IS ABORT SET ???
		TXNE	T2,FP.SPL		;[2533]SPOOL FILE ???
		  PUSHJ	P,F%DEL			;[2533]YES,,DELETE THE FILE.
 WIT
	;**;[2533] Revamp code at FILD.1:+7L	CTK/16-DEC-82
		TXNE	T2,FP.DEL		;[2533] /DELETE specified?
		TXNE	S,ABORT			;[2533] Is ABORT set?
		TXNE	T2,FP.SPL		;[2533] Spool file?
		  PUSHJ	P,F%DEL			;[2533] YES,,DELETE THE FILE.
 REP 22/23
		CAIE	T1,.OROBJ		;IS THIS THE OBJECT BLOCK ???
 WIT
		CAIE	T1,.OROBJ		;IS THIS THE OBJECT BLOCK?
 REP 7/27
		TDNE	S2,JOBSTW(S1)		;ARE WE WAITING FOR OPR RESPONSE ???
		$KWTOR	(JOBWAC(S1))		;YES,,KILL IT !!!
 WIT
		TDNE	S2,JOBSTW(S1)		;ARE WE WAITING FOR OPR RESPONSE?
		$KWTOR	(JOBWAC(S1))		;YES,,KILL IT !
 REP 15/28
		TXNE	S2,RQB			;REQUEUING JOB ?
		MOVX	T2,%REQUE		;YES
		TXNE	S2,ABORT		;ABORTING JOB ?
 WIT
		TXNE	S2,RQB			;REQUEUING JOB?
		MOVX	T2,%REQUE		;YES
		TXNE	S2,ABORT		;ABORTING JOB?
 REP 22/28
		TXNE	S2,PSF%OR		;ARE WE WAITING FOR OPR RESPONSE ???
		MOVX	T2,%OREWT		;YES,,SAY SO
		TXNE	S2,PSF%ST		;ARE WE STOPPED ???
		MOVX	T2,%STOPD		;YES,,SAY SO
		TXNE	S2,PSF%DO		;ARE WE OFFLINE ???
 WIT
		TXNE	S2,PSF%OR		;ARE WE WAITING FOR OPR RESPONSE?
		MOVX	T2,%OREWT		;YES,,SAY SO
		TXNE	S2,PSF%ST		;ARE WE STOPPED?
		MOVX	T2,%STOPD		;YES,,SAY SO
		TXNE	S2,PSF%DO		;ARE WE OFFLINE?
 REP 5/29
	; dependant service routines to generate half of the ASCIZ text that gets
 WIT
	; dependent service routines to generate half of the ASCIZ text that gets
 REP 9/29
		SKIPN	JOBACT(S1)		;NEED TO CHECKPOINT ?
 WIT
		SKIPN	JOBACT(S1)		;NEED TO CHECKPOINT?
 REP 15/29
		SKIPGE	S1			;TIME TO CHECKPOINT YET ?
 WIT
		SKIPGE	S1			;TIME TO CHECKPOINT YET?
 REP 41/29
		PUSHJ	P,DCHKP(S1)		;GENERATE DEVICE DEPENDANT TEXT
 WIT
		PUSHJ	P,DCHKP(S1)		;GENERATE DEVICE dependent TEXT
 REP 12/30
		JRST	SETU.2			;YES!!
 WIT
		JRST	SETU.2			;YES!
 REP 17/30
	SETU.2:	HRRZM	T2,STREAM		;SAVE THE STREAM NUMBER
		$CALL	I%NOW			;USE SETUP TIME AS ACK STAMP
 WIT
	;[CSM] There is a problem if two streams start with 1/3 of a second
	SETU.2:	HRRZM	T2,STREAM		;SAVE THE STREAM NUMBER
		$CALL	I%NOW			;USE SETUP TIME AS ACK STAMP
		LSH	S1,3		;[CSM]	;Free up 3 bits
		IOR	S1,T2		;[CSM]	;Make it be unique
 REP 9/32
		TDNE	S2,JOBSTW(S1)		;ARE WE WAITING FOR OPR RESPONSE ???
		$KWTOR	(JOBWAC(S1))		;YES,,KILL IT !!!
 WIT
		TDNE	S2,JOBSTW(S1)		;ARE WE WAITING FOR OPR RESPONSE?
		$KWTOR	(JOBWAC(S1))		;YES,,KILL IT !
 REP 19/32
		CAIN	T1,.ORREA		;IS THIS THE REASON BLOCK ???
		MOVEI	P1,0(T3)		;YES..SAVE ADDRESS OF REASON
		CAIE	T1,.CANTY		;IS THIS THE CANCEL TYPE BLOCK ???
		JRST	OACC.1			;NO,,SKIP IT AND GET NEXT BLOCK
		MOVE	S1,0(T3)		;YES - LOAD THE CANCEL TYPE
		CAIE	S1,.CNPRG		;IS IT /PURGE ???
 WIT
		CAIN	T1,.ORREA		;IS THIS THE REASON BLOCK?
		MOVEI	P1,0(T3)		;YES..SAVE ADDRESS OF REASON
		CAIE	T1,.CANTY		;IS THIS THE CANCEL TYPE BLOCK?
		JRST	OACC.1			;NO,,SKIP IT AND GET NEXT BLOCK
		MOVE	S1,0(T3)		;YES - LOAD THE CANCEL TYPE
		CAIE	S1,.CNPRG		;IS IT /PURGE?
 REP 3/34
	OACREQ:	TXNE	S,GOODBY		;IS IT TOO LATE FOR THIS ???
 WIT
	OACREQ:	TXNE	S,GOODBY		;IS IT TOO LATE FOR THIS?
 REP 14/34
		TDNE	S2,JOBSTW(S1)		;ARE WE WAITING FOR OPR RESPONSE ???
		$KWTOR	(JOBWAC(S1))		;YES,,KILL IT !!!
 WIT
		TDNE	S2,JOBSTW(S1)		;ARE WE WAITING FOR OPR RESPONSE?
		$KWTOR	(JOBWAC(S1))		;YES,,KILL IT !
 REP 22/34
		CAIN	T1,.REQTY		;IS THIS THE REQUEST TYPE BLOCK ???
		JRST	OACR.2			;YES,,GO PROGESS IT
		CAIN	T1,.ORREA		;IS THIS THE REASON BLOCK ???
 WIT
		CAIN	T1,.REQTY		;IS THIS THE REQUEST TYPE BLOCK?
		JRST	OACR.2			;YES,,GO PROGESS IT
		CAIN	T1,.ORREA		;IS THIS THE REASON BLOCK?
 INS 1/36
	SUBTTL	FRMLEX - Forms limit exceeded routine

 REP 5/36
		JRST	OUTIGN			;YES, DOUBLE THE LIMIT
 WIT
		JRST	OUTIGN			;YES, set to +infinity
 REP 18/36
		TXNE	S,ABORT			;WERE WE CANCELLED ???
 WIT
		TXNE	S,ABORT			;WERE WE CANCELLED?
 REP 15/37
		TLNN	S1,-1			;ARE WE DEATCHED ???
 WIT
		TLNN	S1,-1			;ARE WE DEATCHED?
 REP 24/37
		TXNE	S2,GL.ITY		;ARE WE A PTY ???
		MOVE	TF,[ASCII/P/]		;YES,,MAKE US 'PTY'
		TXNE	S2,GL.CTY		;ARE WE THE CTY ???
 WIT
		TXNE	S2,GL.ITY		;ARE WE A PTY?
		MOVE	TF,[ASCII/P/]		;YES,,MAKE US 'PTY'
		TXNE	S2,GL.CTY		;ARE WE THE CTY?
 INS 32/38
	CONT. (ACTEND)
 REP 66/38
		SETZM	FACTBL+7		;NO DISK WRITES
 WIT

		CSMEDT	04,1	;CSM accounting, part 1 after QUEUE. uuo
	IFE CSM04$,< SETZM FACTBL+7 >		;No disk writes
	IFN CSM04$,<
		MOVE	S1,J$FORM(J)		;Get the forms type
		MOVEM	S1,FACTBL+7		;Instead of disk writes
	>  ;End of CSM04$

	CONT. (ACTEND)

 REP 71/38
		MOVE	S1,J$APRT(J)		;NUMBER OF PAGES PRINTED
		MOVEM	S1,FACTBL+12		;STORE
 WIT
		MOVE	S1,J$APRT(J)		;Number of cards, feet, minutes
		MOVEM	S1,FACTBL+12		;Store as pages printed
 REP 91/38
	ACTRNT:	SKIPN	ACTFLG			;Accounting turned on ?
 WIT
	ACTRNT:	SKIPN	ACTFLG			;Accounting turned on?
 REP 33/39
		USNM3.	(.EQOWN+1(J))		;USER NAME 1 (TOPS10)
 WIT
		USNM3.	(.EQOWN+1(J))		;USER NAME 2 (TOPS10)
 REP 27/40
		CAMN	S1,[POINT 7,J$XTBF(J)]	;IS THERE A MESSAGE FOR THE OPERATOR ??
		$RETT				;NO,,RETURN.
 WIT
		CAMN	S1,[POINT 7,J$XTBF(J)]	;IS THERE A MESSAGE FOR THE OPERATOR?
		$RETT				;NO,,RETURN.

	IFN CSM02$,< FORM.3:	>	;PUSHJ to here to wait for 'PROCEED' in OPRTXT

 REP 21/41
		JUMPF	FRMIEX			;EOF!!
		GETLIM	T2,.EQLIM(J),FORM	;GET FORMS
		CAMN	T1,T2			;MATCH??
		JRST	FRMI.4			;YES!!
 WIT
		JUMPF	FRMIEX			;EOF!
		GETLIM	T2,.EQLIM(J),FORM	;GET FORMS
		CAMN	T1,T2			;MATCH?
		JRST	FRMI.4			;YES!
 REP 38/41
		JUMPF	FRMIEX			;EOF!!
		JUMPE	T1,FRMI.6		;MAYBE PAREN??
 WIT
		JUMPF	FRMIEX			;EOF!
		JUMPE	T1,FRMI.6		;MAYBE PAREN?
 REP 10/42
		  SKIPA				;NO!!!
		JRST	FRMSWI			;YES!!
		CAMN	T1,J$LDEV(J)		;COMPARE TO OUR DEVNAM
		JRST	FRMSWI			;MATCH!!
 WIT
		  SKIPA				;NO!
		JRST	FRMSWI			;YES!
		CAMN	T1,J$LDEV(J)		;COMPARE TO OUR DEVNAM
		JRST	FRMSWI			;MATCH!
 REP 9/43
		JUMPF	FRMIEX			;EOF!!
		JRST	FRMSWI			;AND LOOP AROUND
	FRMS.1:	$CALL	FH$SIX			;GET THE SWITCH
		JUMPF	FRMIEX			;EOF!!
 WIT
		JUMPF	FRMIEX			;EOF!
		JRST	FRMSWI			;AND LOOP AROUND
	FRMS.1:	$CALL	FH$SIX			;GET THE SWITCH
		JUMPF	FRMIEX			;EOF!
 REP 23/43
		CAMN	T3,T1			;MATCH??
 WIT
		CAMN	T3,T1			;MATCH?
 REP 32/43
		PUSHJ	P,0(T3)			;GO!!
 WIT
		PUSHJ	P,0(T3)			;GO!
 REP 15/44
		JUMPF	S$NOT2			;EOF, FINISH UP!!
 WIT
		JUMPF	S$NOT2			;EOF, FINISH UP!
 INS 33/45
		SKIPE	T1		;[CSM]	;If not zero,
 INS 37/45
		SKIPE	T1		;[CSM]	;If not zero,
 REP 14/46
		  SKIPA				;ITS NOT!!
 WIT
		  SKIPA				;ITS NOT!
 REP 19/47
		IMULI	T1,12			;SHIFT A PLACE
 WIT
		IMULI	T1,^D10		;[CSM]	;Shift one decimal place
 REP 41/49
		TXNE	S,DSKOPN		;IS THE SPOOL FILE OPEN ???
 WIT
		TXNE	S,DSKOPN		;IS THE SPOOL FILE OPEN?
 REP 48/49
		TXNE	S,DSKOPN		;IS THE SPOOL FILE OPEN ???
 WIT
		TXNE	S,DSKOPN		;IS THE SPOOL FILE OPEN?
 REP 11/50
		MOVEI	S2,T$DISP		;YES!!
		CAXN	S1,.OTCDP		;NO, HOW ABOUT A CARD PUNCH?
		MOVEI	S2,C$DISP		;WIN!!
 WIT
		MOVEI	S2,T$DISP		;YES!
		CAXN	S1,.OTCDP		;NO, HOW ABOUT A CARD PUNCH?
		MOVEI	S2,C$DISP		;WIN!
 REP 30/50
		MOVX	T1,.IOIMG+UU.PHS+UU.AIO
						;IMAGE+PHONLY+NBIO
 WIT
		MOVX	T1,.IOIMG+UU.PHS+UU.AIO	;IMAGE+PHONLY+NBIO

		CSMEDT	05,3	;TTY I/O and SLEEP, part 3 after DEVNAM in OUTGET
	IFN CSM05$,<	;Check for devices connected to TTY lines
		HLRZ	T2,J$LDEV(J)		;Get first part of physical name
		CAIE	T2,'TTY'		;Is it a terminal?
		 JRST	CSM05Z			;No
		MOVE	S2,J$LSER(J)		;Get service routine
		MOVE	S1,DNAME(S2)		;Get 'PLT' or 'CDP'
		MOVEM	S1,J$TTY(J)		;Put in LH
		MOVE	T2,J$LDEV(J)		;Get device again
		IONDX.	T2,			;Get UDX
		  SETZB	T2,J$TTY(J)		;Should never happen
		HRRM	T2,J$TTY(J)		;Store TTY UDX in RH

	CONT.	(OUTGET)		;FORCE NEW LISTING PAGE

	;Disable free CRLFs every 80 characters and SET TTY NO GAG

		MOVX	T1,.TONFC+.TOSET	;Change setting to
		MOVEI	T3,1			; no free CRLFs
		MOVE	S1,[3,,T1]
		TRMOP.	S1,			;SET TTY NO CRLF
		  JFCL

	;*BUG*;	MOVX	T1,.IOPIM+UU.PHS	;Packed image mode (no echo)
		MOVX	T1,.IOIMG+UU.PHS+IO.SUP	;Image mode, no echo
		HLRZ	S1,J$TTY(J)		;Get device type
		CAIN	S1,'PLT'		;Output to plotter?
		 MOVX	T1,.IOASC+UU.PHS+IO.SUP	;ASCII mode, no echo
	CSM05Z:	>  ;End of IFN CSM05$

 REP 40/50


		CONT.	(OUTGET)		;FORCE NEW LISTING PAGE
		MOVE	S1,J$LSER(J)		;GET DEVICE DISPATCH ADDRESS
		MOVE	S1,DBYTE(S1)		;GET OUTPUT BYTE SIZE
 WIT
		MOVE	S1,J$LSER(J)		;GET DEVICE DISPATCH ADDRESS
		MOVE	S1,DBYTE(S1)		;GET OUTPUT BYTE SIZE

	IFN CSM05$,<	;Cannot use 6 bits to PTC-6
		HLRZ	S2,J$TTY(J)		;Nonzero if TTY as output device
		CAIN	S2,'PLT'		;Going to the plotter?
		 MOVEI	S1,7			;Yes, use normal ASCII mode

	;SET TTY NO GAG after it has been inited

		MOVX	T1,.TOSND+.TOSET	;Change setting to
		HRRZ	T2,J$TTY(J)
		MOVEI	T3,0			; no SENDs allowed
		MOVE	S2,[3,,T1]
		SKIPE	T2			;Don't TRMOP. if not a TTY
		 TRMOP.	S2,			;SET TTY GAG
		  JFCL
	>  ;End of IFN CSM05$

 REP 10/51
		CAXN	S1,.OTPLT		;PLOTTER ?
 WIT
		CAXN	S1,.OTPLT		;PLOTTER?
 REP 24/51
		  ERJMP	OUTDDE			;DEVICE DOESNT EXIST!!
 WIT
		  ERJMP	OUTDDE			;DEVICE DOESNT EXIST!
 INS 6/54

		CSMEDT	01,2	;3-Pen plotter, part 2 at OUTOUT:+1 <TOPS10>
	IFN CSM01$,<	;The plotter does not interrupt for off-line or on-line
		SKIPE	J$FPLT(J)		;Is this going to the plotter?
		 PUSHJ	P,PLTCHK		;Yes, check if it is on-line
	>  ;End of CSM01$

 REP 30/54
	>  ;END TOPS10 CONDITIONAL

 WIT

	CONT. (OUTOUT)

	IFN CSM01$,<	;After OUTWAT: inside TOPS10<>
	;Ask the monitor to do a CONI to check if PLT is on-line

		OPDEF	STSPL.	[CALLI	-4]	;CSM UUO to do <CONI PLT,T1>
		PLT.ON==1B30			;The plotter power is on

	PLTCHK:	CSMEDT	08,1	;PTC-6 Plotter Controller, part 1 inside CSM01$
	IFN CSM08$,<
		SKIPE	J$TTY(J)		;Output going to a TTY?
		 POPJ	P,			;Yes, cannot determine on-line status
	>  ;End of IFN CSM08$
		STSPL.	S1,			;Get current status of plotter
		TXNE	S1,PLT.ON		;Is the POWER-ON bit set?
		 JRST	PLTONL			;Yes, plotter is on-line now
		AOS	S1,J$NACK(J)		;Increment NACK count
		IDIVI	S1,^D30			;Set S2 modulo 30
		JUMPN	S2,PLTCH1		;Complain every 30 seconds
		HRRZ	S1,STREAM		;Get stream number
		SETOM	JOBCHK(S1)		;Request checkpoint
		$WTO	(Off-line,,@JOBOBA(S1))
	PLTCH1:	CSMEDT	05,4	;TTY I/O and SLEEP, part 4 after PLTCHK:
	IFN CSM05$,< $DSCHD  (1) >		;De-schedule for 1 second
	IFE CSM05$,< MOVEI   S1,1		;Wait 1 second
		     SLEEP   S1, >		; before continuing
		JRST	PLTCHK			;Check if it is on-line now

	PLTONL:	SETOM	J$NACK(J)		;Plotter is on-line now
		$RETT				;OK to do the OUT UUO
	>  ;End of IFN CSM01$
	>  ;END TOPS10 CONDITIONAL

		CONT.	(OUTOUT)
 INS 1/59
	SUBTTL	TTY I/O -- Input character from TTY, no wait

		CSMEDT	05,5	;TTY I/O and SLEEP, part 5 between OUTFLS and C$DISP
	IFN CSM05$,<	INTERN	TIWAIT,TTYIN,TRMERR	;Entry points for TABCDP.MAC

	;Routine to input a single character from terminal into S1.
	;Uses T1 and T2.

	TTYIN::	MOVX	T1,.TOSIP		;Skip if input in progress
		HRRZ	T2,J$TTY(J)		;Get UDX
		MOVE	S1,[2,,T1]		;Point to args
		TRMOP.	S1,			;Check if input
		  JRST	TTYIN1			;Nothing there
		MOVX	T1,.TOISC		;Input single character
		MOVE	S1,[2,,T1]		;Point to args
		TRMOP.	S1,			;Get the char
		  PUSHJ	P,TRMERR		;Should never happen
		$RETT				;Got char in S1

	TTYIN1:	MOVEI	S1,0			;Signify failure
		$RETF

	TRMERR::$STOP	(TUF,TRMOP. UUO Failure)
	SUBTTL	TTY I/O -- Input character, wait up to 30 seconds

	;Routine to wait up to 30 seconds for a character to come in.
	;Returns TRUE if char in S1, FALSE and zero in S1 if timed out

	TIWAIT::PUSHJ	P,TTYIN			;Check for input
		JUMPT	TIWAI2			;Clear NACK counter if got input

	;There is a good possibility that the response will come in within 1 second

		MOVX	S1,HB.RTC+^D1000	;Wait 1 second, wake on char ready
		HIBER	S1,
		  JFCL
		PUSHJ	P,TTYIN			;Anything now?
		JUMPT	TIWAI2			;Return if so
		AOS	J$NACK(J)		;No, waited 1 second already

	TIWAT1:	$DSCHD	(1)			;De-schedule this stream for 1 second

		PUSHJ	P,TTYIN			;Input now?
		JUMPT	TIWAI2			;Yes, continue
		AOSG	S1,J$NACK(J)		;No, count failure
		 JRST	TIWAT1			;Keep waiting if negative or zero
		IDIVI	S1,^D30			;Set S2 modulo 30
		JUMPN	S2,TIWAT1		;If less than 30 seconds, wait again
		HRRZ	S1,STREAM		;Get stream number
		$WTO	(<No response from ^W/J$LDEV(J)/ after ^D/J$NACK(J)/ seconds>,,@JOBOBA(S1))
		MOVEI	S1,0			;Signify no response
		$RETF

	TIWAI2:	SETZM	J$NACK(J)		;Terminal is responding
		POPJ	P,			;TF has been set to TRUE already

	>  ;End of IFN CSM05$
 REP 13/59
		JRST	.RETT			;(11) ACCOUNTING
		JRST	C$CHKP			;(12) CHECKPOINT TEXT GENERATION
 WIT

		CSMEDT	04,2	;CSM accounting, part 2 at C$DISP:+11
	IFE CSM04$,< JRST  .RETT >		;(11) ACCOUNTING
	IFN CSM04$,< JRST  CSMACT >		;(11) Accounting

		JRST	C$CHKP			;(12) CHECKPOINT TEXT GENERATION

	IFN CSM04$,<
	CSMACT:	MOVE	S1,J$APRT(J)		;Get cards punched or feet punched
		MOVEM	S1,J$ADRD(J)		;Save instead of disk reads
		$RETT
	>  ;End of IFN CSM04$
 REP 7/60
		CAMN	P2,[.INFIN]		;+INFINITY ?
		JRST	C$CHK1			;YES
		CAMG	P1,J$RLIM(J)		;OPERATOR ALLOW LIMIT TO EXCEED ?
		$TEXT	(DEPBP,<punched ^D/P1/ of ^D/J$RLIM(J)/ cards^0>)
		CAMLE	P1,J$RLIM(J)		;OPERATOR ALLOW LIMIT TO EXCEED ?
 WIT
		CAMN	P2,[.INFIN]		;+INFINITY?
		JRST	C$CHK1			;YES
		CAMG	P1,J$RLIM(J)		;OPERATOR ALLOW LIMIT TO EXCEED?
		$TEXT	(DEPBP,<punched ^D/P1/ of ^D/J$RLIM(J)/ cards^0>)
		CAMLE	P1,J$RLIM(J)		;OPERATOR ALLOW LIMIT TO EXCEED?
 INS 8/61

		CSMEDT	07,1	;QUEUE defaults, part 1 at C$PROC:+4
	IFE CSM07$,<
 REP 11/61


 WIT
	>  ;End of CSM07$
	IFN CSM07$,<JRST CDASC>			;Default to ASCII mode
 REP 34/62
		JUMPF	.RETT			;THIS SHOULD NEVER REALLY HAPPEN!!
 WIT
		JUMPF	.RETT			;THIS SHOULD NEVER REALLY HAPPEN!
 REP 27/64
		CAIN	C,.CHTAB		;IS IT A VERTICAL TAB?
 WIT
		CAIN	C,.CHTAB		;IS IT A HORIZONTAL TAB?
 REP 35/65
	;FOLLOWING ALPHABETICS ARE SMALL LETTERS
		BYTE (12)	0402,5400,5200	;' A B
		BYTE (12)	5100,5040,5020	;C D E
		BYTE (12)	5010,5004,5002	;F G H
		BYTE (12)	5001,6400,6200	;I J K
		BYTE (12)	6100,6040,6020	;L M N
		BYTE (12)	6010,6004,6002	;O P Q
		BYTE (12)	6001,3200,3100	;R S T
		BYTE (12)	3040,3020,3010	;U V W
		BYTE (12)	3004,3002,3001	;X Y Z
		BYTE (12)	5000,6000,3000	;
		BYTE (12)	3400,0000,0000	;
 WIT
	;The following alphabetics are lowercase
		BYTE (12)	0402,5400,5200	;` a b
		BYTE (12)	5100,5040,5020	;c d e
		BYTE (12)	5010,5004,5002	;f g h
		BYTE (12)	5001,6400,6200	;i j k
		BYTE (12)	6100,6040,6020	;l m n
		BYTE (12)	6010,6004,6002	;o p q
		BYTE (12)	6001,3200,3100	;r s t
		BYTE (12)	3040,3020,3010	;u v w
		BYTE (12)	3004,3002,3001	;x y z
		BYTE (12)	5000,6000,3000	;{ | }
		BYTE (12)	3400,0000,0000	;~ DEL
 REP 36/66
						;FOLLOWING ALPHABETICS ARE SMALL LETTERS
		BYTE (12)	0402,5400,5200	;' A B
		BYTE (12)	5100,5040,5020	;C D E
		BYTE (12)	5010,5004,5002	;F G H
		BYTE (12)	5001,6400,6200	;I J K
		BYTE (12)	6100,6040,6020	;L M N
		BYTE (12)	6010,6004,6002	;O P Q
		BYTE (12)	6001,3200,3100	;R S T
		BYTE (12)	3040,3020,3010	;U V W
		BYTE (12)	3004,3002,3001	;X Y Z
		BYTE (12)	5000,6000,3000	;
		BYTE (12)	3400,0000,0000	;
 WIT
	;The following alphabetics are lowercase
		BYTE (12)	0402,5400,5200	;` a b
		BYTE (12)	5100,5040,5020	;c d e
		BYTE (12)	5010,5004,5002	;f g h
		BYTE (12)	5001,6400,6200	;i j k
		BYTE (12)	6100,6040,6020	;l m n
		BYTE (12)	6010,6004,6002	;o p q
		BYTE (12)	6001,3200,3100	;r s t
		BYTE (12)	3040,3020,3010	;u v w
		BYTE (12)	3004,3002,3001	;x y z
		BYTE (12)	5000,6000,3000	;{ | }
		BYTE (12)	3400,0000,0000	;~ DEL
 REP 6/67
		LOAD	S1,.FPINF(E),FP.NFH	;GET NO FILE HEADER BIT
		JUMPN	S1,.RETT		;RETURN IF NOT WANTED
 WIT

		CSMEDT	07,2	;QUEUE defaults, part 2 at C$HEAD:+2
	IFE CSM07$,<	;Ignore QUEUE's default of /NOHEADER, always punch it
		LOAD	S1,.FPINF(E),FP.NFH	;GET NO FILE HEADER BIT
		JUMPN	S1,.RETT		;RETURN IF NOT WANTED
	>  ;End of IFN CSM07$

 REP 7/68
		PJRST	OUTOUT			;FORCE OUTPUT
 WIT
	;[CSM]	PJRST	OUTOUT			;FORCE OUTPUT
		PJRST	OUTCD1		;[CSM]	;FORCE OUTPUT
 REP 4/69
	C$BANN:	SKIPN	J$FBAN(J)		;GET COUNT OF BANNER CARDS
 WIT
	C$BANN:	CSMEDT	06,1	;TTY CDP, part 1 at C$BANN:
	IFN CSM06$,<	;Set terminal to PUNCH+PRINT mode if /FORMS:NORMAL
		MOVEI	S1,J$FORM(J)		;Get forms name
		CAMN	S1,['NORMAL']		;Normal forms?
		 MOVEI	S1,0			;Yes, turn on print mode
		SKIPE	S2,J$TTY(J)		;Punch really a terminal?
		 PUSHJ	P,TABINI##		;Yes, set it up
	>  ;End of IFN CSM06$

		SKIPN	J$FBAN(J)		;BANNER cards wanted?
 REP 8/69
		MOVEI	S1,[ITEXT<BEGIN:>]
		PJRST	CTRA.1			;FALL INTO COMMON CODE

	C$TRAI:	SKIPN	J$FTRA(J)		;GET TRAILER COUNT
		$RETT				;RETURN IF ZERO
 WIT

		CSMEDT	07,3	;QUEUE defaults, part 3 at C$BANN:+4
	IFE CSM07$,<	;"BEGIN: JOB jobnam USER:" wastes 4 cards.
		MOVEI	S1,[ITEXT<BEGIN:>]
		PJRST	CTRA.1			;FALL INTO COMMON CODE
	>  ;End of IFE CSM07$
	IFN CSM07$,<	;Punch just NAME, PPN, and NOTE (if any)
		PJRST	CTRA.2			;Punch user name
	>  ;End of IFN CSM07$

	IFE CSM06$,<
	C$TRAI:	SKIPN	J$FTRA(J)		;Check TRAILER wanted flag
		$RETT				;RETURN IF ZERO
	>  ;End of IFE CSM06$
	IFN CSM06$,<	;Call TABFIN after all is done
	C$TRAI:	SKIPE	J$FTRA(J)		;Trailer cards wanted?
		 $CALL	CTRA.0			;Yes
		SKIPE	J$TTY(J)		;Output to a TTY?
		 PUSHJ	P,TABFIN##		;Yes, finish up
		$RETT
	CTRA.0:	>  ;End of IFN CSM06$

 INS 27/69
		CONT.	(C$BANN)
	IFN CSM07$,< CTRA.2: >			;Here to skip over garbage
 REP 27/70
		PJRST	OUTOUT			;PUNCH CARD AND RETURN
 WIT
	;[CSM]	PJRST	OUTOUT			;PUNCH CARD AND RETURN
		PJRST	OUTCD1		;[CSM]	;PUNCH CARD AND RETURN
 REP 5/71
	;Call with Ascii character to Punch in S1
	;Punches Characters as 10 12 bit Frames followed by 2 blank frames
	;Character is Punched in Rows 0 thru 6.  The Contents of J$CMSK is
	;ORED with the Column Punch to identify the Card as a Job or File card.
 WIT
	;Call with ASCII character to punch in S1.
	;Punches 6 characters as 10 frames each followed by 2 blank frames.
	;Character is punched in Rows 0 thru 6.  The contents of J$CMSK is
	;OR'ed with the column punch to identify the card as a Job or File card.
 REP 13/71
		CAILE	S1,"_"			;UPPER CASE ?
 WIT
		CAILE	S1,"_"			;UPPER CASE?
 REP 6/72
	CDPBYT:	PJRST	OUTBYT			;OUTPUT THE BYTE
 WIT
	CDPBYT:	CSMEDT	06,2	;TTY CDP, part 2 at CDPBYT
	IFE CSM06$,< PJRST  OUTBYT >
	IFN CSM06$,<	;Special output for TAB Products Cardpunch Terminal
		SKIPN	J$TTY(J)		;Output to a TTY?
		 PJRST	OUTBYT			;No
		$SAVE	<S1,S2>			;Yes, preserve ACs used
		MOVE	S1,C			;Copy to expected AC
		PJRST	TABBYT##		;Store byte in other buffer
	>  ;End of IFN CSM06$
 REP 11/72
	OUTCDP:	PUSHJ	P,OUTOUT		;FORCE CARD OUT
		AOS	S1,J$APRT(J)		;COUNT ANOTHER ONE
		CAMLE	S1,J$RLIM(J)		;OVER LIMIT?
		PUSHJ	P,FRMLEX		;HANDLE LIMIT EXCEEDED
		POPJ	P,			;RETURN
 WIT
	OUTCDP:	AOS	S1,J$APRT(J)		;COUNT ANOTHER ONE
		CAMLE	S1,J$RLIM(J)		;OVER LIMIT?
		PUSHJ	P,FRMLEX		;HANDLE LIMIT EXCEEDED

	OUTCD1:					;Output without counting
	IFN CSM06$,<	;Special output for TAB Products Cardpunch Terminal
		SKIPE	J$TTY(J)		;Output to a TTY?
		 PJRST	TABPUN##		;Yes, output the card
	>  ;End of IFN CSM06$
		PJRST	OUTOUT			;FORCE CARD OUT
 REP 25/72
		PUSHJ	P,PTPBYT		;OUTPUT A BYTE
 WIT
	;[CSM]	PUSHJ	P,PTPBYT		;OUTPUT A BYTE
		PUSHJ	P,CDPBYT	;[CSM]	;Use the right output routine
 DEL 3/73

 REP 13/73
		JRST	.RETT			;(11) ACCOUNTING
		JRST	P$CHKP			;(12) CHECKPOINT TEXT GENERATION
 WIT

		CSMEDT	04,3	;CSM accounting, part 3 at P$DISP:+11
	IFE CSM04$,<JRST .RETT>			;(11) ACCOUNTING
	IFN CSM04$,<JRST PLTACT>		;(11) Plotter accounting

		JRST	P$CHKP			;(12) CHECKPOINT TEXT GENERATION


	IFN CSM04$,<	;Account for both elapsed time and paper used
	PLTACT:	MOVE	S1,J$XLIM(J)		;Get total X increments
		ADDI	S1,INCS/2		;Round up
		IDIVI	S1,INCS			;Convert to inches
		EXCH	S1,J$APRT(J)		;Store amount of paper used
		MOVEM	S1,J$ADRD(J)		;Store minutes in place of disk reads
		$RETT
	>  ;End of IFN CSM04$
 REP 6/74
		IDIV	P1,J$PTPM(J)		;T1:= MINUTES, T2:= FRACTION
		IMULI	P2,^D1000		;MAKE IT DECIMAL
		IDIV	P2,J$PTPM(J)		;T2:= DECIMAL FRACTION OF A MINUTE
		MOVE	P3,J$RLIM(J)		;GET LIMIT
		CAMN	P3,[.INFIN]		;+INFINITY ?
		JRST	P$CHK1			;YES
		CAMG	P1,J$RLIM(J)		;OPERATOR ALLOW LIMIT TO EXCEED ?
		$TEXT	(DEPBP,<plotted ^D/P1/.^D3L0/P2/ of ^D/J$RLIM(J)/ minutes^0>)
		CAMLE	P1,J$RLIM(J)		;OPERATOR ALLOW LIMIT TO EXCEED ?
	P$CHK1:	$TEXT	(DEPBP,<plotted ^D/P1/.^D3L0/P2/ minutes (limit exceeded)^0>)
 WIT
		IDIV	P1,J$PTPM(J)		;P1:= MINUTES, P2:= FRACTION
		IMULI	P2,^D10			;[CSM] One decimal place
		IDIV	P2,J$PTPM(J)		;P2:= DECIMAL FRACTION OF A MINUTE
		MOVE	P3,J$RLIM(J)		;GET LIMIT
		CAMN	P3,[.INFIN]		;+INFINITY?
		JRST	P$CHK1			;YES
		CAMG	P1,J$RLIM(J)		;OPERATOR ALLOW LIMIT TO EXCEED?
		$TEXT	(DEPBP,<plotted ^D/P1/.^D/P2/ of ^D/J$RLIM(J)/ minutes^0>)
		CAMLE	P1,J$RLIM(J)		;OPERATOR ALLOW LIMIT TO EXCEED?
	P$CHK1:	$TEXT	(DEPBP,<plotted ^D/P1/.^D/P2/ minutes (limit exceeded)^0>)
 INS 8/75

		CSMEDT	07,4	;QUEUE defaults, part 4 at P$PROC:+4
	IFE CSM07$,<	;This code removed because all plots must be BINARY halfwords
 INS 11/75
	>  ;End of IFE CSM07$
	IFN CSM07$,< JRST  PLTHLF >		;Default always to halfword format
 REP 15/75
		EXP	PLTSIX			;/PLOT:BINARY	(6 BIT)
 WIT

		CSMEDT	02,1	;Halfword format, part 1 at P$ROUT:+3
	IFE CSM02$,<EXP	PLTSIX>			;/PLOT:BINARY	(6 BIT)
	IFN CSM02$,<EXP	PLTHLF>			;/PLOT:BINARY	(18 bit)
 INS 40/76

	;Here at end of plot file

 REP 1/77
	SUBTTL	Plotter service -- Devout output errors
 WIT
	SUBTTL	Plotter service -- Expand CSM's compressed plot format

		CSMEDT	02,2	;Halfword format, part 2 after PLTLP0:
	IFN CSM02$,<				;Read halfwords from disk
	COMMENT ~ Do not use many semicolons, it confuses FILCOM's /C switch

		!=======================================================!
		!                                                       !
		!                PLOTTER MODE  --  18 BIT               !
		!                                                       !
		! In 18 bit mode, each word read from disk is divided   !
		! into halfwords, which are interpreted by subroutine   !
		! TOLP.  Most halfwords have 9 bits of delta-X and      !
		! 9 bits of delta-Y, special opcodes raise and lower    !
		! the pen.  See TOLP.MAC for a full description.        !
		!                                                       !
		!=======================================================!
		!   Delta Y   !   Delta X   !   Delta Y   !   Delta X   !
		!=======================================================!

	Call TOLP. with
	 S1/ Addr of input routine, which returns data in S1, -1 on EOF
	 S2/ 0 to suppress header/trailer, 1 for header, 2 for trailer, 3 for both
	 T1/ Current X position (should be same as J$XMIN)
	 T2/ Current Y position (should be same as J$YMIN)

	On return, ACs 7-16 have been preserved
	 TF/ Garbage
	 S1/ Garbage
	 S2/ Addr of error message, or 0 if no error
	 T1-T4/ Garbage

	~ ;End of COMMENT

		EXTERN	TOLP.			;Routine to reverse PLOT
		INTERN	PLOT			;Routine to move the pen
		INTERN	NEWPEN,OPRTXT,PAUSEP,TITLE ;Other routines called by TOLP

		ND	INCS,^D400		;Steps per inch (620 octal)
	;Process 18-bit format

	PLTHLF:	MOVEI	T1,^D36			;Read full words from disk
		MOVEM	T1,J$DBSZ(J)		;(let TOLP split them into halfwords)

		MOVE	T1,J$XPOS(J)		;Raise the pen, but
		MOVE	T2,J$YPOS(J)		; stay at current position
		MOVE	T3,PN.UP
		PUSHJ	P,PLOT

		MOVEI	S2,3			;Assume both header and trailer
		LOAD	S1,.FPINF(E),FP.NFH	;Get No File Header bit
		SKIPE	S1			;Bit set?
		 MOVEI	S2,0			;Yes, suppress internal header and trailer

		MOVEI	S1,READ36		;Input routine (S2 has flags)
		MOVE	T1,J$XPOS(J)		;TOLP needs to know current position
		MOVE	T2,J$YPOS(J)
		PUSHJ	P,TOLP.##		;TOLP is PLOT spelled backwards

		MOVEI	S1,[ITEXT (<^T/0(S2)/ ^F/@J$DFDA(J)/>)]	;S2 points to ASCIZ
		SKIPE	S2			;If errors were detected, copy string
		 PUSHJ	P,PUTERR		; and file name to error buffer

		JRST	PLTLP0			;File is at EOF, finish up
	SUBTTL	Plotter service -- READ36, OPRTXT, PAUSEP, TITLE for TOLP

	;Routine to read a word from the input file, returns -1 for EOF, -2 if ABORT

	READ36:	MOVE	S1,J$PTIC(J)		;Get tics plotted
		IDIV	S1,J$PTPM(J)		;Convert to minutes
		CAMLE	S1,J$RLIM(J)		;Still in range?
		 PUSHJ	P,FRMLEX		;No, complain
		PUSHJ	P,INPBYT		;Get a word
		MOVE	T1,C			;Copy to expected AC
		JUMPT	.POPJ			;Use it if OK
		MOVNI	T1,1			;-1 for EOF
		TXNE	S,RQB+ABORT		;Unless OPR caused EOF
		 MOVNI	T1,2			;-2 for ABORT
		POPJ	P,			;Continue back in TOLP


	;Routine to send a message to the OPR.
	;Called with byte count in S1, addr of ASCIZ message in S2.

	OPRTXT:	PUSHJ	P,PLTOUT		;Dump buffers
		HRRZ	S1,STREAM		;Get the stream number
		$WTO	(OPRTXT message,<^T/0(S2)/>,@JOBOBA(S1)) ;Tell OPR
		POPJ	P,


	;Routine to pause the plotter.
	;Zero in S1 means to wait for human intervention, nonzero causes graphic
	;terminals to pause that many seconds before automatically resuming.

	PAUSEP:	PUSHJ	P,PLTOUT		;Dump the buffers
		JUMPN	S1,.POPJ		;Nonzero valid for graphics terminals
		PUSHJ	P,SETTBF		;Set up WTO buffer
		PJRST	FORM.3			;Wait for a "PROCEED" response


	;Routine to plot text.
	;  T1/ Height in increments
	;  T2/ Addr of text
	;  T3/ Angle in degrees, 0 to 359
	;  T4/ Byte count for text

	TITLE:	POPJ	P,			;Not implemented

	PLTOUT:
	IFE CSM08$,< PJRST  OUTOUT >
	IFN CSM08$,<
		SKIPE	J$TTY(J)		;Output to a TTY?
		 PJRST	OUTOUT			;No
		PUSHJ	P,PTCOUT##		;Yes, get ready to output last buffer
		SETZM	J$PPOS(J)		;PTCOUT always raises the pen
		PJRST	OUTRSP			;Output string and wait for response
	>  ;End of IFN CSM08$
	>  ;End of IFN CSM02$
	SUBTTL	Plotter service -- NEWPEN for 3-pen plotter

		CSMEDT	01,3	;3-Pen plotter, part 3 before P$DERR
	IFN CSM01$,<
	PEN.1:	MOVEI	S1,1			;Set to blue pen
		JRST	NEWPEN

	PEN.2:	MOVEI	S1,2			;Set to black pen
		JRST	NEWPEN

	PEN.3:	MOVEI	S1,3			;Set to red pen and fall into NEWPEN
		JRST	NEWPEN

		ND PENSEP,INCS*4/4		;Pen separation is 1 inch or 3/4 inch

	CHGPEN:	BYTE (6) CNGP,PNDN,0		;Codes to change to pen #1
		BYTE (6) CNGP,PEN2,PNDN,0	;			#2
		BYTE (6) CNGP,PEN3,PNDN,0	;			#3


	;Routine to change pens.  Called with pen number in S1, trashes it and S2.

	NEWPEN:	$SAVE	<P1,P2>			;Save preserved ACs
	;Make sure pen number in S1 is between 1 and 3 inclusive
		SUBI	S1,1			;Change to number from 0 to 2
		IDIVI	S1,3			;Set S2 modulo 3
		AOS	P2,S2			;Copy new pen number (from 1 to 3)

		CSMEDT	08,2	;PTC-6 Plotter Controller, part 2 in NEWPEN
	IFN CSM08$,<	;Special codes for PTC-6
		SKIPE	J$TTY(J)		;Using a terminal line?
		 JRST	[PUSHJ	P,PTCPEN##	  ;Yes, tell it (pen number in S2)
			 JRST	NEWPN2	]	  ;Then move the pen holder
	>  ;End of IFN CSM08$
		MOVEI	P1,CHGPEN-1(S2)		;Get addr of data
		HRLI	P1,(POINT 6,)		;Make into byte pointer
		PUSHJ	P,PENUP			;Raise any and all pens

	;Output the codes to select new pen (even if it was previously selected)

	NEWPN1:	ILDB	C,P1			;Get a byte
		PUSHJ	P,PLTBTX		;Send to plotter (even if no-op)
		JUMPN	C,NEWPN1		;Loop till no-op is sent


	;When pen #1 is positioned at Y=5.0, then pen #2 is at Y=4.0 and pen #3
	;is at Y=3.0.  Therefore, when changing from pen #1 to pen #2 (or 2 to 3),
	;the pen holder must be moved 1.0 inches in the +Y direction, without
	;affecting J$YPOS and in spite of J$YMAX and J$YMIN.

	NEWPN2:	MOVE	P1,P2			;Copy new pen number
		SUB	P1,J$PENN(J)		;Find change (+1 if from pen 1 to pen 2)
		JUMPE	P1,.POPJ		;All done if same as previous pen
		EXCH	P2,J$PENN(J)		;Set new, get old
		JUMPE	P2,.POPJ		;All done if called from P$CPEN

		IMULI	P1,PENSEP		;Distance between pens
		SKIPL	P1			;If going plus,
		 ADDM	P1,J$YMAX(J)		; allow blue pen to move off the paper
		SKIPG	P1			;If going minus,
		 ADDM	P1,J$YMIN(J)		; allow red pen to move off the paper

		MOVE	T1,J$XPOS(J)		;No change in X
		MOVE	T2,P1			;Delta Y
		ADD	T2,J$YPOS(J)		;New Y position
		MOVEI	T3,PN.UP		;Raise the pen
		PUSHJ	P,PLOT			;Move the pen holder into position

		MOVNS	P1			;Cancel the offset
		SKIPG	P1			;If used to be positive,
		 ADDM	P1,J$YMAX(J)		; reset max limit
		SKIPL	P1			;If used to be negative,
		 ADDM	P1,J$YMIN(J)		; reset min limit
		ADDM	P1,J$YPOS(J)		;New pen is where previous one was
		POPJ	P,

	;Routine to output bytes to plotter, passing nulls and CNGP codes correctly.
	;Note: When changing pens, the first PNDN code does NOT lower the pen.

	PLTBTX:	MOVEI	S1,PLTMOV		;Load # tics for movement
		CAIN	C,PNDN			;Pen down code?
		 MOVEI	S1,PLTPEN		;Load # tics for pen up/down
		ADDM	S1,J$PTIC(J)		;Add in for accounting
		PJRST	OUTBYT			;Bypass J$ROTA check
	>  ;End of IFN CSM01$
	SUBTTL	Plotter service -- DEVOUT output errors
 REP 7/77
	; error return. Just siz we're nice guys, we'll bitch at the operator
 WIT
	; error return. Just cuz we're nice guys, we'll bitch at the operator
 REP 3/78

	P$BANN:	PUSHJ	P,P$CPEN		;RE-CALIBRATE THE PEN
 WIT
		CSMEDT	03,1	;Banner changes, part 1 at P$BANN:
	;*; IFN CSM03$,<ND NAMSIZ,1>
		ND NAMSIZ,3	;User's name will be 3 times larger than other text

	P$BANN:	CSMEDT	08,3	;PTC-6 Plotter Controller, part 3 at P$BANN
	IFN CSM08$,<
		SKIPE	J$TTY(J)		;PTC-6 controller?
		 PUSHJ	P,[MOVEI T1,PLTPEN	  ;Yes, positive to use CR handshake
			   PUSHJ P,PTCINI##	  ;Initialize terminal
			   PJRST OUTRSP	]	  ;Output string to TTY
	>  ;End of IFN CSM08$

		PUSHJ	P,P$CPEN		;RE-CALIBRATE THE PEN
 REP 12/78
		ADD	T1,J$XPOS(J)		;POINT TO NEXT LINE
		MOVE	T2,J$YMIN(J)		;GET MINIMUM Y POSITION
		MOVEI	T3,3			;PEN UP
 WIT

	IFN NAMSIZ-1,<	;Start a separate line
		ADD	T1,J$XPOS(J)		;POINT TO NEXT LINE
		MOVE	T2,J$YMIN(J)		;GET MINIMUM Y POSITION
	>  ;End of IFN NAMSIZ-1
	IFE NAMSIZ-1,<	;Put LIMIT on same line as user name
		MOVE	T2,T1			;Copy character size
		ADD	T2,J$YPOS(J)		;Space over a bit in plus-Y direction
		MOVE	T1,J$XPOS(J)		;Current X position
	>  ;End of IFN NAMSIZ-1

		MOVEI	T3,PN.UP		;Pen up
 REP 16/79
		SKIPE	J$DSPN(J)		;WAS IT /DISPOSE:RENAME ?
		MOVEI	S2,[ITEXT (< (^W/J$DSPN(J)/.^W/J$DSPX(J)/)>)] ;YES
		$TEXT	(DEPBP,<* File: ^F/@J$DFDA(J)/^I/(S2)/ created:^H/S1/ *^0>)
 WIT
		SKIPE	J$DSPN(J)		;WAS IT /DISPOSE:RENAME?
		MOVEI	S2,[ITEXT (< (^W/J$DSPN(J)/.^W/J$DSPX(J)/)>)] ;YES

		CSMEDT	02,3	;Halfword format, part 3 at P$HEA1:-2
	IFE CSM02$,< $TEXT (DEPBP,<* File: ^F/@J$DFDA(J)/^I/(S2)/ created:^H/S1/ *^0>) >
	IFN CSM02$,< $TEXT (DEPBP,<* File: ^F/@J$DFDA(J)/^I/(S2)/ *^0>) >
				;CSM internal headers have creation date/time
 REP 22/79
		IMULI	T1,4			;LEAVE THIS MUCH SPACE
		ADD	T1,J$XPOS(J)		;OFFSET BY CURRENT POSITION
		MOVE	T2,J$YMIN(J)		;GET MINIMUM Y POSITION
		MOVEI	T3,3			;PEN GOES UP
 WIT
		ADD	T1,J$XPOS(J)		;OFFSET BY CURRENT POSITION
		MOVE	T2,J$YMIN(J)		;GET MINIMUM Y POSITION
		MOVEI	T3,PN.UP		;Pen up
 INS 29/79
	IFN CSM01$,<	;Allow plots to butt up against each other
		ADDI	T1,INCS/2		;Set lowest seen to 1/2 inch margins
		MOVEM	T1,J$XLOW(J)		;(not fully implemented yet)
	>  ;End of IFN CSM01$
 REP 7/80
		MOVEI	T3,3			;WITH PEN UP
		PUSHJ	P,PLOT			;POSITION PEN
 WIT
		MOVEI	T3,PN.UP		;Pen up
		PUSHJ	P,PLOT			;POSITION PEN

		CSMEDT	08,4	;PTC-6 Plotter Controller, part 4 at end of P$EOF
	IFN CSM08$,<	;Call PTCOUT instead of OUTOUT
		SKIPE	J$TTY(J)		;PTC-6 controller?
		 JRST	[PUSHJ P,PTCOUT##	  ;Yes, raise pen
			 PJRST OUTRSP	]	  ;Wait for response
	>  ;End of IFN CSM08$

 REP 4/81
	P$TRAI:	PUSHJ	P,P$DASH		;SEPARATE FROM LAST FILE
 WIT
	P$TRAI:	CSMEDT	03,3	;Banner changes, part 3 at P$TRAI:
	IFE CSM03$,<	;This test prevents error messages from coming out
		PUSHJ	P,P$DASH		;SEPARATE FROM LAST FILE
 REP 8/81
		SKIPN	J$XERR(J)		;ANY ERROR TEXT ?
		JRST	P$TRA0			;NO - ONWARD
		PUSHJ	P,P$CHKS		;COMPUTE CHARACTER SIZE
		ADD	T1,J$XPOS(J)		;POINT TO NEXT LINE
		MOVE	T2,J$YMIN(J)		;GET MINIMUM Y POSITION
		MOVEI	T3,3			;PEN UP
 WIT
	>  ;End of IFE CSM03$
	IFN CSM03$,<	;Output dashed line only if text will be plotted
		PUSH	P,J$PTIC(J)		;Don't charge for plotter overhead
		SKIPN	J$FTRA(J)		;Plot the trailer?
		SKIPE	J$XERR(J)		; or an error message?
		 PUSHJ	P,P$DASH		;Yes, separate text from plot
	>  ;End of IFN CSM03$

		SKIPN	J$XERR(J)		;ANY ERROR TEXT?
		JRST	P$TRA0			;NO - ONWARD
		PUSHJ	P,P$CHKS		;COMPUTE CHARACTER SIZE
		IMULI	T1,2		;[CSM]	;Make room for characters
		ADD	T1,J$XPOS(J)		;POINT TO NEXT LINE
		MOVE	T2,J$YMIN(J)		;GET MINIMUM Y POSITION
		MOVEI	T3,PN.UP		;Pen up
 REP 19/81
	P$TRA0:	MOVEI	S1,[ASCIZ |End|]	;GET LINE IDENTIFIER
		PUSHJ	P,PLTJOB		;PLOT JOB LINE

	P$TRA1:	PUSHJ	P,P$CHKS		;COMPUTE CHARACTER SIZE
		ADD	T1,J$XPOS(J)		;POINT TO NEXT LINE
		MOVE	T2,J$YMIN(J)		;GET MINIMUM Y POSITION
		MOVEI	T3,3			;PEN UP
 WIT
	P$TRA0:
	IFN CSM03$,<	;Check for /TRAILER after plotting error message
		SKIPN	J$FTRA(J)		;Trailer wanted?
		 JRST	P$TRA3			;No, skip job line and summary
	>  ;End of IFN CSM03$

		MOVEI	S1,[ASCIZ |End|]	;GET LINE IDENTIFIER
		PUSHJ	P,PLTJOB		;PLOT JOB LINE
	CONT.	(P$TRAI)


	P$TRA1:	PUSHJ	P,P$CHKS		;COMPUTE CHARACTER SIZE

	IFN NAMSIZ-1,<	;Start a separate line
		ADD	T1,J$XPOS(J)		;POINT TO NEXT LINE
		MOVE	T2,J$YMIN(J)		;GET MINIMUM Y POSITION
	>  ;End of IFN NAMSIZ-1
	IFE NAMSIZ-1,<	;Put SUMMARY on same line as user name
		MOVE	T2,T1			;Copy character size
		ADD	T2,J$YPOS(J)		;Space over a bit in plus-Y direction
		MOVE	T1,J$XPOS(J)		;Current X position
	>  ;End of IFN NAMSIZ-1

		MOVEI	T3,PN.UP		;Pen up
 REP 33/81

	P$TRA2:	MOVE	T1,(P)			;GET # TICS FOR JOB
		IDIV	T1,J$PTPM(J)		;T1:= MINUTES, T2:= FRACTION
		IMULI	T2,^D1000		;MAKE IT DECIMAL
		IDIV	T2,J$PTPM(J)		;T2:= DECIMAL FRACTION OF A MINUTE
		$TEXT	(DEPBP,< plotted in ^D/T1/.^D3L0/T2/ minutes^0>)
 WIT
	P$TRA2:	MOVE	T1,(P)			;GET # TICS FOR JOB
		IDIV	T1,J$PTPM(J)		;T1:= MINUTES, T2:= FRACTION
		IMULI	T2,^D10			;[CSM] 1 decimal place (=6 seconds)
		IDIV	T2,J$PTPM(J)		;T2:= DECIMAL FRACTION OF A MINUTE
		$TEXT	(DEPBP,< plotted in ^D/T1/.^D/T2/ minutes^0>)
 REP 49/81
		MOVEI	T3,3			;PEN UP
 WIT
		MOVEI	T3,PN.UP		;Pen up
 INS 55/81

		CSMEDT	08,5	;PTC-6 Plotter Controller, part 5 at end of P$TRAI
	IFN CSM08$,<
		SKIPE	J$TTY(J)		;PTC-6 controller?
		 PUSHJ	P,[PUSHJ P,PTCOUT##	  ;Yes, raise pen
			   PUSHJ P,OUTRSP	  ;Wait for response
			   PUSHJ P,PTCFIN##	  ;Finish up and deselect
			   PJRST OUTSTG	]	  ;Output string to TTY
	>  ;End of IFN CSM08$

 REP 11/82
		MOVE	T2,J$YMIN(J)		;GET MINIMUM Y POSITION
		MOVEI	T3,3			;PEN UP
		PUSHJ	P,PLOT			;POSITION PEN
		MOVE	T1,J$XPOS(J)		;DON'T TOUCH X POSITION
		MOVE	T2,J$YMAX(J)		;GET MAXIMUM Y VALUE
		MOVEI	T3,2			;PEN DOWN
 WIT

		CSMEDT	03,4	;Banner changes, part 4 at P$LINE:+2
	IFE CSM03$,<	;Going from MIN to MAX when pen is near MAX wastes time
		MOVE	T2,J$YMIN(J)		;GET MINIMUM Y POSITION
		MOVEI	T3,PN.UP		;Pen up
		PUSHJ	P,PLOT			;POSITION PEN
		MOVE	T1,J$XPOS(J)		;Use current X position
		MOVE	T2,J$YMAX(J)		;GET MAXIMUM Y VALUE
	>  ;End of IFE CSM03$
	IFN CSM03$,<	;Go to MAX, then to MIN and end there
		MOVE	T2,J$YMAX(J)		;Go to closer end point
		CAIL	T2,INCS*6		;More than 6 inches?
		 MOVEI	T2,INCS*6		;Yes, don't waste inc
		MOVEI	T3,PN.UP		;Pen up
		PUSHJ	P,PLOT			;Position pen
		MOVE	T1,J$XPOS(J)		;Use current X position
		MOVE	T2,J$YMIN(J)		;Go to "HOME" position
	>  ;End of IFE CSM03$
		MOVEI	T3,PN.DWN		;Pen down
 REP 23/82
		MOVEI	T3,3			;PEN UP
 WIT
		MOVEI	T3,PN.UP		;Pen up
 REP 4/83
	; This routine works like P$LINE
	;
	P$DASH:	PUSHJ	P,P$CHKS		;COMPUTE CHARACTER SIZE
		ADD	T1,J$XPOS(J)		;POINT TO NEXT LINE
		MOVE	T2,J$YMIN(J)		;GET MINIMUM Y POSITION
		MOVEI	T3,3			;PEN UP
 WIT
	; This routine works like P$LINE, but line is drawn with dashes.
	; The length of each dash is the same as the height of the characters

	P$DASH:	PUSHJ	P,P$CHKS		;COMPUTE CHARACTER SIZE
		ADD	T1,J$XPOS(J)		;POINT TO NEXT LINE

		CSMEDT	03,5	;Banner changes, part 5 at P$DASH:+3
	IFE CSM03$,< MOVE  T2,J$YMIN(J) >	;GET MINIMUM Y POSITION
	IFN CSM03$,<
		MOVE	T2,J$YMAX(J)		;Get maximum Y position
		CAIL	T2,INCS*6		;More than 6 inches?
		 MOVEI	T2,INCS*6		;Yes, don't waste time and ink
	>  ;End of IFN CSM03$
		MOVEI	T3,PN.UP		;Pen up
 REP 13/83
		ADD	T1,J$YPOS(J)		;ADD TO Y POSITION
		CAML	T1,J$YMAX(J)		;GONE TOO FAR ?
 WIT
	IFE CSM03$,<
		ADD	T1,J$YPOS(J)		;ADD TO Y POSITION
		CAML	T1,J$YMAX(J)		;GONE TOO FAR?
	>  ;End of IFE CSM03$
	IFN CSM03$,<
		MOVNS	T1			;Make negative
		ADD	T1,J$YPOS(J)		;Decrement Y position
		CAMG	T1,J$YMIN(J)		;Gone too far?
	>  ;End of IFN CSM03$
 REP 18/83
		MOVEI	T3,2			;PEN DOWN
 WIT
		MOVEI	T3,PN.DWN		;Pen down
 REP 22/83
		ADD	T1,J$YPOS(J)		;ADD TO Y POSITION
		CAML	T1,J$YMAX(J)		;GONE TOO FAR ?
 WIT
	IFE CSM03$,<
		ADD	T1,J$YPOS(J)		;ADD TO Y POSITION
		CAML	T1,J$YMAX(J)		;GONE TOO FAR?
	>  ;End of IFE CSM03$
	IFN CSM03$,<
		MOVNS	T1			;Make negative
		ADD	T1,J$YPOS(J)		;Decrement Y position
		CAMG	T1,J$YMIN(J)		;Gone too far?
	>  ;End of IFN CSM03$
 REP 27/83
		MOVEI	T3,3			;PEN UP
 WIT
		MOVEI	T3,PN.UP		;Pen up
 REP 5/84
	; Call:	MOVEI	S1,[ASCIZ |Start|]	;OR [ASCIZ |Stop|]
 WIT
	; Call:	MOVEI	S1,[ASCIZ |Start|]	;OR [ASCIZ |End|]
 REP 13/84
		MOVEI	T3,3			;PEN UP
		PUSHJ	P,PLOT			;POSITION PEN
		PUSHJ	P,SETTBF		;SET UP TEXT BUFFER
 WIT
		MOVEI	T3,PN.UP		;Pen up
		PUSHJ	P,PLOT			;POSITION PEN
		PUSHJ	P,SETTBF		;SET UP TEXT BUFFER

		CSMEDT	03,6	;Banner changes, part 6 at PLTJOB:+8
	IFN CSM03$,< PUSHJ P,PEN.3 >		;Do "*START*" in red

 REP 21/84
		PUSHJ	P,P$CHKS		;COMPUTE CHARACTER SIZE
		IMULI	T1,^D4			;GET STARTING POSITION
		ADD	T1,J$XPOS(J)		;OFFSET BY CURRENT POSITION
		MOVE	T2,J$YMIN(J)		;GET MINIMUM Y POSITION
		MOVEI	T3,3			;PEN UP
 WIT

		PUSHJ	P,P$CHKS		;COMPUTE CHARACTER SIZE
		IMULI	T1,NAMSIZ+1	;[CSM]	;Size of name plus blank space
		ADD	T1,J$XPOS(J)		;OFFSET BY CURRENT POSITION
		MOVE	T2,J$YMIN(J)		;GET MINIMUM Y POSITION
		MOVEI	T3,PN.UP		;Pen up
 REP 29/84
		IMULI	T1,3			;COMPUTE NEW CHARACTER SIZE
		MOVEM	T1,J$CSIZ(J)		;STORE IT

		;PLOT THE USERS NAME

	TOPS10<	DMOVE	T3,.EQOWN(J)		
 WIT
		IMULI	T1,NAMSIZ	;[CSM]	;The name is bigger than other text
		MOVEM	T1,J$CSIZ(J)		;STORE IT

	IFN CSM03$,< PUSHJ P,PEN.2 >		;Do user's name in black

	CONT.	(PLTJOB)
		;PLOT THE USERS NAME

	TOPS10<	DMOVE	T3,.EQOWN(J)		;Name and PPN, 28 chars max
 REP 43/84
		MOVEI	T3,3			;PEN UP
		PUSHJ	P,PLOT			;POSITION PEN
 WIT
		MOVEI	T3,PN.UP		;Pen up
		PUSHJ	P,PLOT			;POSITION PEN

	IFN CSM03$,< PUSHJ P,PEN.1 >		;Next dividing line will be blue

 INS 13/85
		MOVEI	S1,.CHNUL	;[CSM]	;Terminate previous string
		PUSHJ	P,DEPBP		;[CSM]	; (in case of /NOTE: in SPFORM.INI)
 REP 19/85
		MOVEI	T3,3			;PEN UP
 WIT
		MOVEI	T3,PN.UP		;Pen up
 REP 23/85
		CAIN	C,200			;DONE ALL CHARACTERS ?
 WIT
		CAIN	C,200			;DONE ALL CHARACTERS?
 REP 31/85
		SOJLE	P1,TEST.1		;DONE WITH THIS LINE ?
 WIT
		SOJLE	P1,TEST.1		;DONE WITH THIS LINE?
 REP 3/86

	P$CPEN:	MOVE	T1,J$YMAX(J)		;GET THE MAXIMUM Y VALUE WE KNOW ABOUT
 WIT
	;This is the only place that J$XPOS is reset.  It is called from P$BANN.

	P$CPEN:	MOVE	T1,J$YMAX(J)		;GET THE MAXIMUM Y VALUE WE KNOW ABOUT

		CSMEDT	01,4	;3-pen plotter, part 4 at end of P$CPEN
	IFN CSM01$,<	;Assume pen is positioned close to the origin
		CAIL	T1,INCS*4		;More than 4 inches?
		 MOVEI	T1,INCS*4		;Yes, don't waste time ramming the pen
	>  ;End of IFN CSM01$

 REP 8/86
		MOVE	T1,J$XPOS(J)		;DON'T TOUCH THE X POSITION
		MOVEI	T2,0			;RAM THE PEN INTO THE AXIS
		MOVEI	T3,3			;PEN UP
 WIT
		MOVE	T1,J$XPOS(J)		;Use current X position
		MOVEI	T2,0			;RAM THE PEN INTO THE AXIS
		MOVEI	T3,PN.UP		;Pen up
 REP 18/86
		MOVEI	T3,3			;PEN UP
 WIT
		MOVEI	T3,PN.UP		;Pen up
 REP 23/86
		POPJ	P,			;RETURN
	SUBTTL	Plotter service -- Compute chracter size
 WIT

	IFN CSM01$,<	;RECAL has positioned pen #1 at YMIN
		SETZM	J$PENN(J)		;Flag that pen holder was reset
		MOVEI	S1,1			;Select pen number 1
		PUSHJ	P,NEWPEN		;Tell the plotter which pen to use
	>  ;End of IFN CSM01$

		POPJ	P,			;RETURN
	SUBTTL	Plotter service -- Compute character size
 INS 7/87

		CSMEDT	01,5	;3-Pen plotter, part 5 at P$CHKS:+3
	IFN CSM01$,<	;Don't plot giant letters on 36 inch wide paper
		CAIL	T1,INCS/6		;Bigger than 1/6 inch?
		 MOVEI	T1,INCS/6		;Yes, reduce size
	>  ;End of IFN CSM01$

 REP 43/88
		MOVEI	T3,3			;PEN UP BEFOR PLOTTING
 WIT
		MOVEI	T3,PN.UP		;Pen up
 REP 7/89
	;		1	No Change in Pen
	;		2	Pen Down before Plotting
	;		3	Pen Up before moving
	;
	PLOT:	$SAVE	<T1,T2,T3,T4>		;PRESERVE TEMPORARIES
		CAIG	T3,1			;CHANGE REQUESTED?
		JRST	PLT.1			;NO..PROCEED
		SUBI	T3,3			;YES..GET -1  OR 0
 WIT
		PN.SAM==1	;No Change in Pen
		PN.DWN==2	;Pen Down before Plotting
		PN.UP== 3	;Pen Up before moving
	;
	PLOT:	$SAVE	<T1,T2,T3,T4>		;PRESERVE TEMPORARIES

		CSMEDT	08,6	;PTC-6 Plotter Controller, part 6 at PLOT:+1
	IFN CSM08$,<	;Delay testing of T3 if output to a terminal
		SKIPN	J$TTY(J)		;Is the plotter really a TTY?
	>  ;End of IFN CSM08$

		CAIG	T3,PN.SAM		;CHANGE REQUESTED?
		JRST	PLT.1			;NO..PROCEED
		SUBI	T3,PN.UP		;Yes, get -1  or 0
 INS 22/89
		SUB	T2,J$YPOS(J)		;COMPUTE DELTA Y

	IFN CSM08$,<	;Call external routine if PTC-6
		SKIPE	J$TTY(J)		;TTY?       (T1, T2, and T3 set up)
		 JRST	PTCMV			;Yes, calculate character string
	>  ;End of IFN CSM08$

 DEL 25/89
		SUB	T2,J$YPOS(J)		;COMPUTE DELTA Y
 INS 1/91
	SUBTTL	Plotter service -- PTC-6 interface

	IFN CSM08$,<	;T1 & T2 have delta movement, T3 has 2 or 3
	PTCMV:	ADDM	T1,J$XPOS(J)		;Update position
		ADDM	T2,J$YPOS(J)
		MOVE	S1,J$XPOS(J)		;Get new X position
		CAIL	T3,3			;Pen up?
		 JRST	PTCMV1			;No, skip next tests
		CAMLE	S1,J$XLIM(J)		;Highest seen so far?
		 MOVEM	S1,J$XLIM(J)		;Yes
		CAMGE	S1,J$XLOW(J)		;Closest to the origin?
		 MOVEM	S1,J$XLOW(J)		;Yes

	;T1, T2, and T3 are set up with delta-X, delta-Y, and pen up/down code

	PTCMV1:	PUSHJ	P,PTCMOV##		;Translate move, fall into OUTRSP

				PAGE
	;Routine to output the string pointed to by T1 and wait for response.
	;S1 has accumulated increments for the last 4 buffers, to be used to
	;predict how long it will take for the PTC-6 to respond.

	OUTRSP:	JUMPE	T1,.POPJ		;Don't wait if no string
		IMULI	S1,PLTMOV		;Number of ticks to move
		LSH	S1,-2			;S1 has count for 4 buffers
		ADDM	S1,J$PTIC(J)		;Predict elapsed time
		IMULI	S1,^D60*4		;Cancel LSH, use seconds not minutes
		IDIV	S1,J$PTPM(J)		;Number of seconds required
		ADDI	S1,^D<512*10/CSM08$>	;512 chars take 2 seconds at 2400 baud
		MOVNM	S1,J$NACK(J)		;Negative to delay the complaints

	OUTRS1:	PUSHJ	P,OUTSTG		;Send the string

	OUTRS2:	PUSHJ	P,TIWAIT		;Get response, waiting up to 30 seconds
		JUMPT	OUTRS3			;Got it
		TXNE	S,RQB+ABORT		;REQUEUE or ABORT?
		 $RETF				;Yes, give up
		PUSHJ	P,PTCOUT##		;Send string to raise pen
		SETZM	J$PPOS(J)		;(just to get controller to respond)
		JRST	OUTRS1			;Loop until response or REQUEUE

	OUTRS3:	CAIE	S1,.CHCRT		;CR at end?
		 JRST	OUTRS2			;No, skip over "0", "C"
		PJRST	TTYIN			;Yes, snarf up the LF (if it's there)


	;Routine to output the string pointed to by T1.
	;The Monitor will put the job in "TO" Terminal Output wait if there are more
	;than 400 characters in the TTY chunks.

		TOMAX=^D248			;Avoid output wait for TTY

	OUTSTG:	JUMPE	T1,.POPJ		;Return if nothing to do
		HRLI	T1,(POINT 7,)		;Make into ASCII byte pointer
	OUTST1:	MOVEI	S1,0			;Clear byte count

	OUTST2:	ILDB	C,T1			;Get a character
		JUMPE	C,OUTOUT		;Stop on null, output buffer, return
		PUSHJ	P,OUTBYT		;Send it
		CAIG	S1,TOMAX		;Almost enough to cause 'TO' wait?
		 AOJA	S1,OUTST2		;Loop till end of ASCIZ
		PUSHJ	P,OUTOUT		;Dump partial buffer
		$DSCHD	(TOMAX*^D10/CSM08$)	;Wait 1 second at 2400 baud
		JRST	OUTST1			;(gives checkpoint routine a chance)
	>  ;End of IFN CSM08$
 REP 11/91
	ROTAB:	EXP 0						;NO MOVEMENT
		BYTE (18) 106 (2) 0 (4) XYU ,XYL ,XYD ,XYR 	;MOVE DOWN
		BYTE (18) 102 (2) 0 (4) XYD ,XYR ,XYU ,XYL 	;MOVE UP
		BYTE (18) 114 (2) 0 (4) PEN3,PEN3,PEN3,PEN3	;SELECT PEN3
		BYTE (18) 104 (2) 0 (4) XYR ,XYU ,XYL ,XYD 	;MOVE RIGHT
		BYTE (18) 105 (2) 0 (4) XYDL,XYUL,XYUR,XYDR	;MOVE DOWN+RIGHT
		BYTE (18) 103 (2) 0 (4) XYDR,XYDL,XYUL,XYUR	;MOVE UP+RIGHT
		EXP -1						;ILLEGAL
		BYTE (18) 100 (2) 0 (4) XYL ,XYD ,XYR ,XYU 	;MOVE LEFT
		BYTE (18) 107 (2) 0 (4) XYUL,XYUR,XYDR,XYDL	;MOVE DOWN+LEFT
		BYTE (18) 101 (2) 0 (4) XYUR,XYDR,XYDL,XYUL	;MOVE UP+LEFT
		EXP -1						;ILLEGAL
		BYTE (18) 113 (2) 0 (4) PEN2,PEN2,PEN2,PEN2	;SELECT PEN 2
		EXP -1						;ILLEGAL
		EXP -1						;ILLEGAL
		BYTE (18) 112 (2) 0 (4) CNGP,CNGP,CNGP,CNGP	;CHANGE PENS
 WIT
	ROTAB:	EXP 0						; 0 NO MOVEMENT
		BYTE (18) 106 (2) 0 (4) XYU ,XYL ,XYD ,XYR 	; 1 Minus X
		BYTE (18) 102 (2) 0 (4) XYD ,XYR ,XYU ,XYL 	; 2 Plus X
		BYTE (18) 114 (2) 0 (4) PEN3,PEN3,PEN3,PEN3	; 3 SELECT PEN3
		BYTE (18) 104 (2) 0 (4) XYR ,XYU ,XYL ,XYD 	; 4 Plus Y
		BYTE (18) 105 (2) 0 (4) XYDL,XYUL,XYUR,XYDR	; 5 Plus Y & Minus X
	;[CSM]	BYTE (18) 103 (2) 0 (4) XYDR,XYDL,XYUL,XYUR	;MOVE UP+RIGHT
		BYTE (18) 103 (2) 0 (4) XYDR,XYUR,XYUL,XYDL;[CSM] 6 Plus Y & Plus X
		EXP -1						; 7 ILLEGAL
		BYTE (18) 100 (2) 0 (4) XYL ,XYD ,XYR ,XYU 	;10 Minus Y
	;[CSM]	BYTE (18) 107 (2) 0 (4) XYUL,XYUR,XYDR,XYDL	;MOVE DOWN+LEFT
		BYTE (18) 107 (2) 0 (4) XYUL,XYDL,XYDR,XYUR;[CSM]11 Minus Y & Minus X
		BYTE (18) 101 (2) 0 (4) XYUR,XYDR,XYDL,XYUL	;12 Minus Y & Plus X
		EXP -1						;13 ILLEGAL
		BYTE (18) 113 (2) 0 (4) PEN2,PEN2,PEN2,PEN2	;14 SELECT PEN 2
		EXP -1						;15 ILLEGAL
		EXP -1						;16 ILLEGAL
		BYTE (18) 112 (2) 0 (4) CNGP,CNGP,CNGP,CNGP	;17 CHANGE PENS
 REP 10/92
	PLTBYT:	TRZE	C,PNUP			;TEST AND CLEAR PEN UP CODE
 WIT
	PLTBYT:	$SAVE	<S1,S2>		;[CSM]	;Preserve ACs
		TRZE	C,PNUP			;TEST AND CLEAR PEN UP CODE
 REP 15/92
	PLTXYD:	TRNN	C,XYD			;GOING DOWN ?
		JRST	PLTXYU			;NO
		AOS	S1,J$XPOS(J)		;+1
		CAMG	S1,J$XMAX(J)		;BEYOND X MAXIMUM ?
		CAMG	S1,J$XMIN(J)		;WITHIN X BOUNDS ?
		TRZ	C,XYD!XYU		;STOP MOVING

	PLTXYU:	TRNN	C,XYU			;GOING UP ?
		JRST	PLTXYL			;NO
		SOS	S1,J$XPOS(J)		;-1
		CAMGE	S1,J$XMAX(J)		;BEYOND X MAXIMUM ?
		CAMGE	S1,J$XMIN(J)		;WITHIN X BOUNDS ?
		TRZ	C,XYD!XYU		;STOP MOVING

	PLTXYL:	TRNN	C,XYL			;GOING LEFT ?
		JRST	PLTXYR			;NO
		AOS	S2,J$YPOS(J)		;+1
		CAMG	S2,J$YMAX(J)		;BEYOND Y MAXIMUM ?
		CAMG	S2,J$YMIN(J)		;WITHIN Y BOUNDS ?
		TRZ	C,XYR!XYL		;STOP MOVING

	PLTXYR:	TRNN	C,XYR			;GOING RIGHT ?
		JRST	PLTB.6			;NO
		SOS	S2,J$YPOS(J)		;-1
		CAMGE	S2,J$YMAX(J)		;BEYOND Y MAXIMUM ?
		CAMGE	S2,J$YMIN(J)		;WITHIN Y BOUNDS ?
		TRZ	C,XYR!XYL		;STOP MOVING

	PLTB.6:	SKIPN	J$PPOS(J)		;IS PEN DOWN?
		PJRST	PLTB.8			;NO..DON'T RECORD MAX POSITIONS
 WIT
	PLTXYD:	TRNN	C,XYD			;GOING DOWN?
		JRST	PLTXYU			;NO
		TRNE	C,XYU		;[CSM]	;Going +X and -X at the same time?
		 JRST	PLTB.8		;[CSM]	;Yes, this is a change-pen code
		AOS	S1,J$XPOS(J)		;+1
		CAMG	S1,J$XMAX(J)		;BEYOND X MAXIMUM?
		CAMG	S1,J$XMIN(J)		;WITHIN X BOUNDS?
		TRZ	C,XYD!XYU		;STOP MOVING

	PLTXYU:	TRNN	C,XYU			;GOING UP?
		JRST	PLTXYL			;NO
		SOS	S1,J$XPOS(J)		;-1
		CAMGE	S1,J$XMAX(J)		;BEYOND X MAXIMUM?
		CAMGE	S1,J$XMIN(J)		;WITHIN X BOUNDS?
		TRZ	C,XYD!XYU		;STOP MOVING

	PLTXYL:	TRNN	C,XYL			;GOING LEFT?
		JRST	PLTXYR			;NO
		TRNE	C,XYR		;[CSM]	;Going +Y and -Y at the same time?
		 JRST	PLTB.8		;[CSM]	;Yes, this is a change-pen code
		AOS	S2,J$YPOS(J)		;+1
		CAMG	S2,J$YMAX(J)		;BEYOND Y MAXIMUM?
		CAMG	S2,J$YMIN(J)		;WITHIN Y BOUNDS?
		TRZ	C,XYR!XYL		;STOP MOVING

	PLTXYR:	TRNN	C,XYR			;GOING RIGHT?
		JRST	PLTB.6			;NO
		SOS	S2,J$YPOS(J)		;-1
		CAMGE	S2,J$YMAX(J)		;BEYOND Y MAXIMUM?
		CAMGE	S2,J$YMIN(J)		;WITHIN Y BOUNDS?
		TRZ	C,XYR!XYL		;STOP MOVING

		CONT.	(PLTBYT)
	PLTB.6:	SKIPN	J$PPOS(J)		;IS PEN DOWN?
		PJRST	PLTB.8			;NO..DON'T RECORD MAX POSITIONS
		MOVE	S1,J$XPOS(J)	;[CSM]	;In case of no AOS or SOS was done
 INS 50/92
		CSMEDT	01,6	;3-pen plotter, part 6 at PLTB.6:+5
	IFN CSM01$,<	;Remember X minimum for positioning trailer after X maximum
		CAMGE	S1,J$XLOW(J)		;Smaller than the previous XLOW?
		 MOVEM	S1,J$XLOW(J)		;Yes, user went near -X boundry
						;therefore put dashed line close to plot
	>  ;End of IFN CSM01$

 REP 5/95
	PLTTAB:

	C%000:	Z				;NULL IS ILLEGAL
	C%001:	XX <200,542,702,142,604,FIN>
	C%002:	XX <144,563,603,622,621,600,560,541,542,563,603,624,FIN>
	C%003:	XX <561,701,702,663,642,241,643,624,603,601,FIN>
	C%004:	XX <602,544,FIN>
	C%005:	XX <220,624,564,FIN>
	C%006:	XX <243,641,620,560,541,543,200,602,FIN>
	C%007:	XX <141,641,240,644,243,543,FIN>
	C%010:	XX <602,240,544,FIN>
	C%011:	XX <240,661,604,564,543,562,602,644,FIN>
	C%012:	XX <242,641,620,560,541,543,564,624,643,642,702,704,FIN>
	C%013:	XX <160,541,562,662,703,664,FIN>
	C%014:	XX <240,644,302,562,160,564,FIN>
	C%015:	XX <200,560,541,543,564,624,643,641,620,600,604,242,542,FIN>
	C%016:	XX <202,561,600,620,641,622,602,563,604,624,643,622,FIN>
	C%017:	XX <204,623,621,600,560,541,543,564,644,702,701,FIN>
	C%020:	XX <244,641,620,560,541,544,FIN>
	C%021:	XX <240,643,624,564,543,540,FIN>
	C%022:	XX <160,640,661,663,644,564,FIN>
	C%023:	XX <260,600,561,563,604,664,FIN>
	C%024:	XX <300,600,542,604,704,240,644,FIN>
	C%025:	XX <544,704,700,221,624,206>
	C%026:	XX <100,640,600,561,562,603,643,603,564,FIN>
	C%027:	XX <143,564,603,164,560,221,640,661,240,644,FIN>
	C%030:	XX <541,561,600,620,641,643,624,604,563,543,544,FIN>
	C%031:	XX <220,624,262,624,562,FIN>
	C%032:	XX <160,601,543,564,FIN>
	C%033:	XX <602,642,704,244,640,200,604,FIN>
	C%034:	XX <160,563,303,620,623,FIN>
	C%035:	XX <300,623,620,160,563,FIN>
	C%036:	XX <160,564,224,620,260,664,FIN>
	C%037:	XX <200,542,604,FIN>
 WIT
	PLTTAB:				;Characters used at Stanford (SUAI)

	C%000:	Z				;NULL IS ILLEGAL
	C%001:	XX <200,542,702,142,604,FIN>			;Down arrow
		.XCREF				;[CSM] Don't CREF the rest
	C%002:	XX <144,563,603,622,621,600,560,541,542,563,603,624,FIN> ;Alpha
	C%003:	XX <561,701,702,663,642,241,643,624,603,601,FIN>;Beta
	C%004:	XX <602,544,FIN>				;Up angle bracket
	C%005:	XX <220,624,564,FIN>				;Negation
	C%006:	XX <243,641,620,560,541,543,200,602,FIN>	;Epsilon
	C%007:	XX <141,641,240,644,243,543,FIN>		;Pi
	C%010:	XX <602,240,544,FIN>				;Lambda
	C%011:	XX <240,661,604,564,543,562,602,644,FIN>	;Gamma
	C%012:	XX <242,641,620,560,541,543,564,624,643,642,702,704,FIN> ;Linefeed
	C%013:	XX <160,541,562,662,703,664,FIN>		;Integral
	C%014:	XX <240,644,302,562,160,564,FIN>		;Plus or Minus
	C%015:	XX <200,560,541,543,564,624,643,641,620,600,604,242,542,FIN> ;CR
	C%016:	XX <202,561,600,620,641,622,602,563,604,624,643,622,FIN> ;Infinity
	C%017:	XX <204,623,621,600,560,541,543,564,644,702,701,FIN>	;Delta
	C%020:	XX <244,641,620,560,541,544,FIN>		;Subset
	C%021:	XX <240,643,624,564,543,540,FIN>		;Element of
	C%022:	XX <160,640,661,663,644,564,FIN>		;Intersection
	C%023:	XX <260,600,561,563,604,664,FIN>		;Union
	C%024:	XX <300,600,542,604,704,240,644,FIN>		;All elements
	C%025:	XX <544,704,700,221,624,206>			;There exists
	C%026:	XX <100,640,600,561,562,603,643,603,564,FIN>	;Mu (micro)
	C%027:	XX <143,564,603,164,560,221,640,661,240,644,FIN>;Double arrow
	C%030:	XX <541,561,600,620,641,643,624,604,563,543,544,FIN> ;Omega
	C%031:	XX <220,624,262,624,562,FIN>			;Left arrow
	C%032:	XX <142,600,642,604,542,FIN>	;Formerly C%175	;Diamond box [CSM]
	C%033:	XX <602,642,704,244,640,200,604,FIN>		;Not equal
	C%034:	XX <160,563,303,620,623,FIN>			;Less or equal
	C%035:	XX <300,623,620,160,563,FIN>			;Greater or equal
	C%036:	XX <160,564,224,620,260,664,FIN>		;Identically
	C%037:	XX <200,542,604,FIN>				;Down angle bracket
 REP 27/98
	C%172:	XX <240,644,540,544,201,603,FIN>
	C%173:	XX <144,543,562,602,621,620,621,642,662,703,704,FIN>
	C%174:	XX <102,702,FIN>
	C%175:	XX <142,600,642,604,542,FIN>
	C%176:	XX <541,562,602,623,624,623,642,662,701,700,FIN>
	C%177:	XX <260,564,FIN>
 WIT
	C%172:	XX <240,644,540,544,201,603,FIN> ;z Lowercase Z
	C%173:	XX <144,543,562,602,621,620,621,642,662,703,704,FIN> ;{
	C%174:	XX <102,702,FIN>		;| Vertical bar
	  ;[CSM] Put close brace and tilde where they belong in the ASCII code
	C%175:	XX <541,562,602,623,624,623,642,662,701,700,FIN> ;} 175, not C%176
	C%176:	XX <160,601,543,564,FIN>	;~ Tilde, formerly C%032
		.CREF			;[CSM]	;OK to CREF now
	C%177:	XX <260,564,FIN>		;\ Backslash, duplicate of C%134
 REP 13/99
		JRST	.RETT			;(11) ACCOUNTING
 WIT

		CSMEDT	04,4	;CSM accounting, part 4 at T$DISP:+11
	IFE CSM04$,< JRST   .RETT >		;(11) ACCOUNTING
	IFN CSM04$,< JRST   CSMACT >		;(11) ACCOUNTING

 REP 8/100
		CAMN	P2,[.INFIN]		;+INFINITY ?
		JRST	T$CHK1			;YES
		CAMG	P1,J$RLIM(J)		;OPERATOR ALLOW LIMIT TO EXCEED ?
		$TEXT	(DEPBP,<punched ^D/P1/ of ^D/J$RLIM(J)/ feet^0>)
		CAMLE	P1,J$RLIM(J)		;OPERATOR ALLOW LIMIT TO EXCEED ?
 WIT
		CAMN	P2,[.INFIN]		;+INFINITY?
		JRST	T$CHK1			;YES
		CAMG	P1,J$RLIM(J)		;OPERATOR ALLOW LIMIT TO EXCEED?
		$TEXT	(DEPBP,<punched ^D/P1/ of ^D/J$RLIM(J)/ feet^0>)
		CAMLE	P1,J$RLIM(J)		;OPERATOR ALLOW LIMIT TO EXCEED?
 INS 11/101

		CSMEDT	07,5	;QUEUE defaults, part 5 at T$PROC:+6
	IFE CSM07$,<	;This code will punch SOS files in BINARY mode
 INS 14/101
	>  ;End of IFE CSM07$
	IFN CSM07$,< JRST  PTASC >		;Default always to ASCII
 REP 24/104
		JUMPF	.RETT			;DONE!!
 WIT
		JUMPF	.RETT			;DONE!
 REP 14/110
		CAIG	S1,^D10			;PUNCH AT LEASE 10 FRAMES
 WIT
		CAIG	S1,^D10			;PUNCH AT least 10 FRAMES
 REP 17/111
	TLET.1:	ILDB	C,S1			;GT SEGMENT BITS
 WIT
	TLET.1:	ILDB	C,S1			;Get SEGMENT BITS
 REP 6/112
	PTPBYT:	PUSH	P,S1			;SAVE FROM
		PUSH	P,S2			; DESTRUCTION
 WIT
	PTPBYT:	$SAVE	<S1,S2>		;[CSM]	;Preserve ACs
 REP 12/112
		CAMLE	S1,J$RLIM(J)		;EXCEEDED LIMIT ?
		PUSHJ	P,FRMLEX		;YES - ASK THE OPERATOR'S ADVICE
		POP	P,S2			;RESTORE
		POP	P,S1			; S1 & S2
		POPJ	P,			;RETURN
 WIT
		CAMLE	S1,J$RLIM(J)		;EXCEEDED LIMIT?
		PUSHJ	P,FRMLEX		;YES - ASK THE OPERATOR'S ADVICE
		POPJ	P,		;[CSM]	;ACs automatically retored on return
 REP 24/112
	PTPREP:	PUSH	P,P1			;SAVE P1
 WIT
	PTPREP:	$SAVE	<P1>		;[CSM]	;Save P1
 DEL 28/112
		POP	P,P1			;RESTORE P1
 REP 32/114
		BYTE (7) 010,034,052,010,010	;
 WIT
		BYTE (7) 010,034,052,010,010	;_
 INS 41/115
			PAGE
		CSMEDT	07,6	;QUEUE defaults, part 6 before DSPMOD:
	IFE CSM07$,<
 INS 53/115
	>  ;End of IFE CSM07$
 REP 25/116
		JRST	CHKS.3			;GET A COMPLETE BLOCK!!
 WIT
		JRST	CHKS.3			;GET A COMPLETE BLOCK!
 INS 1/123
	LITS:	XLIST	;[CSM] Literals
		LIT	;[CSM]
		LIST	;[CSM]

 SUM 114036