A86: Re: CPIR


[Prev][Next][Index][Thread]

A86: Re: CPIR




CPIR is not the best way to search strings.  If you're looking to find one
char, it is, but not multiple chars.  The reason for this is that cpir will
skip the null terminator at the end of your string.  The smallest string
searching routine is probably this one, the winner of the ZPC contest:

http://icarus.ticalc.org/features/zpc.htm

Search:
 push de
 push hl
benedick:
 ld a,(de)
 or a
 jr z,beatrice
 sub (hl)
 ld a,(hl)
 inc de
 inc hl
 jr z,benedick
 or a
 scf
beatrice:
 pop hl
 pop de
 ret z
 inc hl
 jr Search

> anyoe got some helpful info for string searching using cpir?




References: