Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-02 - 43,50277/format.mac
There are 10 other files named format.mac in the archive. Click here to see a list.
TITLE  3DA   U OF O MODIFIED
SUBTTL   BRUCE ALAN VANNATTA/BAV  18-MAY-71

;TAPE CERTIFICATION PROGRAM FOR PDP-10
;DECTAPE
;WILL PRODUCE AND CHECK A TAPE OF
;1102 OCTAL BLOCKS OF 128 PDP-10 WORDS EACH
;FOLLOW DIRECTIONS TYPED. TO PRODUCE TAPE.

P=17
UNIT=16
TAPENO=15						;U/O-BAV
SEL=30000
FWD=200000
DTS=324
DTC=320


RVS=100000

RIM10B
LOC 4000


A:	SETZM 	TTYOFF
	SETZM	LPTOFF
	MOVEI [ASCIZ /
TYPE IN THE UNIT NO	/]
	JSR	17,PNTIT
	CONO	TTY,1000		;CLEAR TYPE IN
	CONSZ	TTY,20		;WAIT IF TYPING
	JRST	.-1		;NOW
	CONSO	TTY,40
	JRST	.-1		;WAIT FOR OPERATOR
	DATAI	TTY,
	DATAO	TTY,		;ECHO CHAR
	CONSO	TTY,10
	JRST	.-1		;WAIT FOR ECHO
	ANDI	177
	SUBI	60
	JUMPL	A		;TYPING MISTAKE
	CAILE	10
	JRST	A		;TYPING MISTAKE
	ANDI	7
	LSH	11
	MOVEM	UNIT		;VALID UNIT
A1:	SETZ	TAPENO,		;CLEAR TAPE #		;U/O-BAV
	MOVE	1,[POINT 6,TAPENO]	;SET UP POINTR	;U/O-BAV
	MOVEI	[ASCIZ/
TYPE IN THE TAPE NUMBER    /]	;TYPE OUT MESSAGE	;U/O-BAV
	JSR	17,PNTIT				;U/O-BAV
NEXT:	CONO	TTY,1000	;CLEAR TTY 		;U/O-BAV
	CONSZ	TTY,20		;BUSSY TYPING OUT?	;U/O-BAV
	JRST	.-1		;YES			;U/O-BAV
	CONSO	TTY,40		;IS INPUT READY?	;U/O-BAV
	JRST	.-1		;NO			;U/O-BAV
	DATAI	TTY,		;GET CHARACTER INTO AC0	;U/O-BAV
	DATAO	TTY,		;ECHO CHARACTER		;U/O-BAV
	CONSO	TTY,10		;ECHO DONE?		;U/O-BAV
	JRST	.-1		;NO			;U/O-BAV
	ANDI	177		;CLEAR ALL BUT LOW 8	;U/O-BAV
	CAIN	15		;SKIP IF NOT A CR	;U/O-BAV
	JRST	SETUP		;WE'RE DONE		;U/O-BAV
	SUBI	40		;CONVERT TO SIX BIT	;U/O-BAV
	CAIG	32		;> 10 DECIMAL?		;U/O-BAV
	CAIGE	20		;< 0  DECIMAL?		;U/O-BAV
	JRST	A1		;TYPING ERROR		;U/O-BAV
	IDPB	1		;DEPOSIT THE CHARACTER	;U/O-BAV
	JRST 	NEXT		;GO AND GET NEXT CHAR	;U/O-BAV
SETUP:							;U/O-BAV
	MOVE	P,[XWD -40,PLIST]
B:	MOVEI	[ASCIZ /


MOUNT TAPE,SET WRITE,REMOTE,THEN (AND ONLY THEN) SET WRTM SWITCH/]
	JSR	17,PNTIT		;PRINT MESSAGE
	CONSO	DTS,1B25		;WAIT FOR TIMING AND
	JRST	.-1		;MARK SWITCH TO BE SET
	CONO	DTC,SEL(UNIT)
	CONSO 	DTS,1B24
	JRST	C
	MOVEI	[ASCIZ /
THE TRANSPORT WRITE SWITCH IS NOT SET/]
	JSR	17,PNTIT		;MESSAGE
	PUSHJ	P,STOP		;+STATUS
	PUSHJ	P,PSTAT		;INFO
	JRST	A		;TRY AGAIN
