Google
 

Trailing-Edge - PDP-10 Archives - decuslib20-03 - decus/20-0081/vtsseg.mac
There is 1 other file named vtsseg.mac in the archive. Click here to see a list.
	TITLE	VTSSEG	--	SHARED SEGMENT PART OF VTTAM SYSTEM
	;TONY LAUCK	2 JUN 71

	HISEG

;THIS SHARED SEGMENT IS USED BY THE VTTAM MASTER JOB TO COMMUNICATE
;WITH ALL THE VTTAM SLAVE JOBS. ALL THE JOBS INITIALIZE THIS
;SEGMENT WITH A GETSEG AND SETUWP UUO.

;THIS SEGMENT CONTAINS FLAGS AND CONTROL WORDS TO ENABLE
;MASTER / SLAVE COMMUNICATION.

;THIS SEGMENT CONTAINS A SHARED OUTPUT BUFFER WHICH THE MASTER
;JOB FILLS AND THE APPROPRIATE SLAVE EMPTIES.

;THIS SEGMENT CONAINS A SHARED INPUT BUFFER WHICH THE SLAVES
;FILL AND THE MASTER EMPTIES. THE SLAVES CONTEND FOR THIS BUFFER.

;THIS SEGMENT CONTAINS QUEUEING TABLES TO ENABLE THE SLAVES
;TO CONTEND FOR THE SHARED INPUT BUFFER ON A F.C.F.S. BASIS.

;THIS SEGMENT CONTAINS SYNCHRONIZING TABLES AND COUNTS
;TO ENABLE CORRECT OPERATION OF THE QUEUEING FUNCTION.

;FINALLY, THIS SEGMENT CONTAINS INFORMATION ENABLING THE MASTER
;AND SLAVES TO START UP AND SHUT DOWN SMOOTHLY, AND KNOW EACH OTHER'S
;JOB NUMBERS.
	SUBTTL	PARAMETERS

;THESE PARAMETERS MUST AGREE WITH THOSE DEFINED BY THE MASTER AND SLAVE.


;VT05 PARAMETERS

	SCRCOL=^D72		;COLUMNS PER LINE OF VT05
	SCRLIN=^D20		;LINES PER SCREEN OF VT05
	INTERN SCRCOL,SCRLIN	;FORCE AGREEMENT.

	SCRCHR=SCRCOL*SCRLIN	;CHARACTERS PER SCREEN
	SCRWDS=<SCRCHR+5>/6	;WORDS PER SCREEN (DISPLAY-6)


;TABLE SIZE PARAMETERS.

	MAXTRM=^D63		;MAXIMUM NUMBER OF VTTAM TERMINALS
	INTERN MAXTRM		;DEFINE FOR MASTER AND SLAVE

	QSIZE=MAXTRM+1		;NUMBER OF ENTRIES IN QUEUE AREA
	QSIZW=<QSIZE+4>/5	;NUMBER OF WORDS IN QUEUE AREA
				; (7 BIT BYTE PER ENTRY)
;INPUT BUFFER QUEUE TABLES.
;THESE ARE READ OR WRITTEN ONLY WITH THE CRITICAL SECTION ASSIGNED
; EXCEPT FOR ONE CASE: A SLAVE OWNING AVLINP MAY PASS IT TO
; THE MASTER PROVIDED HE HASN'T SIGNALED THE MASTER YET.

	INTERN	AVLINP,QBFINP,QININP,QOUINP,QSTINP,QFNINP

QSTINP:	POINT 7,QBFINP	;BYTE POINTER TO START OF QBFINP

QFNINP:	POINT 7,QBFINP+QSIZW-1,34
			;BYTE POINTER TO END OF QBFINP. USED TO ALLOW
			; CIRCULAR USE OF QBFINP.


;1ST WORD TO ZERO ON START UP.
	INTERN	SHZERL
SHZERL:

AVLINP:	BLOCK	1	;ASSIGNMENT WORD FOR SHARED INPUT BUFFER.
			;0 MEANS BUFFER IS FREE.
			;NON-ZERO IS JOB NUMBER OF OWNER.
			;-1 MEANS WAS PASSED TO THE MASTER.

QBFINP:	BLOCK	QSIZW	;TABLE OF 7 BIT BYTES HOLDING THE JOB
			; NUMBERS OF REQUESTORS FOR THE SHARED INPUT
			; BUFFER. THIS IS A CIRCULAR TABLE, AND ENABLES
			; F.C.F.S. USE OF THE INPUT BUFFER.

QININP:	BLOCK	1	;BYTE POINTER USED BY SLAVE IN ADDING ENTRIES
			;INTO QBFINP.

QOUINP:	BLOCK	1	;BYTE POINTER USED BY MASTER FOR REMOVING
			;ENTRIES FROM QBFINP.
	SUBTTL	QUEUING AND SYNCRONIZING TABLES


	;CRITICAL SECTION TABLES

	INTERN	QREQ,QBITS

QREQ:	BLOCK	1		;CRITICAL SECTION SYNC COUNT.
				;-1 IF CRITICAL SECTION FREE,
				; .GE. 0 IF BUSY.
				;AOS'D ON REQUEST.
				;SOS'D ON RELEASE.

QBITS:	BLOCK	4		;BIT TABLE INDEXED BY JOB NUMBER.
				;A BIT SET MEANS THE CORRESPONDING JOB
				; IS ABOUT TO REQUEST THE CRITICAL
				; SECTION, HAS JUST REQUESTED IT AND
				; IS WAITING, HAS JUST REQUESTED IT,
				; OBTAINED IT AND IS ABOUT TO CLEAR THE
				; BIT, OR HAS JUST BEEN ASSIGNED THE
				; CRITICAL SECTION BY ITS PREVIOUS OWNER
				; AND THE PREVIOUS OWNER IS ABOUT TO
				; CLEAR THE BIT.
				;THIS BIT ENABLES AN OWNER TO WAKE UP
				; A WAITER WHEN RESOUCE IS FREE. A
				; WAITER LOOPS UNTIL HIS BIT IS CLEARED
				; BY AN OWNER.
	SUBTTL	COMMUNICATIONS AND CONTROL

	INTERN	MJOBN,JOBTAB,STDAY,STTIME

MJOBN:	BLOCK	1		;MASTER STORES HIS JOB NUMBER HERE SO 
				; SLAVES CAN WAKE HIM.

JOBTAB:	BLOCK	MAXTRM+1	;TABLE INDEXED BY VTTAM TERMINAL NO.
				;SLAVES STORE THEIR JOB NUMBERS HERE
				; SO MASTER CAN WAKE THEM.
				;SLAVES CLEAR THEIR JOB NUMBER WHEN THEY
				; ARE IDLE. THIS ENABLES START-UP
				; SHUT-DOWN SYNCHRONIZATION.


STDAY:	BLOCK	1		;DATE VTTAM STARTED OR STOPPED IN
				; STANDARD 12 BIT FORMAT.
				;MASTER SETS THIS SO SLAVE CAN OUTPUT
				; ITS OPEN AND CLOSE MESSAGES.


STTIME:	BLOCK	1		;MSTIME + 1 WHEN MASTER STARTED UP, OR
				; -(MSTIME + 1) WHEN MASTER SHUT DOWN.
				;ZERO WHEN VTTAM IS SAFELY STOPPED.
				;USED TO TELL SLAVES OF START UP, OR
				; SHUT DOWN, AND TO SYNCHRONIZE
				; START-UP SHUT-DOWN.
	SUBTTL	BUFFERING AND REQUEST / RESPONSE

;INPUT TRANSACTIONS.

	INTERN	SINFLG,SINBF

SINBF:	BLOCK	SCRWDS		;SHARED INPUT BUFFER.
				;SLAVE PUTS A SCREEN IMAGE HERE WHEN IT
				;WANTS IT PROCESSED BY MASTER. THE SLAVE
				;MUST HAVE INPUT BUFFER RESOURCE TO DO
				;THIS. THE MASTER READS THIS TO GET
				;DATA FOR THE COBOL PROGRAM.

SINFLG:	BLOCK	1		;INPUT BUFFER REQUEST/RESPONSE WORD
				;IF 0, INPUT BUFFER IS EMPTY.
				;IF NON-ZERO, IT CONTAINS DATA FROM
				;VTTAM TERMINAL NUMBER STORED HERE.
				;SINFLG IS SET BY SLAVE AFTER FILLING
				;SINBF, AND CLEARED BY MASTER AFTER
				;READING DATA FROM SINBF
	;OUTPUT TRANSACTIONS.

	INTERN SOUTBF,SOUTRM,SOUMOD

SOUTBF:	BLOCK	SCRWDS		;SHARED OUTPUT BUFFER.
				;MASTER PUTS A SCREEN IMAGE HERE.
				;THE APPROPRIATE SLAVE COPIES THE
				;DATA TO ITS OWN BUFFERS AND OUTPUTS IT.

SOUTRM:	BLOCK	1		;OUTPUT BUFFER REQUEST / RESPONSE WORD.
				;0 IF SOUTBF IS EMPTY.
				;ELSE CONTAINS VTTAM TERMINAL NUMBER
				;OF DATA IN SOUTBF.
				;SET BY MASTER AFTER FILLING SOUTBF.
				;CLEARED BY SLAVE AFTER EMPTYING SOUTBF.

SOUMOD:	BLOCK	1		;INDICATES TYPE OF OUTPUT REQUEST.
				;SET BY MASTER BEFORE IT SETS SOUTRM.
				;-1 MEANS ERASE SCREEN.
				;0 MEANS WRITE WHOLE SCREEN.
				;.GT.0 MEANS WRITE LINE NUMBER HERE
				;USING THE FIRST LINE OF DATA IN SOUTBF.


;LAST WORD OF SHARED DATA TO ZERO
	INTERN SHZERH
	SHZERH=.-1

	END