mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-23 16:38:06 +11:00
z80: protect BC in _find
In preparation for the IY->BC move
This commit is contained in:
parent
6fab30b164
commit
a6e987b5f7
1
blk/291
1
blk/291
@ -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. )
|
||||
|
4
blk/292
4
blk/292
@ -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 )
|
||||
|
8
blk/294
8
blk/294
@ -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),
|
||||
|
||||
|
5
blk/295
5
blk/295
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user