|
DataMuseum.dkPresents historical artifacts from the history of: Commodore CBM-900 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Commodore CBM-900 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - download
Length: 578 (0x242) Types: TextFile Notes: UNIX file Names: »strcmp.s«
└─⟦f27320a65⟧ Bits:30001972 Commodore 900 hard disk image with partial source code └─⟦f4b8d8c84⟧ UNIX Filesystem └─ ⟦this⟧ »libc/gen/strcmp.s«
/ Segmented Z8001 Coherent string library / compare two strings / strcmp(s1, s2) / char *s1, *s2; .globl strcmp_ .globl SS strcmp_: ldm r2, SS|4(r15), $4 / rr2 = s1, rr4 = s2 subl rr0, rr0 / r0=count, r1=null byte cpirb rl1, (rr2), r0, eq / Find length of `s1' string neg r0 / Adjust string length sub r3, r0 / Put rr2 back at beg. of s2 cpsirb (rr2), (rr4), r0, ne / Compare the strings ret ne / Return 0 if strings the same dec r3 dec r5 ldb rl0, (rr2) cpb rl0, (rr4) / check last byte jr ult, 1f / Branch if s1 < s2 inc r1 ret 1: dec r1 ret