C:	MOVEI	200
	MOVEM	CERSIZ#		;BLK SIZE
	MOVEI	1102
	MOVEM	CERBLK#		;1102 OCTAL BLOCKS
	PUSHJ	P,WRTMK1		;WRITE TIMING & MARK
D:	MOVEI	[ASCIZ/

IF TAPE IS OFF REEL REMOUNT,THEN (AND ONLY THEN) TURN OFF WRTM SWITCH/]
	JSR	17,PNTIT		;PRINT MESSAGE
	CONSZ	DTS,1B25		;WAIT FOR OPERATOR TO
	JRST	.-1		;TURN OFF TIMING & MARK SWITCH
	PUSHJ	P,TMKBM		;THEN WRITE BLOCK NUMBERS & CHECK
	CONO	DTC,FWD+SEL(UNIT)	;GO A LITTLE
	CONSO	DTS,1B22		;FARTHER INTO
	JRST	.-1			;END ZONE
	CONO	DTC,RVS+7B29
FIX1:	CONSZ	DTS,745700		;LOOK FOR
	JRST	ER1			;ERRORS
	CONSZ	DTS,1B22
	JRST	E			;END
	CONSO	DTS,1
	JRST	FIX1
;	DATAO	DTC,[0]			;WRITE ZEROS	;%%-BAV
	DATAO	DTC,TAPENO		;WRITE TAPE #	;U/O-BAV
	JRST	FIX1
