1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-09-29 09:20:55 +10:00

Remove (sysv)

Replace its usages with direct RAM+ offsets. The (sysv) mechanism was
incompatible with cross-compilation of a full interpreter.
This commit is contained in:
Virgil Dupras 2020-04-10 14:57:00 -04:00
parent a6efb65010
commit 6368cc3bac
7 changed files with 36 additions and 45 deletions

Binary file not shown.

View File

@ -103,26 +103,6 @@
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

View File

@ -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<)
( 60 == SYSTEM SCRATCHPAD ) ( 2e == BOOT C< PTR )
0x60 RAM+ @ ( a ) 0x2e RAM+ @ ( a )
DUP C@ ( a c ) DUP C@ ( a c )
SWAP 1 + ( c a+1 ) SWAP 1 + ( c a+1 )
0x60 RAM+ ! ( c ) 0x2e RAM+ ! ( c )
; ;
: BOOT : BOOT
0x02 RAM+ CURRENT* ! 0x02 RAM+ CURRENT* !
LIT< (parse) (find) DROP (parse*) ! LIT< (parse) (find) DROP (parse*) !
( 60 == SYSTEM SCRATCHPAD ) ( 2e == SYSTEM SCRATCHPAD )
CURRENT @ 0x60 RAM+ ! CURRENT @ 0x2e RAM+ !
( 0c == CINPTR ) ( 0c == CINPTR )
LIT< (c<) (find) DROP 0x0c RAM+ ! LIT< (c<) (find) DROP 0x0c RAM+ !
LIT< INIT (find) LIT< INIT (find)

View File

@ -9,11 +9,11 @@
64 CONSTANT INBUFSZ 64 CONSTANT INBUFSZ
( points to INBUF ) ( points to INBUF )
(sysv) IN( : IN( 0x53 RAM+ ;
( points to INBUF's end ) ( points to INBUF's end )
(sysv) IN) : IN) 0x55 RAM+ ;
( current position in INBUF ) ( current position in INBUF )
(sysv) IN> : IN> 0x57 RAM+ ;
( flush input buffer ) ( flush input buffer )
( set IN> to IN( and set IN> @ to null ) ( 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 ( 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. )
(sysv) ORG : ORG 0x59 RAM+ ;
: 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. )
(sysv) L1 : L1 0x5b RAM+ ;
(sysv) L2 : L2 0x5d RAM+ ;
(sysv) L3 : L3 0x5f RAM+ ;
(sysv) L4 : L4 0x61 RAM+ ;
(sysv) L5 : L5 0x63 RAM+ ;
(sysv) L6 : L6 0x65 RAM+ ;
( 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

View File

@ -86,11 +86,21 @@ RAMSTART INITIAL_SP
+0a PARSEPTR +0a PARSEPTR
+0c CINPTR +0c CINPTR
+0e WORDBUF +0e WORDBUF
+2e SYSVNXT +2e BOOT C< PTR
+4e INTJUMP +4e INTJUMP
+51 CURRENTPTR +51 CURRENTPTR
+53 RESERVED +53 readln's IN(
+60 SYSTEM SCRATCHPAD +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
+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
@ -110,7 +120,8 @@ CINPTR holds routine address called on C<
WORDBUF is the buffer used by WORD WORDBUF is the buffer used by WORD
SYSVNXT is the buffer+tracker used by (sysv) BOOT C< PTR is used when Forth boots from in-memory source. See "Initialization
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
@ -122,12 +133,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.
SYSTEM SCRATCHPAD is reserved for temporary system storage or can be reserved FUTURE USES section is unused for now.
by low-level drivers. These are the current usages of this space throughout the
project:
* 0x60-0x62: (c<) pointer during in-memory initialization (see below) DRIVERS section is reserved for recipe-specific drivers. Here is a list of
* 0x62-0x6a: ACIA buffer pointers in RC2014 recipes. known usages:
* 0x70-0x78: ACIA buffer pointers in RC2014 recipes.
*** Initialization sequence *** Initialization sequence

View File

@ -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 0x62 + CONSTANT ACIA_MEM RAMSTART 0x70 + CONSTANT ACIA_MEM