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

xcomp: simplify further

This commit is contained in:
Virgil Dupras 2020-04-09 12:02:56 -04:00
parent e6d3638f4f
commit 54929c2aa0

View File

@ -14,7 +14,7 @@
"'" and friends will *not* find words you're about to "'" and friends will *not* find words you're about to
define. Only (xfind) will. 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 shadowed to allow the harmless inclusion of this unit. This
shadowing has to take place in your xcomp configuration. shadowing has to take place in your xcomp configuration.
@ -29,48 +29,43 @@ VARIABLE XOFF
: (xentry) XCON (entry) XCOFF ; : (xentry) XCON (entry) XCOFF ;
( Finds in *both* CURRENT and XCURRENT )
( w -- a f xa xf )
: (xfind)
DUP ( w 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 XCON CODE XCOFF ; : XCODE XCON CODE XCOFF ;
: XIMM XCON IMMEDIATE XCOFF ; : XIMM XCON IMMEDIATE XCOFF ;
: X: : X:
(xentry) XCON
(entry)
( 0e == compiledWord ) ( 0e == compiledWord )
[ 0x0e LITN ] , [ 0x0e LITN ] ,
BEGIN BEGIN
WORD ( DUP is because we need a copy in case it's IMMED )
(xfind) WORD DUP
IF ( a f xa ) (find) ( w a f )
IF
( is word ) ( is word )
DUP IMMED? DUP IMMED?
IF ( a f xa ) IF ( w a )
( When encountering IMMEDIATE, we exec the *host* ( When encountering IMMEDIATE, we exec the *host*
word. ) word. )
DROP ( a f ) DROP ( w )
( hardcoded system CURRENT )
0x02 RAM+ @ SWAP ( cur w )
_find ( a f )
NOT IF ABORT THEN ( a ) NOT IF ABORT THEN ( a )
EXECUTE EXECUTE
ELSE ELSE
( when compiling, we don't care about the host ( not an immed. drop backup w and write, with
find. ) offset. )
SWAP DROP ( a )
DUP 0x100 > IF XOFF @ - THEN DUP 0x100 > IF XOFF @ - THEN
, 2DROP ,
THEN THEN
ELSE ( w f xa ) ELSE ( w a )
( maybe number ) ( maybe number )
2DROP ( w ) DROP ( w )
(parse*) @ EXECUTE LITN (parse*) @ EXECUTE LITN
THEN THEN
AGAIN AGAIN
XCOFF
; ;