SRCH	MACRO M1110  21-AUG-78 23:24  PAGE 2





      1						.TITLE	SRCH

      2						.IDENT	/00/

      3

      4					;

      5					; COPYRIGHT (C) 1976, 1977

      6					; DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.

      7					;

      8					; THIS SOFTWARE IS FURNISHED UNDER  A LICENSE FOR USE ONLY  ON  A

      9					; SINGLE COMPUTER SYSTEM AND MAY BE  COPIED ONLY WITH  THE INCLU-

     10					; SION OF  THE  ABOVE  COPYRIGHT NOTICE.  THIS SOFTWARE,  OR  ANY

     11					; OTHER COPIES THEREOF, MAY NOT BE  PROVIDED  OR  OTHERWISE  MADE

     12					; AVAILABLE TO ANY OTHER PERSON EXCEPT  FOR  USE  ON  SUCH SYSTEM

     13					; AND TO  ONE WHO AGREES  TO  THESE LICENSE  TERMS.  TITLE TO AND

     14					; OWNERSHIP OF THE SOFTWARE SHALL AT ALL TIMES REMAIN IN DEC.

     15					;

     16					; THE INFORMATION IN THIS SOFTWARE  IS  SUBJECT TO CHANGE WITHOUT

     17					; NOTICE AND SHOULD NOT BE CONSTRUED  AS  A COMMITMENT BY DIGITAL

     18					; EQUIPMENT CORPORATION.

     19					;

     20					; DEC ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS

     21					; SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DEC.

     22					;

     23					; VERSION 00

     24					;

     25					; C. MONIA 11-OCT-77

     26					;

     27					; ROUTINE TO SEARCH FOR A STRING

     28					;

     29					; LOCAL MACROS

     30					;

     31					; SAVE R3 - R5

     32					;

     33

     34						.MACRO	SAVRG

     35						JSR	R5,$SAVRG

     36						.ENDM

     37

     38					;+

     39					; **-SRCH-SEARCH FOR SPECIFIED STRING

     40					;

     41					; THIS ROUTINE IS CALLED TO SEARCH FOR A SPECIFIED STRING.

     42					;

     43					; INPUTS:

     44					;

     45					;	R0 = ADDRESS OF TWO-WORD DESCRIPTOR FOR STRING TO BE SEARCHED

     46					;

     47					;	R1 = ADDRESS OF TWO WORD DESCRIPTOR FOR STRING TO BE LOCATED

     48					;

     49					; OUTPUTS:

     50					;

     51					;	C/CLEAR - FOUND SPECIFIED STRING

     52					;

     53					;		R0 = NUMBER OF BYTES REMAINING IN STRING TO BE SEARCHED

     54					;		R1 = ADDRESS OF BYTE FOLLOWING STRING

     55					;

     56					;	C/SET - STRING NOT FOUND

     57					;

SRCH	MACRO M1110  21-AUG-78 23:24  PAGE 2-1





     58					;-

     59

     60	000000				SRCH::					;

     61	000000					SAVRG				; SAVE R3 - R5

     62	000004	010004 				MOV	R0,R4			; SAVE ADDRESS DESCRIPTOR TO SEARCH

     63	000006	010105 				MOV	R1,R5			; SAVE ADDRESS OF SEARCH DESCRIPTOR

     64	000010	005046 				CLR	-(SP)			; SET SEARCH COUNT

     65	000012				10$:					;

     66	000012	011400 				MOV	(R4),R0			; GET COUNT OF SEARCH STRING

     67	000014	016401 	000002 			MOV	2(R4),R1		; GET ADDRESS OF SEARCH STRING

     68	000020	061601 				ADD	(SP),R1			; INCLUDE CURRENT COUNT

     69	000022	161600 				SUB	(SP),R0			; ....

     70	000024	011502 				MOV	(R5),R2			; GET COUNT OF STRING TO FIND

     71	000026	016503 	000002 			MOV	2(R5),R3		; GET ADDRESS OF STRING TO FIND

     72	000032	020002 				CMP	R0,R2			; CHECK LENGTH OF REMAINING STRING

     73	000034	103407 				BLO	40$			; IF LO STRING NOT FOUND

     74	000036				20$:					;

     75	000036	122123 				CMPB	(R1)+,(R3)+		; COMPARE STRINGS

     76	000040	001402 				BEQ	30$			; IF EQ CONTINUE

     77	000042	005216 				INC	(SP)			; INCREMENT SEARCH COUNT

     78	000044	000762 				BR	10$			;

     79	000046				30$:					;

     80	000046	005300 				DEC	R0			; DECREMENT COUNT OF CHARACTERS LEFT

     81	000050	005302 				DEC	R2			; DECREMENT STRING COUNT

     82	000052	001371 				BNE	20$			; IF NEQ MORE TO SEARCH

     83	000054				40$:					;

     84	000054	005226 				INC	(SP)+			; CLEAN STACK

     85	000056					RETURN				;

     86

     87		000001 				.END

SRCH	MACRO M1110  21-AUG-78 23:24  PAGE 2-2

SYMBOL TABLE



CR    = 000015   	HT    = 000011   	R$$11M= 000000   	SRCH    000000RG 	$SAVRG= ****** GX

FF    = 000014   	LF    = 000012   	SPA   = 000040   	VT    = 000013



. ABS.	000000	   000

      	000060	   001

ERRORS DETECTED:  0



VIRTUAL MEMORY USED:  588 WORDS  ( 3 PAGES)

DYNAMIC MEMORY:  2772 WORDS  ( 10 PAGES)

ELAPSED TIME:  00:00:05

OBJ$:SRCH,LIS$:SRCH/-SP=SRC$:MACFLM,SRCH

