Add word ERR

This commit is contained in:
Virgil Dupras 2020-05-14 11:57:26 -04:00
parent 303b34b483
commit 8a58449776
5 changed files with 6 additions and 3 deletions

View File

@ -12,4 +12,5 @@ have to consume it to avoid PSP leak.
] -- End interpretative mode.
ABORT -- Resets PS and RS and returns to interpreter.
ABORT" x" -- *I* Compiles a ." followed by a ABORT.
EXECUTE a -- Execute wordref at addr a
ERR a -- Prints a and ABORT. Defined early and used by
drivers. (cont.)

View File

@ -1,3 +1,4 @@
EXECUTE a -- Execute wordref at addr a
INTERPRET -- Get a line from stdin, compile it in tmp memory,
then execute the compiled contents.
LEAVE -- In a DO..LOOP, exit at the next LOOP call.

View File

@ -1,4 +1,5 @@
: ABORT (resSP) QUIT ;
: ERR LIT< (print) (find) IF EXECUTE THEN ABORT ;
: = CMP NOT ; : < CMP -1 = ; : > CMP 1 = ;
: 0< 32767 > ; : >= < NOT ; : <= > NOT ; : 0>= 0< NOT ;
( n l h -- f )

View File

@ -12,5 +12,5 @@
: CRLF CR LF ; : SPC 32 EMIT ;
: NL 0x0a RAM+ @ ( NLPTR ) DUP IF EXECUTE ELSE DROP CRLF THEN ;
: (ok) SPC LIT" ok" (print) NL ;
: (uflw) LIT" stack underflow" (print) ABORT ;
: (wnf) (print) SPC LIT" word not found" (print) ABORT ;
: (uflw) LIT" stack underflow" ERR ;
: (wnf) (print) SPC LIT" word not found" ERR ;

Binary file not shown.