	.TITLE     ***  BDMAIN -- BATCH MAIN PROCESSING LOOP

 

 

 

 

/

/ COPYRIGHT (C) 1976

/ 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 DIGITIAL EQUIPMENT CORPORATION.

/

/ DEC ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY

/ OF ITS SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DEC.

/

	.TITLE DESCRIPTION AND EDIT HISTORY

 

 

 

 

/

/ BDMAIN

/

/ COME HERE AFTER ^T, WITH TDV WAITING FOR LOGIN DISK AND UFD.

/ THE $JOB CARD IS IN IN.BFR.  PROCESS JOB UNTIL AN END-OF-JOB

/ CONDITION IS REACHED; EXIT TO BDDONE.

/

 

 

 

/

/ 100	20-AUG-76 (EAG)		MULTIACCESS BATCH, INITIAL

/				VERSION.

/

	.TITLE MISCELLANEOUS ASSEMBLY CONSTANTS & MACROS

 

 

 

 

/

/ NOTE:  THIS PROGRAM USES NO ASSEMBLY PARAMETERS.  ALL

/	 PARAMETERIZED VALUES ARE OBTAINED FROM THE

/	 RESIDENT SECTION VIA INITIALIZATION CODE.

/

 

 

 

TDV=240426			/ .SIXBT "TDV".  USED TO

				/ DETERMINE WHETHER AN I/O

				/ REQUEST IS FROM TDV... OR

				/ FROM SOME OTHER TASK.

 

...=565656			/ .SIXBT "...".  USED TO

				/ DETERMINE WHETHER AN I/O

				/ REQUEST IS FROM TDV... OR

				/ FROM SOME OTHER TASK.

 

HINFO=300021			/ FUNNY EV VALUE RETURNED

				/ BY HINF REQUEST.

 

 

 

/

/ INDIRECT-INDEXED INSTRUCTION MNEMONICS:

/

 

DACIX=DAC* X

LACIX=LAC* X

XORIX=XOR* X

TADIX=TAD* X

ISZIX=ISZ* X

SADIX=SAD* X

 

 

 

/

/ SPECIAL INSTRUCTIONS:

/

 

.INH=705522			/ INHIBIT INTERRUPTS.

.ENB=705521			/ ENABLE INTERRUPTS.

 

 

 

/

/ MACRO TO SUSPEND TASK EXECUTION:

/

 

	.DEFIN SUSPEND

	  CAL (06)

	.ENDM

 

 

 

/

/ MACRO TO SET ERROR FLAGS IN JOBERR:

/

 

	.DEFIN ERROR FLAG

	  LAC (FLAG)

	  JMS* ERRFLG

	.ENDM

 

 

 

/

/ MACRO TO DECLARE SIGNIFICANT EVENT.  SINCE BATCH IS AN I/O

/ HANDLER, WE ASSUME ALL TASKS ISSUEING REQUESTS TO IT ARE AT

/ LOWER PRIORITIES.  THEREFORE BATCH WILL NEVER DECLARE A

/ SIGNIFICANT EVENT FOR I/O REQUEST COMPLETION, WHICH IS

/ THE ONLY REASON FOR WHICH BDMAIN (THIS OVERLAY) MIGHT

/ DECLARE A SIGNIFICANT EVENT.  WE PREVENT BDMAIN FROM

/ DECLARING SIGNIFICANT EVENTS BY MAKING THIS A NULL MACRO.

/

 

	.DEFIN .SET6

	.ENDM

 

 

 

/

/ MACRO TO DEFINE A TEXT BUFFER WITH CORRECT HEADER

/ WORD PAIR COUNT.

/

 

	.DEFIN TEXT TXT,?LBL

	  .NOLST

	  LBL-.*400+2

	  0

	  .ASCII TXT

LBL=.

	  .LST

	.ENDM

 

 

 

/

/ DEFINE DEBUGGING AID MACRO:

/

 

	.DEFIN .DEBUG MESSAG,WORD,FORM

	.ENDM

 

	.IFDEF %DEBUG

 

	.DEFIN .DEBUG MESSAG,WORD,FORM

	  .NOLST

	  .GLOBL .DBG

	  JMS* .DBG

	    .ASCII MESSAG@<0>

	    .DSA FORM

	    .DSA WORD

	  .LST

	.ENDM

 

	.ENDC

	.TITLE REFERENCES TO EXECUTIVE'S SCOM AREA

 

 

 

 

/

/ AUTO-INCREMENT REGISTERS:

/

 

X15=15

X16=16

 

 

 

/

/ REENTRANT REGISTERS USED TO INTERFACE TO REENTRANT

/ ROUTINES:

/

 

R1=101

R2=102

R3=103

R4=104

 

 

 

/

/ REENTRANT SYSTEM ROUTINE ENTRY POINTS:

/

 

NADD=107			/ ADD NODE IN R2 TO

				/ LISTHEAD IN R1.

 

SPRI=126			/ INSERT NODE IN R2 INTO

				/ PRIORITY ORDERED LISTHEAD

				/ IN R1.

 

 

 

/

/ TIME VALUES:

/

 

SSM=160				/ SECONDS SINCE MIDNIGHT.

 

MM=164				/ MINUTE WITHIN HOUR.

 

DA=167				/ CURRENT DAY (WITHIN MONTH).

 

 

 

/

/ MULTIACCESS CONTROL REGISTERS.  USED TO INTERFACE WITH TDV:

/

 

MA.CST=230			/ POINTER TO TDV'S CONTROL

				/ AND STATUS TABLE.  OFFSETS

				/ WITHIN CONTROL AND STATUS

				/ TABLE ARE DEFINED LATER.

 

 

 

/

/ QUEUE LISTHEADS:

/

 

POOL=240			/ POOL OF EMPTY NODES.

 

 

 

/

/ ENTRY POINTS TO I/O HANDLER REENTRANT ROUTINES:

/

 

DQRQ=337			/ DEQUEUE AN I/O REQUEST

				/ FROM PDVL NODE IN R1 AND

				/ RETURN IT IN AC, R2.

 

VAJX=342			/ VERIFY AND ADJUST I/O

				/ BUFFER IN R3, R4, R2.

 

IOCD=345			/ ADJUST TRANFER PENDING

				/ COUNT OF I/O REQUEST IN R2.

 

DMTQ=361			/ PROCESS ABORT REQUEST IN R2

				/ FOR PDVL NODE IN R1.

	.TITLE NODE FORMAT DEFINITIONS

 

 

 

 

/

/ REFERENCES TO STL NODES:

/

 

S.N1=2				/ FIRST WORD OF TASK NAME.

S.N2=3				/ SECOND WORD OF TASK NAME.

 

 

 

/

/ REFERENCES TO PDVL NODES:

/

 

D.QF=6				/ I/O REQUEST QUEUE LISTHEAD.

 

 

 

/

/ REFERENCES TO I/O REQUEST NODES ARE CODED USING NUMERIC

/ CONSTANTS.

/

	.TITLE REFERENCES TO TDV TABLES

 

 

 

 

/

/ REFERENCES TO TDV'S USER CONTEXT AREA.  THE USER CONTEXT

/ AREA IS ACCESSED VIA THE TTY.UC TABLE IN TDV'S CONTROL AND

/ STATUS TABLE.  ONLY THE USER CONTEXT AREA FOR THE

/ BATCH USER (TERMINAL) IS REFERENCED.

/

 

U.SSM=74			/ SSM (SECONDS SINCE MIDNIGHT)

				/ WHEN CURRENT REQUEST BEGAN

				/ PARTITION WAIT, OR -1 IF NOT

				/ IN PARTITION WAIT.

 

U.TW=75				/ TOTAL TIME, IN SECONDS, SPENT

				/ IN PARTITION WAIT EXCLUDING

				/ CURRENT REQUEST (PARTITION

				/ WAIT TIME FOR CURRENT REQUEST

				/ DETERMINED FROM U.SSM).

	.TITLE REFERENCES TO BDRES AND OTHER BATCH OVERLAYS

 

 

 

 

/

/ DEFINE ENTRY POINT TO THIS OVERLAY:

/

 

	.GLOBL BDMAIN

 

 

 

/

/ DEFINE ENTRY POINT TO BATCH OVERLAY WHICH

/ THIS OVERLAY EXITS TO:

/

 

	.GLOBL BDDONE

 

 

 

/

/ DEFINE ENTRY POINT TO BATCH SYSTEM ERROR PROCESSOR:

/

 

	.GLOBL BDABRT

 

 

 

/

/ DEFINE ENTRY POINTS TO ROUTINES IN RESIDENT SECTION:

/

 

	.GLOBL ISSUE		/ ROUTINE TO ISSUE CPB'S.

 

	.GLOBL CHKCRD		/ ROUTINE TO DETERMINE TYPE OF

				/ INPUT LINE.

 

	.GLOBL CTRL.Y		/ ROUTINE TO SIMULATE A ^Y.

 

	.GLOBL USRSTAT		/ ROUTINE TO DETERMINE LOGIN

				/ STATUS OF BATCH.

 

	.GLOBL ERRFLG		/ ROUTINE TO SET ERROR

				/ FLAG BITS IN LOCATION

				/ JOBERR.

 

	.GLOBL PRINT		/ ROUTINE TO PRINT A LINE

				/ ON THE LISTING DEVICE.

 

	.GLOBL ECHO		/ ROUTINE TO ECHO INPUT LINE

				/ ON THE LISTING DEVICE.

 

	.GLOBL ECHOWT		/ ROUTINE TO WAIT FOR LISTING

				/ ACTIVITY TO FINISH.

 

 

 

/

/ DEFINE REFERENCES TO CURRENT JOB NODE IMAGE (PRIMARY NODE):

/

 

	.GLOBL JBFLGS		/ JOB FLAGS WORD. (SEE BELOW)

 

 

 

/

/ DEFINE BIT MASKS WITHIN JOB FLAGS WORD (JBFLGS):

/

 

UFDFLG=002000			/ EXPLICIT LOGIN DEVICE/UFD

 

 

 

/

/ OTHER LOCATIONS IN BATCH CONTROL VECTOR:

/

 

	.GLOBL TLEACT		/ ACTION TO TAKE ON TIME

				/ ESTIMATE EXCEEDED.

				/ 1 ==> ABORT JOB.

				/ 2 ==> STOP JOB.

				/ 3 ==> KILL JOB.

				/ 4 ==> REPORT.

				/ 5 ==> IGNORE.

 

	.GLOBL TIMLIM		/ CURRENT JOB FILE TIME LIMIT.

				/ NEGATIVE OF THE MAXIMUM

				/ SECONDS ALLOWED.

 

	.GLOBL JOBFND		/ JOB FOUND & EXECUTING FLAG.

				/ 0 => NO JOB BEING EXECUTED.

				/	(I.E., CURRENT JOB NODE

				/	IMAGE IS INVALID).

				/ 1 => JOB BEING EXECUTED,

				/	START-UP SEQUENCE OR

				/	END-OF-JOB SEQUENCE

				/	IN PROGRESS.

				/ 2 => JOB IS RUNNING.

				/ 3 => BATCH IS SCANNING TO

				/	$ERR CARD (JOB HAS

				/	BEEN KILLED).

 

	.GLOBL JOBERR		/ JOB ERROR FLAGS WORD.  (SEE

				/ BELOW).

 

	.GLOBL PAUSW		/ $PAUSE IN PROGRESS FLAG.

				/ 0 => NORMAL EXECUTION.

				/ +1 => $PAUSE IN PROGRESS,

				/	BATCH IS WAITING FOR

				/	OPERATOR PROCEED.

 

 

 

