1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-06 00:30:55 +11:00
collapseos/blk/815
Virgil Dupras 8c452f5add pcat: begin implementing find
Not comparing strings yet. Without asm tooling support, it's a big
chunk to swallow at once. It's progressing well!
2020-06-14 21:52:58 -04:00

15 lines
516 B
Plaintext

L4 BSET PC 3 - ORG @ 4 + ! ( find )
( find word the same name as str in SI starting from tip in
BX. Returns wordref in BX. Z if found, NZ if not. )
CH CH XORrr, CL [SI] MOVr[], ( CX -> strlen )
SI INCx,
AX AX XORxx, ( initial prev )
BEGIN, ( inner )
BX AX SUBxx, ( jump to prev wordref )
BX DECx, AL [BX] MOVr[], ( strlen )
CL AL CMPrr, IFZ, BX INCx, RETn, THEN,
BX DECx, BX DECx, AX [BX] MOVx[], ( prev )
AX AX ORxx,
JNZ, AGAIN,
BEGIN, JMPs, AGAIN,