I started a small code to compare two strings using UT.CSTR utility vectored routine. It takes str1 in A0, str2 in A1, must be relative to A6. I was suprised I actually needed to substract two adresses to get the strings relative to A6.
This works, but is there a shorter coding possible, in a single instruction?
movea.l a6,a0 strings relative to a6
suba.l str1,a0 string str1
Code follows here...
Code: Select all
; compare two strings
;
movea.l a6,a0 strings relative to a6
suba.l str1,a0 string str1
movea.l a6,a1
suba.l str2,a1 string str2
moveq #$0,d0 type=0 case sensitive
;
movea.w $e6,a5 UT.CSTR
jsr (a5)
lea res,a5
move.l d0,(a5) store result
;
clr.b d0
rts
;
res ds.l 1 result at offset 30($1e)
str1 dc.w 4,'ABCD'
str2 dc.w 3,'ABC'
dc.w 0
;
end