home *** CD-ROM | disk | FTP | other *** search
-
- * Maxon C++ Library:
- * Modul "string_find"
- * Jens Gelhar 11.09.91, 16.04.94
-
- xdef _strchr,strchr__PCci
- xdef _strrchr,strrchr__PCci
- xdef _strstr,strstr__PCcPCc
-
- _strchr:
- strchr__PCci:
- move.l 4(a7),a0
- move.l 8(a7),d0
- .loop cmp.b (a0),d0
- beq.b .found
- tst.b (a0)+
- bne.b .loop
- moveq #0,d0
- rts
- .found move.l a0,d0
- rts
-
- _strrchr:
- strrchr__PCci:
- moveq #0,d0
- move.l 4(a7),a0
- move.l 8(a7),d1
- .loop cmp.b (a0),d1
- bne.b .uneq
- move.l a0,d0
- .uneq tst.b (a0)+
- bne.b .loop
- rts
-
- _strstr:
- strstr__PCcPCc:
- movem.l 4(a7),a0/a1 ; a1 in a0 suchen!
- tst.b (a1)
- beq.b .end ; a1 == ""
- move.b (a1),d0
- .loop ; erstmal erstes Zeichen suchen
- cmp.b (a0),d0
- beq.b .comp1
- .cont1 tst.b (a0)+
- bne.b .loop
- ; nicht gefunden:
- moveq #0,d0
- bra.b .ret
- .comp1 ; Strings vergleichen:
- move.l a0,d0 ; a0 in d0 merken
- .4 move.b (a1)+,d1
- beq.b .ret ; Erfolgreich!
- cmp.b (a0)+,d1
- beq.b .4
- ; weitersuchen:
- move.l d0,a0
- move.l 8(a7),a1
- move.b (a1),d0
- bra.b .cont1
- .end move.l a0,d0
- .ret rts
-
- end
-