File LEX.SB (8k SABR macro assembler source file)

Directory of image this file is from
This file as a plain text file

/LEX.SB
/
/	LEXICAL COMPARE FUNCTION
/
/	I = LEX(STR1,STR2)
/
/	STR1, STR2:	12 CHARACTER STRINGS

/	FUNCTION RETURNS:

/	0	IF STR1=STR2
/	-1	IF STR1 PRECEDES STR2 IN LEXICOGRAPHICAL ORDER
/	+1	IF STR1 FOLLOWS  STR2 IN LEXICOGRAPHICAL ORDER

/////////////

OPDEF	TADI	1400
ABSYM	XR0	10
ABSYM	XR1	11
ABSYM	TMP	7

	ENTRY	LEX

LEX,	0
L,	0
	TAD	LEX
	DCA	FLD	/CHANGE TO PARAM'S FIELD

FLD,	HLT
	TADI	L
	DCA	P1FLD	/FETCH PARAM 1 FIELD
	INC	L
	STA
	TADI	L
	DCA	XR0	/GET P1 ADDRESS
	INC	L
	TADI	L
	DCA	P2FLD	/SAME FOR
	INC	L
	STA
	TADI	L	/PARAM 2
	DCA	XR1
	INC	L

	TAD	(-6
	DCA	TMP	/WORD COUNT

LPST,
P1FLD,	HLT
	TADI	XR1
	CLL CIA
P2FLD,	HLT
	TADI	XR0	/STR1(I) - STR2(I)
	SNA
	JMP	LPEND	/EQUAL.. TRY NEXT WORD PAIR
	SNL CLA		/GREATER??
	STA CLL RAL	/AC <-- -2
	IAC		/AC BECOMES + OR - ONE
	JMP	RTN	/RETURN FUNCTION

LPEND,	ISZ	TMP
	JMP	LPST	/MORE PAIRS TO MATCH.

RTN,	RETRN	LEX	/RETURN ZERO IF ALL MATCH


	END



Feel free to contact me, David Gesswein djg@pdp8online.com with any questions, comments on the web site, or if you have related equipment, documentation, software etc. you are willing to part with.  I am interested in anything PDP-8 related, computers, peripherals used with them, DEC or third party, or documentation. 

PDP-8 Home Page   PDP-8 Site Map   PDP-8 Site Search