Compare commits
2 Commits
f1171c656c
...
54929c2aa0
Author | SHA1 | Date | |
---|---|---|---|
|
54929c2aa0 | ||
|
e6d3638f4f |
@ -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
|
||||
|
@ -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.
@ -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+ !
|
||||
|
@ -14,7 +14,7 @@
|
||||
"'" and friends will *not* find words you're about to
|
||||
define. Only (xfind) will.
|
||||
|
||||
Words ":", "IMMEDIATE" and ":" are not automatically
|
||||
Words ":", "IMMEDIATE" and "CODE" are not automatically
|
||||
shadowed to allow the harmless inclusion of this unit. This
|
||||
shadowing has to take place in your xcomp configuration.
|
||||
|
||||
@ -24,67 +24,48 @@
|
||||
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* ! ;
|
||||
|
||||
( Finds in *both* CURRENT and XCURRENT )
|
||||
( w -- a f xa xf )
|
||||
: (xfind)
|
||||
DUP ( w w )
|
||||
CURRENT @ SWAP ( w cur w )
|
||||
_find ( w a f )
|
||||
ROT ( a f w )
|
||||
XCURRENT @ SWAP ( a f xcur w )
|
||||
_find ( a f xa xf )
|
||||
;
|
||||
: (xentry) XCON (entry) XCOFF ;
|
||||
|
||||
: XCODE
|
||||
(xentry) 23 ,
|
||||
;
|
||||
: XCODE XCON CODE XCOFF ;
|
||||
|
||||
: XIMM
|
||||
XCURRENT @ 1 -
|
||||
DUP C@ 128 OR SWAP C!
|
||||
;
|
||||
: XIMM XCON IMMEDIATE XCOFF ;
|
||||
|
||||
: X:
|
||||
(xentry)
|
||||
XCON
|
||||
(entry)
|
||||
( 0e == compiledWord )
|
||||
[ 0x0e LITN ] ,
|
||||
BEGIN
|
||||
WORD
|
||||
(xfind)
|
||||
IF ( a f xa )
|
||||
( DUP is because we need a copy in case it's IMMED )
|
||||
WORD DUP
|
||||
(find) ( w a f )
|
||||
IF
|
||||
( is word )
|
||||
DUP IMMED?
|
||||
IF ( a f xa )
|
||||
IF ( w a )
|
||||
( When encountering IMMEDIATE, we exec the *host*
|
||||
word. )
|
||||
DROP ( a f )
|
||||
DROP ( w )
|
||||
( hardcoded system CURRENT )
|
||||
0x02 RAM+ @ SWAP ( cur w )
|
||||
_find ( a f )
|
||||
NOT IF ABORT THEN ( a )
|
||||
EXECUTE
|
||||
ELSE
|
||||
( when compiling, we don't care about the host
|
||||
find. )
|
||||
( not an immed. drop backup w and write, with
|
||||
offset. )
|
||||
SWAP DROP ( a )
|
||||
DUP 0x100 > IF XOFF @ - THEN
|
||||
, 2DROP
|
||||
,
|
||||
THEN
|
||||
ELSE ( w f xa )
|
||||
ELSE ( w a )
|
||||
( maybe number )
|
||||
2DROP ( w )
|
||||
DROP ( w )
|
||||
(parse*) @ EXECUTE LITN
|
||||
THEN
|
||||
AGAIN
|
||||
XCOFF
|
||||
;
|
||||
|
@ -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 )
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user