1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-12-25 04:48:06 +11:00

pcat: move all find code in _find word

It isn't used by low level boot code anymore, so it can go there.
This commit is contained in:
Virgil Dupras 2020-06-21 11:57:12 -04:00
parent dbd283758c
commit 1b5333d0b4
6 changed files with 18 additions and 29 deletions

View File

@ -14,4 +14,3 @@ XCURRENT @ _xapply ORG @ 0x06 ( stable ABI uflw ) + !

View File

@ -1,4 +1,4 @@
VARIABLE lblexec VARIABLE lblfind VARIABLE lblnext
VARIABLE lblexec VARIABLE lblnext
H@ ORG !
JMPn, 0 A,, ( 00, main ) 0 A, 0 A,, ( unused )
0 A,, ( unused ) 0 A,, ( 08, LATEST )

15
blk/819
View File

@ -1,15 +0,0 @@
lblfind BSET
( find word the same name as str in SI starting from tip in
DI. Returns wordref in DI. Z if found, NZ if not. )
CH CH XORrr, CL [SI] MOVr[], ( CX -> strlen )
SI INCx, ( first char ) AX AX XORxx, ( initial prev )
BEGIN, ( loop )
DI AX SUBxx, ( jump to prev wordref )
AL [DI] -1 MOVr[]+, ( strlen )
CL AL CMPrr, IFZ, ( same len )
SI PUSHx, DI PUSHx, CX PUSHx, ( --> lvl 3 )
3 ADDALi, ( header ) AH AH XORrr, DI AX SUBxx,
CLD, REPZ, CMPSB,
CX POPx, DI POPx, SI POPx, ( <-- lvl 3 )
IFZ, RETn, THEN,
THEN,

View File

@ -1,5 +0,0 @@
( find cont. )
DI 3 SUBxi, AX [DI] MOVx[], ( prev )
AX AX ORxx,
JNZ, AGAIN, ( loop )
SI DECx, ( start of string, and NZ ) RETn,

21
blk/828
View File

@ -1,9 +1,16 @@
CODE _find ( cur w -- a f )
SI POPx, ( w ) DI POPx, ( cur )
CALLn, lblfind @ RPCn,
IFNZ, ( not found )
SI PUSHx, AX AX XORxx, AX PUSHx,
JMPn, lblnext @ RPCn,
THEN, ( found )
DI PUSHx, AX 1 MOVxI, AX PUSHx,
;CODE
CH CH XORrr, CL [SI] MOVr[], ( CX -> strlen )
SI INCx, ( first char ) AX AX XORxx, ( initial prev )
BEGIN, ( loop )
DI AX SUBxx, ( jump to prev wordref )
AL [DI] -1 MOVr[]+, ( strlen )
CL AL CMPrr, IFZ, ( same len )
SI PUSHx, DI PUSHx, CX PUSHx, ( --> lvl 3 )
3 ADDALi, ( header ) AH AH XORrr, DI AX SUBxx,
CLD, REPZ, CMPSB,
CX POPx, DI POPx, SI POPx, ( <-- lvl 3 )
IFZ, DI PUSHx, AX 1 MOVxI, AX PUSHx,
JMPn, lblnext @ RPCn, THEN,
THEN,
DI 3 SUBxi, AX [DI] MOVx[], ( prev ) AX AX ORxx, ( cont. )

View File

@ -1,3 +1,6 @@
( cont. find ) JNZ, AGAIN, ( loop )
SI DECx, SI PUSHx, AX AX XORrr, AX PUSHx,
;CODE
CODE 0 AX AX XORxx, AX PUSHx, ;CODE
CODE 1 AX 1 MOVxI, AX PUSHx, ;CODE
CODE -1 AX -1 MOVxI, AX PUSHx, ;CODE