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

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

Parent Directory Parent Directory | Revision Log Revision Log


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


1 ; char *strcat(char *s1, char *s2)
2 _strcat
3 ldy #3 ; copy s2
4 lda (sp),y
5 sta strcat2+2
6 dey ; Y=#2
7 lda (sp),y
8 sta strcat2+1
9
10 dey ; Y=#1
11 lda (sp),y ; copy s1
12 sta strcat1+2
13 sta strcat3+1 ; copy return value, high
14 dey ; Y=#0
15 lda (sp),y
16 sta strcat1+1
17 sta strcat3+3 ; copy return value, low
18
19 strcat1 ; look for terminating null in s1
20 lda $2211,Y ; self-modifying
21 beq strcat1a ; terminating null found?
22 iny
23 bne strcat1
24 inc strcat1+2 ; next page (whoa, that's a long string!)
25 jmp strcat1
26
27 strcat1a
28 lda strcat1+2 ; set self-mod in strcat2+[5,4] to end of s1
29 sta strcat2+5
30 lda strcat1+1
31 sta strcat2+4
32 clc
33 tya
34 adc strcat2+4
35 sta strcat2+4
36 lda strcat2+5
37 adc #$00
38 sta strcat2+5
39 ldx #$00
40
41 strcat2
42 lda $2211,x
43 sta $5544,x
44 beq strcat3 ; found terminating null?
45 inx
46 bne strcat2
47 inc strcat2+2
48 inc strcat2+5
49 jmp strcat2
50
51 strcat3
52 lda #$01 ; self-mod
53 ldx #$03 ; likewise
54 rts
55
56

  ViewVC Help
Powered by ViewVC 1.1.26