1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-12-28 08:18:05 +11:00

forth: make "'" push 0 when not finding a word

This commit is contained in:
Virgil Dupras 2020-03-17 15:54:17 -04:00
parent 3a70dff53d
commit d91af99fde
2 changed files with 10 additions and 13 deletions

View File

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

View File

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