@@ -1 +1 @@ | |||||
VARIABLE lblofl VARIABLE lblexec VARIABLE lblfind | |||||
VARIABLE lblofl VARIABLE lblexec |
@@ -1,12 +1,12 @@ | |||||
lblfind BSET | |||||
( Find the entry corresponding to word name where (HL) points | |||||
to in dictionary having its tip at DE and sets DE to point | |||||
to that entry. Z if found, NZ if not. ) | |||||
HL PUSH, | |||||
( Native words ) | |||||
H@ 4 + XCURRENT ! ( make next CODE have 0 prev field ) | |||||
CODE _find ( cur w -- a f ) | |||||
HL POP, ( w ) DE POP, ( cur ) chkPS, | |||||
HL PUSH, ( --> lvl 1 ) | |||||
( First, figure out string len ) | ( First, figure out string len ) | ||||
A (HL) LDrr, A ORr, | A (HL) LDrr, A ORr, | ||||
( special case. zero len? we never find anything. ) | ( special case. zero len? we never find anything. ) | ||||
IFNZ, ( fail-B296 ) | |||||
IFZ, PUSH0, JPNEXT, THEN, | |||||
( Let's do something weird: We'll hold HL by the *tail*. | ( Let's do something weird: We'll hold HL by the *tail*. | ||||
Because of our dict structure and because we know our | Because of our dict structure and because we know our | ||||
lengths, it's easier to compare starting from the end. ) | lengths, it's easier to compare starting from the end. ) | ||||
@@ -1,7 +1,7 @@ | |||||
BEGIN, ( inner ) | |||||
BEGIN, ( loop ) | |||||
( DE is a wordref, first step, do our len correspond? ) | ( DE is a wordref, first step, do our len correspond? ) | ||||
HL PUSH, ( --> lvl 1 ) | |||||
DE PUSH, ( --> lvl 2 ) | |||||
HL PUSH, ( --> lvl 2 ) | |||||
DE PUSH, ( --> lvl 3 ) | |||||
DE DECd, | DE DECd, | ||||
LDA(DE), | LDA(DE), | ||||
0x7f ANDi, ( remove IMMEDIATE flag ) | 0x7f ANDi, ( remove IMMEDIATE flag ) | ||||
@@ -1,16 +1,15 @@ | |||||
( At this point, Z is set if we have a match. In all cases, | ( At this point, Z is set if we have a match. In all cases, | ||||
we want to pop HL and DE ) | we want to pop HL and DE ) | ||||
DE POP, ( <-- lvl 2 ) | |||||
HL POP, ( <-- lvl 1 ) | |||||
JRZ, L2 FWR ( end-B296, match? we're done! ) | |||||
DE POP, ( <-- lvl 3 ) | |||||
IFZ, ( match, we're done! ) | |||||
HL POP, HL POP, ( <-- lvl 1-2 ) DE PUSH, PUSH1, | |||||
JPNEXT, | |||||
THEN, | |||||
( no match, go to prev and continue ) | ( no match, go to prev and continue ) | ||||
HL PUSH, ( --> lvl 1 ) | |||||
DE DECd, DE DECd, DE DECd, ( prev field ) | DE DECd, DE DECd, DE DECd, ( prev field ) | ||||
DE PUSH, ( --> lvl 2 ) | |||||
DE PUSH, ( --> lvl 3 ) | |||||
EXDEHL, | EXDEHL, | ||||
LDDE(HL), | LDDE(HL), | ||||
( cont. ) | ( cont. ) |
@@ -1,16 +1,13 @@ | |||||
( DE contains prev offset ) | ( DE contains prev offset ) | ||||
HL POP, ( <-- lvl 2 ) | |||||
( HL is prev field's addr. Is offset zero? ) | |||||
DEZ, | |||||
IFNZ, | |||||
HL POP, ( <-- lvl 3, prev field ) | |||||
DEZ, IFNZ, ( offset not zero ) | |||||
( get absolute addr from offset ) | ( get absolute addr from offset ) | ||||
( carry cleared from "or e" ) | ( carry cleared from "or e" ) | ||||
DE SBCHLd, | DE SBCHLd, | ||||
EXDEHL, ( result in DE ) | EXDEHL, ( result in DE ) | ||||
THEN, | THEN, | ||||
HL POP, ( <-- lvl 1 ) | |||||
JRNZ, AGAIN, ( inner-B292, try to match again ) | |||||
( Z set? end of dict, unset Z ) | |||||
( cont. ) | |||||
HL POP, ( <-- lvl 2 ) | |||||
JRNZ, AGAIN, ( loop-B292, try to match again ) | |||||
( Z set? end of dict, not found. "w" already on PSP TOS ) | |||||
PUSH0, | |||||
;CODE |
@@ -1,6 +0,0 @@ | |||||
THEN, ( zero length check, B291 ) | |||||
A XORr, | |||||
A INCr, | |||||
L2 FSET ( end ) | |||||
HL POP, | |||||
RET, |
@@ -1,6 +1,4 @@ | |||||
( Native words ) | |||||
H@ 4 + XCURRENT ! ( make next CODE have 0 prev field ) | |||||
CODE (br) ( TODO: move with other native words ) | |||||
CODE (br) | |||||
L1 BSET ( used in ?br and loop ) | L1 BSET ( used in ?br and loop ) | ||||
PC ORG @ 0x3d + ! ( stable ABI JP ) | PC ORG @ 0x3d + ! ( stable ABI JP ) | ||||
E 0 IY+ LDrIXY, D 1 IY+ LDrIXY, | E 0 IY+ LDrIXY, D 1 IY+ LDrIXY, | ||||
@@ -1,15 +0,0 @@ | |||||
CODE _find ( cur w -- a f ) | |||||
HL POP, ( w ) | |||||
DE POP, ( cur ) | |||||
chkPS, | |||||
lblfind @ CALL, | |||||
IFNZ, | |||||
( not found ) | |||||
HL PUSH, | |||||
PUSH0, | |||||
JPNEXT, | |||||
THEN, | |||||
( found ) | |||||
DE PUSH, | |||||
PUSH1, | |||||
;CODE |