diff --git a/emul/forth/boot.bin b/emul/forth/boot.bin index 879248d..bb5b52c 100644 Binary files a/emul/forth/boot.bin and b/emul/forth/boot.bin differ diff --git a/emul/forth/z80c.bin b/emul/forth/z80c.bin index 46520bb..66265d0 100644 Binary files a/emul/forth/z80c.bin and b/emul/forth/z80c.bin differ diff --git a/forth/boot.fs b/forth/boot.fs index 34db9b1..795a8cf 100644 --- a/forth/boot.fs +++ b/forth/boot.fs @@ -123,14 +123,16 @@ PC ORG @ 1 + ! ( main ) 0x08 LDHL(nn), RAMSTART 0x02 + LD(nn)HL, ( RAM+02 == CURRENT ) RAMSTART 0x04 + LD(nn)HL, ( RAM+04 == HERE ) + EXDEHL, HL L1 @ LDddnn, 0x03 CALLnn, ( 03 == find ) DE PUSHqq, L2 @ 2 + JPnn, PC ORG @ 4 + ! ( find ) -( Find the entry corresponding to word where (HL) points to - and sets DE to point to that entry. Z if found, NZ if not. +( Find the entry corresponding to word name where (HL) points + to in dictionary having its tip at DE and sets DE to point + to that entry. Z if found, NZ if not. ) BC PUSHqq, @@ -154,7 +156,6 @@ PC ORG @ 4 + ! ( find ) adjust. Because the compare loop pre-decrements, instead of DECing HL twice, we DEC it once. ) HL DECss, - DE RAMSTART 0x02 + LDdd(nn), ( RAM+02 == CURRENT ) L3 BSET ( inner ) ( DE is a wordref, first step, do our len correspond? ) HL PUSHqq, ( --> lvl 1 ) @@ -241,6 +242,7 @@ PC ORG @ 0x15 + ! ( popRS ) '(' A, 'u' A, 'f' A, 'l' A, 'w' A, ')' A, 0 A, L1 BSET ( abortUnderflow ) HL PC 7 - LDddnn, + DE RAMSTART 0x02 + LDdd(nn), ( RAM+02 == CURRENT ) 0x03 CALLnn, ( find ) DE PUSHqq, L2 @ 2 + JPnn, ( EXECUTE, skip nativeWord ) @@ -366,7 +368,7 @@ PC ORG @ 0x22 + ! ( litWord ) JPNEXT, ( filler ) -NOP, NOP, NOP, NOP, NOP, NOP, +NOP, NOP, NOP, NOP, NOP, ( DICT HOOK ) ( This dummy dictionary entry serves two purposes: diff --git a/forth/icore.fs b/forth/icore.fs index ff15d27..e445dd1 100644 --- a/forth/icore.fs +++ b/forth/icore.fs @@ -37,6 +37,9 @@ : HERE 0x04 RAM+ ; : CURRENT 0x02 RAM+ ; +( w -- a f ) +: (find) CURRENT @ SWAP _find ; + : QUIT 0 FLAGS ! (resRS) LIT< INTERPRET (find) DROP EXECUTE diff --git a/forth/z80c.fs b/forth/z80c.fs index d2091ec..82dcf86 100644 --- a/forth/z80c.fs +++ b/forth/z80c.fs @@ -354,8 +354,10 @@ CODE CMP BC PUSHqq, ;CODE -CODE (find) - HL POPqq, +( cur w -- a f ) +CODE _find + HL POPqq, ( w ) + DE POPqq, ( cur ) chkPS, ( 3 == find ) 3 CALLnn,