2 ; Ullrich von Bassewitz, 11.06.1998
3 ; Christian Krueger: 05-Aug-2013, optimization
5 ; size_t strcspn (const char* s1, const char* s2);
10 .importzp ptr1, ptr2, tmp1, tmp2
13 jsr _strlen ; get length in a/x and transfer s2 to ptr1
14 ; Note: It does not make sense to
15 ; have more than 255 test chars, so
16 ; we don't support a high byte here! (ptr1+1 is
17 ; also unchanged in strlen then (important!))
18 ; -> the original implementation also
21 sta tmp1 ; tmp1 = strlen of test chars
22 jsr popax ; get and save s1
25 ldx #0 ; low counter byte
26 stx tmp2 ; high counter byte
30 lda (ptr2),y ; get next char from s1
31 beq leave ; handly byte of s1
33 inc ptr2 ; advance string position to test
36 dey ; correct next iny (faster/shorter than bne...)
40 check: cpy tmp1 ; compare with length of test character string
42 cmp (ptr1),y ; found matching char?
45 leave: txa ; restore position of finding
53 bne loadChar ; like bra...