Browse Source

z80: protect BC in _find

In preparation for the IY->BC move
master
Virgil Dupras 3 years ago
parent
commit
a6e987b5f7
4 changed files with 10 additions and 8 deletions
  1. +1
    -0
      blk/291
  2. +2
    -2
      blk/292
  3. +4
    -4
      blk/294
  4. +3
    -2
      blk/295

+ 1
- 0
blk/291 View File

@@ -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. )


+ 2
- 2
blk/292 View File

@@ -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 )
DE PUSH, ( --> lvl 3 )
HL 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 )


+ 4
- 4
blk/294 View File

@@ -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,
JPNEXT,
HL POP, BC POP, HL POP, ( <-- lvl 1-3 ) DE PUSH,
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),




+ 3
- 2
blk/295 View File

@@ -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…
Cancel
Save