/

/ ERROR FLAG BITS WITHIN JOBERR:

/

/	SIGN BIT -- TERMINATE JOB AT NEXT TDV READ.

/

/	ALL OTHER BITS -- INDICATE SOME SPECIFIC CAUSE OF JOB

/			TERMINATION.  MOST BITS ARE SET WHILE

/			SIMULTANEOUSLY SETTING THE SIGN BIT,

/			THUS STOPPING THE JOB AT NEXT TDV READ.

/			SOME ERRORS ALSO SIMULATE A ^Y, WHICH

/			CAUSES A TDV READ, THUS ABORTING THE

/			JOB IMMEDIATELY.  OTHER ERRORS SET A

/			BIT HERE AND SET JOBFND TO +3, CAUSING

/			A SCAN TO A $ERR CARD, THUS KILLING

/			THE JOB.  NOTE, HOWEVER, THAT A ^Y

/			SHOULD BE SIMULATED AND/OR JOBFND SET

/			TO +3 ONLY IF JOBFND IS CURRENTLY

/			+2 OR +3 (REMEMBER THAT JOBFND RANGES

/			FROM 0 TO +3).  IF JOBFND IS NOT +2

/			OR +3, ONLY THE ERROR FLAG BITS IN

/			JOBERR SHOULD BE SET.  ALSO NOTE THAT

/			ALL MANIPULATIONS OF THESE LOCATIONS

/			MUST TAKE PLACE WITH INTERRUPTS

/			INHIBITED.

/

/ THIS WORD IS PASSED TO THE JOB END PROCESSOR (END...) TO

/ TELL IT THE REASONS FOR JOB TERMINATION.

/

/ IF ANY BIT IN JOBERR IS SET BEFORE THE JOB IS LOGGED IN

/ TO TDV, THE ENTIRE JOB IS ABORTED.  THIS EVEN APPLIES TO

/ ERRORS WHICH NORMALLY CAUSE A SCAN TO A $ERR CARD.

/

/ SPECIFIC BIT DEFINITIONS:

/

 

JE.LGN=010000+400000		/ ILLEGAL EXPLICIT LOGIN

				/ DEVICE/UFD SPECIFIED.

 

JE.TMA=000040			/ JOB ABORTED BY TIME LIMIT

				/ OVERRUN.  ^Y ALSO SIMULATED.

				/ JOBFND ALSO SET TO +3.

 

JE.TMS=000020+400000		/ JOB STOPPED BY TIME LIMIT

				/ OVERRUN.

 

JE.TMK=000010			/ JOB KILLED BY TIME LIMIT

				/ OVERRUN.  JOBFND ALSO SET

				/ TO +3.

 

 

 

/

/ DEFINE REFERENCES TO ASSIGN COMMAND LINES IN RESIDENT:

/

 

	.GLOBL ASS4OPR		/ LUN 4 TO OPERATOR TTY.

 

	.GLOBL ASS13ACCT	/ LUN 13 TO ACCOUNTING FILE.

 

	.GLOBL ASSLP		/ LUNS 4, 13, AND 16 TO

				/ LISTING DEVICE.

 

 

 

/

/ DEFINE REFERENCES TO OTHER TEXT BUFFERS IN RESIDENT:

/

 

	.GLOBL LGNMSG		/ LOGIN MESSAGE, SPECIFYING

				/ LOGIN DEVICE, UNIT, & UFD.

 

	.GLOBL QJBINF		/ TEXT BUFFER CONTAINING INFO.

				/ FROM JOB QUEUE NODE.

 

	.GLOBL BEGMSG		/ MESSAGE PASSED TO JOB...

				/ AND END... CONTAINING

				/ ACCOUNTING INFO.

 

 

 

/

/ DEFINE REFERENCES TO DYNAMIC LINE BUFFER POINTERS.  THERE

/ ARE TWO LINE BUFFERS IN THE RESIDENT SECTION.  THE TWO

/ LOCATIONS IN.BFR AND LP.BFR EACH POINT TO ONE OF THESE

/ BUFFERS.  WHEN A LINE NEEDS TO BE EXCHANGED, ONLY THE 

/ BUFFER POINTERS ARE PHYSICALLY EXCHANGED.

/

 

	.GLOBL IN.BFR		/ JOB FILE INPUT BUFFER.

 

	.GLOBL LP.BFR		/ LISTING OUTPUT BUFFER.

 

 

 

/

/ REFERENCES TO CPB'S AND ASSOCIATED EVENT VARIABLES:

/

 

	.GLOBL IN.CPB,IN.EV	/ CPB TO READ LINE FROM JOB

				/ INTO IN.BFR.

 

	.GLOBL LP.MOD,LP.LEN	/ CPB TO PRINT LINE IN LP.BFR

				/ ON LISTING DEVICE.

 

	.GLOBL TT.CPB		/ CPB TO PRINT LINE

				/ ON OPERATOR TTY.

 

	.GLOBL IN.HINF		/ HINF CPB TO INPUT DEVICE

				/ WHICH WILL SET TRGGR WHEN

				/ DONE.

 

	.GLOBL MRKTIM		/ MARK TIME CPB TO SET TRGGR

				/ IN ONE MINUTE.

 

 

 

/

/ REFERENCES TO WORDS CONTAINING LUN NUMBERS:

/

 

	.GLOBL TT.LUN		/ OPERATOR TTY LUN.

 

 

 

/

/ REFERENCES TO OTHER WORDS IN RESIDENT:

/

 

	.GLOBL PDVLND		/ ADDRESS OF BATCH'S PDVL NODE.

 

	.GLOBL TRGGR		/ BATCH'S TRIGGER EVENT

				/ VARIABLE.

 

	.GLOBL WAITFR		/ A WAITFOR CPB TO WAIT FOR THE

				/ TRIGGER EVENT VARIABLE

				/ (TRGGR) TO BE SET.

 

	.GLOBL TTYOFST		/ OFFSET FROM BASE OF TDV'S

				/ CONTROL AND STATUS TABLE

				/ (ADDRESS IN MA.CST) TO

				/ BATCH'S ENTRY IN UCA ADDRESS

				/ TABLE (TTY.UC).

 

	.GLOBL RUNTIM		/ LOCATION WHICH ACCUMULATES

				/ THE RUN TIME (SECONDS)

				/ (CLOCK OR REAL TIME MINUS

				/ PARTITION WAIT TIME) FOR

				/ ALL JOBS IN THE CURRENT

				/ JOB FILE.

	.TITLE DEFINE INPUT LINE CARD TYPE CODES

 

 

 

 

/

/ DEFINE THE CARD TYPE CODES RETURNED BY ROUTINE CHKCRD

/ IN THE RESIDENT SECTION.  ROUTINE CHKCRD RETURNS THESE

/ CODES IN THE AC.  THE BROAD CLASSIFICATIONS ARE:

/

/	> 0	NOT A CONTROL CARD

/

/	< 0	A CONTROL CARD

/

/ THESE CLASSIFICATIONS ARE BROKEN DOWN BY THE SPECIFIC

/ LINE (CARD) TYPES DEFINED BELOW.

/

/ NOTE:  "%" STANDS FOR "$" IN THESE CODES.

/

/ CODES FOR NON-CONTROL CARDS:

/

 

 

NOT%=1		/ NOT% ==> NOT A CONTROL CARD -- I.E.,

		/	COLUMN 1 DOES NOT CONTAIN "$"

 

%EOF=NOT%+1	/ %EOF ==> $EOF CARD -- RETURN AN END-OF-FILE

		/	TO THE TASK

 

 

 

/

/ CONTROL CARD CODES:

/

 

 

%MSG=-1		/ %MSG ==> $MSG CARD.  PRINTS ON LISTING

		/	DEVICE AND OPERATOR TTY.

 

%LOG=%MSG-1	/ %LOG ==> $LOG CARD.  PRINTS ON LISTING

		/	DEVICE.

 

%PAU=%LOG-1	/ %PAU ==> $PAUSE CARD.  PRINT ON LISTING

		/	DEVICE AND OPERATOR TTY, THEN WAIT

		/	FOR OPERATOR'S OK TO PROCEED.



%EJECT=%PAU-1	/ %EJECT ==> $EJECT CARD.  PRINT FORM-FEED

		/	(PAGE EJECT) ON LISTING DEVICE.

 

%ERR=%EJECT-1	/ %ERR ==> $ERROR CARD.  IF ERROR OCCURS, SKIP

		/	TO NEXT $ERROR CARD.  OTHERWISE, PRINT

		/	ON LISTING DEVICE AND OPERATOR TTY.

 

EOJ=%ERR-1	/ EOJ ==> END-OF-JOB LINE READ ON INPUT FILE.

		/	RETURNED WHEN $JOB, $END, $QUIT, END-

		/	OF-FILE, OR READ ERROR IS ENCOUNTERED.

		/	CAUSES JOB TERMINATION.  NOTE THAT

		/	BITS IN LOCATION JOBERR ARE SET --

		/	SEE BELOW.

 

%OTHER=EOJ-1	/ %OTHER ==> ANY OTHER CONTROL CARD (WITH "$"

		/	IN COLUMN 1) NOT SPECIAL CASED ABOVE.

		/	BY DEFAULT, A TDV COMMAND CARD.

 

 

 

/

/ NOTE:  THE ACTION DESCRIPTIONS ABOVE ARE FOR DESCRIPTIVE

/        PURPOSES ONLY -- IMPLEMENTATION OF THE ACTIONS IS

/        THE RESPONSIBILITY OF THE ROUTINES CALLING CHKCRD.

/

/ NOTE:  CARD TYPES SHOULD BE REFERRED TO ONLY BY THE

/	 MNEMONICS DEFINED ABOVE, AND NEVER BY THEIR

/	 ACTUAL NUMERIC VALUES!

/

/ NOTE:  WHEN THE CODE "EOJ" IS RETURNED (SIGNIFYING AN END-

/        OF-JOB LINE HAS BEEN READ), APPROPRIATE BITS ARE

/        ALSO SET IN JOBERR.  JE.JOB IS SET IF A $JOB IS

/        READ, JE.END IF A $END IS READ, JE.EOF IF A $QUIT

/        OR END-OF-FILE IS READ, OR JE.ERR IF A READ ERROR

/        IS ENCOUNTERED.

/

	.TITLE MISCELLANEOUS LOCATIONS USED BY BDMAIN

 

 

 

 

/

/ TEXT BUFFERS CONTAINING CERTAIN COMMON CONSTANT MESSAGES:

/

 

EOFBFR	1005			/ END-OF-FILE.

	0

 

NULBFR	TEXT <<15>>		/ NULL LINE (I.E., CR ONLY)

 

FFBFR	TEXT <<14><15>>		/ FORM FEED, CARRAIGE RETURN.

 

WRNMSG	WRNM.A-.*400+2

	0

	.ASCII "******************* "

	.ASCII "BATCH -- JOB EXCEEDI"

	.ASCII "NG TIME LIMIT **********"<15>

WRNM.A=.

 

KILMSG	KLMS.A-.*400+2

	0

	.ASCII "******************* "

	.ASCII "BATCH -- JOB KILLED."

	.ASCII "  SCANNING FOR $ERROR CARD **********"<15>

KLMS.A=.

 

 

 

/

/ OTHER LOCATIONS:

