	.SYSID <	.TITLE LVU >,< 030>

/

/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

/J.M. WOLFBERG	(S. ROOT)

/LVU - HANDLER FOR LV PRINTER-PLOTTER, FROM LPU UNICHANNEL HANDLER

/

/EDIT #028	SCR	9/4/75	FIX OCTAL-DECIMAL LINE LENGTH GLITCH

/EDIT #029	SCR	9/17/75	USE LV TCB AREA
/EDIT #030	SCR	9/29/75	IOPS12 FOR UC15 GONE AWAY

/

/CALLING SEQUENCE:

/	CAL + .DAT SLOT (9-17)

/	FUNCTION

/	N ARGS, WHERE N IS A FUNCTION OF "FUNCTION"

/	NORMAL RETURN

/LV PRINTER ASSUMED TO BE 132 COLUMNS WIDE

/ASSEMBLY PARAMETERS:

/   ADSS=1 PRODUCES A VERSION WITHOUT EXTENDED ERROR MESSAGES.

/   NOFF=1 INHIBITS AUTOMATIC END OF PAGE FORM FEED

/   FFCNT CAN BE DEFINED AS NUMBER OF LINES PER PAGE IF NOFF UNDEF.

/   DEFINE FFCNT IN !!OCTAL!!

/   IF FFCNT AND NOFF BOTH UNDEF., 58 LINES PER PAGE IS DEFAULT.

/

	.IFUND	APILVL

APILVL=3

	.ENDC

APISLT=46

/

LSSF=APILVL*20+706101

SIOA=706001			/SKIP ON DATA ACCEPTED BY THE PDP11

LIOR=706006			/CLEAR "DONE" FLAG AND LOAD REG FOR

				/    THE PDP11.

CAPI=APILVL*20+706104		/CLEAR FLAG

/

.SCOM=100

.MED=3

IDX=ISZ

SET=ISZ				/USED TO SET SWITCHES TO NON-ZERO.

EXERRS=.SCOM+37

/

	.IFUND FFCNT

FORMS=72

	.ENDC

	.IFDEF FFCNT

FORMS=FFCNT

	.ENDC

DEVCOD=210		/CODE FOR LV DRIVER IN PIREX

	.GLOBL LVA.

	.TITLE CAL ENTRANCE

LVA.	DAC	LPCALP		/SAVE CAL POINTER.

	DAC	LPARGP		/AND ARGUMENT POINTER.

	IDX	LPARGP		/POINTS TO WORD 2 - FUNCTION CODE.

/

/  FIRST TIME THRU GO CAL INIT. CODE IN LBF

/

NEW	JMP	INIT	/FIRST TIME THRU DO SETUP CAL

/			/AND SET-UP TCB AND BUFFER. OVERWRITE

/			/JUMP WITH NO-OP

