diff --git a/blk/037 b/blk/037 index 243ad52..7b689ac 100644 --- a/blk/037 +++ b/blk/037 @@ -12,5 +12,5 @@ ALLOT n -- Move HERE by n bytes C, b -- Write byte b in HERE and advance it. DELW a -- Delete wordref at a. If it shadows another definition, that definition is unshadowed. -FORGET x -- Rewind the dictionary (both CURRENT and HERE) - up to x's previous entry. (cont.) +EMPTY -- Rewind HERE and CURRENT where they were at + system initialization. (cont.) diff --git a/blk/038 b/blk/038 index 22e0144..3320f91 100644 --- a/blk/038 +++ b/blk/038 @@ -1,5 +1,6 @@ (cont.) -PREV a -- a Return a wordref's previous entry. -WHLEN a -- n Get word header length from - wordref. That is, name length + 3. - a is a wordref +FORGET x -- Rewind the dictionary (both CURRENT and HERE) + up to x's previous entry. +PREV a -- a Return a wordref's previous entry. +WHLEN a -- n Get word header length from wordref. That is, + name length + 3. a is a wordref diff --git a/emul/forth/run.fs b/emul/forth/run.fs index b5dc796..2e6916e 100644 --- a/emul/forth/run.fs +++ b/emul/forth/run.fs @@ -11,5 +11,6 @@ ['] EFS@ BLK@* ! RDLN$ Z80A$ + LIT< _sys [entry] INTERPRET ; diff --git a/emul/forth/z80c.bin b/emul/forth/z80c.bin index 543f472..3f44d69 100644 Binary files a/emul/forth/z80c.bin and b/emul/forth/z80c.bin differ diff --git a/forth/core.fs b/forth/core.fs index bdf4012..8c87021 100644 --- a/forth/core.fs +++ b/forth/core.fs @@ -144,3 +144,8 @@ DUP WHLEN - HERE ! ( w ) PREV CURRENT ! ; + +: EMPTY + LIT< _sys (find) NOT IF ABORT THEN + DUP HERE ! CURRENT ! +; diff --git a/forth/icore.fs b/forth/icore.fs index efb1622..58872e2 100644 --- a/forth/icore.fs +++ b/forth/icore.fs @@ -146,10 +146,9 @@ AGAIN ; -: (entry) - HERE @ ( h ) - WORD ( h s ) - SCPY ( h ) +: [entry] + HERE @ ( w h ) + SWAP SCPY ( h ) ( Adjust HERE -1 because SCPY copies the null ) HERE @ 1 - ( h h' ) DUP HERE ! ( h h' ) @@ -161,6 +160,8 @@ HERE @ CURRENT ! ; +: (entry) WORD [entry] ; + : INTERPRET BEGIN WORD