mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-27 14:48:06 +11:00
Extract EMIT-dependent routines from core
This commit is contained in:
parent
d013c572ad
commit
41cefb7460
@ -1,6 +1,6 @@
|
|||||||
TARGETS = runbin/runbin forth/forth
|
TARGETS = runbin/runbin forth/forth
|
||||||
# Those Forth source files are in a particular order
|
# Those Forth source files are in a particular order
|
||||||
FORTHSRCS = core.fs str.fs parse.fs readln.fs fmt.fs z80a.fs
|
FORTHSRCS = core.fs print.fs str.fs parse.fs readln.fs fmt.fs z80a.fs
|
||||||
FORTHSRC_PATHS = ${FORTHSRCS:%=../forth/%} forth/run.fs
|
FORTHSRC_PATHS = ${FORTHSRCS:%=../forth/%} forth/run.fs
|
||||||
OBJS = emul.o libz80/libz80.o
|
OBJS = emul.o libz80/libz80.o
|
||||||
SLATEST = ../tools/slatest
|
SLATEST = ../tools/slatest
|
||||||
|
@ -118,29 +118,3 @@
|
|||||||
( Set up initial SYSVNXT value, which is 2 bytes after its
|
( Set up initial SYSVNXT value, which is 2 bytes after its
|
||||||
own address )
|
own address )
|
||||||
46 RAM+ DUP 2 + SWAP !
|
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
|
|
||||||
C< DUP ( c c )
|
|
||||||
( 34 is ASCII for " )
|
|
||||||
DUP 34 = IF DROP DROP 0 0 THEN
|
|
||||||
C,
|
|
||||||
0 = UNTIL
|
|
||||||
COMPILE (print)
|
|
||||||
; IMMEDIATE
|
|
||||||
|
|
||||||
: ABORT" [COMPILE] ." COMPILE ABORT ; IMMEDIATE
|
|
||||||
|
|
||||||
: (uflw) ABORT" stack underflow" ;
|
|
||||||
: (wnf) ABORT" word not found" ;
|
|
||||||
|
30
forth/print.fs
Normal file
30
forth/print.fs
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
( Words allowing printing strings. Require core )
|
||||||
|
( This used to be in core, but some drivers providing EMIT
|
||||||
|
are much much easier to write with access to core words,
|
||||||
|
and these words below need EMIT... )
|
||||||
|
|
||||||
|
: (print)
|
||||||
|
BEGIN
|
||||||
|
DUP C@ ( a c )
|
||||||
|
( exit if null )
|
||||||
|
DUP NOT IF 2DROP EXIT THEN
|
||||||
|
EMIT ( a )
|
||||||
|
1 + ( a+1 )
|
||||||
|
AGAIN
|
||||||
|
;
|
||||||
|
|
||||||
|
: ."
|
||||||
|
LIT
|
||||||
|
BEGIN
|
||||||
|
C< DUP ( c c )
|
||||||
|
( 34 is ASCII for " )
|
||||||
|
DUP 34 = IF DROP DROP 0 0 THEN
|
||||||
|
C,
|
||||||
|
0 = UNTIL
|
||||||
|
COMPILE (print)
|
||||||
|
; IMMEDIATE
|
||||||
|
|
||||||
|
: ABORT" [COMPILE] ." COMPILE ABORT ; IMMEDIATE
|
||||||
|
|
||||||
|
: (uflw) ABORT" stack underflow" ;
|
||||||
|
: (wnf) ABORT" word not found" ;
|
Loading…
Reference in New Issue
Block a user