add LCC - a better C-Compiler for WEGA

This commit is contained in:
Oliver Lehmann 1990-03-14 20:48:58 +00:00
parent 136f50b5bd
commit a456e1b61f
1 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,41 @@
//
// memcmp - compares its arguments, looking at the first n characters only,
// and returns an integer less than, equal to, or greater than 0,
// according as s1 is lexicographically less than, equal to, or
// greater than s2.
//
// Input: s1 and s2 - the strings to compare
// n - maximum number of bytes to compare
//
// Output: 0 if s1 == s2
// <0 if s1 < s2
// >0 if s1 > s2
//
.seg
sp := r15
SP := rr14
.psec
.code
_memcmp::
{
ldm r2,|_stkseg+4|(sp),#5 // rr2 = s1
// rr4 = s2
// r6 = n
cp r7,#0
jr le,~reteq
cpsirb @rr2,@rr4,r6,ne
jr z,~noteq
~reteq: // return(0) (s1 == s2)
xor r2,r2
ret
~noteq:
jr ult,~retlt
~retgt: // return(1) (s1 > s2)
ldk r2,#1
ret
~retlt: // return(-1) (s1 < s2)
ld r2,#-1
ret
}