mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-02 16:30:57 +11:00
Compare commits
No commits in common. "2af959a13dc543d0fc6efec7962e478a5f8e63d1" and "80891d7ec172bc22e5dc7594b1b87dbdea92ffdb" have entirely different histories.
2af959a13d
...
80891d7ec1
@ -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 print.fs str.fs parse.fs readln.fs fmt.fs z80a.fs
|
FORTHSRCS = core.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
|
||||||
|
Binary file not shown.
@ -118,3 +118,29 @@
|
|||||||
( 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" ;
|
||||||
|
@ -53,11 +53,7 @@
|
|||||||
' ( get word )
|
' ( get word )
|
||||||
-^ ( apply offset )
|
-^ ( apply offset )
|
||||||
, ( write! )
|
, ( write! )
|
||||||
;
|
; IMMEDIATE
|
||||||
( We can't use IMMEDIATE because the one we've just compiled
|
|
||||||
in z80c target's the *target*'s RAM addr, not the host's.
|
|
||||||
manually set namelen field. )
|
|
||||||
0x82 CURRENT @ 1 - C!
|
|
||||||
|
|
||||||
: RAM+
|
: RAM+
|
||||||
[ RAMSTART LITN ] _c +
|
[ RAMSTART LITN ] _c +
|
||||||
@ -223,10 +219,7 @@
|
|||||||
|
|
||||||
( : and ; have to be defined last because it can't be
|
( : and ; have to be defined last because it can't be
|
||||||
executed now also, they can't have their real name
|
executed now also, they can't have their real name
|
||||||
right away. We also can't use IMMEDIATE because the offset
|
right away )
|
||||||
used for CURRENT is the *target*'s RAM offset. we're still
|
|
||||||
on the host.
|
|
||||||
)
|
|
||||||
|
|
||||||
: X
|
: X
|
||||||
_c (entry)
|
_c (entry)
|
||||||
@ -242,17 +235,15 @@
|
|||||||
( maybe number )
|
( maybe number )
|
||||||
ELSE _c (parse*) _c @ EXECUTE _c LITN THEN
|
ELSE _c (parse*) _c @ EXECUTE _c LITN THEN
|
||||||
AGAIN
|
AGAIN
|
||||||
;
|
; IMMEDIATE
|
||||||
|
|
||||||
: Y
|
: Y
|
||||||
['] EXIT _c ,
|
['] EXIT _c ,
|
||||||
_c R> _c DROP ( exit : )
|
_c R> _c DROP ( exit : )
|
||||||
;
|
; IMMEDIATE
|
||||||
|
|
||||||
( Give ":" and ";" their real name and make them IMMEDIATE )
|
( Give ":" and ";" their real name )
|
||||||
0x81 ' X 1 - C!
|
|
||||||
':' ' X 4 - C!
|
':' ' X 4 - C!
|
||||||
0x81 ' Y 1 - C!
|
|
||||||
';' ' Y 4 - C!
|
';' ' Y 4 - C!
|
||||||
|
|
||||||
( Add dummy entry. we use CREATE because (entry) is, at this
|
( Add dummy entry. we use CREATE because (entry) is, at this
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
( 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" ;
|
|
@ -313,8 +313,7 @@ CODE R>
|
|||||||
;CODE
|
;CODE
|
||||||
|
|
||||||
CODE IMMEDIATE
|
CODE IMMEDIATE
|
||||||
( CURRENT == RAM+2 )
|
CURRENT LDHL(nn),
|
||||||
RAMSTART 0x02 + LDHL(nn),
|
|
||||||
HL DECss,
|
HL DECss,
|
||||||
7 (HL) SETbr,
|
7 (HL) SETbr,
|
||||||
;CODE
|
;CODE
|
||||||
@ -394,8 +393,7 @@ L1 FSET ( found )
|
|||||||
CODE SCPY
|
CODE SCPY
|
||||||
HL POPqq,
|
HL POPqq,
|
||||||
chkPS,
|
chkPS,
|
||||||
( HERE == RAM+4 )
|
DE HERE LDdd(nn),
|
||||||
DE RAMSTART 0x04 + LDdd(nn),
|
|
||||||
B 0 LDrn,
|
B 0 LDrn,
|
||||||
L1 BSET ( loop )
|
L1 BSET ( loop )
|
||||||
A (HL) LDrr,
|
A (HL) LDrr,
|
||||||
@ -406,7 +404,7 @@ L1 BSET ( loop )
|
|||||||
A ORr,
|
A ORr,
|
||||||
JRNZ, L1 BWR ( loop )
|
JRNZ, L1 BWR ( loop )
|
||||||
DE A LD(dd)r
|
DE A LD(dd)r
|
||||||
RAMSTART 0x04 + DE LD(nn)dd,
|
HERE DE LD(nn)dd,
|
||||||
;CODE
|
;CODE
|
||||||
|
|
||||||
CODE (im1)
|
CODE (im1)
|
||||||
|
Loading…
Reference in New Issue
Block a user