; ; File generated by cc65 v 2.11.0 ; .fopt compiler,"cc65 v 2.11.0" .setcpu "6502" .smart on .autoimport on .case on .debuginfo on .importzp sp, sreg, regsave, regbank, tmp1, ptr1, ptr2 .macpack longbranch .dbg file, "strtok.c", 1493, 1116364232 .dbg file, "../../include/string.h", 4676, 1116364269 .dbg file, "../../include/stddef.h", 2974, 1061022172 .import _strchr .export _strtok .segment "DATA" _Last: .word $0000 ; --------------------------------------------------------------- ; unsigned char* __fastcall__ strtok (register unsigned char*, const unsigned char*) ; --------------------------------------------------------------- .segment "CODE" .proc _strtok .segment "CODE" ; ; { ; .dbg line, "strtok.c", 31 jsr pushax ldy #$02 ldx #$04 jsr regswap2 ; ; if (s1 == 0) { ; .dbg line, "strtok.c", 36 jsr decsp3 lda regbank+4 ora regbank+4+1 bne L0004 ; ; s1 = Last; ; .dbg line, "strtok.c", 37 lda _Last ldx _Last+1 sta regbank+4 stx regbank+4+1 ; ; if (*s1 == '\0') { ; .dbg line, "strtok.c", 41 L0004: ldy #$00 lda (regbank+4),y bne L0009 ; ; return 0; ; .dbg line, "strtok.c", 42 tax jmp L0003 ; ; while ((c = *s1) && strchr (s2, c) != 0) { ; .dbg line, "strtok.c", 48 L0009: ldy #$00 lda (regbank+4),y ldy #$02 sta (sp),y tax beq L000D ldy #$06 jsr pushwysp ldy #$04 ldx #$00 lda (sp),y jsr _strchr cpx #$00 bne L000E cmp #$00 beq L000D ; ; ++s1; ; .dbg line, "strtok.c", 49 L000E: inc regbank+4 bne L0009 inc regbank+4+1 ; ; } ; .dbg line, "strtok.c", 50 jmp L0009 ; ; if (c == '\0') { ; .dbg line, "strtok.c", 51 L000D: ldy #$02 lda (sp),y bne L0018 ; ; Last = s1; ; .dbg line, "strtok.c", 53 lda regbank+4 ldx regbank+4+1 sta _Last stx _Last+1 ; ; return 0; ; .dbg line, "strtok.c", 54 ldx #$00 txa jmp L0003 ; ; start = s1; ; .dbg line, "strtok.c", 58 L0018: lda regbank+4 ldx regbank+4+1 ldy #$00 jsr staxysp ; ; while ((c = *s1) && strchr (s2, c) == 0) { ; .dbg line, "strtok.c", 61 L001F: ldy #$00 lda (regbank+4),y ldy #$02 sta (sp),y tax beq L0020 ldy #$06 jsr pushwysp ldy #$04 ldx #$00 lda (sp),y jsr _strchr cpx #$00 bne L0020 cmp #$00 bne L0020 ; ; ++s1; ; .dbg line, "strtok.c", 62 inc regbank+4 bne L001F inc regbank+4+1 ; ; } ; .dbg line, "strtok.c", 63 jmp L001F ; ; if (c == '\0') { ; .dbg line, "strtok.c", 64 L0020: ldy #$02 lda (sp),y bne L002B ; ; Last = s1; ; .dbg line, "strtok.c", 66 lda regbank+4 ldx regbank+4+1 ; ; } else { ; .dbg line, "strtok.c", 67 jmp L0034 ; ; *s1 = '\0'; ; .dbg line, "strtok.c", 68 L002B: lda #$00 tay sta (regbank+4),y ; ; Last = s1 + 1; ; .dbg line, "strtok.c", 69 lda regbank+4 ldx regbank+4+1 clc adc #$01 bcc L0034 inx L0034: sta _Last stx _Last+1 ; ; return start; ; .dbg line, "strtok.c", 73 ldy #$01 jsr ldaxysp ; ; } ; .dbg line, "strtok.c", 74 L0003: pha ldy #$05 lda (sp),y sta regbank+4 iny lda (sp),y sta regbank+5 pla jmp incsp7 .dbg line .endproc