mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-27 09:58:06 +11:00
z80: inline lblfind's routine into _find word
This commit is contained in:
parent
b9fb6a6226
commit
6fab30b164
2
blk/282
2
blk/282
@ -1 +1 @@
|
||||
VARIABLE lblofl VARIABLE lblexec VARIABLE lblfind
|
||||
VARIABLE lblofl VARIABLE lblexec
|
||||
|
12
blk/291
12
blk/291
@ -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 )
|
||||
A (HL) LDrr, A ORr,
|
||||
( 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*.
|
||||
Because of our dict structure and because we know our
|
||||
lengths, it's easier to compare starting from the end. )
|
||||
|
6
blk/292
6
blk/292
@ -1,7 +1,7 @@
|
||||
BEGIN, ( inner )
|
||||
BEGIN, ( loop )
|
||||
( 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,
|
||||
LDA(DE),
|
||||
0x7f ANDi, ( remove IMMEDIATE flag )
|
||||
|
13
blk/294
13
blk/294
@ -1,16 +1,15 @@
|
||||
( At this point, Z is set if we have a match. In all cases,
|
||||
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 )
|
||||
HL PUSH, ( --> lvl 1 )
|
||||
DE DECd, DE DECd, DE DECd, ( prev field )
|
||||
DE PUSH, ( --> lvl 2 )
|
||||
DE PUSH, ( --> lvl 3 )
|
||||
EXDEHL,
|
||||
LDDE(HL),
|
||||
|
||||
|
||||
|
||||
|
||||
( cont. )
|
||||
|
17
blk/295
17
blk/295
@ -1,16 +1,13 @@
|
||||
( 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 )
|
||||
( carry cleared from "or e" )
|
||||
DE SBCHLd,
|
||||
EXDEHL, ( result in DE )
|
||||
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
|
||||
|
6
blk/296
6
blk/296
@ -1,6 +0,0 @@
|
||||
THEN, ( zero length check, B291 )
|
||||
A XORr,
|
||||
A INCr,
|
||||
L2 FSET ( end )
|
||||
HL POP,
|
||||
RET,
|
4
blk/297
4
blk/297
@ -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 )
|
||||
PC ORG @ 0x3d + ! ( stable ABI JP )
|
||||
E 0 IY+ LDrIXY, D 1 IY+ LDrIXY,
|
||||
|
Loading…
Reference in New Issue
Block a user