mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-27 12:08:07 +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,
|
A (HL) LDrr, A ORr,
|
||||||
( special case. zero len? we never find anything. )
|
( special case. zero len? we never find anything. )
|
||||||
IFZ, PUSH0, JPNEXT, THEN,
|
IFZ, PUSH0, JPNEXT, THEN,
|
||||||
|
BC PUSH, ( --> lvl 2, protect )
|
||||||
( 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. )
|
||||||
|
4
blk/292
4
blk/292
@ -1,7 +1,7 @@
|
|||||||
BEGIN, ( loop )
|
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 2 )
|
HL PUSH, ( --> lvl 3 )
|
||||||
DE PUSH, ( --> lvl 3 )
|
DE PUSH, ( --> lvl 4 )
|
||||||
DE DECd,
|
DE DECd,
|
||||||
LDA(DE),
|
LDA(DE),
|
||||||
0x7f ANDi, ( remove IMMEDIATE flag )
|
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,
|
( 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 3 )
|
DE POP, ( <-- lvl 4 )
|
||||||
IFZ, ( match, we're done! )
|
IFZ, ( match, we're done! )
|
||||||
HL POP, HL POP, ( <-- lvl 1-2 ) DE PUSH, PUSH1,
|
HL POP, BC POP, HL POP, ( <-- lvl 1-3 ) DE PUSH,
|
||||||
JPNEXT,
|
PUSH1, JPNEXT,
|
||||||
THEN,
|
THEN,
|
||||||
( no match, go to prev and continue )
|
( no match, go to prev and continue )
|
||||||
DE DECd, DE DECd, DE DECd, ( prev field )
|
DE DECd, DE DECd, DE DECd, ( prev field )
|
||||||
DE PUSH, ( --> lvl 3 )
|
DE PUSH, ( --> lvl 4 )
|
||||||
EXDEHL,
|
EXDEHL,
|
||||||
LDDE(HL),
|
LDDE(HL),
|
||||||
|
|
||||||
|
5
blk/295
5
blk/295
@ -1,13 +1,14 @@
|
|||||||
( DE contains prev offset )
|
( DE contains prev offset )
|
||||||
HL POP, ( <-- lvl 3, prev field )
|
HL POP, ( <-- lvl 4, prev field )
|
||||||
DEZ, IFNZ, ( offset not zero )
|
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 2 )
|
HL POP, ( <-- lvl 3 )
|
||||||
JRNZ, AGAIN, ( loop-B292, try to match again )
|
JRNZ, AGAIN, ( loop-B292, try to match again )
|
||||||
|
BC POP, ( <-- lvl 2 )
|
||||||
( Z set? end of dict, not found. "w" already on PSP TOS )
|
( Z set? end of dict, not found. "w" already on PSP TOS )
|
||||||
PUSH0,
|
PUSH0,
|
||||||
;CODE
|
;CODE
|
||||||
|
Loading…
Reference in New Issue
Block a user