X-Git-Url: http://cloudbase.mooo.com/gitweb/avrcpm.git/blobdiff_plain/08716d4f9066a68af4d306849878284e24daa043..623dd899f6326f34aaf298fd4f83dbd69d7ef750:/avr/utils.asm diff --git a/avr/utils.asm b/avr/utils.asm index 155c027..685ce56 100644 --- a/avr/utils.asm +++ b/avr/utils.asm @@ -202,6 +202,44 @@ printstr_end: pop zh ret +; ------------------------ String functions ------------------------- +; + +#if 0 +; String compare (z, y), one z-string in flash. + +strcmp_p: + lpm _tmp0,z+ + tst _tmp0 + breq strcmp_pex + + ld temp, y+ + lpm _tmp0, z+ + sub temp,_tmp0 + brne strcmp_pex + tst _tmp0 + brne strcmp_p +strcmp_pex: + ret +#endif + +; String compare (x, y, temp2). Max temp2 bytes are compared. + +strncmp_p: + subi temp2,1 + brcs strncmp_peq + ld temp,y+ + lpm _tmp0, z+ + sub temp,_tmp0 + brne strncmp_pex + tst _tmp0 + brne strncmp_p +strncmp_peq: + sub temp,temp +strncmp_pex: + ret + + ; --------------- Debugging stuff --------------- ; Print a line with the 8080/Z80 registers