1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-12-28 08:28:06 +11:00

Add CURRENT* and simplify xcomp

This commit is contained in:
Virgil Dupras 2020-04-09 12:01:08 -04:00
parent f1171c656c
commit e6d3638f4f
7 changed files with 25 additions and 28 deletions

View File

@ -98,6 +98,8 @@ J -- n Copy RS third item to PS
C@ a -- c Set c to byte at address a
C! c a -- Store byte c in address a
CURRENT -- a Set a to wordref of last added entry.
CURRENT* -- a A pointer to active CURRENT*. Useful when we have
multiple active dicts.
HERE -- a Push HERE's address
H@ -- a HERE @
MOVE a1 a2 u -- Copy u bytes from a1 to a2, starting with a1, going

View File

@ -4,3 +4,8 @@
CURRENT @ XCURRENT !
H@ ' _bend - 4 + XOFF !
( dummy entry for dict hook )
(xentry) _
H@ 256 /MOD 2 PC! 2 PC!

Binary file not shown.

View File

@ -35,7 +35,8 @@
: FLAGS 0x08 RAM+ ;
: (parse*) 0x0a RAM+ ;
: HERE 0x04 RAM+ ;
: CURRENT 0x02 RAM+ ;
: CURRENT* 0x51 RAM+ ;
: CURRENT CURRENT* @ ;
( w -- a f )
: (find) CURRENT @ SWAP _find ;
@ -185,6 +186,7 @@
;
: BOOT
0x02 RAM+ CURRENT* !
LIT< (parse) (find) DROP (parse*) !
( 60 == SYSTEM SCRATCHPAD )
CURRENT @ 0x60 RAM+ !

View File

@ -24,40 +24,26 @@
VARIABLE XCURRENT
VARIABLE XOFF
: (xentry)
H@ ( h )
WORD ( h s )
SCPY ( h )
( Adjust HERE -1 because SCPY copies the null )
H@ 1 - ( h h' )
DUP HERE ! ( h h' )
-^ ( sz )
( write prev value )
H@ XCURRENT @ - ,
( write size )
C,
H@ XCURRENT !
;
: XCON XCURRENT CURRENT* ! ;
: XCOFF CURRENT CURRENT* ! ;
: (xentry) XCON (entry) XCOFF ;
( Finds in *both* CURRENT and XCURRENT )
( w -- a f xa xf )
: (xfind)
DUP ( w w )
CURRENT @ SWAP ( w cur w )
( hardcoded system CURRENT )
0x02 RAM+ @ SWAP ( w cur w )
_find ( w a f )
ROT ( a f w )
XCURRENT @ SWAP ( a f xcur w )
_find ( a f xa xf )
;
: XCODE
(xentry) 23 ,
;
: XCODE XCON CODE XCOFF ;
: XIMM
XCURRENT @ 1 -
DUP C@ 128 OR SWAP C!
;
: XIMM XCON IMMEDIATE XCOFF ;
: X:
(xentry)

View File

@ -22,10 +22,6 @@
This unit expects the same conf as boot.fs.
)
( dummy entry for dict hook )
(xentry) _
H@ 256 /MOD 2 PC! 2 PC!
( a b c -- b c a )
CODE ROT
HL POPqq, ( C )

View File

@ -88,7 +88,8 @@ RAMSTART INITIAL_SP
+0e WORDBUF
+2e SYSVNXT
+4e INTJUMP
+51 RESERVED
+51 CURRENTPTR
+53 RESERVED
+60 SYSTEM SCRATCHPAD
+80 RAMEND
@ -116,6 +117,11 @@ those slots...) in boot binaries are made to jump to this address. If you use
one of those slots for an interrupt, write a jump to the appropriate offset in
that RAM location.
CURRENTPTR points to current CURRENT. The Forth CURRENT word doesn't return
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.
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: