/

/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

/ROLF HUBERT 

/EDIT # 0 ........ 5/21/71

/ EDIT #001	SCR	9/12/75	COPYRIGHT

/ EDIT #002	SCR	9/19/75	IOPS67;CNTL P FIX

/

	.GLOBL	LKA.

SPKF=704101		/SKIP ON RECEIVER FLAG

RBCF=704102		/READ RECEIVER BUFFER AND CLEAR FLAG

.MED=3			/ERROR MESSAGES

.SCOM=100			/EXTENDED ERROR MESSAGES

LKA.	DAC	LKCALP	/ADDRESS OF CAL INSTRUCTION

	DAC	LKARGP	/ARGUMENT POINTER

LKJM1	CAL+75		/.SETUP FOR PIC AND API CHANNEL 75

	16		/

	SPKF		/SKIP ON RECEIVER FLAG

	LKINT		/INTERRUPT HANDLER ADDRESS

	LAC	(JMP LKJ1		/JUMP AROUND AFTER 1ST PASS

	DAC	LKJM1	/

LKJ1	ISZ	LKARGP	/GET FUNCTION CODE

	LAC*	LKARGP	/LOC+1

	AND	(177	/JUST FUNCTION CODE

	ISZ	LKARGP	/POINT TO NEXT ARGUMENT  LOC+2

	TAD	(JMP LKDISP	/SET UP FUNCTION DISPATCH

	DAC	.+1

LKDISP	XX		/DISPATCH TABLE

	JMP	LKINIT	/1=.INIT

	JMP	LKFST	/2=.FSTAT

	JMP	LKIGNR	/3=.SEEK  (IGNORED)

	JMP	LKENTR	/4=.ENTER (ILLEGAL)

	JMP	LKCLR	/5=.CLEAR (ILLEGAL)

	JMP	LKWT11	/6=.CLOSE (SAME AS .WAIT)

	JMP	LKMTP	/7=.MTAPE (ILLEGAL)

	JMP	LKREAD	/10=.READ

	JMP	LKWRIT	/11=.WRITE (ILLEGAL)

	JMP	LKWAIT	/12=.WAIT, .WAITR

	JMP	LKTRAN	/13=.TRAN (ILLEGAL)

	.EJECT

/

/.INIT

/

LKINIT	LAC*	LKARGP

	JMS	TOP3	/(002)CHECK IOPS67;MERGE TOP

/			/(002)3 BITS IN FROM CAL ADDR!

	DAC	LKRET	/ADDRESS OF CTRL P 

	LAC	(40	/RETURN STANDARD LINE BUFFER SIZE

	ISZ	LKARGP	/LOC+3

	DAC*	LKARGP	/MAXIMUM LINE BUFFER

	DZM	LKIOBY	/CLEAR I/O BUSY SWITCH

	LAC	LKNOP	/SET UP CORRECT STUFF IN INTERRUPT CODE

	DAC	LKNT1

LKIGNR	ISZ	LKARGP	/LOC+4

LKRET1	DBR

	XCT	(JMP* LKARGP	/RETURN TO USER

LKBSY	DBR

	XCT	(JMP* LKCALP	/BUSY, RETURN TO CAL

	.EJECT

/

/.READ

/

LKREAD	LAC	LKIOBY	/CHECK IF I/O IS UNDERWAY

	SZA

	JMP	LKBSY	/YES,RETURN TO CAL

	LAC*	LKCALP	/SEE IF IOPS OR IMAGE READ

	DAC	LKIOBY	/SET I/O UNDERWAY

	AND	(17000	/

	SAD	(2000	/IOPS ASCII

	JMP	LKASC

	SAD	(3000	/IMAGE

	JMP	LKIMG

	JMP	LKILL	/ILLEGAL DATA MODE

LKASC	LAC*	LKARGP	/GET USERS LINE BUFFER ADDRESS

	DAC	LKLBF

	JMS	TOP3	/(002)IOPS67 IF A BIT OF TOP3 ON

	DZM	LKWH	/ZERO=IOPS ASCII

	ISZ	LKARGP

	JMP	LKIGNR	/RETURN TO USER

LKIMG	LAC*	LKARGP

	DAC	LKLBF

	JMS	TOP3	/(002) IOPS67 IF A BIT OF TOP 3 ON

	LAC	(1

	DAC	LKWH	/1=IMAGE

	ISZ	LKARGP	/GET WORD COUNT FOR IMAGE ONLY

	LAC*	LKARGP	/GET WORD COUNT

	TAD	(2

	DAC	LKWDCT	/

	DAC	LKWDC1	/SAVE FOR CTRL U

	JMP	LKIGNR	/RETURN TO USER

	.EJECT

/

/.WAIT

/

LKWAIT	LAC*	LKCALP	/GET CAL

	AND	(1000	/CHECK BIT 8

	SZA

	JMP	LKWT10	/.WAITR

LKWT11	LAC	LKIOBY	/.WAIT,   GET BUSY SWITCH

	SZA

	JMP	LKBSY	/BUSY RETURN TO CAL

	JMP	LKRET1	/NOT BUSY RETURN TO USER

LKWT10	LAC	LKIOBY	/GET BUSY SWITCH

	SNA

	JMP	LKIGNR	/NOT BUSY RETURN

	LAC*	LKARGP	/(002)USER ADDR

	JMS	TOP3	/(002)CHECK IOPS67;MERGE TOP 3

/			/(002) BITS FROM CAL ADDR

	DAC	LKARGP	/SAVE IN RETURN POINTER

	JMP	LKRET1	/AND GO THERE

	.EJECT

/

/.FSTAT

/

LKFST	LAC*	LKCALP	/GET CAL

	AND	(3000	/CHECK BITS 7&8 TO SEE IF THIS IS A FSTAT

	SAD	(3000

	JMP	LKFT10	/YES

	JMP	LKIGNR	/NO

LKFT10	LAC*	LKARGP	/

	AND	(77777

	DAC*	LKARGP

	CLA

	JMP	LKIGNR

	.EJECT

/

/INTERRUPT HANDLER

/

LKINT	SKP		/PIC ENTRY

	JMP	LKAPI	/API ENTRY

	DAC	LKAC	/SAVE THE AC

	LAC	LKION	/ION INTO INTERRUPT RETURN SEQUENCE

	DAC	LKSW

	LAC*	(0	/PIC RETURN ADDRESS IN LOC 0

	DAC	LKPC

	JMP	LKNT1

LKAPI	DAC	LKAC	/SAVE THE AC

	LAC	LKINT	/SAVE RETURN ADDRESS

	DAC	LKPC

	LAC	LKNOP

	DAC	LKSW

	LAC	LKSKP	/PUT SKP BACK INTO LKINT

	DAC	LKINT

LKNT1	NOP

	LAC	LKWH

	SZA

	JMP	LK1

	LAC	(LKBUF	/ADDRESS OF INTERNAL BUFFER

LK2	TAD	(1

	DAC	LKPT1	/POINTER TO 2ND WORD OF BUFFER

	TAD	(1

	DAC	LKPT2	/POINTER TO 1ST USABLE WORD OF THE BUFFER

	JMP	.+3

LK1	LAC	LKLBF	/ADDRESS OF USERS BUFFER

	JMP	LK2

	LAC	LKJMP	/JUMP AROUND BUFFER INITIALIZATION

	DAC	LKNT1

LKRD	CLA

	RBCF		/READ KEYBOARD

	AND	(177	/SAVE JUST THE CHARACTER

	DAC	LKCH

	LAC	LKIOBY	/IS THIS INTERRUPT EXPECTED

	SNA

	JMP	LKEXIT	/NO   RETURN TO USER

	LAC	LKWH	/WHICH READ IS THIS

	SZA

	JMP	LKIM	/IMAGE READ

	LAC	LKCH	/IOPS READ

	SAD	(15	/CR

	JMP	LKCR	/GO PACK BUFFER

	SAD	(175	/ALTMODE

	JMP	LKCR	/GO PACK BUFFER

	SAD	(177	/RUBOUT

	JMP	LKROUT

	SAD	(25	/CTRL U

	JMP	LKWIPE	/

LKIM	LAC	LKCH	/GET THE CHARACTER

	SAD	(3	/CTRL C

	JMP	LKCTC

	SAD	(20	/CTRL P

	JMP	LKCTP

	SAD	(4	/CTRL D

	JMP	LKMED

	LAC	LKWH	/SEE WHICH READ THIS IS

	SZA

	JMP	LKIMAG	/IMAGE READ

	LAC	LKCH	/GET CHARACTER

	DAC*	LKPT2	/PUT INTO THE BUFFER

	ISZ	LKPT2

	JMP	LKEXIT	/RETURN TO USER

	.EJECT

LKIMAG	LAC	LKCH	/GET THE CHARACTER

	DAC*	LKPT2

	ISZ	LKPT2

	LAC	LKWPCT

	SZA

	JMP	LKIM1	/ZERO OUT COUNTER AND ADD 1 TO WORD PAIR

	TAD	(1

	DAC	LKWPCT

LKIM2	ISZ	LKWDCT	/IF WORD COUNT = 0 GO SET UP HEADER PAIR

	JMP	LKEXIT 	/RETURN TO USER

	LAC	LKWP	/GET WORD PAIR COUNT

	TAD	(1

	AND	(377

	RTL

	RTL

	RTL

	RTL

	RAL

	AND	(377000

	TAD	(3	/PUT IN I/O MODE

	DAC*	LKLBF	/PUT IN FIRST WORD OF HEADER PAIR

	DZM	LKWPCT

	DZM	LKWP

	JMP	EXIT

LKIM1	LAC	LKWP

	TAD	(1	/UPDATE WORD PAIR COUNT

	DAC	LKWP

	DZM	LKWPCT

	JMP	LKIM2

	.EJECT

LKCTP	LAC	LKRET	/GET RETURN ADDRESS AND PUT IT IN RETURN SEQUENCE

	DAC	LKPC

	JMP	EXIT	/RETURN TO USER

LKMED	LAC	(1006	/PUT END OF MEDIUM IN HEADER PAIR

	DAC*	LKLBF

	JMP	EXIT

LKROUT	LAC	LKPT2

	TAD	(-1

	SAD	LKPT1

	JMP	LKEXIT

	DAC	LKPT2

	LAC	(0

	DAC*	LKPT2

	LAC	LKWDCT	/DECREMENT CHARACTER COUNT

	TAD	(-1

	DAC	LKWDCT

	JMP	LKEXIT

LKWIPE	LAC	LKPT1

	TAD	(1

	DAC	LKPT2

	LAC	LKWDC1	/RESET CHARACTER COUNT

	DAC	LKWDCT

	JMP	LKEXIT

LKCTC	.EXIT		/CTRL C

	.EJECT

LKCR	LAC	LKCH	/SET UP TO PACK

	DAC*	LKPT2

LKPACK	LAC	(LKBUF

	TAD	(2

	DAC	LKPT3

	LAC	LKLBF

	TAD	(2

	DAC	LKPT4

LKOVER	ISZ	LKWP

	LAC*	LKPT3

	CLL

	RTR

	RTR

	RTR

	RTR

	DAC*	LKPT4

	JMS	LKCRAL

	ISZ	LKPT3

	LAC*	LKPT3

	CLL

	RTL

	RTL

	TAD*	LKPT4

	DAC*	LKPT4

	JMS	LKCRAL

	ISZ	LKPT3

	LAC*	LKPT3

	CLL

	RTR

	RAR

	DAC	LKWD1

	RAR

	DAC	LKWD2

	LAC	LKWD1

	AND	(17

	TAD*	LKPT4

	DAC*	LKPT4

	ISZ	LKPT4

	LAC	LKWD2

	AND	(700000

	DAC*	LKPT4

	JMS	LKCRAL

	ISZ	LKPT3

	LAC*	LKPT3

	CLL

	RTL

	RTL

	RTL

	RTL

	TAD*	LKPT4

	DAC*	LKPT4

	JMS	LKCRAL

	ISZ	LKPT3

	LAC*	LKPT3

	CLL

	RAL

	TAD*	LKPT4

	DAC*	LKPT4

	JMS	LKCRAL

	ISZ	LKPT3

	ISZ	LKPT4

	JMP	LKOVER

LKCRAL	0

	LAC*	LKPT3

	SAD	(15

	JMP	LKFILL

	SAD	(175

	JMP	LKFILL

	JMP*	LKCRAL

LKFILL	LAC	LKWP

	TAD	(1

	RTL

	RTL

	RTL

	RTL

	RAL

	AND	(377000

	TAD	(2

	DAC*	LKLBF

	DZM	LKWP

	JMP	EXIT

EXIT	DZM	LKIOBY

	LAC	LKNOP

	DAC	LKNT1

LKEXIT	LAC	LKAC

LKSW	XX

	DBR

	XCT	(JMP* LKPC	/RETURN TO USER

	.EJECT

/ERROR MESSAGES

/IF PDP9 IS DEFINED THEN THE STANDARD ERROR MESSAGES FOR V5A WILL 

/OCCUR, OTHERWISE THE EXPANDED ERROR MESSAGES FOR DOS WILL OCCUR

LKENTR	LAC	(640000

	DAC	LKRT

	JMP	LKEROR

LKEROR	LAW	6

	.IFDEF	PDP9

	JMP*	(.MED+1

	.ENDC

	JMS*	(.SCOM+37

	JMP	LKEROR

	LAW	-2

	.SIXBT	'LK'

LKRT	XX

LKCLR	LAC	(650000

	DAC	LKRT

	JMP	LKEROR

LKMTP	LAC	(670000

	DAC	LKRT

	JMP	LKEROR

LKWRIT	LAC	(616100

	DAC	LKRT

	JMP	LKEROR

LKTRAN	LAC	(616300

	DAC	LKRT

	JMP	LKEROR

LKILL	LAC	(616000

	DAC	LKRT1

LKI1	LAW	7

	.IFDEF	PDP9

	JMP*	(.MED+1

	.ENDC

	JMS*	(.SCOM+37

	JMP	LKI1

	LAW	-2

	.SIXBT	'LK'

LKRT1	XX

	.EJECT

/

/  THIS ENTIRE PAGE EDIT #002

/

/  TOP3  SUBROUTINE RECEIVES AN ADDRESS IN THE AC

/	 IT GOES TO IOPS67 IF ANY OF THE TOP 3 BITS ON.

/	 IF NOT IOPS67,THE TOP 3 BITS OF THE PRESENT

/	 CAL ADDRESS ARE MERGED INTO THE PROVIDED

/	 ADDRESS. THE RESULTING ADDRESS IN RETURNED IN THE AC.

/

TOP3	0

	DAC	TOP3T	/SAVE CALLING ARGUMENT

	AND	(700000	/CHECK IF ADDR >32K

	SZA		/SKIP IF OK

	JMP	IOPS67	/ISN'T, CAUSE IOPS67

	LAC	LKCALP	/GET MODE BITS FROM CAL

	AND	(700000	/KEEPING ONLY THOSE BITS

	TAD	TOP3T	/MERGE WITH INPUT ADDRESS

	JMP*	TOP3	/RETURN WITH RESULT IN AC

/

TOP3T	0		/TEMPORARY FOR TOP3

/

IOPS67	LAW	67	/IOPS67

	JMS*	(.SCOM+37 /ERROR HANDLER

	JMP	IOPS67	/TRY AGAIN

	LAW	-1	/ONLY ONE WORD

	.SIXBT	'LK'	/HANDLER NAME

/

	.EJECT

/

/CONSTANTS

/

LKCALP	0		/ADDRESS OF CAL INSTRUCTION

LKARGP	0		/ADDRESS OF ARGUMENT POINTER

LKRET	0		/ADDRESS OF CONTROL P RETURN

LKIOBY	0		/I/O BUSY SWITCH

LKNOP	NOP

LKLBF	0		/USER'S LINE BUFFER ADDRESS

LKWH	0		/0=IOPS ASCII,  1=IMAGE ASCII

LKWDCT	0		/WORD COUNT FOR IMAGE ASCII ONLY

LKAC	0		/SAVE AC IN INTERRUPT HANDLER

LKION	ION

LKPC	0		/RETURN TO USER ADDRESS

LKSKP	SKP

LKBUF	.BLOCK	120	/INTERNAL BUFFER

LKPT1	0

LKPT2	0

LKJMP	JMP LKRD

LKCH	0		/CHARACTER

LKWPCT	0

LKWP	0		/WORD PAIR COUNT

LKPT3	0

LKPT4	0

LKWD1	0

LKWD2	0

LKWDC1	0		/CHARACTER COUNT FOR CTRL U

	.END	LKA.

LKRET	0		/ADDRESS OF CONTROL P RETURN

LKIOBY	0		/I/O BUSY SWITCH

LKNOP	NOP

LKLBF	0		/USER'S LINE BUFFER ADDRESS

LKWH	0		/0=IOPS ASCII,  1=IMAGE ASCII

LKWDCT	0		/WORD COUNT FOR IMAGE ASCII ONLY

LKAC	0		/SAVE AC IN INTERRUPT HANDLER

LKION	ION

LKPC	0		/RETURN TO USER ADDRESS

LKSKP	SKP

LKBUF	.BLOCK	120	/INTERNAL BUFFER

LKPT1	0

LKPT2	0

LKJMP	JMP LKRD

LKCH	0		/CHARACTER

LKWPCT	0

LKWP	0		/WORD PAIR COUNT

LKPT3	0

LKPT4	0

LKWD1	0

LKWD2	0

LKWDC1	0		/CHARACTER COUNT FOR CTRL U

	.END	LKA.
