	SECT	VOCAB
	EXTERN	SIXOUT
/	SUBROUTINE VOCAB(ID1,ID2,INIT,V)
/	OS/8: SUBROUTINE VOCAB(ID, INIT, V)
/C
/C LOOK UP ID1:ID2 IN THE VOCABULARY (ATAB AND A2TAB)
/C Note: A2TAB not used on the '8
/C AND RETURN ITS "DEFINITION" (KTAB), OR
/C -1 IF NOT FOUND. IF INIT IS POSITIVE, THIS IS AN INIT CALL SETTING
/C UP A KEYWORD VARIABLE, AND NOT FINDING IT CONSTITUTES A BUG. IT ALSO MEANS
/C THAT ONLY KTAB VALUES WHICH TAKEN OVER 1000 EQUAL INIT MAY BE CONSIDERED.
/C (THUS "STEPS", WHICH IS A MOTION VERB AS WELL AS AN OBJECT, MAY BE LOCATED
/C AS AN OBJECT.) AND IT ALSO MEANS THE KTAB VALUE IS TAKEN MOD 1000.
/C
/	IMPLICIT INTEGER (A-Z)
/	COMMON /VOCCOM/ KTAB,ATAB,A2TAB,TABSIZ
/	DIMENSION KTAB(300),ATAB(300),A2TAB(300)

	EXTERN	BUG
	EXTERN	MOD
	JA	#ST
#XR,	ORG	.+10
	TEXT	+VOCAB+
#RET,	SETX	#XR
	SETB	#BASE
	JA	.+3
#BASE,	ORG	.+3
ID,	ORG	.+3
INIT,	ORG	.+3
ONE,	F 1.0
FOUR,	F 4.0
THOUS,	F 1000.0
TWO,	F 2.0
SIX,	F 6.0
	ORG	#BASE+30
	FNOP
	JA	#RET
	FNOP
#GOBAK,	0;0
#VAL,	ORG	.+6
ZERO,	F 0.0
I,	ORG	.+3
KTABI,	ORG	.+3
K21,	F 21.0
K5,	F 5.0
	#LBL=.
	COMMON	VOCCOM
KTAB,	ORG	.+1604
ATAB,	ORG	.+1604
TABSIZ,	ORG	.+3
	ORG	#LBL
#RTN,	BASE	#BASE
	FLDA	#VAL
	JA	#GOBAK
#ST,	STARTD
	0210
	FSTA	#GOBAK,0
	0200
	SETX	#XR
	SETB	#BASE
	LDX	0,1
	FSTA	#BASE
	FLDA%	#BASE,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