You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

39 lines
444 B

STRINDEX: ; SEARCH FOR STRING AT DE WITHIN STRING AT HL
LD B, 0
LD C, 0
TRYNEXT:
PUSH HL
PUSH DE
CALL STRCMP
POP DE
POP HL
RET Z
INC HL
INC BC
LD A, (HL)
OR A
JR NZ, TRYNEXT
OR $FF ; RETURN NZ
RET
STRCMP: ; COMPARE STRING AT HL WITH DE - RETURN Z IF LIKE
LD A, (DE)
OR A
RET Z
LD B, A
LD A, (HL)
OR A
JR NZ, STRCMP1
OR $FF ; END OF STRING HL - SO NOT FOUND
RET
STRCMP1
CP B
RET NZ
INC HL
INC DE
JR STRCMP