The code below is supposed to search through the data, and then if it finds the byte given to it, in the clump of data(r2) it'll return it's index(0 based). Otherwise it should have 65535 be stored as the
.SEARCH
Lbl SEARCH
65535->theta
255->X
For(B,0,X)
If {{r1}}={B+{r2}}
B->theta
255->X
Return
End
End
Return
The code below is the code that calls that subroutine.
.RC1
"SILLY STRING"->Str1
length(Str1)->L
Disp L>Dec,[i]
Pause 2000
0-Z
For(A,0,768)
0->{L1+A}
End
For(A,0,12)
SEARCH({Str1+A},L1)->theta
If theta!=65535
{L1+theta}^^r++
Else
{Str1+A}->{L1+A}
0->{A+255+L1}^^r
Z+1->Z
End
End
prgmSEARCH
I've tried debuggingn it by displaying the two values, and they _should_ match but it never seems to fire off right, and I have no idea why. I never seem to get a single byte to match a single other byte in the data. Even when I _know_ it should be in there and I can clearly see it.