diff --git a/emul/forth/boot.bin b/emul/forth/boot.bin index 13921e3..3d6d116 100644 Binary files a/emul/forth/boot.bin and b/emul/forth/boot.bin differ diff --git a/emul/forth/z80c.bin b/emul/forth/z80c.bin index d5b0fe7..1cfc35a 100644 Binary files a/emul/forth/z80c.bin and b/emul/forth/z80c.bin differ diff --git a/forth/boot.fs b/forth/boot.fs index e792357..49e57ba 100644 --- a/forth/boot.fs +++ b/forth/boot.fs @@ -30,10 +30,10 @@ NOP, NOP, ( 26, unused ) 0 JPnn, ( 28, flagsToBC ) 0 JPnn, ( 2b, doesWord ) NOP, NOP, ( 2e, unused ) -RAMSTART 0x51 + JPnn, ( RST 30 ) +RAMSTART 0x4e + JPnn, ( RST 30 ) NOP, NOP, NOP, ( unused ) NOP, NOP, ( unused ) -RAMSTART 0x51 + JPnn, ( RST 38 ) +RAMSTART 0x4e + JPnn, ( RST 38 ) NOP, ( unused ) ( BOOT DICT diff --git a/forth/core.fs b/forth/core.fs index a587790..67d3f2e 100644 --- a/forth/core.fs +++ b/forth/core.fs @@ -5,8 +5,10 @@ : LIT 34 , ; : LITS LIT SCPY ; : LIT< WORD LITS ; IMMEDIATE -: _err LIT< word-not-found (print) ABORT ; -: ' WORD (find) NOT (?br) [ 4 , ] _err ; +: ' + WORD (find) (?br) [ 4 , ] EXIT + LIT< (wnf) (find) DROP EXECUTE +; : ['] ' LITN ; IMMEDIATE : COMPILE ' LITN ['] , , ; IMMEDIATE : [COMPILE] ' , ; IMMEDIATE @@ -117,6 +119,16 @@ own address ) 46 RAM+ DUP 2 + SWAP ! +: (print) + BEGIN + DUP C@ ( a c ) + ( exit if null ) + DUP NOT IF 2DROP EXIT THEN + EMIT ( a ) + 1 + ( a+1 ) + AGAIN +; + : ." LIT BEGIN @@ -129,3 +141,6 @@ ; IMMEDIATE : ABORT" [COMPILE] ." COMPILE ABORT ; IMMEDIATE + +: (uflw) ABORT" stack underflow" ; +: (wnf) ABORT" word not found" ; diff --git a/forth/icore.fs b/forth/icore.fs index 9aff774..9299a36 100644 --- a/forth/icore.fs +++ b/forth/icore.fs @@ -114,22 +114,6 @@ _c (parsed) _c NOT IF _c ABORT THEN ; -( a -- ) -: (print) - BEGIN - _c DUP ( a a ) - _c C@ ( a c ) - ( exit if null ) - _c DUP _c NOT IF _c 2DROP EXIT THEN - _c EMIT ( a ) - 1 _c + ( a+1 ) - AGAIN -; - -: (uflw) - LIT< stack-underflow _c (print) _c ABORT -; - : C< ( 0c == CINPTR ) 0x0c _c RAM+ _c @ EXECUTE