/

 

STATE	0			/ CURRENT STATE POINTER.

				/ USED BY STATE TABLE DRIVEN

				/ READ REQUEST PROCESSOR.  SEE

				/ COMMENTS UNDER HEADING "READ

				/ REQUEST PROCESSOR".

 

RQSTND	0			/ PLACE TO SAVE CURRENT REQUEST

				/ NODE ADDRESS.  SET BY MAINLP,

				/ USED BY RD.FIN AND OTHERS.

 

KIL.SW	0			/ SWITCH ASSOCIATED WITH

				/ JOB KILLED MESSAGE (KILMSG

				/ ABOVE).  0 IF MESSAGE NEEDS

				/ TO BE PRINTED, -1 IF MESSAGE

				/ ALREADY PRINTED.

 

 

 

/

/ LOCATIONS IN WHICH TO SAVE SSM AND PARTITION WAIT TIME

/ WHEN TMSTRT IS CALLED.  TMSTOP REFERENCES THESE TO

/ CALCULATE THE JOB RUN TIME SINCE TMSTRT WAS CALLED.

/

/ OLDSSM IS ALSO USED BY THE TIME LIMIT PROCESSOR (TIMEUP)

/ TO DETERMINE WHETHER OR NOT RUN TIME IS CURRENTLY BEING

/ MEASURED -- I.E., WHETHER TMSTRT OR TMSTOP WAS MOST

/ RECENTLY CALLED.  TMSTOP SETS OLDSSM TO -1, TMSTRT SETS

/ IT TO SSM (WHICH WILL BE BETWEEN 0 AND 250577).

/

 

OLDSSM	-1			/ SSM WHEN TMSTRT WAS CALLED,

				/ OR -1 IF TMSTOP WAS CALLED

				/ MOST RECENTLY.

 

OLDWAT	0			/ PARTITION WAIT TIME WHEN

				/ TMSTRT WAS CALLED.

 

 

 

/

/ LOCATIONS USED BY TIME LIMIT PROCESSING.  PRIMARILY USED

/ BY ROUTINE TIMEUP.  ALSO INITIALIZED AT INITIAL ENTRY

/ AND REFERENCED BY MAINLP TO DETERMINE WHEN TO CALL TIMEUP.

/

/ TIM.MM STORES THE CONTENTS OF SCOM LOCATION MM

/ WHEN TIMEUP WAS LAST CALLED.  WHENEVER THIS LOCATION

/ CHANGES (I.E. ONCE EVERY MINUTE) MAINLP WILL CALL

/ (VIA A JMP) TIMEUP.

/

 

TIM.MM	0			/ MINUTE WITHIN HOUR WHEN

				/ TIMEUP WAS LAST CALLED.

 

TIM.SW	0			/ SWITCH ASSOCIATED WITH TIME

				/ LIMIT WARNING MESSAGE (WRNMSG

				/ ABOVE).  0 IF MESSAGE NEEDS

				/ TO BE PRINTED, -1 IF MESSAGE

				/ ALREADY PRINTED.

	.TITLE BDMAIN -- MAIN ENTRY POINT, INITIALIZATION.

 

 

 

 

/

/ COME HERE TO PROCESS A JOB.  INITIALIZE THE READ REQUEST

/ PROCESSOR STATE VALUE TO THE LOGIN SEQUENCE, THEN

/ ENTER THE MAIN PROCESSING LOOP.

/

/ NOTE THAT THERE IS NO NEED TO INITIALIZE OLDSSM TO -1, AS

/ IT IS ALREADY INITIALIZED IF THIS IS AN OVERLAY, AND IF THIS

/ IS NOT AN OVERLAY, IT WAS SET TO -1 WHEN WE LAST EXITTED

/ BECAUSE TIME ACCOUNTING IS ALWAYS TURNED OFF WHEN WE EXIT.

/

 

 

BDMAIN	0

	.DEBUG <"BDMAIN ENTERED, JOBERR = ">,JOBERR,21

	LAC (ST.LGN)		/ SET STATE TO ST.LGN.

	DAC STATE

	JMP TIMEUP		/ GO INITIALIZE TIME LIMIT

	.TITLE TIMEUP -- TIME LIMIT PROCESSOR

 

 

 

 

/

/ THIS ROUTINE IS CALLED AT APPROPRIATE TIMES FROM MAINLP.

/ MAINLP CHECKS MM (THE MINUTES WITHIN HOUR TIME LOCATION

/ IN SCOM) AND CALLS THIS ROUTINE WHENEVER IT CHANGES.

/ LOCATION TIM.MM SAVES THE MM VALUE WHEN THIS ROUTINE

/ WAS LAST CALLED.

/

/ WHEN APPROPRIATE, MAINLP CALLS THIS ROUTINE VIA A JMP.

/ THIS ROUTINE COMPARES THE ACCUMULATED RUN TIME (IN LOCATION

/ RUNTIM) AGAINST THE JOB FILE TIME LIMIT (TIMLIM).  THE

/ APPROPRIATE ACTION IS TAKEN, THEN THE MARK TIME CPB

/ ISSUED AND TIM.MM UPDATED.  THIS ROUTINE RETURNS BY

/ JUMPING TO MAINLP.

/

 

 

TIMEUP	LAC OLDSSM		/ CHECK WHETHER TMSTRT OR

	SAD (-1)		/ WAS MOST RECENTLY ISSUED.

	JMP TMUP.A		/ JMP IF TMSTOP MOST RECENT.

	JMS TMSTOP		/ MUST CALL TMSTOP TO UPDATE

	JMS TMSTRT		/ JOBTIM, THEN TMSTRT TO

				/ CONTINUE TIME ACCOUNTING.

TMUP.A	LAC* TIMLIM		/ FETCH TIME LIMIT (NEGATIVE

	STL			/ SECOND) AND COMPARE AGAINST

	TAD* RUNTIM		/ ACCUMULATED RUN TIME.

	SZL			/ SKIP IF TIME LIMIT OVERRUN.

	JMP TMUP.F		/ JMP IF TIME STILL LEFT

	LAC* TLEACT		/ IF TLEACT = 5, IGNORE TIME

	SAD (5)			/ LIMIT EXCEEDED.

	JMP TMUP.F		/ JMP TO IGNORE TIME LIMIT.

	ISZ TIM.SW		/ SKIP IF WARNING MESSAGE

				/ ALREADY PRINTED.

	JMP TMUP.E		/ JMP IF NOT PRINTED YET.

	LAC* TLEACT		/ DETERMINE ACTION TO TAKE.

	PAX			/ SAVE IN XR.

	CLL!RAR			/ ALIGN BITS.

	SZA			/ SKIP IF ABORT (TLEACT=1).

	JMP TMUP.B		/ JMP IF ACTION ISN'T ABORT.

	LAC* JOBFND		/ CHECK JOB STATE.  SIMULATE

	AAC -2			/ ^Y IF JOBFND IS +2 OR +3.

	SMA

	JMS* CTRL.Y		/ (PRESERVES LINK)

TMUP.B	SNL!CLA			/ SKIP IF ABORT OR KILL

				/ (TLEACT=1 OR TLEACT=3).

	JMP TMUP.C		/ JMP IF NOT ABORT OR KILL.

	AAC +2			/ CHECK JOB STATE.  SET JOBFND

	.INH			/// TO +3 IF IT IS CURRENTLY

	SAD* JOBFND		/// +2.  I.E., IF IN NORMAL

	ISZ* JOBFND		/// STATE, CAUSE SCAN TO $ERR.

	.ENB			///

TMUP.C	LAC TMUP.D-1,X		/ PICK UP JOBERR FLAG BITS.

	JMS* ERRFLG		/ SET BITS IN JOBERR.

	DZM* TIMLIM		/ DISABLE FUTURE TIMEOUTS.

	JMP TMUP.F

 

 

/ TABLE OF JOBERR FLAG BITS FOR THE VARIOUS ACTIONS:

 

TMUP.D	JE.TMA			/ ABORT (TLEACT=1)

	JE.TMS			/ STOP (TLEACT=2)

	JE.TMK			/ KILL (TLEACT=3)

	0			/ REPORT (TLEACT=4)

 

 

/ COME HERE IF TIME LIMIT EXCEEDED AND WARNING MESSAGE

/ (WRNMSG) HASN'T BEEN PRINTED YET.

 

TMUP.E	JMS* PRINT		/ PRINT WARNING MESSAGE.

	  JMP NORQST		/ JMP IF LISTING DEVICE BUSY.

	  LAC (WRNMSG)

	JMS* ISSUE		/ ALSO PRINT ON OPERATOR TTY.

	  TT.CPB+400000

	CLA!CMA!SKP		/ FLAG THAT MESSAGE HAS BEEN

				/ PRINTED.

/ COME HERE TO FLAG THAT WARNING MESSAGE HASN'T BEEN PRINTED,

/ UPDATE TIM.MM, AND THEN ISSUE MARK TIME CPB.

TMUP.F	CLA			/ 0 => PRINT MESSAGE.

	DAC TIM.SW

	LAC* (MM)		/ REMEMBER CURRENT MINUTES

	DAC TIM.MM		/ VALUE.

	JMS* ISSUE		/ MARK TIME FOR ONE MINUTE.

	  MRKTIM+400000		/ SETS TRGGR IN ONE MINUTE.

	JMP MAINLP		/ THEN RETURN.

	.TITLE NORQST, MAINLP -- MAIN REQUEST PROCESSING LOOP

 

 

 

 

/

/ COME HERE WHEN NO REQUESTS ARE OUTSTANDING TO

/ WAIT FOR TRIGGER EVENT VARIABLE TO BE SET.  NOTE

/ THAT THE TRIGGER EVENT VARIABLE IS SET BY ANY OF

/ THE FOLLOWING:

/

/	1.  AN I/O REQUEST BEING RECEIVED.

/

/	2.  THE TIME LIMIT PROCESSORS MARK TIME REQUEST.

/

/	3.  A HINF ISSUED TO THE LISTING OR INPUT DEVICES,

/	    WHEN WE ARE WAITING FOR I/O TO COMPLETE ON THAT

/	    DEVICE.

/

 

 

NORQST	LAW 777775		/ MASK OUT THE BIT WHICH WE

	.INH			/// SET OURSELVES.

	AND* TRGGR		///

	.ENB			///

	DAC* TRGGR		///

	SNA			/ HAS ANYONE ELSE SET A BIT

				/ IN THE TRIGGER?

	CAL* WAITFR		/ NO -- WAIT FOR IT.

/ MAIN PROCESSING LOOP -- COME HERE WHENEVER WE ARE FINISHED

/ WITH A REQUEST.  FIND A NEW REQUEST TO PROCESS, AND GO

/ PROCESS IT.

MAINLP	LAC (2)			/ SET TRIGGER NON-ZERO TO AVOID

	DAC* TRGGR		/ REDUNDANT SIGNIFICANT EVENTS.

	LAC TIM.MM		/ CHECK IF SCOM LOCATION MM

	SAD* (MM)		/ HAS CHANGED SINCE TIMEUP

	SKP			/ WAS LAST CALLED.

	JMP TIMEUP		/ IT HAS CHANGED -- THEREFORE

				/ CALL TIMEUP, SINCE ONE MINUTE

				/ HAS PASSED.

	LAC* PDVLND		/ OBTAIN AN I/O REQUEST FROM

	DAC* (R1)		/ THE REQUEST QUEUE.

	JMS* (DQRQ)

	  JMP NORQST		/ JMP IF QUEUE EMPTY -- WAIT

				/ FOR A REQUEST.

	DAC RQSTND		/ SAVE ADDRESS OF REQUEST NODE.

	PAX			/ POINT XR TO REQUEST NODE.

	LACIX (5)		/ FETCH I/O FUNCTION CODE.

	AND (777)

	SAD (26)		/ AND DISPATCH ON I/O FUNCTION.

	  JMP READ

	SAD (27)

	  JMP WRITE

	SAD (17)

	  JMP ABORT

	SAD (36)

	  JMP HINF

	SAD (24)

	  JMP ATTACH

	SAD (25)

	  JMP DETACH

