26 |
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
27 |
POSSIBILITY OF SUCH DAMAGE. */ |
POSSIBILITY OF SUCH DAMAGE. */ |
28 |
|
|
29 |
|
/* $Id$ */ |
30 |
|
|
31 |
/* |
/* |
32 |
strcasecmp_P.S |
strcasecmp_P.S |
33 |
Case insensitive compare |
Case insensitive compare |
64 |
|
|
65 |
#if !defined(DOXYGEN) |
#if !defined(DOXYGEN) |
66 |
|
|
67 |
.text |
.text |
68 |
.global _U(strcasecmp_P) |
.global _U(strcasecmp_P) |
69 |
.type _U(strcasecmp_P), @function |
.type _U(strcasecmp_P), @function |
70 |
_U(strcasecmp_P): |
_U(strcasecmp_P): |
71 |
LOAD_Z(s2_lo, s2_hi) |
X_movw ZL, s2_lo |
72 |
LOAD_X(s1_lo, s1_hi) |
X_movw XL, s1_lo |
73 |
.strcasecmp_P_loop: |
.L_strcasecmp_P_loop: |
74 |
LD ret_lo, X+ ; load *s1 |
LD ret_lo, X+ ; load *s1 |
75 |
LPM_R0_ZP ; load *s2 |
LPM_R0_ZP ; load *s2 |
76 |
MOV tmp,r0 ; copy of *s2 to tmp |
MOV tmp,r0 ; copy of *s2 to tmp |
77 |
MOV cht, r0 ; copy of *s2 to cht |
MOV cht, r0 ; copy of *s2 to cht |
78 |
ORI cht, 0x20 ; make tmp lower case |
ORI cht, 0x20 ; make tmp lower case |
79 |
CPI cht, 'a' ; test on [a .. z] |
CPI cht, 'a' ; test on [a .. z] |
80 |
BRLT .strcasecmp_P_tst |
BRLT .L_strcasecmp_P_tst |
81 |
CPI cht, 'z'+1 |
CPI cht, 'z'+1 |
82 |
BRGE .strcasecmp_P_tst |
BRGE .L_strcasecmp_P_tst |
83 |
ORI tmp, 0x20 ; we got an aplpha in s2 |
ORI tmp, 0x20 ; we got an aplpha in s2 |
84 |
ORI ret_lo, 0x20 |
ORI ret_lo, 0x20 |
85 |
.strcasecmp_P_tst: ; compare |
.L_strcasecmp_P_tst: ; compare |
86 |
SUB ret_lo, tmp |
SUB ret_lo, tmp |
87 |
BRNE .strcasecmp_P_done |
BRNE .L_strcasecmp_P_done |
88 |
TST r0 ; end of s2? |
TST r0 ; end of s2? |
89 |
BRNE .strcasecmp_P_loop |
BRNE .L_strcasecmp_P_loop |
90 |
.strcasecmp_P_done: |
.L_strcasecmp_P_done: |
91 |
; ret_hi = SREG.C ? 0xFF : 0 |
; ret_hi = SREG.C ? 0xFF : 0 |
92 |
SBC ret_hi, ret_hi |
SBC ret_hi, ret_hi |
93 |
RET |
RET |
94 |
.strcasecmp_P_end: |
.L_strcasecmp_P_end: |
95 |
.size _U(strcasecmp_P), .strcasecmp_P_end - _U(strcasecmp_P) |
.size _U(strcasecmp_P), .L_strcasecmp_P_end - _U(strcasecmp_P) |
96 |
|
|
97 |
#endif /* not DOXYGEN */ |
#endif /* not DOXYGEN */ |