Google
 

Trailing-Edge - PDP-10 Archives - decuslib20-02 - decus/20-0038/lptque.pal
There are 2 other files named lptque.pal in the archive. Click here to see a list.
/*** LPTQUE.PAL, APRIL 14, 1970*****
/
/
/
/	PETER LEMKIN
/	NATIONAL INSTITUTES OF HEALTH
/	BETHESDA, MD. 20014
/
/
/INTRODUCTION
/------------
/"LPTQUE" IS A PDP8 UTILITY PROGRAM WHICH IS USED TO BUFFER ASCII
/INPUT FROM A PT08 SERIAL TO PARALLEL INTERFACE ONTO AN A.B. DICK
/940 (USING THE ECLECTIC COMPUTER COMPANY'S INTERFACE) LINEPRINTER.
/THE  ASR33 TELETYPE CAN BE USED TO SEND COMMANDS TO A COMPUTER
/ON THE OTHER END OF THE PT08 ( WHICH IN TURN IS SENDING INFORMATION TO
/THE PDP8 TO BE PRINTED ON THE LINEPRINTER.).
/I.E. PDP8'S ASR33 TTY ==> PT08 ==>PDP10
/    PDP8'S 940 LPT <=== PT08 <== PDP10.
/
/
/MINIMUM HARDWARE:
/------------------
/PDP8 WITH PT08, 4K MEMORY, AND A.B. DICK 940 LINEPRINTER
/WITH ECLECTIC COMPUTER COMPANY INTERFACE TO PDP8. TO RUN "LPTQUE"
/IN ANOTHER FIELD, SET DATFLD=10 TIMES THE DESIRED FIELD. IE.E 00, 10
/ETC. THEN REASSEMBLE "LPTQUE". "LPTQUE" WAS ASSEMBLED USING PAL10 ON A 
/PDP10.
/
/
/CORE REQUIREMENTS AND STARTING ADDRESS:
/--------------------------------------
/	<200,577> PROGRAM
/	<600,4577>  LPT BUFFER.
/	STARTING ADDRESS IS 200
/
/
/
/ERROR CONDITION:
/---------------
/NOTE: ALTHOUGH THE 940 LINEPRINTER CAN PRINT AT 2400 BAUD, ITS
/EFFECTIVE DATA RATE IS A FUNCTION OF LENGTH OF THE LINE PRINTED.
/FOR SHORT LINES, THIS CAN GO BELOW 1200 BAUD. THEREFORE IF YOU
/ARE USING A 1200 BAUD LINE (AS WE ARE), OCCASIONALLY YOU WILL OVERFLOW
/THE LPT BUFFER DUE TO PTHE FACT THAT YOU ARE ACCUMULATING DATA FASTER THAN
/YOU CAN PRINT IT. WHEN THIS HAPPENS, THE PROGRAM HALTS. TO RESTART IT
/DO A LOAD ADDRESS-START 200.
/NOTE: THE NUMBER OF LINES IN THE BUFFER QUEUE WAITING TO BE PRINTED
/ARE DISPLAYED IN THE MQ REGISTER. IF YOU DO NOT HAVE EAE, THIS IS A NOP.
/
/
/PROBLEMS:
/-------
/TABS AND FORM FEEDS ARE NOT IMPLEMENTED.
/
/
/
/
/
/
/
/PT08 OP CODES
PTSF=6411
PKSF=6401
PTLS=6416
PKRB=6406
PTCF=6412
/AB DICK 940 LINEPRINTER OP CODES
LTLS=6656
LTSF=6651
LTCF=6652
/LPT BUFFER MIN AND MAX POINTERS: MAY BE CHANGED BEFORE ASSEMBLE.
TQMIN=601
TQMAX=4577
/FIELD DEFINITION - I.E. RUNNING FIELDS.
DATFLD=00
INSTFD=DATFLD
/
/
/
/
/
	FIELD INSTFD
	*200
/MONITOR LOOP
	CLA /DISABLE THE EMB
	TAD (-62 /SET LINE COUNTER
	DCA LINCNT
	DCA EMB
	DCA BUFCTR /ZERO THE BUFFER COUNTER
	LTLS /START IT UP
START,	JMS INITQU /INIT QUEUE
	JMS INITBF
INPUT,	KSF /TTY? IF SO TYPE IT AND SEND TO PDP10.
	JMP .+4 /NO
	KRB
	TLS
	PTLS /SEND TO PDP10 SO AND TELL IT OFF.
	TAD (-215 /IS IT CR?
	SZA CLA
	JMP .+5 /NO
	TAD (212 /PRINT A LINE FEED
	TSF
	JMP .-1
	TLS
	CLA /PUT THE # OF BUFFERS IN THE MQ
	TAD BUFCTR
	MQL=7421
	MQL
	PKSF /INPUT?
	SKP
	JMP .+3
	JMS OUTPUT /NO, CHECK OUTPUT
	JMP INPUT
	PKRB
	AND (177
	TAD (200
	DCA LPTCHR
	ISZ N /INCREMENT THE CHARACTER COUNTER.
/TEST IT  TO SEE IF FORM FEED.
	TAD LPTCHR
	TAD (-214 /FF
	SZA CLA
	JMP NOFF /NO
LOOP1,	TAD (212 /YES, PUT THE REQUIRED # LF TO
/FINISH UP THE PAGE.
	JMS INSRQ
	HLT
	JMS CLOSBF /PUT ON QUEUE, AND CLOSE BUFFER..
	JMS INITBF /FIX UP BUFFER
	ISZ LINCNT /DONE?
	JMP LOOP1 /NO
/
/NOW GO 20 20 SPACES TO NEXT PAGE.
LOOP2,	CLA
	TAD (-20
	DCA LINCNT
LOOP3,	TAD (212
	JMS INSRQ
	HLT
	JMS OUTPUT /TRY OUTPUT
	JMS CLOSBF
	JMS INITBF
	ISZ LINCNT
	JMP LOOP3
	TAD (-62 /RESET LINE PER PAGE COUNTER
	DCA LINCNT
	JMP INPUT
/
NOFF,	TAD LPTCHR
	JMS INSRQ /PUT ON QUEUE
	HLT
	TAD LPTCHR
	TAD (-212 /IS IT A LF?
	SZA CLA
	SKP
	JMP .+3
	JMS OUTPUT /NO, GO CHECK THE OUTPUT
	JMP INPUT
	/IT WAS A LINEFEED, BOP THE LINE COUNTER
	ISZ LINCNT
	JMP NORST /DON'T RESET IT
	TAD (-62 /RESET IT
	DCA LINCNT
NORST,	JMS CLOSBF /YES, GO CLOSE THE BUFFER
	JMS INITBF /OPEN THE NEXT BUFFER
	JMS OUTPUT /GO CHECK THE OUTPUT.
	JMP INPUT
/
/
/
/
/
/
OUTPUT,	0
	LTSF /LINE PRINTER READY?
	JMP  I OUTPUT /NOT YET
	CLA
	TAD EMB
	SZA CLA
	JMP GETOUT /ENABLED, GET THE OUTPUT
	CLA /TEST IF ANY BUFFERS
	TAD BUFCTR /THE NUMBER OF ACTIVE BUFFERS
	SNA CLA
	JMP  I OUTPUT /NO BUFFERS
	CLA CMA
	TAD BUFCTR /SET BUFCTR=BUFCTR-1
	DCA BUFCTR
	CLA CMA 
	DCA EMB /YES, SET BUFFER FLAG = -1
GETOUT,	JMS TTYFQ /GET THE CHAR.
	JMP  I OUTPUT /NEVER SHOULD GET HERE.
	SMA /SEE IF THE CHAR IS 7777, END OF BUFFER.
	JMP PUTOUT /NO, GO OUTPUT IT.
	CLA
	DCA EMB /YES, CLEAR THE ENABLE BUFFER FLAG AND LEAVE
	JMP  I OUTPUT
PUTOUT,	LTLS /OUTPUT IT
	CLA
	JMP  I OUTPUT
BUFCTR,	0
EMB,	0
LINCNT,	0
LPTCHR,	0
/
/
/
	PAGE
/SUBROUTINE CLOSBF
/PUTS AN EM, N/4+19 NULLS, 7777 AT THE END OF THE BUFFER.
/CALLING SEQUENCE:
/	JMS CLOSBF
/	NORMAL RETURN
CLOSBF,	0
	CLA
	TAD (31 /EM
	JMS INSRQ 
	HLT /BUFFER OVERFLOW
	JMS OUTPUT /TRY TO DO OUTPUT
	TAD N /COMPUTE THE N/4 # OF NULLS
	CLL RAR
	CLL RAR /DIVIDE BY 4
	TAD (23 /19
	CIA
	DCA IBMM
	DCA N /ZERO THE CHARACTER COUNTER.
	JMS INSRQ
	HLT
	JMS OUTPUT /TRY TO DO OUTPUT
	ISZ IBMM
	JMP .-4
	CLA CMA /PUT EOF AT END OF BUFFER.
	JMS INSRQ
	HLT
	JMS OUTPUT /TRY TO DO OUTPUT
	ISZ BUFCTR /INCREMENT THE BUFFER COUNTER.
	JMP I CLOSBF /RETURN
	HLT /OVERFLOW
IBMM,	0
/
/SUBROUTINE INITBF
/PUTS A SYN,SOH,8 NULLS IN FRONT OF THE BUFFER.
/CALLING SEQUENCE:
/	JMS INITBF
/	NORMAL RETURN
INITBF,	0 /INIT THE BUFFER.
	CLA
	DCA N /ZERO THE WORKING CHAR COUNTER.
	TAD (26 /SYN
	JMS INSRQ
	HLT /OVERFLOW
	JMS OUTPUT /TRY OUTPUT
	TAD (1 /SOH
	JMS INSRQ
	HLT /OVERFLOW
	JMS OUTPUT
	TAD (-10 /8
	DCA IBM
	JMS INSRQ
	HLT
	JMS OUTPUT /TRY OUTPUT
	ISZ IBM
	JMP .-4 /PUT 8 NULLS IN BUFFER
	JMP I INITBF /RETURN
IBM,	0
N,	0 /WORKING CHARACTER COUNTER FOR USE IN COMPUTING NULLS AT EOB.
/
/
/
/
/
/
/
/SUBROUTINE INITQU 
/IS USED TO INIT THE QUEUE
/RESETS THE QUEUE.
/CALLING SEQUENCE:
/	JMS INITQU
/	NORMAL RETURN
INITQU,	0
	CLA
	TAD (TQMIN
	DCA KFQ
	TAD KFQ
	DCA KRQ
	JMP I INITQU
 /
/
/
/
/
/
/
/
/
/SUBROUTINE INSRQ
/INSERTS A DATA WORD IN THE 
/AC--> THE TTY OUTPUT BUFFER
/AT THE REAR OF THE QUEUE.
/CALLING SEQUENCE1G
/    JMS INSRQ /DATA IN AC
/    ERROR RETURN /BUFFER OVERFLOW
/     NORMAL RETURN /DATA ENTERED
/                  /RQ POINTER ADVANCED.
/
INSRQ,	 0
    DCA TQDAT /SAVE DATA
/A.1 COMPUTE NEW KRQ
    TAD ITQMAX
    CIA
    TAD KRQ
    SMA CLA
    JMP .+3
    ISZ KRQ /KRQ<--KRQ+1
    JMP .+3
    TAD ITQMIN /KRQ<--TQMIN
    DCA KRQ
/A.2 TEST FOR OVERFLOW
    TAD KRQ





    CIA
    TAD KFQ
    SNA CLA
    JMP I INSRQ /ERROR RETURN
    ISZ INSRQ
/A.3 INSERT DATA INTO THE REAR OF THE QUEUE.
    TAD TQDAT
    CDF DATFLD
    DCA I KRQ
    CDF INSTFD
    JMP I INSRQ /RETURN
/.........................................
/
/SUBROUTINE TTYFQ
/GET A DATA WORD FROM THE REAR
/OF THE TTY QUEUE-->AC.
/CALLING SEQUENCE:
/    JMS TTYFQ /DATA-->AC
/    ERROR RETURN /BUFFER EMPTY
/    NORMAL RETURN /DATA IN AC.
TTYFQ,	 0
/A.1 TEST IF KFQ=KRQ
/IF SO BUFFER EMPTY
    CLA
    TAD KFQ
    CIA
    TAD KRQ
    SNA CLA
    JMP I TTYFQ /ERROR RETURN
    ISZ TTYFQ /SET UP NORMAL RETURN.
/A.2 ADVANCE THE KFQ POINTER
    CLA
    TAD ITQMAX
    CIA
    TAD KFQ
    SMA CLA
    JMP .+3 /YES, SET KFQ=TQMIN
    ISZ KFQ /NO, SET KFQ=KFQ+1
    JMP .+3
    TAD ITQMIN
    DCA KFQ
/A.3 GET DATA FROM THE QUEUE.
    CDF DATFLD
    TAD I KFQ
    CDF INSTFD
    JMP I TTYFQ /RETURN
/...CONSTANTS...
ITQMAX,	 TQMAX
ITQMIN,	 TQMIN
KRQ,	 TQMIN
KFQ,	 TQMIN
TQDAT,	 0
/..........................................
/P. LEMKIN, APRIL 14, 1970...





$