/

	LAW -6			/ ILLEGAL FUNCTION -- SET EV

	JMS RQSTFN		/ TO -6, AND TRY FOR ANOTHER

	JMP MAINLP		/ REQUEST.

	.TITLE MISCELLANEOUS I/O REQUEST PROCESSORS

 

 

 

 

/

/ ATTACH -- ALWAYS SUCCEEDS, BUT OTHERWISE DOES NOTHING.

/

 

 

ATTACH	CLA!IAC			/ SET EV TO +1

	JMS RQSTFN

	JMP MAINLP

 

 

 

 

/

/ DETACH -- SAME AS ATTACH

/

 

 

DETACH=ATTACH

 

 

 

 

/

/ HINF -- SET EV TO THE MAGIC CONSTANT

/

 

 

HINF	LAC (HINFO)

	JMS RQSTFN

	JMP MAINLP

 

 

 

 

/

/ ABORT -- PROCESS THE ABORT (VIA DMTQ), THEN RETURN EV = +1.

/

 

 

ABORT	JMS* (DMTQ)

	CLA!IAC

	JMS RQSTFN

	JMP MAINLP

	.TITLE RQSTFN -- SUBROUTINE TO FINISH I/O REQUEST



 

 

 

/

/ ROUTINE TO FINISH I/O REQUEST.  COME HERE WITH EV VALUE

/ IN AC.  AFTER CALLING HERE, MUST JMP TO MAINLP TO GET

/ NEXT REQUEST.

/

/ THIS ROUTINE SETS THE REQUESTOR'S EVENT VARIABLE,

/ ADJUSTS HIS TRANSFERS PENDING COUNT, AND RETURNS THE

/ REQUEST NODE TO THE FREE POOL.  IT ALSO DECLARES A

/ SIGNIFICANT EVENT.

/

/ BEFORE CALLING THIS ROUTINE, LOCATION RQSTND MUST BE

/ SET TO THE REQUEST NODE ADDRESS.  THIS IS OF NO CONCERN

/ TO NORMAL REQUEST PROCESSORS, AS THE MAIN I/O REQUEST

/ LOOP (MAINLP) DOES THIS BEFORE DISPATCHING TO THE REQUEST

/ PROCESSING ROUTINE.

/

/ CALLING SEQUENCE:

/	< STORE REQUEST NODE ADDRESS IN RQSTND >

/	LAC (EV VALUE)

/	JMS RQSTFN

/

/ REGISTERS ALTERED:

/	ALL

/

/ VALUES RETURNED:

/	NONE

/

 

 

RQSTFN	0

	PAL			/ SAVE EV VALUE IN LR

	LAC RQSTND		/ PUT REQUEST NODE ADDR. IN

	DAC* (R2)		/ R2 FOR IOCD & NADD, THEN

	PAX			/ POINT XR TO REQUEST NODE.

	LACIX (6)		/ FETCH EV ADDRESS.

	SZA			/ SKIP IF NO EV.

	PAX			/ POINT XR TO EV.

	PLA			/ GET EV VALUE BACK IN AC.

	DACIX (0)		/ STORE VALUE INTO EV.  IF NO

				/ EV, CLOBBERS FIRST WORD OF

				/ REQUEST NODE.

	JMS* (IOCD)		/ ADJUST TRANSFER PENDING COUNT

	LAC (POOL)		/ RETURN NODE TO FREE POOL.

	DAC* (R1)

	JMS* (NADD)

	.SET6			/ DECLARE SIGNIFICANT EVENT.

	JMP* RQSTFN

	.TITLE RQSTWT -- DELAY AN I/O REQUEST

 

 

 

 

/

/ ROUTINE TO DELAY AN I/O REQUEST.  IF, FOR ANY REASON, AN

/ I/O REQUEST CANNOT BE SATISFIED IMMEDIATELY, ARRANGE FOR

/ TRGGR TO BE SET AT AN APPROPRIATE TIME IN THE FUTURE

/ (USUALLY BY ISSUEING A HINF) AND JMP HERE.  THIS ROUTINE

/ REPLACES THE I/O REQUEST BACK ON THE I/O REQUEST QUEUE,

/ THEN TRANSFERS TO NORQST TO WAIT FOR TRGGR TO BE SET.

/ AT THAT TIME THE I/O REQUEST WILL BE RETRIED.

/

/ NOTE THAT THIS ROUTINE MUST ONLY BE USED BY I/O REQUEST

/ PROCESSORS CALLED FROM THE MAIN I/O REQUEST LOOP (MAINLP).

/

 

 

RQSTWT	LAC RQSTND		/ PUT REQUEST NODE ADDR. IN

	DAC* (R2)		/ R2 FOR SPRI & NADD.

	PAX			/ POINT XR TO IT.

	LAC* PDVLND		/ POINT R1 TO REQUEST QUEUE

	AAC D.QF		/ IN PDVL NODE.

	DAC* (R1)

	CLA!CMA!CLL		/ SUBTRACT ONE FROM PRIORITY,

	TADIX (4)		/ SO SPRI WILL INSERT NODE AT

				/ ITS FORMER POSITION.

	SNL			/ SKIP IF NO OVERFLOW.

	JMP RQWT.A		/ JMP IF OVERFLOW -- SPECIAL CASE

	DACIX (4)

	JMS* (SPRI)		/ INSERT NODE IN QUEUE.

	LAC RQSTND		/ RESTORE PRIORITY TO ITS

	PAX			/ FORMER VALUE.

	ISZIX (4)

	JMP NORQST		/ GO WAIT FOR TRGGR.

 

 

/ COME HERE IF PRIORITY DECREMENT OVERFLOWS -- I.E., IF

/ PRIORITY IS ZERO.  SINCE PRIORITY IS ZERO, INSERT AT

/ FRONT OF QUEUE -- I.E., USE NADD, NOT SPRI!

 

RQWT.A	JMS* (NADD)

	JMP NORQST		/ GO WAIT FOR TRGGR.

	.TITLE WRITE -- ECHO WRITE REQUESTS TO LISTING DEVICE

 

 

 

 

/

/ THIS ROUTINE ECHOS ALL WRITE REQUESTS TO THE LISTING DEVICE,

/ EXCEPT WHEN THE SIGN BIT IS SET IN THE FIRST WORD OF THE

/ LINE BUFFER (BIT 0 OF THE WORD CONTAINING THE WORD PAIR

/ COUNT).  THIS BIT WAS PREVIOUSLY UNUSED, EXCEPT TO IGNORE

/ CHECKSUMS DURING BINARY INPUT.  THUS IT SEEMS SAFE TO

/ ASSUME THAT THE STATE OF THIS BIT WILL BE IGNORED BY

/ HANDLERS (I HAVE PERSONALLY VERIFIED THE LINE PRINTER AND

/ TELETYPE HANDLERS, THE ONLY TWO WHICH SHOULD MATTER) AND

/ THAT IT WILL BE CLEARED BY ALL TASKS WHICH ARE IGNORANT OF

/ THIS BATCH FEATURE.  THIS FEATURE IS USED BY TDV... (AND

/ PERHAPS OTHER TASKS) TO CAUSE "NOISE" MESSAGES TO BE

/ SUPPRESSED ON THE JOB LISTING (I.E., COMMAND PROMPTS WON'T

/ BE PRINTED) WHILE STILL PRINTING ERRORS.

/

/ NOTE THAT THIS ROUTINE MODIFIES LP.MOD (THE DATA MODE USED

/ BY PRINT) WITHOUT CHECKING IF PREVIOUS OUTPUT HAS COM-

/ PLETED.  THIS IS PERMISSABLE, SINCE CPB DATA IS COPIED

/ TO THE I/O REQUEST NODE WHEN THE REQUEST IS ISSUED, AND

/ NOT REFERENCED LATER.

/

 

 

WRITE	LACIX (7)		/ COPY DATA MODE.

	DAC* LP.MOD

	CLL!RAR			/ VERIFY IT IS EITHER IOPS

	SAD (1)			/ OR IMAGE ASCII.

	JMP WRT.A		/ JMP IF IT IS.

	LAW -7			/ ILLEGAL DATA MODE --

	JMP WRT.F		/ RETURN ERROR.

 

 

/ COME HERE IF DATA MODE IS OK -- EITHER IOPS OR IMAGE ASCII.

 

WRT.A	LACIX (10)		/ FETCH BUFFER ADDRESS.

	DAC* (R3)		/ PREPARE TO VERIFY W/ VAJX.

	DAC WRT.0		/ ALSO SAVE FOR LATER.

	CLA!IAC			/ LENGTH = ONE WORD, JUST

	DAC* (R4)		/ CHECK HEADER WORD.

	JMS* (VAJX)		/ VERIFY LEGAL HEADER WORD.

	  JMP WRT.D		/ JMP IF ILLEGAL ADDRESS.

	LAW -1			/ SET UP X16 TO FETCH FROM

	TAD* (R3)		/ LINE BUFFER.

	DAC* (X16)

	LAC* X16		/ FETCH HEADER WORD.

	.IFUND %DEBUG

	SPA!SWHA		/ SKIP IF LINE SHOULD BE ECHOED

	JMP WRT.C		/ JMP IF SIGN BIT SET -- IGNORE

				/ THIS LINE.

	.ENDC

	.IFDEF %DEBUG

	SWHA			/ IF %DEBUG, ALWAYS PRINT LINE.

	.ENDC

	AND (377)		/ MASK OUT WORD PAIR COUNT.

	AAC -1			/ VERIFY W.P.C. > 1.

	SPA!SNA!IAC		/ SKIP IF OK & RESTORE.

	JMP WRT.E		/ JMP IF ILLEGAL W.P.C.

	CLL!RAL			/ CONVERT TO # OF WORDS.

	DAC* (R4)		/ STORE FOR VAJX.

	CLL!TCA			/ COMPARE AGAINST MAXIMUM

	TAD* LP.LEN		/ SIZE (= LENGTH OF OUR BUFFER

	SNA!SPA!TCA		/ MINUS 2).  IF TOO BIG, USE

	LAW -2			/ OUR BUFFER LENGTH MINUS 2.

	TAD* LP.LEN		/ (MUST ALLOW FOR CARRIAGE

				/ RETURN WHICH WE WILL APPEND

				/ TO RECORD).

	PAL			/ SAVE LENGTH FOR COPY LOOP.

	LAC WRT.0		/ RESTORE UNRELOCATED BUFFER

	DAC* (R3)		/ ADDRESS FOR VAJX.

	JMS* (VAJX)		/ VERIFY BUFFER IS OK.

	  JMP WRT.D		/ JMP IF ILLEGAL BUFFER.

	JMS* ECHOWT		/ WAIT FOR PRIOR OUTPUT TO 

	  JMP RQSTWT		/ FINISH.

	LAC* LP.BFR		/ INITIALIZE FOR COPY LOOP.

	DAC WRT.0

	CLX

	PLA			/ FORMULATE HEADER WORD.

	CLL!RAR

	SWHA!SKP		/ SKIP SINCE HAVE ALREADY

				/ FETCHED HEADER WORD.

