1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-26 17:28:05 +11:00

Compare commits

..

No commits in common. "6368cc3bacb3942181961ce55d1240dd6f223b34" and "f62376bd0a84c87c27fc63861479ba65756c59ec" have entirely different histories.

9 changed files with 52 additions and 49 deletions

View File

@ -1,14 +1,6 @@
TARGETS = runbin/runbin forth/forth
BIN2C = ../tools/bin2c
# 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
FORTHSRC_PATHS = ${FORTHSRCS:%=../forth/%} forth/run.fs
OBJS = emul.o libz80/libz80.o
@ -68,9 +60,11 @@ 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
updatebootstrap: forth/stage2
cat $(BOOTSRCS) | ./forth/stage2 > ./forth/z80c.bin
updatebootstrap: forth/z80c.bin
.PHONY: clean
clean:

View File

@ -1,3 +0,0 @@
(xentry) _
H@ 256 /MOD 2 PC! 2 PC!

Binary file not shown.

View File

@ -103,6 +103,26 @@
COMPILE R> COMPILE DROP COMPILE R> COMPILE DROP
; 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 -- )
: MOVE
( u ) 0 DO

View File

@ -178,18 +178,18 @@
( system c< simply reads source from binary, starting at
LATEST. Convenient way to bootstrap a new system. )
: (c<)
( 2e == BOOT C< PTR )
0x2e RAM+ @ ( a )
( 60 == SYSTEM SCRATCHPAD )
0x60 RAM+ @ ( a )
DUP C@ ( a c )
SWAP 1 + ( c a+1 )
0x2e RAM+ ! ( c )
0x60 RAM+ ! ( c )
;
: BOOT
0x02 RAM+ CURRENT* !
LIT< (parse) (find) DROP (parse*) !
( 2e == SYSTEM SCRATCHPAD )
CURRENT @ 0x2e RAM+ !
( 60 == SYSTEM SCRATCHPAD )
CURRENT @ 0x60 RAM+ !
( 0c == CINPTR )
LIT< (c<) (find) DROP 0x0c RAM+ !
LIT< INIT (find)
@ -231,3 +231,6 @@
ELSE (parse*) @ EXECUTE LITN THEN
AGAIN
;
(xentry) _
H@ 256 /MOD 2 PC! 2 PC!

View File

@ -9,11 +9,11 @@
64 CONSTANT INBUFSZ
( points to INBUF )
: IN( 0x53 RAM+ ;
(sysv) IN(
( points to INBUF's end )
: IN) 0x55 RAM+ ;
(sysv) IN)
( current position in INBUF )
: IN> 0x57 RAM+ ;
(sysv) IN>
( flush input buffer )
( set IN> to IN( and set IN> @ to null )

View File

@ -9,7 +9,7 @@
( H@ offset at which we consider our PC 0. Used to compute
PC. To have a proper PC, call "H@ ORG !" at the beginning
of your assembly process. )
: ORG 0x59 RAM+ ;
(sysv) ORG
: PC H@ ORG @ - ;
( A, spits an assembled byte, A,, spits an assembled word
@ -28,12 +28,12 @@
pre-declare label variables here, which means we have a
limited number of it. For now, 6 ought to be enough. )
: L1 0x5b RAM+ ;
: L2 0x5d RAM+ ;
: L3 0x5f RAM+ ;
: L4 0x61 RAM+ ;
: L5 0x63 RAM+ ;
: L6 0x65 RAM+ ;
(sysv) L1
(sysv) L2
(sysv) L3
(sysv) L4
(sysv) L5
(sysv) L6
( There are 2 label types: backward and forward. For each
type, there are two actions: set and write. Setting a label

View File

@ -86,21 +86,11 @@ RAMSTART INITIAL_SP
+0a PARSEPTR
+0c CINPTR
+0e WORDBUF
+2e BOOT C< PTR
+2e SYSVNXT
+4e INTJUMP
+51 CURRENTPTR
+53 readln's IN(
+55 readln's IN)
+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
+53 RESERVED
+60 SYSTEM SCRATCHPAD
+80 RAMEND
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
BOOT C< PTR is used when Forth boots from in-memory source. See "Initialization
sequence" below.
SYSVNXT is the buffer+tracker used by (sysv)
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
@ -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
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
known usages:
* 0x70-0x78: ACIA buffer pointers in RC2014 recipes.
* 0x60-0x62: (c<) pointer during in-memory initialization (see below)
* 0x62-0x6a: ACIA buffer pointers in RC2014 recipes.
*** Initialization sequence

View File

@ -2,5 +2,5 @@
0xf000 CONSTANT RS_ADDR
0x80 CONSTANT ACIA_CTL
0x81 CONSTANT ACIA_IO
RAMSTART 0x70 + CONSTANT ACIA_MEM
RAMSTART 0x62 + CONSTANT ACIA_MEM