~z88dk-team/z88dk-pkg/trunk

« back to all changes in this revision

Viewing changes to libsrc/strings/strrchr_callee.asm

  • Committer: Bazaar Package Importer
  • Author(s): Luca Falavigna
  • Date: 2008-02-12 08:23:49 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080212082349-wgijt44scmgje90o
Tags: 1.7.ds1-1ubuntu1
* Merge from Debian unstable. Remaining Ubuntu changes:
  - build z88dk and z88dk-bin binary packages for lpia too
  - update Maintainer field as per spec

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
; char __CALLEE__ *strrchr_callee(char *s, char c)
 
2
; return ptr to last occurrence of c in s
 
3
; 04.2001 dom, 01.2007 aralbrec
 
4
 
 
5
XLIB strrchr_callee
 
6
XDEF ASMDISP_STRRCHR_CALLEE
 
7
 
 
8
.strrchr_callee
 
9
 
 
10
   pop hl
 
11
   pop bc
 
12
   pop de
 
13
   push hl
 
14
   
 
15
   ; enter :  c = char c
 
16
   ;         de = char *s
 
17
   ; exit  : found : hl = ptr
 
18
   ;         else  : hl = 0
 
19
   ; uses  : af, de, hl
 
20
 
 
21
.asmentry
 
22
 
 
23
   ld hl,0
 
24
   
 
25
.loop
 
26
 
 
27
   ld a,(de)
 
28
   cp c
 
29
   
 
30
   jp nz, nomatch
 
31
   ld l,e
 
32
   ld h,d
 
33
 
 
34
.nomatch
 
35
 
 
36
   or a
 
37
   inc de
 
38
   jp nz, loop
 
39
 
 
40
   ret
 
41
 
 
42
DEFC ASMDISP_STRRCHR_CALLEE = asmentry - strrchr_callee