2 ; Ullrich von Bassewitz, 31.05.1998
3 ; Christian Krueger, 2013-Aug-04, minor optimization
5 ; const char* strchr (const char* s, int c);
15 tay ; low byte of pointer to y
18 sta ptr1 ; ptr access page wise
20 Loop: lda (ptr1),y ; Get next char
21 beq EOS ; Jump on end of string
23 beq Found ; Jump if yes
27 bne Loop ; Branch always
29 ; End of string. Check if we're searching for the terminating zero
32 lda tmp1 ; Get the char we're searching for
33 bne NotFound ; Jump if not searching for terminator
35 ; Found. Set pointer to c.
38 ldx ptr1+1 ; Load high byte of pointer
39 tya ; low byte is in y
42 ; Not found, return NULL