WRT.B	LAC* X16		/ COPY LINE BUFFER TO OUR

	DACIX WRT.0		/ LISTING BUFFER.

	AXS 1

	JMP WRT.B

	LAC (15*200*20+15)	/ APPEND A CARRAIGE RETURN

	DACIX WRT.0		/ TO LINE (ALLOW FOR BOTH

				/ IOPS AND IMAGE ASCII).

	JMS* PRINT		/ PRINT THE LINE.

	  JMP RQSTWT		/ SHOULD NEVER HAPPEN.

	  LAC* LP.BFR

WRT.C	CLA!IAC!SKP		/ RETURN EV = +1.

/ COME HERE IF USER'S BUFFER IS OUTSIDE HIS PARTITION.

WRT.D	LAW -30

	SKP

/ COME HERE IF WORD PAIR COUNT IS NOT > 1.

WRT.E	LAW -16

/ COME HERE TO RETURN EV = VALUE IN AC.

WRT.F	JMS RQSTFN

	JMP MAINLP

 

 

 

WRT.0	0			/ TEMPORARY.

	.TITLE READ REQUEST PROCESSOR

 

 

 

 

/

/ THIS ROUTINE PROCESSES READ I/O REQUESTS USING A STATE

/ TABLE.  LOCATION STATE POINTS TO A TWO WORD ENTRY OF

/ THE FOLLOWING FORM:

/

/	STATE --> < ACTION IF TDV READ >

/		  < ACTION IF NON-TDV READ >

/

/ A STATE TABLE ENTRY CONSISTS OF TWO WORDS.  THE FIRST

/ WORD SPECIFIES THE ACTION TO TAKE IF THE READ REQUEST

/ WAS ISSUED BY THE TDV DISPATCHER.  THE SECOND WORD

/ SPECIFIES THE ACTION TO TAKE IF THE READ REQUEST IS FROM

/ ANY OTHER TASK.

/

/ ACTION WORDS HAVE THE FOLLOWING FORM:

/

/		[NXT+]ACTION ADDRESS

/

/ AN ACTION WORD CONSISTS OF AN ACTION TYPE FIELD AND AN

/ ADDRESS FIELD.  THE CODE "NXT" MAY BE OPTIONALLY ADDED

/ TO ANY OF THE ACTION TYPE CODES.  THE MEANING TO THE

/ ACTION TYPE CODES IS AS FOLLOWS:

/

/	NXT	ADVANCE TO NEXT STATE -- I.E., ADD TWO

/		TO LOCATION STATE.

/

/	MSG	"ADDRESS" IS THE ADDRESS OF A TEXT BUFFER.

/		USE THE CONTENTS OF THE TEXT BUFFER TO

/		SATISFY THE READ.

/

/	GLBMSG	"ADDRESS" IS A GLOBAL SYMBOL USED TO

/		REFERENCE THE TEXT BUFFER, WHICH RESIDES

/		IN THE RESIDENT SECTION.  NOTE THAT THIS

/		IS IDENTICAL TO "MSG" WITH ONE LEVEL OF

/		INDIRECTION SPECIFIED.

/

/	GLBIND	"ADDRESS" IS A GLOBAL SYMBOL USED TO

/		REFERENCE A POINTER TO THE TEXT BUFFER.

/		NOTE THAT THIS IS IDENTICAL TO "MSG"

/		WITH TWO LEVELS OF INDIRECTION SPECIFIED.

/

/	GOTO	"ADDRESS" IS THE ADDRESS OF A STATE TABLE

/		ENTRY.  CHANGE STATE TO THAT ENTRY, THEN

/		PERFORM THE ACTION INDICATED BY THAT ENTRY.

/		NOTE THAT IT IS INAPPROPRIATE TO COMBINE

/		"NXT" WITH "GOTO".

/

/	CALL	"ADDRESS" IS THE ADDRESS OF A ROUTINE.  JMP

/		TO THAT ROUTINE.  THE ROUTINE MUST RETURN

/		IN ONE OF THE WAYS DESCRIBED BELOW.

/

/ ALTERNATIVELY, AN ACTION WORD MAY CONTAIN THE SYMBOL

/ "ILLEGAL".  THIS INDICATES THAT AN EV VALUE OF -6 SHOULD BE

/ RETURNED.  "NXT" MAY BE COMBINED WITH "ILLEGAL" IF DESIRED.

/

/ WHEN A "CALL" ACTION ROUTINE IS CALLED, AN INPUT LINE

/ IS PRESENT IN THE INPUT BUFFER (ADDRESS IN IN.BFR).  THE

/ ROUTINE INVOKED BY THE "CALL" ACTION MUST RETURN VIA

/ ONE OF THE FOLLOWING PATHS:

/

/  JMP RD.CONT	THE READ REQUEST HAS NOT YET BEEN SATISFIED.

/		THE STATE MUST HAVE CHANGED, EITHER VIA

/		A "NXT" VARIATION OR BY THE ROUTINE MANUALLY

/		CHANGING LOCATION STATE; OTHERWISE AN INFINITE

/		LOOP WILL RESULT.  A NEW ACTION IS PERFORMED,

/		BASED UPON THE NEW STATE VALUE.  THE INPUT

/		LINE HAS NOT BEEN AFFECTED.

/

/  CAL* IN.CPB	THE READ REQUEST HAS NOT YET BEEN SATISFIED.

/  JMP RD.NEXT	THE ROUTINE MUST HAVE ISSUED THE IN.CPB TO

/		OBTAIN A NEW JOB INPUT LINE (USUALLY DONE

/		IMPLICITLY BY ROUTINE ECHO).  WHEN THE NEW

/		INPUT LINE IS AVAILABLE, THE ACTION WILL BE

/		RETRIED (I.E., THE ROUTINE WILL BE RECALLED).

/

/  JMP RD.WAT	THE READ REQUEST CANNOT BE SATISFIED AT THIS

/		TIME.  THE ROUTINE HAS ARRANGED FOR LOCATION

/		TRGGR TO BE SET WHEN THE REQUEST CAN BE

/		SATISFIED.  NORMALLY USED WHEN SOME I/O

/		PROCESS MUST COMPLETE, ISSUEING A HINF TO SET

/		TRGGR.  THE INPUT LINE HAS NOT BEEN AFFECTED.

/

/  JMP RD.FIN	THE READ REQUEST CAN BE SATISFIED.  THE AC

/		CONTAINS THE ADDRESS OF A TEXT BUFFER.  THE

/		CONTENTS OF THIS TEXT BUFFER WILL BE USED

/		TO SATISFY THE READ REQUEST.  FURTHERMORE,

/		IF THE BUFFER IS THE INPUT BUFFER (ADDRESS

/		IN IN.BFR) A NEW JOB INPUT LINE WILL BE

/		REQUESTED.

/

/ NOTE THAT STATE TRANSITIONS ONLY TAKE EFFECT IF WE TRANSFER

/ TO RD.FIN.  RD.WAT "UNWINDS" ANY TRANSITIONS WHICH HAVE TAKEN

/ PLACE.  RD.CONT AND RD.NEXT BOTH IMPLY THAT A NEW ACTION

/ WILL BE PERFORMED, IMPLYING THAT RD.FIN OR RD.WAT WILL

/ EVENTUALLY BE CALLED.

/

/ SPECIAL CASE PROCESSING IS AVAILABLE TO HANDLE EXITS FROM

/ STATE DRIVEN PROCESSING.  THIS IS USED BY THE JOB END/LOGOFF

/ PROCESSING.  A "CALL" ACTION IS USED TO INVOKE A ROUTINE.

/ THIS ROUTINE CALL SUBROUTINE RD.XFER TO SATISFY THE READ

/ REQUEST, THEN EXITS HOWEVER IT DESIRES.  BEFORE REENTERING

/ THE READ PROCESSOR, A NEW INPUT LINE MUST BE REQUESTED.

/

 

 

 

 

NXT=400000

 

MSG=000000

GOTO=100000

GLBMSG=200000

GLBIND=240000

CALL=300000

 

ILLEGAL=CALL RDILLGL

	.TITLE     ENTRY FROM I/O FUNCTION DISPATCH

 

 

 

 

/

/ READ REQUEST PROCESSOR -- MAIN ENTRY FROM I/O DISPATCH.

/ ENTER WITH REQUEST NODE ADDRESS IN RQSTND.

/

 

 

READ	LACIX (7)		/ FETCH DATA MODE

	SAD (2)			/ MUST BE IOPS ASCII.

	JMP RD.B		/ JMP IF IT IS

	LAW -7			/ IT ISN'T -- ERROR.

	SKP

RDILLGL	LAW -6			/ "CALL" ENTRY FOR ILLEGAL READ

	SKP

RD.A	LAW -30			/ COME HERE IF ILLEGAL BUFFER

	.DEBUG <"BDMAIN:READ -- READ REQUEST ERROR, EV SET TO ">,-1,10

	JMS RQSTFN		/ SET EV TO NEG. VALUE & FINISH

	JMP MAINLP		/ REQUEST, THEN GO GET ANOTHER.

 

 

/ COME HERE IF DATA MODE IS INDEED IOPS ASCII

 

RD.B	LACIX (10)		/ FETCH BUFFER ADDRESS

	DAC* (R3)		/ SAVE FOR VAJX

	LACIX (11)		/ FETCH BUFFER LENGTH

	DAC* (R4)		/ SAVE FOR VAJX

	DAC RDBFRL		/ SAVE FOR RD.XFER

	LACIX (2)		/ FETCH STL OF REQUESTOR

	PAX			/ POINT XR TO IT.

	.DEBUG <"BDMAIN:READ -- READ REQUEST FROM TASK ">,-2,111

	LAC (TDV)		/ LOAD AC WITH ZERO IF

	SADIX (S.N1)		/ REQUESTOR'S TASK NAME IS

	LACIX (S.N2)		/ "TDV...", +1 OTHERWISE.

	SAD (...)

	CLA!SKP

	CLA!IAC

	DAC RDTDV		/ SAVE TDV SWITCH IN RDTDV.

	JMS* (VAJX)		/ VERIFY I/O BUFFER IS OK.

	  JMP RD.A		/ JMP IF NOT OK -- ERROR.

	LAC* (R3)		/ SAVE REQUEST BUFFER ADDRESS

	DAC RDBFRA		/ FOR RD.XFER.

	LAC STATE		/ SAVE INITIAL STATE, IN CASE

	DAC RDSTATE		/ RD.WAT MUST UNWIND ALL MODS.

	JMP RD.CONT		/ GO PROCESS ACTION FOR CURRENT

				/ STATE.

 

 

 

RDTDV	0			/ TDV/NON-TDV READ SWITCH.  SET

				/ TO 0 FOR TDV READS, 1 FOR

				/ NON-TDV READS BY ABOVE CODE.

				/ USED BY RD.CONT TO INDEX

				/ INTO STATE TABLE ENTRY.

 

RDSTATE	-1			/ SAVED STATE VALUE.  SET TO

				/ INITIAL STATE BY ABOVE

				/ CODE, USED BY RD.WAT TO

				/ UNWIND STATE TRANSITIONS.

 

