mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-27 11:18:05 +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
|
( Native words )
|
||||||
( Find the entry corresponding to word name where (HL) points
|
H@ 4 + XCURRENT ! ( make next CODE have 0 prev field )
|
||||||
to in dictionary having its tip at DE and sets DE to point
|
CODE _find ( cur w -- a f )
|
||||||
to that entry. Z if found, NZ if not. )
|
HL POP, ( w ) DE POP, ( cur ) chkPS,
|
||||||
HL PUSH,
|
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. )
|
||||||
|
6
blk/292
6
blk/292
@ -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 )
|
HL PUSH, ( --> lvl 2 )
|
||||||
DE 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 )
|
||||||
|
13
blk/294
13
blk/294
@ -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 )
|
DE POP, ( <-- lvl 3 )
|
||||||
HL POP, ( <-- lvl 1 )
|
IFZ, ( match, we're done! )
|
||||||
JRZ, L2 FWR ( end-B296, 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. )
|
||||||
|
17
blk/295
17
blk/295
@ -1,16 +1,13 @@
|
|||||||
( DE contains prev offset )
|
( DE contains prev offset )
|
||||||
HL POP, ( <-- lvl 2 )
|
HL POP, ( <-- lvl 3, prev field )
|
||||||
( HL is prev field's addr. Is offset zero? )
|
DEZ, IFNZ, ( offset not zero )
|
||||||
DEZ,
|
|
||||||
IFNZ,
|
|
||||||
( 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 )
|
HL POP, ( <-- lvl 2 )
|
||||||
JRNZ, AGAIN, ( inner-B292, try to match again )
|
JRNZ, AGAIN, ( loop-B292, try to match again )
|
||||||
( Z set? end of dict, unset Z )
|
( Z set? end of dict, not found. "w" already on PSP TOS )
|
||||||
|
PUSH0,
|
||||||
|
;CODE
|
||||||
( cont. )
|
|
||||||
|
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 )
|
CODE (br)
|
||||||
H@ 4 + XCURRENT ! ( make next CODE have 0 prev field )
|
|
||||||
CODE (br) ( TODO: move with other native words )
|
|
||||||
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,
|
||||||
|
Loading…
Reference in New Issue
Block a user