mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-26 19:28:06 +11:00
Compare commits
No commits in common. "6368cc3bacb3942181961ce55d1240dd6f223b34" and "f62376bd0a84c87c27fc63861479ba65756c59ec" have entirely different histories.
6368cc3bac
...
f62376bd0a
@ -1,14 +1,6 @@
|
|||||||
TARGETS = runbin/runbin forth/forth
|
TARGETS = runbin/runbin forth/forth
|
||||||
BIN2C = ../tools/bin2c
|
BIN2C = ../tools/bin2c
|
||||||
# Those Forth source files are in a particular order
|
# Those Forth source files are in a particular order
|
||||||
BOOTSRCS = ./forth/conf.fs \
|
|
||||||
../forth/xcomp.fs \
|
|
||||||
./forth/xcomp.fs \
|
|
||||||
../forth/boot.fs \
|
|
||||||
../forth/z80c.fs \
|
|
||||||
../forth/icore.fs \
|
|
||||||
./forth/xstop.fs
|
|
||||||
|
|
||||||
FORTHSRCS = core.fs cmp.fs print.fs str.fs parse.fs readln.fs fmt.fs z80a.fs
|
FORTHSRCS = core.fs cmp.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
|
||||||
@ -68,9 +60,11 @@ emul.o: emul.c
|
|||||||
$(CC) -c -o emul.o emul.c
|
$(CC) -c -o emul.o emul.c
|
||||||
|
|
||||||
|
|
||||||
|
forth/z80c.bin: forth/stage2
|
||||||
|
cat ./forth/conf.fs ../forth/xcomp.fs ./forth/xcomp.fs ../forth/boot.fs ../forth/z80c.fs ../forth/icore.fs | ./forth/stage2 | tee $@ > /dev/null
|
||||||
|
|
||||||
.PHONY: updatebootstrap
|
.PHONY: updatebootstrap
|
||||||
updatebootstrap: forth/stage2
|
updatebootstrap: forth/z80c.bin
|
||||||
cat $(BOOTSRCS) | ./forth/stage2 > ./forth/z80c.bin
|
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
(xentry) _
|
|
||||||
H@ 256 /MOD 2 PC! 2 PC!
|
|
||||||
|
|
Binary file not shown.
@ -103,6 +103,26 @@
|
|||||||
COMPILE R> COMPILE DROP COMPILE R> COMPILE DROP
|
COMPILE R> COMPILE DROP COMPILE R> COMPILE DROP
|
||||||
; IMMEDIATE
|
; IMMEDIATE
|
||||||
|
|
||||||
|
( WARNING: there are no limit checks. We must be cautious, in
|
||||||
|
core code, not to create more than SYSV_BUFSIZE/2 sys vars.
|
||||||
|
Also: SYSV shouldn't be used during runtime: SYSVNXT won't
|
||||||
|
point at the right place. It should only be used during
|
||||||
|
stage1 compilation. This is why this word is not documented
|
||||||
|
in dictionary.txt )
|
||||||
|
|
||||||
|
: (sysv)
|
||||||
|
( Get new sysv addr )
|
||||||
|
( RAM+46 (2e) == SYSVNXT )
|
||||||
|
46 RAM+ @
|
||||||
|
CONSTANT
|
||||||
|
( increase current sysv counter )
|
||||||
|
2 46 RAM+ +!
|
||||||
|
;
|
||||||
|
|
||||||
|
( Set up initial SYSVNXT value, which is 2 bytes after its
|
||||||
|
own address )
|
||||||
|
46 RAM+ DUP 2 + SWAP !
|
||||||
|
|
||||||
( a1 a2 u -- )
|
( a1 a2 u -- )
|
||||||
: MOVE
|
: MOVE
|
||||||
( u ) 0 DO
|
( u ) 0 DO
|
||||||
|
@ -178,18 +178,18 @@
|
|||||||
( system c< simply reads source from binary, starting at
|
( system c< simply reads source from binary, starting at
|
||||||
LATEST. Convenient way to bootstrap a new system. )
|
LATEST. Convenient way to bootstrap a new system. )
|
||||||
: (c<)
|
: (c<)
|
||||||
( 2e == BOOT C< PTR )
|
( 60 == SYSTEM SCRATCHPAD )
|
||||||
0x2e RAM+ @ ( a )
|
0x60 RAM+ @ ( a )
|
||||||
DUP C@ ( a c )
|
DUP C@ ( a c )
|
||||||
SWAP 1 + ( c a+1 )
|
SWAP 1 + ( c a+1 )
|
||||||
0x2e RAM+ ! ( c )
|
0x60 RAM+ ! ( c )
|
||||||
;
|
;
|
||||||
|
|
||||||
: BOOT
|
: BOOT
|
||||||
0x02 RAM+ CURRENT* !
|
0x02 RAM+ CURRENT* !
|
||||||
LIT< (parse) (find) DROP (parse*) !
|
LIT< (parse) (find) DROP (parse*) !
|
||||||
( 2e == SYSTEM SCRATCHPAD )
|
( 60 == SYSTEM SCRATCHPAD )
|
||||||
CURRENT @ 0x2e RAM+ !
|
CURRENT @ 0x60 RAM+ !
|
||||||
( 0c == CINPTR )
|
( 0c == CINPTR )
|
||||||
LIT< (c<) (find) DROP 0x0c RAM+ !
|
LIT< (c<) (find) DROP 0x0c RAM+ !
|
||||||
LIT< INIT (find)
|
LIT< INIT (find)
|
||||||
@ -231,3 +231,6 @@
|
|||||||
ELSE (parse*) @ EXECUTE LITN THEN
|
ELSE (parse*) @ EXECUTE LITN THEN
|
||||||
AGAIN
|
AGAIN
|
||||||
;
|
;
|
||||||
|
|
||||||
|
(xentry) _
|
||||||
|
H@ 256 /MOD 2 PC! 2 PC!
|
||||||
|
@ -9,11 +9,11 @@
|
|||||||
|
|
||||||
64 CONSTANT INBUFSZ
|
64 CONSTANT INBUFSZ
|
||||||
( points to INBUF )
|
( points to INBUF )
|
||||||
: IN( 0x53 RAM+ ;
|
(sysv) IN(
|
||||||
( points to INBUF's end )
|
( points to INBUF's end )
|
||||||
: IN) 0x55 RAM+ ;
|
(sysv) IN)
|
||||||
( current position in INBUF )
|
( current position in INBUF )
|
||||||
: IN> 0x57 RAM+ ;
|
(sysv) IN>
|
||||||
|
|
||||||
( flush input buffer )
|
( flush input buffer )
|
||||||
( set IN> to IN( and set IN> @ to null )
|
( set IN> to IN( and set IN> @ to null )
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
( H@ offset at which we consider our PC 0. Used to compute
|
( H@ offset at which we consider our PC 0. Used to compute
|
||||||
PC. To have a proper PC, call "H@ ORG !" at the beginning
|
PC. To have a proper PC, call "H@ ORG !" at the beginning
|
||||||
of your assembly process. )
|
of your assembly process. )
|
||||||
: ORG 0x59 RAM+ ;
|
(sysv) ORG
|
||||||
: PC H@ ORG @ - ;
|
: PC H@ ORG @ - ;
|
||||||
|
|
||||||
( A, spits an assembled byte, A,, spits an assembled word
|
( A, spits an assembled byte, A,, spits an assembled word
|
||||||
@ -28,12 +28,12 @@
|
|||||||
pre-declare label variables here, which means we have a
|
pre-declare label variables here, which means we have a
|
||||||
limited number of it. For now, 6 ought to be enough. )
|
limited number of it. For now, 6 ought to be enough. )
|
||||||
|
|
||||||
: L1 0x5b RAM+ ;
|
(sysv) L1
|
||||||
: L2 0x5d RAM+ ;
|
(sysv) L2
|
||||||
: L3 0x5f RAM+ ;
|
(sysv) L3
|
||||||
: L4 0x61 RAM+ ;
|
(sysv) L4
|
||||||
: L5 0x63 RAM+ ;
|
(sysv) L5
|
||||||
: L6 0x65 RAM+ ;
|
(sysv) L6
|
||||||
|
|
||||||
( There are 2 label types: backward and forward. For each
|
( There are 2 label types: backward and forward. For each
|
||||||
type, there are two actions: set and write. Setting a label
|
type, there are two actions: set and write. Setting a label
|
||||||
|
29
notes.txt
29
notes.txt
@ -86,21 +86,11 @@ RAMSTART INITIAL_SP
|
|||||||
+0a PARSEPTR
|
+0a PARSEPTR
|
||||||
+0c CINPTR
|
+0c CINPTR
|
||||||
+0e WORDBUF
|
+0e WORDBUF
|
||||||
+2e BOOT C< PTR
|
+2e SYSVNXT
|
||||||
+4e INTJUMP
|
+4e INTJUMP
|
||||||
+51 CURRENTPTR
|
+51 CURRENTPTR
|
||||||
+53 readln's IN(
|
+53 RESERVED
|
||||||
+55 readln's IN)
|
+60 SYSTEM SCRATCHPAD
|
||||||
+57 readln's IN>
|
|
||||||
+59 z80a's ORG
|
|
||||||
+5b z80a's L1
|
|
||||||
+5d z80a's L2
|
|
||||||
+5f z80a's L3
|
|
||||||
+61 z80a's L4
|
|
||||||
+63 z80a's L5
|
|
||||||
+65 z80a's L6
|
|
||||||
+67 FUTURE USES
|
|
||||||
+70 DRIVERS
|
|
||||||
+80 RAMEND
|
+80 RAMEND
|
||||||
|
|
||||||
INITIAL_SP holds the initial Stack Pointer value so that we know where to reset
|
INITIAL_SP holds the initial Stack Pointer value so that we know where to reset
|
||||||
@ -120,8 +110,7 @@ CINPTR holds routine address called on C<
|
|||||||
|
|
||||||
WORDBUF is the buffer used by WORD
|
WORDBUF is the buffer used by WORD
|
||||||
|
|
||||||
BOOT C< PTR is used when Forth boots from in-memory source. See "Initialization
|
SYSVNXT is the buffer+tracker used by (sysv)
|
||||||
sequence" below.
|
|
||||||
|
|
||||||
INTJUMP All RST offsets (well, not *all* at this moment, I still have to free
|
INTJUMP All RST offsets (well, not *all* at this moment, I still have to free
|
||||||
those slots...) in boot binaries are made to jump to this address. If you use
|
those slots...) in boot binaries are made to jump to this address. If you use
|
||||||
@ -133,12 +122,12 @@ RAM+2 directly, but rather the value at this address. Most of the time, it
|
|||||||
points to RAM+2, but sometimes, when maintaining alternative dicts (during
|
points to RAM+2, but sometimes, when maintaining alternative dicts (during
|
||||||
cross compilation for example), it can point elsewhere.
|
cross compilation for example), it can point elsewhere.
|
||||||
|
|
||||||
FUTURE USES section is unused for now.
|
SYSTEM SCRATCHPAD is reserved for temporary system storage or can be reserved
|
||||||
|
by low-level drivers. These are the current usages of this space throughout the
|
||||||
|
project:
|
||||||
|
|
||||||
DRIVERS section is reserved for recipe-specific drivers. Here is a list of
|
* 0x60-0x62: (c<) pointer during in-memory initialization (see below)
|
||||||
known usages:
|
* 0x62-0x6a: ACIA buffer pointers in RC2014 recipes.
|
||||||
|
|
||||||
* 0x70-0x78: ACIA buffer pointers in RC2014 recipes.
|
|
||||||
|
|
||||||
*** Initialization sequence
|
*** Initialization sequence
|
||||||
|
|
||||||
|
@ -2,5 +2,5 @@
|
|||||||
0xf000 CONSTANT RS_ADDR
|
0xf000 CONSTANT RS_ADDR
|
||||||
0x80 CONSTANT ACIA_CTL
|
0x80 CONSTANT ACIA_CTL
|
||||||
0x81 CONSTANT ACIA_IO
|
0x81 CONSTANT ACIA_IO
|
||||||
RAMSTART 0x70 + CONSTANT ACIA_MEM
|
RAMSTART 0x62 + CONSTANT ACIA_MEM
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user