RDADDR	-1			/ ADDRESS FIELD OF STATE TABLE

				/ ENTRY.  SET TO ADDRESS FIELD

				/ OF STATE TABLE ENTRY BY

				/ RD.CONT, REFERENCED BY

				/ RD.CONT AND RD.NEXT.

 

RDBFRA	-1			/ REQUESTOR'S BUFFER ADDRESS.

				/ SET TO ABSOLUTE BUFFER

				/ BY ABOVE CODE, USED BY

				/ RD.XFER.

 

RDBFRL	0			/ REQUESTOR'S BUFFER LENGTH.

				/ TO BUFFER LENGTH BY ABOVE

				/ CODE, USED BY RD.XFER.

	.TITLE     RD.CONT -- INVOKE CURRENT STATE ACTION

 

 

 

 

/

/ THIS ROUTINE SELECTS THE APPROPRIATE WORD FROM THE

/ CURRENT STATE TABLE ENTRY (POINTED TO BY LOCATION STATE).

/ THE ACTION WORD IS DECODED AND APPROPRIATE STEPS TAKEN

/ TO OBEY IT.

/

 

 

RD.CONT	LAC RDTDV		/ GET TDV SWITCH IN XR (0 IF

	PAX			/ TDV, +1 OTHERWISE).

	LAC STATE		/ COMPUTE ADDRESS FIELD OF

	XORIX STATE		/ ACTION.  ACTION WORD CON-

	AND (770000)		/ TAINS OFFSET WITHIN PAGE,

	XORIX STATE		/ MUST USE PAGE BITS FROM

	DAC RDADDR		/ CURRENT STATE POINTER.

	LACIX STATE		/ PICK UP ACTION WORD.

	SPA			/ SKIP IF NOT "NXT"

	ISZ STATE		/ "NXT" -- BUMP STATE

	SPA!RAL			/ SKIP IF NOT "NXT"

	ISZ STATE		/ "NXT" -- FINISH STATE BUMP.

	SPA!RTL			/ SKIP IF "MSG" OR "GOTO"

	JMP RDCN.A		/ JMP IF "GLBMSG", "GLBIND", 

				/ OR "CALL"

	LAC RDADDR		/ FETCH ACTION WORD ADDR. FIELD

	SNL			/ SKIP IF "GOTO"

	JMP RDCN.B		/ JMP IF "MSG" -- GO DO IT.

	DAC STATE		/ "GOTO" -- UPDATE STATE,

	JMP RD.CONT		/ THEN GO FIND NEW ACTION.

 

 

/ COME HERE IF ACTION IS "GLBMSG", "GLBIND", OR "CALL"

 

RDCN.A	SZL!RAL			/ SKIP IF "GLBMSG" OR "GLBIND".

	JMP RD.NEXT		/ JMP IF "CALL" -- GO DO IT.

	LAC* RDADDR		/ INDIRECT THROUGH GLOBAL SYM.

	SNL			/ SKIP IF "GLBIND".

	JMP RDCN.B		/ JMP IF "GLBMSG".

	DAC RDADDR		/ INDIRECT THROUGH POINTER TO

	LAC* RDADDR		/ PICK UP TEXT BUFFER ADDRESS.

/ COME HERE ON "MSG", "GLBMSG", OR "GLBIND" WITH TEXT BUFFER

/ ADDRESS IN AC.

/ CAN'T USE RD.FIN, BECAUSE IT MIGHT READ A NEW INPUT LINE.

RDCN.B	JMS RD.XFER		/ TRANSFER TEXT TO REQUEST

	JMP MAINLP		/ GO FIND ANOTHER  REQUEST.

	.TITLE     RD.NEXT, RD.WAT -- PROCESS "CALL" ACTION

 

 

 

 

/

/ COME HERE TO PROCESS "CALL" REQUEST.  ALSO COME HERE IF

/ "CALL" ROUTINE READS A NEW INPUT LINE AND WANTS TO MAKE

/ SURE ITS IN THE INPUT BUFFER.

/

/ THIS ROUTINE CHECKS IF INPUT HAS COMPLETED -- IF NOT,

/ DO RD.WAT.

/

 

 

RD.NEXT	LAC* IN.EV		/ IS INPUT COMPLETE?

	SZA			/ SKIP IF NOT.

	JMP* RDADDR		/ JMP IF IT IS -- INVOKE

				/ "CALL" ROUTINE.

	JMS* ISSUE		/ ISSUE HINF TO INPUT DEVICE.

	  IN.HINF+400000	/ SO WE WILL WAKEUP WHEN I/O

				/ IS DONE.

	.DEBUG <"BDMAIN:RD.NEXT -- IN.HINF ISSUED.">,0,0

/ COME HERE TO WAIT FOR I/O TO FINISH, THEN RETRY REQUEST.

/ THIS ROUTINE UNWINDS ANY STATE TRANSITIONS WHICH HAVE

/ OCCURED DURING THIS REQUEST.

RD.WAT	LAC RDSTATE		/ RESTORE SAVED STATE.

	DAC STATE

	JMP RQSTWT		/ AND DEFER REQUEST.

	.TITLE     RD.FIN -- FINISH A READ REQUEST

 

 

 

 

/

/ RD.FIN -- ROUTINE TO FINISH A READ REQUEST.  COME HERE

/ WITH TEXT BUFFER ADDRESS IN AC TO SATISFY CURRENT READ

/ REQUEST.  TEXT BUFFER CONTAINS TEXT TO SATISFY THE READ.

/ IF THE TEXT BUFFER IS THE INPUT BUFFER (ADDRESS IN IN.BFR),

/ A NEW INPUT LINE WILL BE READ.

/

 

 

RD.FIN	JMS RD.XFER		/ TRANSFER TEXT TO READ &

				/ FINISH READ & PRESERVE AC.

	SAD* IN.BFR		/ IS IT THE INPUT BUFFER?

	SKP			/ SKIP IF YES.

	JMP RDFN.A		/ JMP IF NO.

	JMS* ISSUE		/ IT IS THE INPUT BUFFER --

	  IN.CPB+400000		/ READ NEW INPUT LINE.

RDFN.A	JMP MAINLP		/ GO FETCH NEXT REQUEST.

	.TITLE     RD.XFER -- SUBR. TO TRANSFER TEXT BUFFER

 

 

 

 

/

/ ROUTINE TO TRANSFER TEXT BUFFER TO THE READ

/ REQUEST BUFFER.  ENTER WITH AC CONTAINING ADDRESS OF

/ TEXT BUFFER.  THE TEXT BUFFER IS COPIED TO THE REQUESTOR'S

/ BUFFER, HIS EV IS SET TO +2, AND THE I/O REQUEST IS

/ FINISHED (VIA JMS RQSTFN).

/

/ NOTE THAT THE HEADER WORD PAIR IS ALWAYS COPIED, REGARDLESS

/ OF THE WORD PAIR COUNT OR BUFFER LENGTH.

/

/ THE AC IS PRESERVED.

/

/ CALLING SEQUENCE:

/	LAC (TEXT BUFFER ADDRESS)

/	JMS RD.XFER

/

/ REGISTERS ALTERED:

/	ALL EXCEPT AC

/

/ VALUES RETURNED:

/	NONE

/

 

 

RD.XFER	0

	.DEBUG <"BDMAIN:RD.XFER -- READ SATISFIED, BUFFER:  ">,-1,51

	DAC RDXF.0		/ SAVE TEXT BUFFER ADDRESS

	DAC* (X15)		/ SET UP X15 TO FETCH FROM IT

	LAW -1			/ SET UP X16 TO STORE INTO

	TAD RDBFRA		/ REQUESTOR'S BUFFER.

	DAC* (X16)

	LAW 777000		/ FETCH HEADER WORD PAIR COUNT

	AND* RDXF.0

	SWHA

	PAL			/ PUT IN LR FOR LOOP CONTROL

	CLX			/ ALSO CLEAR XR.

	CLL!RAL			/ CALC. NEGATIVE LENGTH IN

	CLL!TCA			/ WORDS OF TEXT BUFFER.

	TAD RDBFRL		/ AND COMPARE WITH REQUESTOR'S

	SZL!CLA			/ SKIP IF BUFFER OVERFLOW

	JMP RDXF.A		/ JMP IF TEXT WILL FIT.

	LAC RDBFRL		/ TRANSFORM REQUESTOR'S BUFFER

	CLL!RAR			/ LENGTH TO WORD PAIR COUNT.

	PAL			/ PUT IN LR FOR LOOP CONTROL.

	SWHA			/ FORMULATE HEADER WORD WITH

	AAC 60			/ BUFFER OVERFLOW BITS SET.

	XOR* RDXF.0		/ MERGE INTO EXISTING HEADER

	AND (777060)		/ WORD.

RDXF.A	XOR* RDXF.0		/ PICK UP HEADER WORD, REVISED

				/ AS APPROPRIATE.

	DAC* X16		/ SAVE IT AWAY.

	LAC* X15		/ PICK UP NEXT WORD.

	AXS 1			/ CHECK FOR WORD PAIR COUNTS

	SKP			/ OF ZERO OR ONE.

	JMP RDXF.C		/ JMP IF WPC ZERO OR ONE.

RDXF.B	DAC* X16		/ COPY TEXT BUFFER TO

	LAC* X15		/ REQUESTOR'S BUFFER,

	DAC* X16		/ LEAVING FINAL WORD IN AC.

	LAC* X15

	AXS 1

	JMP RDXF.B

	DAC RDXF.1		/ SAVE FINAL WORD.

	AND (177*2)		/ MASK OUT LAST CHAR.

	SAD (175*2)		/ IS LAST CHAR. AN ALT MODE?

	CLA!SKP			/ IS ALT MODE -- DON'T ALTER

	XOR (15*2)		/ OTHERWISE, FORCE TO CR

	XOR RDXF.1

RDXF.C	DAC* X16		/ STORE LAST WORD.

	LAC (2)			/ SET EV TO +2.

	JMS RQSTFN		/ AND FINISH REQUEST.

	LAC RDXF.0		/ RESTORE AC,

	JMP* RD.XFER		/ AND RETURN.

 

 

RDXF.0	0			/ TEXT BUFFER ADDRESS OR SAVED

				/ AC VALUE.

 

RDXF.1	0			/ TEMPORARY USED TO SAVE LAST

				/ WORD OF TEXT BUFFER.

	.TITLE ST.LGN -- LOGIN SEQUENCE STATE TABLE

 

 

 

 

/

/ THIS STATE TABLE CONTROLS THE LOGIN COMMAND SEQUENCE.

/

/ IT ALSO CONTAINS THE MAIN STATE (ST.MAIN) WHERE ALL

/ REAL PROCESSING OCCURS.

/

/ BDMAIN INITIALIZATION POINTS LOCATION STATE

/ TO ST.LGN.

/

 

 

ST.LGN	NXT+GLBMSG LGNMSG	/ SEND LOGIN DEVICE, UNIT & UFD

	ILLEGAL

/

	NXT+CALL LOGCHK		/ VERIFY LOGIN SUCCEEDED

	ILLEGAL

/

	NXT+MSG NULBFR		/ SEND BLANK LINE TO LOGIN TO

	ILLEGAL			/ DEFAULT DEVICE AND UFD.

/

	NXT+GLBMSG ASSLP	/ ASSIGN LUNS 4, 13, AND 16

	ILLEGAL			/ TO LISTING DEVICE.

/

	NXT+GLBMSG ASS13ACCT	/ ASSIGN LUN 13 TO ACCT. FILE

	ILLEGAL

