Google
 

Trailing-Edge - PDP-10 Archives - ap-c800d-sb - gettag.mac
There are 5 other files named gettag.mac in the archive. Click here to see a list.
; UPD ID= 616 on 11/21/77 at 2:22 PM
TITLE	GETTAG FOR COBOL V12
SUBTTL	GET NEXT TAG NUMBER TO BE USED		AL BLACKINGTON/CAM



;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
;  OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
;
;COPYRIGHT (C) 1974, 1979 BY DIGITAL EQUIPMENT CORPORATION

	SEARCH	P
	%%P==:%%P

;EDITS
;V12*****************
;NAME	DATE		COMMENTS
;----	----		--------
;MFTT	8/30/77		ADD "DRFTAG" ROUTINE
;DAW	8/16/77		ADD "REFTAG" ROUTINE
;DAW	8/15/77		CHANGE TAGTAB TO A FULL-WORD-ENTRY TABLE
;********************


TWOSEG
RELOC	400000

ENTRY	GETTAG
ENTRY	REFTAG
ENTRY	DRFTAG

;NOTE: THE ONLY ROUTINES THAT SHOULD EVER TOUCH TAGNXT
;  ARE GETTAG AND XPNTAG

GETTAG:	MOVE	CH,TAGCNT##	;GET NEXT TAG NUMBER
	HRLS	CH		;  MAKE N,,N
	ADD	CH,TAGLOC##	;CREATE NEW TAGNXT
	JUMPL	CH,GETTA1	;IF COUNT STILL NEG, NEW TAG FITS

	PUSHJ	PP,XPNTAG##	;OTHERWISE, EXPAND TABLE
	JRST	GETTAG		;RECOMPUTE NEW TAGNXT

GETTA1:	MOVEM	CH,TAGNXT##	;STORE NEW VALUE FOR TAGNXT
	SETZM	(CH)		;CLEAR ENTRY

	MOVE	CH,TAGCNT	;GET TAG NUMBER TO RETURN TO CALLER
	IORI	CH,AS.TAG##	;PUT IN ASSEMBLER CODE

	AOS	TAGCNT		;RESET TAGCNT FOR NEXT CALL TO GETTAG
	POPJ	PP,
;ROUTINE TO REFERENCE A TAG - ENTER WITH TA= TAG #.
;USES TE

REFTAG:	TRCN	TA,700000	;SKIP IF POSSIBLY AS.TAG SET
	JRST	REFTG1		;NOTHING
	TRCE	TA,AS.TAG	;ONLY REFERENCE IF ADDRESS TYPE IS AS.TAG
	POPJ	PP,		;SOMETHING ELSE - FORGET IT
REFTG1:	ANDI	TA,77777	;LEAVE ONLY THE TAG NUMBER
	ADD	TA,TAGLOC##	;RH (TA) IS ADDRESS OF THE TAG ENTRY
	MOVSI	TE,1		;ADD 1 TO LEFT HALF
	ADDM	TE,(TA)		; (REFERENCE COUNT)
	POPJ	PP,		;RETURN



;ROUTINE TO DE-REFERENCE A TAG.  ENTER WITH TAG IN TA.
;USES TEMP AC TE
;SKIP RETURN WHEN REFERENCE COUNT EQUAL ZERO.

DRFTAG:	ANDI	TA,77777	;LEAVE ONLY TAG NUMBER
	ADD	TA,TAGLOC	;RH (TA) IS NOW THE ADDRESS OF ENTRY
	MOVE	TE,(TA)		;TE=ENTRY
DRFTG2:	TLNE	TE,(1B0!1B1)	;IS THIS AN INDIRECT REFERENCE?
	 JRST	DRFTG1		;YES
	LDB	TE,[POINT 15,TE,17] ;GET REFERENCE COUNT
	SOJL	TE,DOKILL	;SUBTRACT ONE, IF NEGATIVE, COMPLAIN
	SKIPN	TE		;SKIP IF NON-ZERO
	AOS	(PP)		;SKIP RETURN FOR ZERO COUNT
	DPB	TE,[POINT 15,(TA),17] ;STORE DECREMENTED COUNT
	POPJ	PP,

DRFTG1:	TRC	TE,AS.PRO##	;A PARA-NAME?
	TRNN	TE,700000
	 POPJ	PP,		;YES-DON'T DO ANYTHING
	HRRZ	TA,TE
	JRST	DRFTAG

DOKILL:	TTCALL 3,[ASCIZ/? TAG COUNT LESS THAN ZERO IN DRFTAG
/]
	PJRST	KILL##		;DIE

END