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

z80: protect BC in _find

In preparation for the IY->BC move
This commit is contained in:
Virgil Dupras 2020-07-05 22:43:32 -04:00
parent 6fab30b164
commit a6e987b5f7
4 changed files with 10 additions and 8 deletions

View File

@ -7,6 +7,7 @@ CODE _find ( cur w -- a f )
A (HL) LDrr, A ORr,
( special case. zero len? we never find anything. )
IFZ, PUSH0, JPNEXT, THEN,
BC PUSH, ( --> lvl 2, protect )
( 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. )

View File

@ -1,7 +1,7 @@
BEGIN, ( loop )
( DE is a wordref, first step, do our len correspond? )
HL PUSH, ( --> lvl 2 )
DE PUSH, ( --> lvl 3 )
HL PUSH, ( --> lvl 3 )
DE PUSH, ( --> lvl 4 )
DE DECd,
LDA(DE),
0x7f ANDi, ( remove IMMEDIATE flag )

View File

@ -1,13 +1,13 @@
( At this point, Z is set if we have a match. In all cases,
we want to pop HL and DE )
DE POP, ( <-- lvl 3 )
DE POP, ( <-- lvl 4 )
IFZ, ( match, we're done! )
HL POP, HL POP, ( <-- lvl 1-2 ) DE PUSH, PUSH1,
JPNEXT,
HL POP, BC POP, HL POP, ( <-- lvl 1-3 ) DE PUSH,
PUSH1, JPNEXT,
THEN,
( no match, go to prev and continue )
DE DECd, DE DECd, DE DECd, ( prev field )
DE PUSH, ( --> lvl 3 )
DE PUSH, ( --> lvl 4 )
EXDEHL,
LDDE(HL),

View File

@ -1,13 +1,14 @@
( DE contains prev offset )
HL POP, ( <-- lvl 3, prev field )
HL POP, ( <-- lvl 4, 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 2 )
HL POP, ( <-- lvl 3 )
JRNZ, AGAIN, ( loop-B292, try to match again )
BC POP, ( <-- lvl 2 )
( Z set? end of dict, not found. "w" already on PSP TOS )
PUSH0,
;CODE