/[projet1]/public/pc/tools/osdk/main/Osdk/_final_/lib2/strncmp.s
Defence Force logotype

Contents of /public/pc/tools/osdk/main/Osdk/_final_/lib2/strncmp.s

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1154 - (show annotations)
Sun Aug 10 18:19:54 2014 UTC (5 years, 3 months ago) by dbug
File size: 710 byte(s)


1 ;int strncmp(char *s1, char *s2, int n)
2 _strncmp
3 jsr get_2ptr
4 ldy #5
5 lda (sp),y ; get n
6 sta tmp ; tmp=hi(n)
7 dey
8 lda (sp),y
9 tax ; x=lo(n)
10 ldy #0
11
12 strncmploop
13 dex ; decrease n
14 cpx #$ff
15 bne strncmp1
16 dec tmp
17 lda tmp
18 cmp #$ff
19 beq strncmpend0 ; n<0?
20
21 strncmp1
22 lda (op1),Y
23 cmp (op2),Y
24 bne strncmpend
25 cmp #0
26 beq strncmpend0
27 iny
28 bne strncmploop
29 inc op1+1
30 inc op2+1
31 jmp strncmploop
32
33 strncmpend0
34 jmp retzero
35 strncmpend
36 sec
37 sbc (op2),Y
38 tax
39 lda #0
40 bcs *+4
41 lda #$ff
42 rts
43

  ViewVC Help
Powered by ViewVC 1.1.26