Google
 

Trailing-Edge - PDP-10 Archives - BB-H506D-SM_1983 - cobol/source/zerc.mac
There are 7 other files named zerc.mac in the archive. Click here to see a list.
TITLE	ZERC FOR LIBOL
SUBTTL	CHECK STRING FOR ZERO CHAR



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

;REVISION HISTORY:

;V10	*****

;	27-AUG-76	CREATION [454]
;*****

	SEARCH	LBLPRM		;DEFINE PARAMETERS.
	%%LBLP==:%%LBLP
	EBCMP.==:EBCMP.
	BIS==:BIS

	EXTERN	EASTB.		;FORCE EASTBL TO BE LOADED.

	HISEG

COMMENT	\

	THIS ROUTINE CHECKS A STRING TO SEE IF IT CONTAINS ONLY SPACES.

CALL:
	MOVEI	16,PARAMETER ADDRESS
	PUSHJ	17,ZERC.6/ZERC.7/ZERC.9

PARAMETER:
	BITS	0-5	BYTE POINTER RESIDUE FOR INPUT FIELD.
	BIT	6	IGNORED (1 IF A SIGN IS PRESENT.)
	BITS	7-17	SIZE OF THE INPUT FIELD.
	BITS	18-35	ADDRESS OF THE FIRST CHARACTER OF THE INPUT FIELD.

RETURNS:
	CALL+1	IF THE STRING LENGTH IS ZERO OR CONTAINS A CHARACTER
		 OTHER THAN A ZERO.
	CALL+2	IF THE STRING CONTAINS ALL ZEROS.

REGISTERS USED:
	CH,ZERO,JAC, IPTR, CNT, SW

\
	ENTRY	ZERC.6		;IF THE STRING IS SIXBIT.
	ENTRY	ZERC.7		;IF THE STRING IS ASCII.
IFN EBCMP.,<
	ENTRY	ZERC.9		;IF THE STRING IS EBCDIC.
>
	EXTERN	SIXZR.		;WHAT A SIXBIT ZERO LOOKS LIKE.
	EXTERN	ASCZR.		;WHAT AN ASCII ZERO LOOKS LIKE.
IFN EBCMP.,<
	EXTERN	EBCZR.		;WHAT AN EBCDIC ZERO LOOKS LIKE.
>

IFE	BIS,<

;LOCAL AC DEFINITIONS:

	ZERO==TAC4

	EXTERN	RET.2		;RETURNS TO CALL+2.
	EXTERN	SET1.		;SETS UP THE PARAMETERS.

ZERC.6:	JSP	CH,	ZERC		;ENTER HERE IF THE INPUT IS SIXBIT,
ZERC.7:	JSP	CH,	ZERC		; HERE IF IT IS ASCII OR
IFN EBCMP.,<
ZERC.9:	JSP	CH,	ZERC		; HERE IF IT IS EBCDIC.
>

ZERC:	SUBI	CH,	ZERC.6-5	;FIND OUT WHAT THE INPUT LOOKS LIKE.
	MOVE	ZERO,	ZEROS-6(CH)	;SELECT THE APPROPRATE ZERO.
	JSP	JAC,	SET1.		;GO SET UP THE PARAMETERS.
					;NOTE:  IF THE STRING LENGTH IS ZERO
					; WE RETURN TO CALL+1, NOT HERE.

ZERC1:	ILDB	CH,	IPTR		;GET A CHAR.
	CAIE	CH,	(ZERO)		;IS IT A ZERO?
	POPJ	PP,			;NO, RETURN TO CALL+1.
	SOJG	CNT,	ZERC1		;LOOP IF THERE ARE MORE CHARS.
	JRST		RET.2		;RETURN TO CALL+2 - ALL ZEROS.
>	;END OF NON-BIS


ZEROS:	EXP		SIXZR.
	EXP		ASCZR.
IFN EBCMP.,<
IFN BIS,<
	BLOCK	1
>
	EXP		EBCZR.
>
IFN	BIS,<

	EXTERN	BSET1.		;SETS UP THE PARAMETERS.
ZERC.6:	JSP	BISCH,	ZERC		;ENTER HERE IF THE INPUT IS SIXBIT,
ZERC.7:	JSP	BISCH,	ZERC		; HERE IF IT IS ASCII OR
IFN EBCMP.,<
	BLOCK	1
ZERC.9:	JSP	BISCH,	ZERC		; HERE IF IT IS EBCDIC.
>

ZERC:	SUBI	BISCH,	ZERC.6-5	;FIND OUT WHAT THE INPUT LOOKS LIKE.
	MOVE	BIST0+E0.FLT,	ZEROS-6(BISCH)	;SELECT THE APPROPRATE ZERO.
						;FOR FILL CHARACTER
	JSP	JAC,	BSET1.		;GO SET UP THE PARAMETERS.
					;NOTE:  IF THE STRING LENGTH IS ZERO
					; WE RETURN TO CALL+1, NOT HERE.

	SETZB	DSTPT,DSTCNT		;NO DESTINATION - COMPARE AGAINST
					; THE FILL CHARACTER
	MOVE	BIST0+E0.INS,[CMPSN	0]	;COMPARE NOT EQUAL
	EXTEND	B.FLAG,BIST0
	AOS	(PP)			;EQUAL TO ZEROS
	POPJ	PP,			;NOT ZEROS

>	;END OF BIS
	END