/

	LAC	LPBUF	/DEFAULT, LINE BUFFER ADDR TO TCB!!

	DAC*	TCBFP	/IN CASE .TRAN HAS CHANGED IT

	LAC*	LPARGP

	IDX	LPARGP		/POINTS TO WORD 3 - BUFFER ADDRESS.

	AND	(17777		/STRIP OFF UNIT NUMBER.

	TAD	(JMP LTABL-1	/DISPATCH TO PROCESS FUNCTION.

	DAC	.+1

	XX

LTABL	JMP	LPIN		/1 - .INIT

	SKP			/2 - .FSTAT,.RENAM,.DLETE - IGNORE

	JMP	LPER06		/3 - .SEEK - ERROR

	IDX	LPARGP		/4 - .ENTER - IGNORE

	JMP	LPNEXT		/5 - .CLEAR - IGNORE

	JMP	LPCLOS		/6 - .CLOSE

	JMP	LPNEXT		/7 - .MTAPE - IGNORE

	JMP	LPER06		/10 - .READ - ERROR.

	JMP	LPWRIT		/11 - .WRITE

	JMP	LPWAIT		/12 - .WAIT OR .WAITR

	JMP	LVTRAN		/13 - .TRAN FOR PLOTS

LPER06	LAW	6		/ILLEGAL HANDLER FUNCTION.

	JMP SETERR
IOPS12	LAW	12	/(SCR-030)UC15 WENT AWAY
	JMP	SETERR	/(SCR-030)
IOPS55	LAW	55	/(SCR-030)NO TCB AREA FOR US
	JMP	SETERR	/(SCR-030)
IOPS67	LAW	67	/(SCR-030)ATTEMPT  REF. >32 K

	JMP	SETERR	/(SCR-030)

	.TITLE INTERRUPT SERVICE

/

/LPU. INTERRUPT SERVICE

LPINT	JMP	LPPIC	/PIC ENTRY, JUMP TO CODE

	DAC	LPAC	/SAVE INTERRUPTED AC

	LAC	LPINT	/GET INTERRUPTED PC

	DAC	LPOUT	/SAVE FOR COMMON EXIT

	LAC	(JMP LPPIC /RESTORE PIC ENTRY

	DAC	LPINT

	LAC	(NOP	/WE DON'T NEED ION IN COMMON EXIT

	JMP	LPICM	/JOIN COMMON CODE

/

LPPIC	DAC	LPAC	/PIC CODE, SAV AC

	LAC*	(0	/GET INTERRUPTED PC

	DAC	LPOUT	/SAVE

	LAC	(ION	/NEED INTERRUPT ON INST. IN COMMON CODE

LPICM	DAC	LPISW

	CAPI		/CLEAR FLAG, NOW IN COMMON CODE

	LAC*	LPEV	/EVENT VARIABLE FROM PIREX

	RTL		/PDP-11 (MINUS) BIT TO OUR AC0

	SPA!RTR		/+ IS OK

	JMP	LPIERR	/ERROR, GO LOOK

LPIRT	DZM	LPUND	/CLEAR UNDERWAY FLAG

LPIRT1	LAC	LPAC	/RESTORE AC

LPISW	HLT		/ION OR NOP

	DBR

	JMP*	LPOUT

/

/

LPIERR	AND	(177777	/KEEP REAL 16 BITS FROM PDP-11

	SAD	(177001	/CODE FROM OUT OF NODES IN PIREX

	JMP	RETRY	/JUST TRY AGAIN, LEAVING LPUND SET

	TAD	(600000	/MAKE - NUMBER FOR IOPS

	JMP	SETERR	/TREAT AS REGULAR IOPS ERROR

/			/NOTE THAT THIS SHOULDN'T HAPPER.

/

/

RETRY	LAC	LPTCB	/TCB ADDRESS

	SIOA

	JMP	.-1	/

	LIOR		/THIS MAGIC SHIPS TCB ADDR. TO PDP-11

	JMP	LPIRT1	/EXIT FROM INTERRUPT

/

/

	.TITLE	ERROR ROUTINE

/

SETERR	DAC ERRNUM

ERLOOP	NOP			/'JMP LPTRY' IF IOPS 4 ERROR.

	LAC ERRNUM

EROUT	JMS* (EXERRS

	JMP ERLOOP

	LAW -1

	.SIXBT 'LVU'

ERRNUM	0			/HOLDS ERROR NUMBER FOR REPEAT.

	.TITLE	.TRAN FUNCTION

/

/EQUATES FOR AUTO-INCR. REG.'S

/

X10=10

X11=11

/

/

/

LVTRAN	JMS	LPIOCK	/ALREADY BUSY? (SHOULDN'T BE)

	ISZ	LPARGP	/MOVE POINTER TO ADDR OF BITS

	LAC*	(X10	/SAVVE AUTO-INCR 10

	DAC	X10S

	LAC*	(X11	/AND 11

	DAC	X11S

	LAC	PLOTSW	/ADDR OF OUR BUFFER

	SNA!SPA		/SKIP IF WE'RE INIT'ED FORPLOTTING

	JMP	LPER06	/NO, TREAT AS IOPS6

	DAC*	TCBFP	/FOR PDP-11 TCB

	AAC	-1	/AND FOR X11 OF PUT LOOP

	DAC*	(X11

	LAW	-1	/SET UP FETCH OF PDP-15 BITS

	TAD*	LPARGP	/POINTER IN CALLER'S LIST

	DAC*	(X10

	ISZ	LPARGP	/MOVE POINTER TO TRAN WORD CNT

	LAC*	LPARGP

	DAC*	TRANCT	/TRAN WORD COUNT IN TCB

	LRSS	3	/COUNT OF 8MOVVES PER BUFFER

	DAC	MAXC	/FOR ISZ

LVLOO	LAC*	X10	/GET FROM CALLER

	CLL!CMA

	SNA!RTL

	JMP	LVTT1

	LMQ

	RTR

	LLS	10

LVTT1	DAC*	X11	/IN MONITOR BUFFER FOR PDP-11

	LAC*	X10

	CLL!CMA

	SNA!RTL

	JMP	LVTT2

	LMQ

	RTR

	LLS	10

LVTT2	DAC*	X11

	LAC*	X10

	CLL!CMA

	SNA!RTL

	JMP	LVTT3

	LMQ

	RTR

	LLS	10

LVTT3	DAC*	X11

	LAC*	X10

	CLL!CMA

	SNA!RTL

	JMP	LVTT4

	LMQ

	RTR

	LLS	10

LVTT4	DAC*	X11

	LAC*	X10

	CLL!CMA

	SNA!RTL

	JMP	LVTT5

	LMQ

	RTR

	LLS	10

LVTT5	DAC*	X11

	LAC*	X10

	CLL!CMA

	SNA!RTL

	JMP	LVTT6

	LMQ

	RTR

	LLS	10

LVTT6	DAC*	X11

	LAC*	X10

	CLL!CMA

	SNA!RTL

	JMP	LVTT7

	LMQ

	RTR

	LLS	10

LVTT7	DAC*	X11

	LAC*	X10

	CLL!CMA

	SNA!RTL

	JMP	LVTT8

	LMQ

	RTR

	LLS	10

LVTT8	DAC*	X11

	ISZ	MAXC	/DONE

	JMP	LVLOO

	LAC	X10S

	DAC*	(X10

	LAC	X11S

	DAC*	(X11

	JMS	LPSET

	LAC	(LPUND	/RETURN BUSY FLAG ADDR IN AC!

	ISZ	LPARGP	/MOVE POINTER TO RETURN ADDR

	JMP	LPNEXT

	.TITLE	.INIT FUNCTION

/

/

/.INIT

/

LPIN	IDX	LPARGP

	LAC BUFSIZ		/36(10) FOR 80 COLS; 56(10) FOR 132 COLS.

	DAC* LPARGP		/RETURN TO USER.

	IDX LPARGP		/NOW POINTS TO RETURN.

	LAC	PAGSIZ	/LF COUNTER

	DAC	PAGCNT

	LAC*	LPCALP	/DOES INIT INHIBIT AUTO FORMS FEED

	AND	(4000	/THIS IS INHIBIT BIT

	TAD	FFFF	/FFFF ASSEMBLED AS NOP FOR NOFF, ISZ IF NOT

	SAD	FFFF	/SKIP IF INIT INHIBITS FF

	SKP		/INIT DOESN'T INHIBIT, USE ASSEMBLED VALUE

	LAC	(NOP	/INIT INHIBITS IT, USE NOP

	DAC	FFSW	/THIS SWITCH XCT'ED BY FORMS CONTROL

/			/SECTION IN PUTCH SUBROUTINE

	JMS	RESETL	/RESET TAB AND LINE WIDTH COUNTERS

	JMS	LPIOCK	/CHECK LP BUSY

	DZM	COP	/SAY A FF OCCURRED

	CLA!IAC		/COUNT OF ONE BYTE FOR HEADER

	DAC*	LPBUF	/HEADER

	AAC	13	/FORM FEED

	DAC*	LPBUFD	/FOR BUFFER

	.IFUND	NOFF	/DO ONLY IF NOFF NOT DEFINED

	JMS	LPSET	/THIS SENDS REQ. TO PDP-11

	.ENDC

/

	LAC	(10000	/SPECIAL INIT FOR PLOTTING?

	AND*	LPCALP	/TOP OF THREE DATA BITS FOR INIT

	SNA		/SKIP IF YES

	JMP	LPNEXT	/NO, JUST EXIT

	.GTBUF		/MONITOR BUFFER FOR PLOT WINDOW TO PDP-11

	SNA!SPA		/COULD WE GET ONE

	JMP	LPER06	/ILLEGAL DATA FOR NOW

	DAC	PLOTSW	/THIS IS SWITCH AND ADDRESS

/

/NORMAL CAL EXIT

/

LPNEXT	DBR

	JMP*	LPARGP

	.TITLE .WRITE FUNCTION

/

/.WRITE

/

LPWRIT	JMS LPIOCK		/PRINTER BUSY?

	LAC* LPCALP		/GET THE DATA MODE FROM THE USER CAL.

	AND	(1000	/MAKE SKP-NOP IN MIX

	XOR	(SKP

	DAC	MIX

	LAC*	LPARGP		/USER BUFFER ADDRESS.

	IDX LPARGP	/NOW POINTS TO WORD COUNT 

	DAC	TCHAR	/SAVE POINTER TO BUFFER HEADER

	AAC	2	/MAKE X12 POINT TO DATA NOT HEADER

	DAC	X12	/GETTER POINTER

	AND	(700000	/(SCR-030)BUFFER >32K

	SZA		/(SCR-030)SKIP IF NOT

	JMP	IOPS67	/(SCR-030)YES, FATAL ERROR

/

/  SET UP LIMIT OF INPUT BUFFER SIZE TO PREVENT DATA OVERRUN

/  FOR BOTH IOPS ASCII AND IMAGE ASCII

/

	LAW	17000	/GET PAIR COUNT FROM LEFT HALF

	AND*	TCHAR

	SWHA		/BRING TO RIGHT. PAIR COUNT INCLUDES HEADER

/			/PAIR COUNT. WE ISZ BEFORE LOOP SO THAT'S

/			/OK. IOPS NOW SET XCPT CMA!IAC

	XCT	MIX	/SKIP IF ASCII, NOT IF IMAGE

	SKP!CLA!CMA	/IMAGE -1 IN AC, SKIP. -1 BECAUSE WE ISZ FIRST

	SKP!CMA!IAC	/IOPS COMPLEMENTED TO CORRECT VALUE

	TAD*	LPARGP	/IMAGE ADD IN TOTAL WORD COUNT, INCL

/			/TWO WORDS FOR HEADER. WE ISZ BEFORE LOOP.

	DAC	TEMP1	/INTO CONTROLLER, BOTH MODES

	ISZ	LPARGP	/MOVE ARG POINTER TO EXIT

	LAC	LPBUFD	/POINTER TO DATA PORTION OF BUFFER

	DAC	PUTP	/LOAD TO CHARACTER PUTTER POINTER

	LAC	GETIN	/INIT. CHAR GETTER

	DAC	GETSW

	LAC	PUTIN	/INIT CHAR PUTTER

	DAC	PUTSW

	CLA		/INIT OUTPUT BUFFER HEADER

	XCT	MIX	/TO 0 IF IOPS, 400 FOR IMAGE

	LAC	(400

	DAC*	LPBUF

	CLA!CMA		/COUNT OF 1 BLANK AS DEFUALT

/			/FOR ZERO LENGTH IOPS LINE

	DAC*	LPBUFD	/IN FIRST DATA CHAR

/

/  MAIN LOOP TO TRANSFER CHAR'S TO HANDLER BUFFER

/

MAIN	JMS	GETCH	/CHARACTER GETTER, LEAVES IT IN AC

	SNA		/SKIP UNLESS NULL CHAR

	JMP	MAIN	/NULL, IGNORE

	SAD	(177	/IGNORE RUB-OUT

	JMP	MAIN	/MAIN

	DAC	TCHAR	/SAVE CHAR THROUGH TESTING

	AAC	-40	/SEPARATE 'TEXT' CHAR'S FROM CONTROL CHAR'S

	SNA!SPA		/SKIP ON REGULAR CHARS

	JMP	MSPEC	/GO DO SPECIALS

	SAD	(135	/ALT MODE

	JMP	UCLP03	/END OF LINE ON ALT MODE

/

/  SORRY ABOUT NE XT FIVE LrNES.

/  THE LOGIC AT PUTCH TO DO FORMS CONTROL DOESN'T DO IMPLIED

/  LINE FEEDS, I.E. THOSE LINES HAVING NO LEADING CONTROL CHAR.

/  WE HAVE TO FAKE IT OUT BY  hLACING A LINE FEED ON SUCH LINES!?!

/

	LAC	FIRST	/DO ONLY IF FIRST CHAR OF LINE IS REGULAR

	SMA		/SKIP IF FIRST CHAR

	JMP	.+3	/NOT FIRST CHAR, JUST CONTINUE

	LAC	(12	/HERE IS LINE FEED

	JMS	PUTCH	/AND CALL TO DO FORMS CONTROL

/

	CLA!IAC		/SET FLAG SAYING A REAL CHAR SINCE A FF

	DAC	COP

/

	LAC	BLANKC	/DO WE HAVE PENDING BLANKS/TABS TO SEND

/

/  NOTE BLANKC HAS MINUS COUNT OF CONSECTIVE BLANKS/TABS

/  SINCE PDP-11 CONTROLLER PRINTS ONLY BLANKS

/

	SMA!CLL		/SKIP IF ANY COLLECTED, TO PUT OUT BEFORE

/			/REAL CHAR'S

	JMP	MAINC	/NONE, PENDING, GO PUT OUT THE CHAR

	TAD	(200	/TOUGH, IF MORE THAN 127 COLLECTED, MUST

/			/PUT OUT TWO COUNTS

	SMA!CLA		/SKIP IF NEED TWO COUNTS

	JMP	MAIND	/NO, JUST PUT OUT COLLECTED COUNT

	TAD	(200	/TWO COUNTS, HERE IS FIRST

	JMS	PUTCH

	LAC	(200	/SET UP TO DO SECOND

MAIND	TAD	BLANKC	/COMMON CODE, LAST COUNT FOR EITHER CASE

	JMS	PUTCH

MAINC	DZM	BLANKC	/CLEAR OUT BLANK COUNTER

	LAC	TCHAR	/GET BACK ORIGINAL CHAR

	JMS	PUTCH	/TO OUTPUT BUFFER

MAINK	ISZ	TABC	/INCREMENT TAB COUNTER

	JMP	MAINE	/NOT OVERFLOW, GO CHECK LINE COUNTER

	LAW	-10	/RESET TAB COUNTER

	DAC	TABC

MAINE	ISZ	MAXC	/HAVE WE RUN OUT OF LINE

	JMP	MAIN	/NO

	JMP	UCLP03	/YES, GO FINISH UP, WITH END OF LINE

/

/  SPECIAL CHARACTERS

/

MSPEC	SZA!CLA!CMA	/SKIP IF IT IS A BLANK

	JMP	MSPEC2	/NOPE, CHECK FOR OTHER THINGS

	TAD	BLANKC	/ADD ONE TO BLANK COUNTER (IS MINUS COUNTER)

	DAC	BLANKC

	JMP	MAINK	/JOIN LINE AND TAB CONTROL SECTION

MSPEC2	LAC	TCHAR	/GET BACK ORIGINAL CHAR

	SAD	(11	/IS IT A TAB

	JMP	MTAB	/YUP, GO DO IT

	SAD	(15	/CARRIAGE RETURN

	JMP	UCLP03	/END OF LINE ON CARRIAGE RETURN

	SAD	(20	/FORTRAN OTS OVERPRINT, DO AS CR

	JMP	MCR

	SAD	(14	/FORM FEED

	JMP	MSPEC3	/JUST PUT IT OUT, FOR NOW

	SAD	(21	/FORTRAN DOUBLE SPACE

	JMP	MSPEC4	/DO AS TWO 12'S

MSPEC5	LAC	(12	/DEFAULT ON UNRECOGNIZED CONTROL CHAR. IS LINE FEED

MSPEC3	JMS	PUTCH	/PLACE IN BUFFER

	JMP	MAIN	/GO DO NEXT

MSPEC4	LAC	(12	/FIRST OF TWO 12'S FOR THE 21

	JMS	PUTCH

	JMP	MSPEC5	/GO DO THE SECOND 112

MCR	JMS	RESETL	/NEW LINE, RESET VARIOUS GUYS

	LAC	(15	/CARRIAGE RETURN

	JMP	MSPEC3	/PUT CHAR AND LOOP

MTAB	LAC	TABC	/GET REMAINING COUNT FOR TAB

	TAD	BLANKC	/AND ADD TO CUMULATIVE BLANK COUNT

	DAC	BLANKC

	LAC	TABC	/AND TO LINE CHECKER

	CMA!IAC

	TAD	MAXC

	DAC	MAXC

	SMA		/SKIP IF SOME LINE LEFT

	JMP	UCLP03	/NONE LEFT, FINISH UP LINE

	LAW	-10

	DAC	TABC	/RESET TAB COUNTER

	JMP	MAIN	/NEXT CHAR

/

UCLP03	LAC	(15	/CARRIAGE RETURN

	XCT	MIX	/PLACE IN BUFFER ONLY ON IMAGE!!!

	JMS	PUTCH

	JMS	RESETL

UCLP04	ISZ	COP	/A BLANK LINE IS STILL A REAL CHAR SINCE FF

	LAC*	LPBUF	/ZERO CHAR COUNT??

	AND	(377	/COUNT ONLY IN LOW 8 BITS

	SZA		/SKIP IF ZERO COUNT

	JMP	UCLP05	/NON-ZERO, JUST GO DO REGULAR

	XCT	MIX	/IMAGE OR IOPS

	JMP	LPNEXT	/IMAGE DO NOTHING

	ISZ*	LPBUF	/IOPS MAKE FAKE 1 COUNT

/			/WE ARE DOING A BLANK LINE, AND 0

/			/COUNT MAKES SPOOLER VERY ILL

UCLP05	JMS	LPSET	/SEND BUFFER TO PDP-11

	JMP	LPNEXT	/CAL EXIT

/

/	CHARACTER UNPACKING ROUTINE

/

/

/  THIS ROUTINE 'OWNS' THE MQ

/

/  

/  CHARACTERS ARE OBTAINED FROM X12 POINTER. EACH CHAR

/  IS RETURNED RIGHT JUSTIFIED IN THE AC

/  TEMP1 HAS A MINUS COUNT OF THE WORDS TO BE OBTAINED

/  FROM THE INPUT POINTER X12

/

GETCH	0

	XCT	MIX	/SKIP IF IT IS ASCII

	SKP

	JMP*	GETSW	/GETSW IS POINTER TO CORRECT ACTION ON ONTHE

/			/CORRECT ONE OF THE FIVE POSSIBLE CHAR'S

/

/  NOW DO IMAGE MODE

/

	ISZ	TEMP1

	SKP		/SKP ON NOT THRU YET

	JMP	UCLP04	/DONE

	LAC*	X12

	ISZ	X12

	JMP	GETCM	/FINISH UP IN COMMON

/

GETSW	0		/POINTER TO CORRECT ACTION. INIT'ED FROM GETIN

/			/FILLED BY JMS GETSW AFTER EACH CHAR

GETCM	AND	(177	/COMMON FINISH UP, STRIP XTRA BITS

	JMP*	GETCH	/OUT

/

GETIN	GET1		/INIT GETSW TO POINT TO FIRST CHAR ACTION

/

/  INDIVIDULA CHARACTER ACTION

/

GETQ	JMS	GETSW	/AFTER 5TH CHAR, POINT BACK TO FIRST

/

GET1	ISZ	TEMP1	/OUT OF PAIRS?

	JMP	.+3	/CONTINUE IF OK

	JMS	RESETL	/END OF LINE RESET SONE STUFF

	JMP	UCLP04

	LAC*	X12	/FIRST WORD OF PAIR

	ISZ	X12

	LMQ		/INTO MQ FOR SHIFTING

	LLS	7

	JMS	GETSW	/DONE, LEAVE POINTER FOR SECOND CHAR

GET2	LLS	7	/SECOND CHAR

	JMS	GETSW	/LEAVING POINTER FOR THIRD

GET3	LLS	4	/THE HALF-AND-HALF CHAR

	DAC	GETSW	/VERY TEMPORARY

	LAC*	X12	/CAN'T END IN MIDDLE OF PAIR

	ISZ	X12

	LMQ		/SECOND WORD TO SHIFTER

	LAC	GETSW	/BRING BACK FIRST

	LLS	3	/COMPLETE CHAR

	JMS	GETSW	/LEAVING POINTER TO FOURTH ACTION

GET4	LLS	7

	JMS	GETSW	/LEAVING FOR 5

GET5	LLS	7

	JMP	GETQ	/BACK TO TOP FOR POINTER TO 1

/

/

/

/  CHARACTER PUTTER FOR PDP-11

/

/  TWO CHAR'S PER WORD FORMAT. FIRST CHAR IS RIGHT JUSTIFIED, SECOND

/  IS PLACED IMMEDIATELY ABOVE FIRST, LEAVING TOP TWO BITS OF WORD

/  UNUSED. CHAR IS DELEVERD TO US IN AC. INIT PUTSW BY DAC'ING CONTENTS

/  OF PUTIN INTO IT. ROUTINE COUNTS THE OUTPUT CHARS IN LBF

/

/  THIS ROUTINE ALSO HANDLES FORM FEED PAGE CONTROL

/  THE PDP-11 ASSUMES LINES HAVE A LF IN BEGINNING AND CR AT END

/  SO THIS ROUTINE REMOVES ANY LEADING LF.

/

/

PUTCH	0

	AND	(377	/STRIP TO EIGHT BITS

	SAD	(12	/SPECIAL CASE #1, LINE FEED

	JMP	PUTLF	/GO DO IT

	SAD	(14	/SPECIAL CASE #2, FORM FEED

	JMP	PUTFF	/GO DO IT

PUTY	ISZ	FIRST	/BUMP FIRST TIME THRU SWTICH

	NOP		/IN CASE SKIPS, WE DON'T NEED IT HERE

PUTZ	ISZ*	LPBUF	/COUNT AN OUTPUT CHAR

	JMP*	PUTSW	/DISPATCH TO FIRST OR SECOND CHAR ACTION

/

PUTLF	LAC	COP	/HAS A REAL CHAR OCCURRED SINCE FF?

	SZA		/SKIP IF NO REAL CHAR

	JMP	PUTW	/GO DO REGULAR

	LAC*	LPBUFD	/IF WE ALREADY HAVE A FF

	SAD	(14	/IN BUFFER OUT, DON'T NEED A CR

	JMP*	PUTCH

	LAC	(15	/LEAD WITH CR, SO PDP-11 DOESN'T PUT ON AUTOMATIC LF

	XCT	MIX	/BUT DO NOTHING FOR IMAGE MODE

	JMP*	PUTCH

	JMP	PUTY	/GO REAJOIN

PUTW	LAC	(12	/GET BACK LINE FEED

	XCT	FFSW	/ISZ OR NOP FOR COUNT OF FF PER PAGE

	JMP	PUTLFR	/NO FORM FEED NOW

PUTFF	LAC	PAGSIZ	/FORM FEED, RESET PAGE COUNTER

	DAC	PAGCNT

	DZM	COP	/FLAG SAYING FF OCCURRED.

	LAC	(14	/FORM FEED CODE

	JMP	PUTZ	/GO COUNT CHAR, AND PLACE IT

PUTLFR	XCT	MIX	/SKIP ON IOPS ASCII

	JMP	PUTY	/IMAGE, ACTUALLY PLACE LF

	ISZ	FIRST	/ASCII, IS IT FIRST THRU?

	JMP	PUTZ	/NOT FIRST, DO LF

	JMP*	PUTCH	/FIRST TIME, JUST RETURN

PUTSW	0		/INIT'ED AS PUT1. FILLED LATER BY JMS PUTSW

	JMP*	PUTCH	/DONE, RETURN

/

PUTIN	PUT1		/START AT FIRST CHAR

/

PUTQ	JMS	PUTSW	/LEAVE POINTER FOR FIRST AFTER SECOND

PUT1	DAC*	PUTP	/FIRST CHARACTER ACTION, PLACE RIGHT JUSTIFIED

	JMS	PUTSW	/LEAVING POINTER FOR SECOND

/

PUT2	CLL!SWHA	/PUT CHAR IN RIGHT PLACE

	RAR

	XOR*	PUTP	/PUT HALVES TOGETHER

	DAC*	PUTP	/BOTH IN BUFFER

	ISZ	PUTP	/MOVE POINTER

	JMP	PUTQ	/GO TELL PUTSW  THAT PUT1 IS NEXT

/

/  OUTINE TO RESET LINE AND TAB COUNTRS

/

RESETL	0

	LAW	-1	/SET FIRST CHAR OF LINE REMEMBERER

	DAC	FIRST

	LAW	-10	/SET TAB COUNTR

	DAC	TABC

	LAC	LINLIM	/SET UP MAX PER LINE COUNTER

	DAC	MAXC

	DZM	BLANKC	/RESET SPACE AND TAB COUNTER

	JMP*	RESETL

/

	.TITLE .CLOSE FUNCTION

/

/

/.CLOSE

/

LPCLOS	JMS	LPIOCK		/CHECK I/O UNDERWAY.

	DZM	COP	/SAY A FF OCCURRED

	ISZ	LPCLSW		/777777 IN AC IF HAVEN'T BEEN THRU CLOSE CODE.

	JMP	LPCLDN		/DONE.

	CLA!IAC		/SPOOLER REQUIRES FF,CR AS CLOSE

	DAC*	LPBUF	/JUST GIVE FF TO DRIVER, HOWEVER

	LAC	(6414	/THIS IS FF,CR IN PDP-11

	DAC*	LPBUFD	/FIRST DATA WORD POINTER

/			/THIS MEANS ALWAYS A FF ON CLOSE!!!

	JMS	LPSET	/SEND BUFFER TO PDP-11

	JMS	RESETL	/RESET THE WORLD

LPCALX	DBR

	JMP*	LPCALP		/HANG ON CAL.

LPCLSW	777777			/-1 = .CLOSE NOT DONE.

LPCLDN	LAW -1

	DAC	LPCLSW		/INITIALIZE .CLOSE INDICATOR

	LAC	PLOTSW		/WERE WE PLOTTING

	SNA			/SKIP IF YES

	JMP	LPNEXT		/NO, JUST EXIT

	0			/THIS IS A GVBUF CAL

	22

PLOTSW	0			/ADDR TO GIVE BACK HERE

	DZM	PLOTSW		/DEFAULT, NO LONGER PLOTTING

	JMP	LPNEXT		/EXIT

	.TITLE .WAIT FUNCTION

/

/.WAIT OR .WAITR

/

LPWAIT	LAC*	LPCALP

	AND	(1000

	SNA			/BIT 8 = 1 FOR .WAITR

	JMP	LPWAT1		/.WAIT - GO HANG ON CAL.

	LAC*	LPARGP	/(SCR-030)CHECK 32K LIMIT

	AND	(700000	/(SCR-030)

	SZA		/(SCR-030)SKIP IF OK

	JMP	IOPS67	/(SCR-030)ASKED FOR ILLEGAL ADDR

	LAC	LPCALP	/(SCR-030)3 MODES BITS FROM CAL

	AND	(700000	/(SCR-030)REST OF ADDR FROM USER

	TAD*	LPARGP	/(SCR-030)

	DAC	LPCALP

	IDX	LPARGP

LPWAT1	JMS	LPIOCK		/CHECK I/O UNDERWAY.

	JMP	LPNEXT		/OK - RETURN.

/

/CHECK FOR I/O UNDERWAY

/

/LPUND 0 WHEN FREE, NON0 WHEN BUSY

/

LPIOCK	0

	LAC	LPUND		/0 = NO ACTIVITY.

	SNA

	JMP*	LPIOCK		/NO I/O UNDERWAY.

	JMP	LPCALX		/HANG ON CAL TIL NOT BUSY.

/

/ SETUP AND OUTPUT TO PRINTER.

/

LPSET	0

	LAC	LPTCB	/SEND TCB POINTER TO PDP-11

	SIOA			/MAKE SURE ITS ABLE TO GET IT

	JMP	.-1		/NOTE THAT THIS IS PROTECTED SINCE

				/    THE LIOR WILL BE ISSUED DIRECTLY

				/    AFTER THE SIOA (FREE INSTRUCTION).

	LIOR

	DAC LPUND		/SET I/O BUSY FLAG.

	JMP* LPSET

	.TITLE INITIALIZATION CODE AND TEMPORARIES

/

LPCALP	0		/POINTER TO CAL ADDR

LPARGP	0		/POINTER ARGUMENTS OF CAL

	.DEC		/(#28) MAKE LIMITS WORK RIGHT

LINLIM	-132		/LINE SIZE LIMIT FOR PRINTING

BUFSIZ	56		/BUFFER SIZE

	.OCT		/(#28) RETURN TO PROGRAM RADIX

PAGSIZ	-FORMS		/ASSEMBLED LINES PER PAGE

PAGCNT	-FORMS		/COUNT THE LINES HERE

LPUND	-7		/0=FREE,+=BUSY,-=ERROR

/			/COUNTS UP TO INITAL 0 BELOW

/

	.IFUND NOFF

FFSW	ISZ	PAGCNT	/ACTION FOR FORMS CONTROL, NEMORY

FFFF	ISZ	PAGCNT	/FFSW LOADED INTO HERE

	.ENDC

	.IFDEF NOFF

FFSW	NOP		/ACTION FOR FORMS, MEMORY

FFFF	NOP		/FFSW LOADED INTO HERE

	.ENDC

INIT	LAC	(NOP	/WRITE OVER JUMP TO HERE

LPTCB	DAC	NEW	/PREVENT RE-ENTRY

LPBUF	LAC*	(.SCOM+100	/FIND OUR ALLOCATED TCB AREA

	SNA!SNA		/(SCR-030)IF ISN'T ONE, UC15 GONE!
	JMP	IOPS12	/(SCR-030)
TCBFP	AAC	7	/(029)LV TCB 7TH IN TABLE
LPEV	DAC	LPBUF
TABC	LAC*	LPBUF
	SNA!SPA		/(SCR-030)IS THERE A TCB FOR US??
	JMP	IOPS55	/(SCR-030)NO, EXIT

TRANCT	DAC	LPTCB

LPBUFD	DAC	LPBUF

TEMP1	AAC	2

MAXC	DAC	LPEV

FIRST	AAC	2

TCHAR	DAC	TCBFP	/POINTER TO BUFFER FROM TCB

COP	AAC	3

BLANKC	DAC	TRANCT

	AAC	3

MIX	DAC	LPBUFD

LPAC	LAC	(APISLT*400+APILVL

LPOUT	DAC*	LPBUF

X12	ISZ	LPBUF

PUTP	LAC	(DEVCOD

X10S	DAC*	LPBUF

X11S	ISZ	LPBUF

LVCNT	DZM*	LPBUF

	ISZ	LPUND

	JMP	.-3	/THIS LEAVES LPBUF POINTING AT BUFFER!

	JMS	RESETL	/RESET LINE AND TAB COUNTRS

	CAL	APISLT	/ISSUE SETUP CAL TO ESTABLISH INTERRUPTS

	16

	LSSF

	LPINT

	JMP	NEW	/WHEW, DONE

/

	.END
