2 ; Ullrich von Bassewitz, 2003-05-05
4 ; void* __fastcall__ memchr (const void* p, int c, size_t n);
8 .import popax, popptr1, return0
18 sta ptr2+1 ; Save ones complement of n
24 ; ldy #$00 is guaranteed by popptr1
26 ldx ptr2 ; Use X as low counter byte
35 bne L1 ; Branch always
37 L3: inc ptr2+1 ; Bump counter high byte
40 ; Not found, return NULL
45 ; Found, return pointer to char
47 found: ldx ptr1+1 ; get high byte of pointer