2020-06-15 11:52:58 +10:00
|
|
|
L4 BSET PC 3 - ORG @ 4 + ! ( find )
|
|
|
|
( find word the same name as str in SI starting from tip in
|
2020-06-15 20:23:19 +10:00
|
|
|
DI. Returns wordref in BX. Z if found, NZ if not. )
|
2020-06-15 11:52:58 +10:00
|
|
|
CH CH XORrr, CL [SI] MOVr[], ( CX -> strlen )
|
2020-06-15 20:23:19 +10:00
|
|
|
SI INCx, ( first char ) AX AX XORxx, ( initial prev )
|
|
|
|
BEGIN, ( loop )
|
|
|
|
DI AX SUBxx, ( jump to prev wordref )
|
|
|
|
DI DECx, AL [DI] MOVr[], ( strlen )
|
|
|
|
CL AL CMPrr, IFZ, ( same len )
|
|
|
|
SI PUSHx, DI PUSHx, CX PUSHx, ( --> lvl 3 )
|
|
|
|
2 ADDALi, ( prev ) AH AH XORrr, DI AX SUBxx,
|
|
|
|
REPZ, CMPSB,
|
|
|
|
CX POPx, DI POPx, SI POPx, ( <-- lvl 3 )
|
|
|
|
IFZ, DI INCx, AL AL XORrr, ( Z ) RETn, THEN,
|
|
|
|
THEN,
|
|
|
|
( cont. )
|