Commit 644f9b9d authored by jwilke's avatar jwilke

introduced bits/byte. For this naming the address unit is per

definition a byte. If bits/byte is not explicitly set, 8 is assumed.
>address works now with bits/byte and translates between target
address units and the hosts' one.
Attention:
In this state this will never work with host address unit size different
than 8 bits.
Step up translation (from 8 to 16 bits address unit size) will only work
with enormous care because "chars" in cross behaves not like "chars" in the
target. Any pre-calculation of offsets that is compiled in litarally
will fail!
Better solution: Emulate target address-unit size in cross, ugh!
parent 9f2d0c09
......@@ -326,19 +326,43 @@ s" relocate" T environment? H
\ \ Create additional parameters 19jan95py
1 8 lshift Constant maxbyte
\ currently cross only works for host machines with address-unit-bits
\ eual to 8 because of s! and sc!
\ but I start to query the environment just to modularize a little bit
: check-address-unit-bits ( -- )
\ s" ADDRESS-UNIT-BITS" environment?
\ IF 8 <> ELSE true THEN
\ ABORT" ADDRESS-UNIT-BITS unknown or not equal to 8!"
\ shit, this doesn't work because environment? is only defined for
\ gforth.fi and not kernl???.fi
;
check-address-unit-bits
8 Constant bits/byte \ we define: byte is address-unit
1 bits/byte lshift Constant maxbyte
\ this sets byte size for the target machine, an (probably right guess) jaw
T
NIL Constant TNIL
cell Constant tcell
cell<< Constant tcell<<
cell>bit Constant tcell>bit
bits/char Constant tbits/char
bits/char 8 / Constant tchar
float Constant tfloat
1 bits/char lshift Constant tmaxchar
NIL Constant TNIL
cell Constant tcell
cell<< Constant tcell<<
cell>bit Constant tcell>bit
bits/char Constant tbits/char
bits/char H bits/byte T /
Constant tchar
float Constant tfloat
1 bits/char lshift Constant tmaxchar
[IFUNDEF] bits/byte
8 Constant tbits/byte
[ELSE]
bits/byte Constant tbits/byte
[THEN]
H
tbits/byte bits/byte / Constant tbyte
\ Variables 06oct92py
......@@ -603,8 +627,8 @@ variable constflag constflag off
: cell+ tcell + ;
: cells tcell<< lshift ;
: chars ;
: char+ 1 + ;
: chars tchar * ;
: char+ tchar + ;
: floats tfloat * ;
>CROSS
......@@ -726,7 +750,7 @@ T has? relocate H
: cfalign ( -- )
T here H cfalign+ 0 ?DO bl T c, tchar H +LOOP ;
: >address dup 0>= IF tchar / THEN ; \ ?? jaw
: >address dup 0>= IF tbyte / THEN ; \ ?? jaw
: A! swap >address swap dup relon T ! H ;
: A, ( w -- ) >address T here H relon T , H ;
......
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