/

	NXT+GLBMSG ASS4OPR	/ ASSIGN LUN 4 TO OPR TTY

	ILLEGAL

/

	NXT+MSG JOBCMD		/ INVOKE JOB...

	ILLEGAL

/

	GOTO ST.ASS		/ IF TDV, JOB... HAS EXITTED.

	NXT+GLBMSG BEGMSG	/ SEND ACCOUNTING INFO. LINE.

/

	GOTO ST.ASS		/ IF TDV, JOB... HAS EXITTED.

	NXT+GLBMSG QJBINF	/ SEND LINE WITH INFO. FROM

				/ JOB QUEUE NODE.

/

	GOTO ST.ASS		/ IF TDV, JOB... HAS EXITTED.

	NXT+GLBIND IN.BFR	/ SEND $JOB LINE TO JOB...

/

ST.ASS	NXT+CALL JBSTRT		/ START UP JOB.  JBSTRT READS

				/ FIRST INPUT LINE, STARTS JOB

				/ TIME ACCOUNTING, AND ASSIGNS

				/ LUNS 4, 13, AND 16 TO LISTING

				/ DEVICE (ASSLP MESSAGE).

	MSG EOFBFR		/ SEND EOF'S TO JOB... UNTIL

				/ IT QUITS.

/

ST.MAIN	CALL TDVRD		/ MAIN STATE -- CALL TDVRD

	CALL OTHRRD		/ OR OTHRRD AS APPROPRIATE.

 

 

 

JOBCMD	TEXT <"JOB"<15>>	/ TDV COMMAND TO INVOKE JOB...

	.TITLE LOGCHK -- VERIFY LOGIN SUCCEEDED

 

 

 

 

/

/ ROUTINE TO VERIFY LOGIN SUCCEEDED.  IF THE LOGIN

/ SUCCEEDED, CONTINUE (VIA RD.CONT).  OTHERWISE, CHECK

/ IF AN EXPLICIT DEVICE/UFD WAS SPECIFIED.  IF SO, TERMINATE

/ THE JOB.  IF DEFAULT WAS USED, GO TO RD.CONT SO THAT STATE

/ TABLE WILL CAUSE A NULL LINE TO BE SENT, SO THAT THE

/ SYSTEM DEFAULT DISK AND UFD WILL BE USED.

/

 

 

LOGCHK	.DEBUG <"BDMAIN:LOGCHK -- CHECK IF LOGIN SUCCEEDED.">,0,0

	JMS* USRSTAT		/ CHECK USER LOGIN STATUS

	  JMP LGCK.A		/ NOT LOGGED IN -- SYSTEM ERROR

	  JMP LGCK.A		/ NOT LOGGED IN -- SYSTEM ERROR

	  SKP			/ PARTIALLY LOGGED IN.

	JMP RD.CONT		/ FULLY LOGGED IN -- CONTINUE.

	.DEBUG <<11>"IT DIDN'T -- TRYING DEFAULT.">,0,0

	LAC* JBFLGS		/ PARTIALLY LOGGED IN -- CHECK

	AND (UFDFLG)		/ IF EXPLICIT DEVICE/UFD WAS

	SNA			/ SPECIFIED.  SKIP IF IT WAS.

	JMP RD.CONT		/ JMP IF DEFAULT DEVICE/UFD --

				/ GO SEND NULL LINE SO THAT

				/ SYSTEM DEFAULTS WILL BE USED.

	ERROR JE.LGN		/ SET LOGIN ERROR FLAG.

	.DEBUG <<11>"DEFAULT NOT ALLOWED, JOBERR = ">,JOBERR,21

	JMP RD.CONT		/ GO RUN JOB..., THEN TERMINATE

				/ THE BATCH JOB.

 

 

/ COME HERE IF BATCH'S USER WAS NOT EVEN LOGGED IN -- THIS

/ IS A SYSTEM ERROR

 

LGCK.A	LAW -601

	JMS* BDABRT

	.TITLE JBSTRT -- START UP JOB

 

 

 

 

/

/ THIS ROUTINE IS CALLED AFTER JOB... HAS FINISHED EXECUTION

/ IN ORDER TO START UP NORMAL JOB PROCESSING.

/

 

 

JBSTRT	.INH			/// CHECK IF A JOBERR HAS

	LAC* JOBERR		/// OCCURRED.  IF ONE HASN'T,

	SNA			/// BUMP JOBFND TO NORMAL

	ISZ* JOBFND		/// STATE (BUMP FROM +1 TO +2).

	.ENB			///

	SZA			/ SKIP IF NO ERROR.

	JMP JBDONE		/ JMP IF ERROR HAS OCCURRED --

				/ GO TERMINATE JOB.

	.DEBUG <"BDMAIN:JBSTRT -- STARTING JOB.">,0,0

	JMS* ISSUE		/ READ FIRST INPUT LINE (AFTER

	  IN.CPB+400000		/ $JOB CARD).

	JMS TMSTRT		/ START JOB TIME ACCOUNTING.

	LAC ASSLP		/ ASSIGN LUNS 4, 13, AND 16

	JMP RD.FIN		/ TO LISTING DEVICE.

	.TITLE OTHRRD -- PROCESS NON-TDV READ REQUEST

 

 

 

 

/

/ OTHRRD -- ROUTINE TO PROCESS NON-TDV READ REQUESTS WHEN

/ IN MAIN JOB PROCESSING STATE.

/

/ ENTER WITH INPUT LINE IN IN.BFR.

/

 

 

OTHRRD	JMS* CHKCRD		/ FETCH INPUT LINE CARD TYPE.

	SPA			/ SKIP IF NON-CONTROL CARD

	JMP OTHR.B		/ JMP IF CONTROL ($) CARD --

				/ GO ABORT TASK.

	SAD (%EOF)		/ IS CARD $EOF?

	JMP OTHR.A		/ YES -- GO RETURN EOF.

	LAC* IN.BFR		/ OTHERWISE FINISH READ USING

	JMP RD.FIN		/ INPUT LINE AS DATA.

 

 

/ COME HERE ON $EOF

 

OTHR.A	JMS* ECHO		/ ECHO CARD TO LP & READ LINE

	  JMP RD.WAT

	LAC (EOFBFR)		/ RETURN EOF TO REQUESTOR.

	JMP RD.FIN

 

 

/ COME HERE ON CONTROL CARDS

 

OTHR.B	JMS SPECIAL		/ PROCESS $MSG, $LOG, $PAU,

				/ AND $EJECT.  NOTE THAT

				/ "SPECIAL" WILL JUMP TO

				/ RD.NEXT OR RD.WAT (RATHER

				/ THAN RETURNING) IF THE

				/ INPUT LINE IS ONE OF THESE.

	JMS* CTRL.Y		/ ABORT REQUESTING TASK.  THIS

				/ SHOULD GET US BACK TO TDV.

	LAC (EOFBFR)		/ RETURN EOF TO REQUESTOR.

	JMP RD.FIN

	.TITLE TDVRD -- PROCESS TDV READ REQUESTS

 

 

 

 

/

/ TDVRD -- ROUTINE TO HANDLE READS FROM TDV (WHEN IN MAIN

/ PROCESSING STATE).

/

/ COME HERE WITH INPUT LINE IN IN.BFR.

/

 

 

TDVRD	LAC* JOBERR		/ CHECK IF JOB WAS TERMINATED.

	SPA			/ SKIP IF IT WASN'T.

	JMP TDVR.C		/ JMP IF JOB TERMINATED.

	LAC* JOBFND		/ COMPUTE ISZ SKIP SWITCH TO

	AAC -3			/ SKIP IF JOBFND IS +2 (NORMAL

	DAC TDVR.0		/ PROCESSING STATE).

	SNA!CMA			/ SKIP IF JOBFND IS +2, AND

				/ COMPUTE NEW VALUE OF KIL.SW.

	SAD KIL.SW		/ EXECUTED IF JOBFND IS +3.

				/ SKIP TO PRINT KILMSG.

	JMP TDVR.A		/ JMP IF JOBFND IS +2 OR IF

				/ KILMSG HAS ALREADY BEEN

				/ PRINTED.  AC HAS NEW VALUE

				/ OF KIL.SW.

	JMS* PRINT		/ PRINT KILMSG.

	  JMP RD.WAT		/ JMP IF LISTING DEVICE BUSY.

	  LAC (KILMSG)

	JMS* ISSUE		/ ALSO PRINT ON OPERATOR TTY.

	  TT.CPB+400000

	LAW -1			/ INDICATE KILMSG HAS BEEN

				/ PRINTED.

TDVR.A	DAC KIL.SW		/ STORE KILMSG PRINTED FLAG.

	JMS* CHKCRD		/ FETCH CARD TYPE CODE.

	SMA			/ SKIP IF CONTROL CARD.

	JMP TDVR.D		/ JMP IF NOT CONTROL CARD --

				/ IGNORE THE CARD.

	SAD (EOJ)		/ CHECK FOR END-OF-JOB CARD.

	JMP TDVR.C		/ JMP IF END-OF-JOB CARD --

				/ GO TERMINATE JOB.

	SAD (%ERR)		/ CHECK FOR $ERR CARD.

	JMP TDVR.E		/ JMP IF $ERR CARD.

	ISZ TDVR.0		/ ARE WE IN "SCAN TO $ERR"

				/ STATE (IS JOBFND = +3)?

	JMP TDVR.F		/ JMP IF YES -- ECHO & IGNORE.

				/ ($ERR ALREADY CHECKED FOR.)

	JMS SPECIAL		/ PROCESS $MSG, $LOG, $PAU,

				/ AND $EJECT.  NOTE THAT

				/ "SPECIAL" WILL JUMP TO

				/ RD.NEXT OR RD.WAT (RATHER

				/ THAN RETURNING) IF THE

				/ INPUT LINE IS ONE OF THESE.

	JMS* ECHO		/ ECHO CARD TO LP & READ LINE.

	  JMP RD.WAT

	LAC* LP.BFR		/ CONTROL CARD IS IN LP.BFR

				/ AFTER JMS ECHO!

	JMP RD.FIN		/ SEND CONTROL CARD TO TDV.

 

 

/ COME HERE TO TERMINATE JOB.

 

TDVR.C	JMS TMSTOP		/ STOP JOB TIME ACCOUNTING.

	JMP JBDONE		/ GO TERMINATE JOB.

 

 

/ COME HERE ON NON-CONTROL CARDS.  IGNORE THE CARD.

 

TDVR.D	JMS* ISSUE		/ IGNORE CARD, READ NEXT ONE.

	  IN.CPB+400000

	JMP RD.NEXT

 

 

/ COME HERE ON $ERR CARDS.

 

TDVR.E	LAC (2)			/ RESTORE NORMAL JOB PROCESSING

	DAC* JOBFND		/ STATE.

/ COME HERE TO ECHO AND IGNORE A CARD.

TDVR.F	JMS* ECHO		/ ECHO CARD TO LP & READ LINE.

	  JMP RD.WAT

	JMP RD.NEXT

 

 

 

TDVR.0	0			/ TEMPORARY (ISZ SKIP SWITCH).

	.TITLE SPECIAL -- PROCESS $MSG, $LOG, $PAU, AND $EJECT

 

 

 

 

/

/ THIS ROUTINE IS CALLED WITH THE INPUT LINE CARD TYPE CODE

/ IN THE AC.  IT CHECKS FOR $MSG, $LOG, $PAU, OR $EJECT,

/ AND HANDLES THEM IF PRESENT.  OTHERWISE IT RETURNS TO

/ THE CALLER.

/

/ NOTE:  THIS ROUTINE DOES NOT ALWAYS RETURN TO ITS CALLER!

/

/ CALLING SEQUENCE:

/	JMS* CHKCRD		/ CARD TYPE CODE TO AC.

/	 .

/	 .			/ (PRESERVE AC).

/	 .

/	JMS SPECIAL

/

/ RETURNS:

/	IF INPUT LINE IS NOT $MSG, $LOG, $PAU, OR $EJECT,

/		RETURN AT JMS+1 WITH ALL REGISTERS

/		(INCLUDING AC AND LINK) PRESERVED.

/	IF INPUT LINE IS $MSG, $LOG, $PAU, OR $EJECT:

/		IF THE LISTING DEVICE IS IDLE, HANDLER

/			THE INPUT LINE AS APPROPRIATE AND

/			JMP TO RD.NEXT.

/		IF THE LISTING DEVICE IS BUSY, JMP TO RD.WAT.

/

 

 

SPECIAL	0

	SAD (%MSG)		/ $MSG CARD?

	JMP SPCL.A		/ JMP IF YES

	SAD (%LOG)		/ $LOG CARD?

	JMP SPCL.B		/ JMP IF YES

	SAD (%PAU)		/ $PAUSE CARD?

	JMP SPCL.C		/ JMP IF YES

	SAD (%EJECT)		/ $EJECT CARD?

	JMP SPCL.D		/ JMP IF YES

/ CARD IS NOT $MSG, $LOG, $PAU, OR $EJECT.

	JMP* SPECIAL		/ SO RETURN!

 

 

/ COME HERE ON $MSG CARDS

 

SPCL.A	JMS* ECHO		/ ECHO CARD ON LP & READ LINE.

	  JMP RD.WAT

	JMS* ISSUE		/ AND PRINT TO OPR TTY

	  TT.CPB+400000

	JMP RD.NEXT		/ CHECK NEXT INPUT LINE.

 

 

/ COME HERE ON $LOG CARDS

 

SPCL.B	JMS* ECHO		/ ECHO CARD ON LP & READ LINE.

	  JMP RD.WAT

	JMP RD.NEXT		/ CHECK NEXT INPUT LINE.

 

 

/ COME HERE ON $PAUSE CARDS

 

SPCL.C	JMS* ECHO		/ ECHO CARD ON LP & READ LINE.

	  JMP RD.WAT

	JMS* ISSUE		/ AND PRINT TO OPR TTY.

	  TT.CPB+400000

	JMS TMSTOP		/ STOP TIME ACCOUNTING DURING

				/ OPERATOR INTERVENTION.

	ISZ* PAUSW		/ SET PAUSE FLAG.

	SUSPEND			/ WAIT FOR OPERATOR RESUME.

	DZM* PAUSW		/ CLEAR PAUSE FLAG.

	JMS TMSTRT		/ RESTART TIME ACCOUNTING.

	JMP RD.NEXT		/ CHECK NEXT INPUT LINE.

 

 

/ COME HERE ON $EJECT CARDS.

 

SPCL.D	JMS* PRINT		/ PRINT FORM FEED.

	  JMP RD.WAT		/ JMP IF LISTING DEVICE BUSY.

	  LAC (FFBFR)

	JMS* ISSUE		/ READ NEXT INPUT LINE.

	  IN.CPB+400000

	JMP RD.NEXT		/ CHECK NEXT INPUT LINE.

	.TITLE JBDONE -- TERMINATE THE JOB (OVERLAY EXIT)

 

 

 

 

/

/ COME HERE, WITH A READ REQUEST OUTSTANDING, TO TERMINATE

/ THE JOB.  FIRST WE SATISFY THE READ REQUEST (WITH A NULL

/ LINE -- IT'S A TDV READ), THEN WE EXIT THIS OVERLAY TO

/ TERMINATE THE JOB.

/

 

JBDONE	JMS* ECHOWT		/ WAIT FOR LISTING ACTIVITY

	  JMP RD.WAT		/ TO COMPLETE.

	LAC (NULBFR)		/ SATISFY THE OUTSTANDING READ.

	JMS RD.XFER

	JMS* BDDONE		/ EXIT OVERLAY!

	.TITLE TMSTRT -- START JOB TIME ACCOUNTING

 

 

 

/

/ THIS SUBROUTINE IS CALLED TO START JOB TIME ACCOUNTING.

/ TMSTRT AND TMSTOP MUST ALWAYS BE CALLED IN MATCHED

/ PAIRS.

/

/ CALLING SEQUENCE:

/	JMS TMSTRT

/	 .

/	 .

/	 .

/	JMS TMSTOP

/

/ REGISTERS ALTERED:

/	AC, LINK, XR

/

/ VALUES RETURNED:

/	NONE

/

 

TMSTRT	0

	JMS GETWAT		/// GET PARTITION WAIT TIME

				/// AND INHIBIT INTERRUPTS.

	DAC OLDWAT		/// SAVE PART. WAIT TIME.

	.ENB			///

	LAC* (SSM)		/// SAVE CURRENT SSM ALSO.

	DAC OLDSSM

	JMP* TMSTRT

	.TITLE TMSTOP -- STOP TIME ACCOUNTING & UPDATE RUNTIM

 

 

 

 

/

/ THIS SUBROUTINE STOPS JOB TIME ACCOUNTING (WHICH MUST HAVE

/ BEEN STARTED BY TMSTRT) AND UPDATES RUNTIM TO THE CURRENT

/ JOB FILE RUN TIME.  NOTE THAT TMSTRT AND TMSTOP MUST BE

/ CALLED IN MATCHED PAIRS.  THIS ROUTINE REFERENCES LOCATIONS

/ OLDSSM AND OLDWAT SET UP BY TMSTRT.

/

/ THE CURRENT JOB FILE RUN TIME IS RETURNED IN LOCATION RUNTIM

/ AND THE AC.

/

/ THE FORMULA FOR COMPUTING RUN TIME (SINCE THE LAST CALL

/ TO TMSTRT) IS AS FOLLOWS:

/

/	RUNTIME =     REALTIME     -      WAITTIME

/	        = ( SSM - OLDSSM ) - ( NEWWAT - OLDWAT )

/               = - ( NEWWAT + OLDSSM ) + SSM + OLDWAT

/

/ NOTE THAT IF "REALTIME" IS NEGATIVE, IT IMPLIES THAT WE

/ HAVE PASSED MIDNIGHT, AND A CORRECTION FACTOR OF ONE DAY

/ MUST BE ADDED TO "REALTIME".  NOTE, HOWEVER, THAT "WAITTIME"

/ MUST BE POSITIVE AND LESS THAN "REALTIME" (EXCEPT WHEN

/ "REALTIME" IS NEGATIVE), WHICH IMPLIES THAT THE CORRECTION

/ FACTOR CAN BE APPLIED WHENEVER "RUNTIME" IS NEGATIVE, RATHER

/ THAN HAVING TO CHECK "REALTIME" EXPLICITLY.  "WAITTIME" MUST

/ BE POSITIVE SINCE THE VALUE RETURNED BY GETWAT IS

/ MONOTONICALLY INCREASING (IMPLYING NEWWAT > OR = OLDWAT).

/ THAT "WAITTIME" MUST BE LESS THAN "REALTIME" IS OBVIOUS

/ (ASSUMING THE ABSCENCE OF RELATIVISTIC TIME CONTRACTION

/ EFFECTS).

/

/ CALLING SEQUENCE:

/	JMS TMSTRT

/	 .

/	 .

/	 .

/	JMS TMSTOP

/

/ REGISTERS ALTERED:

/	AC, LINK, XR

/

/ VALUES RETURNED:

/	CURRENT JOB FILE RUN TIME IN RUNTIM & AC

/

 

TMSTOP	0

	JMS GETWAT		/// GET PARTITION WAIT TIME

				/// AND INHIBIT INTERRUPTS.

	TAD OLDSSM		/// COMPUTE RUN TIME SINCE

	TCA			/// LAST CALL TO TMSTRT

	.ENB			/// ACCORDING TO THE

	TAD* (SSM)		/// FORMULA GIVEN ABOVE.

	TAD OLDWAT

	SPA

	TAD (250600)		/ 250600 = # SECONDS / DAY.

	TAD* RUNTIM		/ ADD TO ACCUMULATED RUN TIME.

	DAC* RUNTIM

	JMP* TMSTOP

	.TITLE GETWAT -- SUBROUTINE USED BY TMSTRT & TMSTOP

 

 

 

 

/

/ THIS SUBROUTINE IS CALLED BY TMSTRT AND TMSTOP TO OBTAIN

/ THE ACCUMULATED PARTITION WAIT TIME FROM THE USER CONTEXT

/ AREA IN TDV....  IT RETURNS WITH INTERRUPTS INHIBITTED

/ AND THE PARTITION WAIT TIME IN THE AC.

/

/ THIS SUBROUTINE LEAVES INTERRUPTS INHIBITED SO THAT ITS

/ CALLER CAN EXAMINE SSM AND GET A VALUE CONSISTENT WITH

/ THE RETURNED PARTITION WAIT TIME.

/

/ CALLING SEQUENCE:

/	JMS GETWAT		///

/	 .			///

/	 .			///

/	 .			///

/	.ENB			///

/

/ REGISTERS ALTERED:

/	AC, LINK, XR

/

/ VALUES RETURNED:

/	PARTITION WAIT TIME IN AC

/

 

GETWAT	0

	.INH			///

	LAC* (MA.CST)		/// FETCH TDV CONTROL & STATUS

	SNA			/// TABLE ADDRESS.  SKIP IF OK.

	JMP GTWT.A		/// JMP IF TDV NOT RUNNING.

	TAD* TTYOFST		/// ADD OFFSET TO BATCH'S UCA

	PAX			/// POINTER, AND FETCH ADDRESS

	LACIX (0)		/// OF BATCH'S UCA.

	SAD (-1)		/// SKIP IF STILL LOGGED IN.

	JMP GTWT.A		/// JMP IF BATCH NOT LOGGED IN.

	PAX			/// POINT XR TO UCA.

	LACIX (U.SSM)		/// FETCH TIME ENTERED PART.

	SAD (-1)		/// WAIT.  IF -1, NOT WAITING

	LAC* (SSM)		/// FOR PARTITION.

	TCA			/// CALCULATE TIME SPENT IN

	TAD* (SSM)		/// CURRENT PARTITION WAIT.

	SPA			/// SKP IF DIDN'T PASS MIDNIGHT

	TAD (250600)		/// CORRECT FOR PASSING

				/// MIDNIGHT.  250600 =

				/// # SECONDS / DAY.

	TADIX (U.TW)		/// ADD TIME SPENT IN PREVIOUS

				/// PARTITION WAITS.

	JMP* GETWAT		/// AND RETURN WITH INTERRUPTS

				/// STILL INHIBITTED.

 

 

/ COME HERE IF TDV ISN'T RUNNING (CONTROL & STATUS TABLE

/ POINTER NOT SET UP) OR IF BATCH ISN'T LOGGED IN (UCA

/ POINTER IS -1).

 

GTWT.A	.ENB			/// ALLOW INTERRUPTS.

	LAW -602		/ DECLARE BATCH SYSTEM ERROR.

	JMS* BDABRT

 

 

 

	.END
