forth: add word 'ABORT"'

This commit is contained in:
Virgil Dupras 2020-03-17 15:30:57 -04:00
parent 25b6e75cf7
commit 3a70dff53d
2 changed files with 22 additions and 1 deletions

View File

@ -165,9 +165,28 @@ abortUnderflow:
.msg: .msg:
.db "stack underflow", 0 .db "stack underflow", 0
.db "ABORT", '"'
.fill 1
.dw ABORT
.db 1 ; IMMEDIATE
ABORTI:
.dw compiledWord
.dw PRINTI
.dw .private
.dw EXIT
.db 0b10 ; UNWORD
.private:
.dw nativeWord
ld hl, (HERE)
ld de, ABORT
call DEinHL
ld (HERE), hl
jp next
.db "BYE" .db "BYE"
.fill 4 .fill 4
.dw ABORT .dw ABORTI
.db 0 .db 0
BYE: BYE:
.dw nativeWord .dw nativeWord

View File

@ -73,6 +73,8 @@ input stream is executed immediately. In this context, branching doesn't work.
atom's cell. atom's cell.
(bbr) -- Branches backward by the number specified in its (bbr) -- Branches backward by the number specified in its
atom's cell. atom's cell.
ABORT -- Resets PS and RS and returns to interpreter
ABORT" x" -- *I* Compiles a ." followed by a ABORT.
AGAIN I:a -- *I* Jump backwards to preceeding BEGIN. AGAIN I:a -- *I* Jump backwards to preceeding BEGIN.
BEGIN -- I:a *I* Marker for backward branching with AGAIN. BEGIN -- I:a *I* Marker for backward branching with AGAIN.
ELSE I:a -- *I* Compiles a (fbr) and set branching cell at a. ELSE I:a -- *I* Compiles a (fbr) and set branching cell at a.