E:	MOVEI	[ASCIZ/
TAPE #/]						;U/O-BAV
;TAPE OK						;%%-BAV
	JSR	17,PNTIT				;U/O-BAV
	MOVE	TAPENO					;U/O-BAV
	JSR	15,PNTIT				;U/O-BAV
	MOVEI	[ASCIZ/OK
/]
	JSR	17,PNTIT		;END MESSAGE
	JRST	A

;WRITE TIMING & MARK INFORMATION

WRTMK1:	CONO	DTC,FWD+SEL+400(UNIT)	;MARK TRACK MODE FORWARD
	CONSZ	DTS,640000
	JRST	ER
	MOVE	1,[404404404404]	;END ZONE
	MOVEI	2,^D2500		;FOR THIS NUMBER
	PUSHJ	P,WTMK		;SEND DATA TO TAPE
	SOJG	2,.-1		;WRITE END ZONE

WRTMK2:	MOVEI	3,@CERSIZ		;WRITE THE TIMING AND
	MOVE	4,CERBLK		;MARK FOR N BLOCKS
	SKIPA	2,[-4]
MKBKE:	HRROI	2,-5
	MOVE	1,MKBKET(2)	;LOAD MARK
	PUSHJ	P,WTMK		;SEND DATA
	AOJLE	2,.-2
	CAIE	2,-3(3)		;THE DATA PORTION
	JRST	.-3		;OF THE BLOCK
	HRROI	2,-2
	MOVE	1,MKBKET+3(2)
	PUSHJ	P,WTMK		;END OF BLOCK STUFF
	AOJLE	2,.-2
	SOJG	4,MKBKE
	MOVE	1,MKBKET-5
	PUSHJ	P,WTMK		;WRITE A RVS BLOCK

WRTMK3:	MOVE	1,[040040040040]	;RVS END
	MOVEI 2,50000
	PUSHJ	P,WTMK		;WRITE THE REVERSE
	SOJG	2,.-1		;END ZONE
	JRST	STOP		;STOP + RETURN
;WRITE BLOCK NUMBERS AND VIRGIN DATA

TMKBM:	PUSHJ	P,MOVAY		;GET THE TAPE IN POSITION

TMKBM1:	SOS	3,CERBLK		;NUMBER OF BLKS-1
	SETCM	2,CERSIZ		;BLOCK SIZE CNTR
	MOVEI	1,(3)
	PUSHJ	P,WTMK		;WRITE FORWARD BLK NO#
	SETCMI	1,-1(3)
	PUSHJ	P,OBVSBK		;OBVERS THE BLK NO#
	PUSHJ	P,WTMK
	SOJE	3,TMKBM2-3		;END OF WRITE
	MOVE 1,[252525252525]
	PUSHJ	P ,WTMK		;WRITE GUARD AND
	AOJLE	2,.-1		;DATA PORTION
	JRST	TMKBM1+1		;WRITE REST OF BLOCKS


	CONSO DTS,20000
	JRST .-1
	CONO DTC,RVS
TMKBM2:	CONO	DTC,300100	;END OF WRITING (TURN)
				;BLK NUMBERS + VIRGIN DATA
TMKCK1:	MOVEI	3,1		;CHECK THE DATA
	SETCMI	1,-1(3)		;THE NUMBER
	PUSHJ	P,OBVSBK		;RVS S. OBVERS
	PUSHJ	P,RTMK		;RD CHAR
	MOVEI	1,(3)
	PUSHJ	P,RTMK		;FORWARD BLOCK NO
	SETCM	2,CERSIZ		;DATA WDS PER BLOCK
	MOVE	1,[252525252525]
	PUSHJ	P,RTMK		;READ DATA PORTION
	AOJLE	2,.-2		;OF BLOCK
	ADDI	3,1
	CAIE	3,@CERBLK		;NUMBER OF BLOCKS
	JRST	TMKCK1+1		;MORE BLOCKS
	JRST	STOP		;STOP AND RETURN
;MISC DATA + SUBROUTINES

	400404040404		;RVS BLK
	040404040440		;FORWARD BLK
	044040004000		;RVS GUARD
	004000004000		;RVS CK SUM
	004000444000		;FST + SECOND DATA
MKBKET:	444000444000		;DATA
	444000444044		;LAST-1 + LAST
	444044444044		;LAST + FWD CK SUM
	444044404004		;RVS LOCK + GUARD


OBVSBK:	MOVEM	1,4		;OBVERS THE RIGHT OF AC1
	REPEAT 6,<
	ROTC 4,-3
	ROT 5,6>
	ROT 5,-3
	HRLO 1,5
	POPJ	P,

MOVAY:	CONO	DTC,RVS+SEL+200(UNIT)	;RDBLK NO FORWARD
	CONSO	DTS,1		;WHEN A BLOCK
	JRST	.-1		;APPEARS
	CONO	DTC,300000	;TURN AROUND AND
	CONSO	DTS,20000		;LOOK FOR
	JRST	.-1		;END ZONE

	CONO DTC,FWD
	CONO	DTC,300500	;THEN OUT OF END WITH WRITE ALL
	POPJ	P,

WTMK:	CONSZ	DTS,775700	;WRITING.  LOOK FOR
	JRST	ER1		;ERROR CONDITIONS
	CONSO	DTS,1
	JRST	.-3		;WAIT FOR FLAG
	DATAO	DTC,1		;SEND DATA
	POPJ	P,
RTMK:	CONSZ	DTS,777700	;READING.  LOOK FOR
	JRST	ER2		;ERRORS
	CONSO	DTS,1		;WAIT
	JRST	.-3		;FOR FLAG
	DATAI	DTC,0		;READ THE DATA
	CAMN	1		;CHECK THE DATA
	POPJ	P,		;OK
	PUSHJ	P,STOP		;ERROR IN DATA
RTMKBD:	MOVEM	SAV0#
	MOVEM	1,SAV1#
	MOVEI	[ASCIZ /
GOOD	/]
	JSR	17,PNTIT		;MESSAGE "GOOD"
	MOVE	SAV1
	JSR	14,PNTIT		;THE DATA
	MOVEI	[ASCIZ /
ERROR	/]
	JSR 	17,PNTIT		;MESSAGE "BAD"
	MOVE	SAV0
	JSR	14,PNTIT		;THE DATA
	PUSHJ	P,PSTAT		;PRINT STATUS
	JRST	A
;STATUS INFO PRINTER

PSTAT:	MOVEI	[ASCIZ /
STATUS DTC	/]
	JSR	17,PNTIT		;MESSAGE
	MOVE	STDTC
	JSR	14,PNTIT		;DTC# DATA
	MOVEI	[ASCIZ /
STATUS DTS	/]
	JSR	17,PNTIT		;MESSAGE
	MOVE	STDTS
	JSR	14,PNTIT		;DTS# DATA
	POPJ	P,

STOP:	CONI	DTC,STDTC#	;READ THE STATUS
	CONI	DTS,STDTS#
	CONO	214,1		;STOP FUNCTION
	CONO	DTC,400000
	CAM
	CAM
	POPJ	P,		;EXIT

ER:	PUSHJ	P,STOP		;ERROR STATUS WHEN START UP
	MOVEI	[ASCIZ /
DECTAPE CNTL ERROR/]
	JSR	17,PNTIT
	PUSHJ	P,PSTAT
	JRST	A

ER1:	PUSHJ	P,STOP		;ERROR STATUS DURING WRITE
	MOVEI	[ASCIZ /
ERROR OCCURED DURING WRITE/]
	JSR	17,PNTIT
	PUSHJ	P,PSTAT
	JRST	A

ER2:	PUSHJ	P,STOP		;ERROR STATUS DURING READ
	MOVEI	[ASCIZ /
ERROR OCCURED DURING READ/]
	JSR	17,PSTAT
	JRST	A

PLIST:	BLOCK	41
	SUBTTL	PRINT SUBROUTINE   B. CORBIN
;THIS IS A SUBROUTINE THAT PRINTS ASCII MESSAGES
;OR A DESIGNATED AMOUNT OF OCTAL NUMBERS.
;YOU ENTER THS ROUTINE WITH AC0 CONTAINING THE
;ADDRESS OF THE ASCII MESSAGE OR THE OCTAL NUMBERS
;TO BE PRINTED.
;CALL SEQUENCE IS AS FOLLOWS:
;JSR	X,PNTIT
;IF X=0,	PRINT ASCII MESSAGE AT ADDRESS (WILL PRINT ONE WORD).
;IF X=17,	PRINT ASCII MESSAGE AT ADDRESS (WILL
;		PRINT UNTIL IT SEES 0'S).
;IF X=1,	IT WILL PRINT THE RIGHT MOST OCTAL NUMBER.
;IF X=14,	IT WILL PRINT THE NUMBER IN AC0.
;IF X=15,	IT WILL PRINT ONE SIXBIT WORD @AC0	;U/O-BAV

PNTIT:	0
	MOVEM	1,ACE1#		;SAVE AC1.
	MOVEM	2,ACE2#		;SAVE AC2.
	MOVEM	3,ACE3#		;SAVE AC3.
	MOVEM	4,ACE4#		;SAVE AC4.
	MOVE	1,PNTIT		;MOVE C(JSR+1) INTO AC1.
	MOVE	2,-1(1)		;MOVE THE JSR INTO AC2.
	ROT	2,15		;GET X
	ANDI	2,17		;OUT OF THE JSR.
	CAIN	2,17		;X=17?
	JRST	ASCPNT-1	;YES. PRINT MORE THAN 1 WORD.
	JUMPE	2,ASCPNT	;X=0? YES. GO PRINT 1 WORD.
	CAIN 	2,15		;IS X=15 ?		;U/O-BAV
	JRST	SIXBIT		;YES 			;U/O-BAV
	MOVE	3,2		;MOVE X INTO AC3.
	ROT	0,-3		;ROT OCTAL NUM 3 PLACES
	SOJN	3,.-1		;X AMOUNT OF TIMES.
PNTIT1:	MOVEI	1,26		;PUT 26 INTO AC1 SO THAT
	ROTC	0,3		;C(AC1) AFTER THE ROTC WILL BE 260
	JSP	3,TOUT		;PLUS NUMBER TO BE PRINTED..GO PNT NUM.
	SOJN	2,PNTIT1	;SUB 1 FROM X...PRINT UNTIL X=0.
	SKIPE	PNT#		;DON'T PRINT ASPACE FLAG SET?
	JRST	PNTIT2		;YES...GO AROUND PRINTING A SPACE.
	MOVEI	1,240		;AT THIS POINT WE HAVE PRINTED
	JSP	3,TOUT		;X AMOUNT OF NUMBER(S) AND NOW A SPACE.
PNTIT2:	SETZM	PNT#		;CLEAR PRINT MORE THAN 1 WORD FLAG.
	MOVE	1,ACE1		;RESTORE AC1.
	MOVE	2,ACE2		;RESTORE AC2.
	MOVE	3,ACE3		;RESTORE AC3.
	MOVE	4,ACE4		;RESTORE AC4.
	JRST	@PNTIT		;RETURN.
SIXBIT:	MOVE	2,[POINT 6,]	;SET UP POINTER TO AC0	;U/O-BAV
	ILDB	1,2		;GET SIXBIT CHAR	;U/O-BAV
	ADDI	1,240		;FIX IT UP		;U/O-BAV
	JSP	3,TOUT		;SEND IT OUT		;U/O-BAV
	TLNE	2,770000	;DONE?			;U/O-BAV
	JRST	SIXBIT+1	;NO			;U/O-BAV
	JRST	PNTIT2		;YES			;U/O-BAV

	SETOM	PNT#		;SET PRINT MORE THAN 1 WORD FLAG.
ASCPNT:	MOVEM	0,POINTR#	;SAVE ADDRESS OF ASCII MESSAGE.
ASCPT1:	MOVEI	2,5		;5 = NUM OF ASCII CHAR. IN A WORD.
	MOVE	0,@POINTR	;C(AC0) = FIRST WORD OF ASCII MESS.
ASCPT2:	SETZ	1,		;CLEAR AC1.
	ROTC	0,7		;C(AC1) = CHAR TO BE PRINTED.
	JUMPE	1,PNTIT2	;CHAR = 0?..NO MORE CHAR..LEAVE.
	JSP	3,TOUT		;PRINT A CHAR.
	SOJN	2,ASCPT2	;PNT ALL CHAR FROM THIS WORD?
	AOS	POINTR		;YES. INC TO GET NEXT WORD.
	SKIPN	PNT		;PNT MORE THAN ONE CHAR FLAG SET?
	JRST	PNTIT2		;NO..LEAVE.
	JRST	ASCPT1		;YES...RETURN TO PNT NEXT WORD.

TOUT:	MOVEM	0,ACE0#		;SAVE AC0.
	SETZ	0,		;CLEAR AC0..USE AS BIT CNTR.
	MOVE	4,1		;PUT CHAR INTO AC4.
	ANDI	4,-1(4)		;THIS WILL CLEAR 1 BIT AT A TIME.
	SKIPE	4		;ALL THE BITS?
	AOJA	0,.-2		;NO. RETURN TO DO ANDI AGAIN.
	TRNN	0,1		;BIT CNTR ODD?
	TRC	1,200		;COMP HI ORDER BIT..EVEN PAR.
	JSP	0,SWT		;GO READ DATA SWITCHES.
	AOS	CARCNT#		;INC CHAR CNTR.
	CAIN	1,215		;CHAR A CR?
	SETZM	CARCNT		;CLR CHAR CNTR.
	CAIN	1,12		;IS CHAR A LF?
	SETZM	CARCNT		;YES. CLR CHAR CNTR.
	CAIN	1,207		;IS CHAR A BELL?
	JRST	BLL		;YES. GO RING A BELL.
	TLNE	0,10		;IS NON PNT SWITCH ON?
	JRST	(3)		;YES. RETURN.
	TLNN	3,10000		;IS USER MODE BIT ON?
	JRST	.+3		;NO.
	TLNN	3,4000		;YES..IS PRIV I/O BIT ON?
	JRST	TOUT2		;NO..USER MODE GO DO OUTPUT.
	TLNE	0,4		;IS LPT PNT SWT UP?
	JRST	TOUT1		;YES. GO PRINT ON LPT.
	CAIN	1,11		;IS CHAR A TAB?
	JRST	TABS		;YES. TURN TAB INTO SPACES.
	DATAO	TTY,1		;PRINT A CHAR.
	CONSO	TTY,10		;TTY BUSY?
	JRST	.-1		;YES.
TOUTA:	MOVE	0,ACE0		;RESTORE AC0.
	JRST	(3)		;RETURN.

CARCNT:	0
TABS:	SOS	1,CARCNT	;PUT CHAR CNT - 1 TAB INTO AC1.
	SUBI	1,10		;DIVIDE
	JUMPGE	1,.-1		;BY 10.
	MOVN	1,1		;C(AC1) NOW = NO. OF SPACES TO PNT.
	SKIPE	TTYOFF		;USER MODE?
	JRST	TABS2		;YES.
TABS1:	DATAO	TTY,[240]	;SEND A SPACE.
	CONSO	TTY,10		;TTY BUSY?
	JRST	.-1		;YES.
	AOS	CARCNT		;INCREMENT CHAR CNTR.
	SOJG	1,TABS1		;DECREMENT SPACES CNTR.
	JRST	TOUTA		;RETURN.

TABS2:	MOVEI	0,240
	ROT	0,-7
TABS3:	MOVEM	0,@OUTTY1	;PUT A SPACE IN BEFFER
	OUTPUT	1,
	AOS	CARCNT		;INC CHAR CNTR.
	AOS	@OUTTY1	;RESET PNTRS.
	AOS	OUTTY1
	SOJG	1,TABS3
	SOS	@OUTTY1		;CANCELL RESETING OF PNTRS.
	SOS	OUTTY1
	JRST	TOUTA

TOUT1:	LSH	1,1		;C(AC1) HAS TO BE LEFT JUSTIFIED.
	DATAO	LPT,1		;PRINT CHAR ONTO LPT.
	CONSO	LPT,100		;LPT DONE?
	JRST	.-1		;NO.
	JRST	TOUTA		;GO RESTORE AC0 AND RETURN.

TOUT2:	TLNE	0,4		;IS LPT PRINT SWT UP?
	JRST	TOUT3		;YES. GO PRINT CHAR ONTO LPT.
	SKIPE	LPTOFF#		;LPT BEEN USED?
	JSR	USERM		;YES. RELEASE IT.
	SETZM	LPTOFF#		;CLEAR INIT LPT FLAG.
	SKIPN	TTYOFF#		;TTY BEEN INITIALIZED YET?
	JSR	USERM		;NO. GO DO IT.
	AOS	@OUTTY1		;SETUP SO IT LOOKS FOR ONE WORD
	AOS	OUTTY1		;THIS POINTS TO WHERE CHAR IS PUT.
	CAIN	1,11		;IS CHAR A TAB?
	JRST	TABS		;YES. TURN TAB INTO SPACES.
	ROT	1,-7		;MAKE C(AC1) FIRST CHAR IN WORD.
	MOVEM	1,@OUTTY1	;PUT CHAR INTO BUFFER.
	OUTPUT	1,		;DO OUTPUT.
	JRST	TOUTA		;GO RESTORE AC0 AND RETURN.
BLL:	TLNN	3,10000		;USER MODE BIT ON?
	JRST	.+3		;NO.
	TLNN	3,4000		;YES..PRIV. I/O?
	JRST	(3)		;NO. USER MODE..DO NOT PRINT A BELL.
	CONSO	TTY,20		;TTY BUSY?
	DATAO	TTY,[207]	;NO. PRINT A BELL.
	JRST	TOUTA		;RESTORE AC0 AND RETURN.


TOUT3:	MOVE	4,ACEE4#	;RESTORE CHAR COUNT TO LAST TIME USED.
	SKIPN	LPTOFF		;LPT BEEN INITED YET?
	JRST	INTLPT		;NO. GO INITIALIZE IT.
	CAIN	1,215		;IS CHAR A CR?
	SETOM	PCR#		;YES. SET FLAG TO DO OUTPUT.
	TRZ	1,200		;CLEAR BIT 28.
	LSH	1,(4)		;SHIFT CHAR.
	IORM	1,@OUTLP1	;PUT CHAR INTO BUF.
	SUBI	4,7		;SUB 7 FROM CHAR CNTR.
	JUMPL	4,OUTLXX	;5 CHAR IN WORD?..RESET CHAR CNTR.
BACKX:	SKIPE	PCR		;LAST CHAR A CR?
	JRST	OUTLYY		;YES. DO AN OUTPUT.
	SOSLE	OUTLP2		;ANY ROOM LEFT IN BUFF?
	JRST	ENDIT		;YES.
	JRST	OUTLYY		;NO. DO AN OUTPUT.

OUTLXX:	AOS	OUTLP1		;INC POINTER TO NEXT WORD.
	HRRZI	4,35		;RESET CHAR CNTR.
	JRST	BACKX		;RETURN.

OUTLYY:	OUTPUT	2,		;DO OUTPUT TO LPT.
	CALL	2,[SIXBIT /WAIT/];WAIT UNTIL LPT FINISHED.
	SETZM	PCR		;CLEAR DO OUTPUT FLAG.
	HRRZI	4,35		;RESET CHAR CNTR.
	AOS	OUTLP1		;INC POINTER TO NEXT WORD.
ENDIT:	MOVEM	4,ACEE4		;SAVE CHAR COUNTER.
	JRST	TOUTA		;GO SAVE AC0 AND RETURN.

INTLPT:	INIT	2,
	SIXBIT	/LPT/
	XWD	OUTLPT,0
	JRST	TOUT2+2		;GO TO PRINT ON TTY IF LPT NOT AVAIL.
	OUTPUT	2,
	SETOM	LPTOFF		;SET INIT LPT FLAG.
	HRRZI	4,35		;SETUP CHAR CNTR.
	AOS	OUTLP1		;INC POINTER TO NEXT WORD.
	JRST	TOUT3+1		;RETURN.

SWT:	MOVEM	0,ACEE0#	;SAVE AC0.
	TLNN	0,10000		;IS USER MODE BIT ON?
	JRST	.+5		;NO..EXEC MODE.
	TLNE	0,4000		;PRIV I/O?
	JRST	.+3		;YES..BYPASS USER MODE DATAI.
	CALL	0,[SIXBIT /SWITCH/];PUT DATA SWITCHES INTO AC0.
	JRST	@ACEE0		;RETURN.
	DATAI	0,0		;PUT SWITCHES INTO AC0.
	JRST	@ACEE0		;RETURN.

USERM:	0
	CALL	[SIXBIT .RESET.]
	INIT	1,21
	SIXBIT	/TTY/
	XWD	OUTTY,INTTY
	JRST	USERM+1
	OUTBUF	1,1
	INBUF	1,1
	OUTPUT	1,
	SETOM	TTYOFF#		;SET INIT TTY FLAG.
	JRST	@USERM		;RETURN.

OUTTY:	0
OUTTY1:	0
OUTTY2:	0

INTTY:	0
INTTY1:	0
INTTY2:	0

OUTLPT:	0
OUTLP1:	0
OUTLP2:	0
	VAR
	LIT
END:	JRST	4,XXX#

END	JRST 4,4000