Commit 11e8f80a authored by pazsan's avatar pazsan

Fixed cell-size dependent masks

parent e7c99e5d
......@@ -1516,14 +1516,15 @@ variable ResolveFlag
>CROSS
\ Header states 12dec92py
: flag! ( w -- ) tlast @ dup >r T @ xor r> ! H ;
bigendian [IF] 0 [ELSE] tcell 1- [THEN] Constant flag+
: flag! ( w -- ) tlast @ flag+ + dup >r T c@ xor r> c! H ;
VARIABLE ^imm
\ !! should be target wordsize specific
$80000000 constant alias-mask
$40000000 constant immediate-mask
$20000000 constant restrict-mask
$80 constant alias-mask
$40 constant immediate-mask
$20 constant restrict-mask
>TARGET
: immediate immediate-mask flag!
......
......@@ -130,13 +130,16 @@ defer header ( -- ) \ gforth
2variable nextname-string
has? OS [IF]
: nextname-header ( -- )
nextname-string 2@ header,
nextname-string free-mem-var
input-stream ;
[THEN]
\ the next name is given in the string
has? OS [IF]
: nextname ( c-addr u -- ) \ gforth
\g The next defined word will have the name @var{c-addr u}; the
\g defining word will leave the input stream alone.
......@@ -144,6 +147,7 @@ defer header ( -- ) \ gforth
nextname-string free-mem-var
save-mem nextname-string 2!
['] nextname-header IS (header) ;
[THEN]
: noname-header ( -- )
0 last ! cfalign
......
......@@ -257,20 +257,25 @@ forth-wordlist current !
\ \ header, finding, ticks 17dec92py
\ !! these should be done using the target's operations and cell size
\ 0 invert 1 rshift invert ( u ) \ top bit set
\ constant alias-mask \ set when the word is not an alias!
\ alias-mask 1 rshift constant immediate-mask
\ alias-mask 2 rshift constant restrict-mask
\ 0 invert 3 rshift constant lcount-mask
\ as an intermediate step, I define them correctly for 32-bit machines:
\ The constants are defined as 32 bits, but then erased
\ and overwritten by the right ones
$80000000 constant alias-mask
1 bits/char 1 - lshift
-1 cells allot bigendian [IF] c, 0 1 cells 1- times
[ELSE] 0 1 cells 1- times c, [THEN]
$40000000 constant immediate-mask
1 bits/char 2 - lshift
-1 cells allot bigendian [IF] c, 0 1 cells 1- times
[ELSE] 0 1 cells 1- times c, [THEN]
$20000000 constant restrict-mask
1 bits/char 3 - lshift
-1 cells allot bigendian [IF] c, 0 1 cells 1- times
[ELSE] 0 1 cells 1- times c, [THEN]
$1fffffff constant lcount-mask
1 bits/char 3 - lshift 1 -
-1 cells allot bigendian [IF] c, $FF 1 cells 1- times
[ELSE] $FF 1 cells 1- times c, [THEN]
\ higher level parts of find
......
......@@ -50,6 +50,7 @@ warnings off
include ./search.fs
include ./extend.fs
[THEN]
include ./stuff.fs
[IFUNDEF] environment?
include ./environ.fs
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment