diff --git a/apps/forth/dict.asm b/apps/forth/dict.asm index 2af2fcb..581b9d2 100644 --- a/apps/forth/dict.asm +++ b/apps/forth/dict.asm @@ -453,25 +453,22 @@ LITS: .fill 6 .dw LITS .db 0 -APOS: +FIND: .dw nativeWord call readword call find - jr nz, .notfound + jr z, .found + ; not found + ld de, 0 +.found: push de jp next -.notfound: - ld hl, .msg - call printstr - jp abort -.msg: - .db "word not found", 0 .db "[']" .fill 4 - .dw APOS + .dw FIND .db 0b01 ; IMMEDIATE -APOSI: +FINDI: .dw nativeWord call readword call find @@ -494,7 +491,7 @@ APOSI: ; ( -- c ) .db "KEY" .fill 4 - .dw APOSI + .dw FINDI .db 0 KEY: .dw nativeWord diff --git a/apps/forth/dictionary.txt b/apps/forth/dictionary.txt index 17db2dd..a556349 100644 --- a/apps/forth/dictionary.txt +++ b/apps/forth/dictionary.txt @@ -35,9 +35,9 @@ directly, but as part of another word. : x ... -- Define a new word ; R:I -- Exit a colon definition , n -- Write n in HERE and advance it. -' x -- a Push addr of word x to a. +' x -- a Push addr of word x to a. If not found, push 0 ['] x -- *I* Like "'", but spits the addr as a number - literal. + literal. If not found, aborts. ( -- *I* Comment. Ignore rest of line until ")" is read. ALLOT n -- Move HERE by n bytes C, b -- Write byte b in HERE and advance it.