version 1.123, 2002/03/21 16:35:18
|
version 1.125, 2002/03/21 17:20:38
|
Line 27 ToDo:
|
Line 27 ToDo:
|
cross.fs is used seperately. jaw |
cross.fs is used seperately. jaw |
- Do we need this char translation with >address and in branchoffset? |
- Do we need this char translation with >address and in branchoffset? |
(>body also affected) jaw |
(>body also affected) jaw |
- MAXU etc. can be done with dlit, |
|
|
|
[THEN] |
[THEN] |
|
|
Line 1235 tbits/char bits/byte / Constant tbyte
|
Line 1234 tbits/char bits/byte / Constant tbyte
|
\ Variables 06oct92py |
\ Variables 06oct92py |
|
|
Variable image |
Variable image |
Variable tlast TNIL tlast ! \ Last name field |
Variable (tlast) |
|
(tlast) Value tlast TNIL tlast ! \ Last name field |
Variable tlastcfa \ Last code field |
Variable tlastcfa \ Last code field |
Variable bit$ |
Variable bit$ |
|
|
Line 1259 Variable region-link \ linked
|
Line 1259 Variable region-link \ linked
|
Variable mirrored-link \ linked list for mirrored regions |
Variable mirrored-link \ linked list for mirrored regions |
0 dup mirrored-link ! region-link ! |
0 dup mirrored-link ! region-link ! |
|
|
|
: >rname 8 cells + ; |
: >rname 7 cells + ; |
: >rbm 4 cells + ; \ bitfield per cell witch indicates relocation |
: >rbm 4 cells + ; |
|
: >rmem 5 cells + ; |
: >rmem 5 cells + ; |
: >rtype 6 cells + ; |
: >rtype 6 cells + ; \ field per cell witch points to a type struct |
|
: >rrom 7 cells + ; \ a -1 indicates that this region is rom |
: >rlink 3 cells + ; |
: >rlink 3 cells + ; |
: >rdp 2 cells + ; |
: >rdp 2 cells + ; |
: >rlen cell+ ; |
: >rlen cell+ ; |
Line 1283 Variable mirrored-link \ linked
|
Line 1283 Variable mirrored-link \ linked
|
save-input create restore-input throw |
save-input create restore-input throw |
here last-defined-region ! |
here last-defined-region ! |
over ( startaddr ) , ( length ) , ( dp ) , |
over ( startaddr ) , ( length ) , ( dp ) , |
region-link linked 0 , 0 , 0 , bl word count string, |
region-link linked 0 , 0 , 0 , 0 , bl word count string, |
ELSE \ store new parameters in region |
ELSE \ store new parameters in region |
bl word drop |
bl word drop |
>body (region) |
>body (region) |
Line 1301 Variable mirrored-link \ linked
|
Line 1301 Variable mirrored-link \ linked
|
\G returns the total area |
\G returns the total area |
dup >rstart @ swap >rlen @ ; |
dup >rstart @ swap >rlen @ ; |
|
|
: mirrored |
: mirrored ( -- ) |
\G mark a region as mirrored |
\G mark last defined region as mirrored |
mirrored-link |
mirrored-link |
align linked last-defined-region @ , ; |
align linked last-defined-region @ , ; |
|
|
|
: writeprotected |
|
\G mark a region as write protected |
|
-1 last-defined-region @ >rrom ! ; |
|
|
: .addr ( u -- ) |
: .addr ( u -- ) |
\G prints a 16 or 32 Bit nice hex value |
\G prints a 16 or 32 Bit nice hex value |
base @ >r hex |
base @ >r hex |
Line 1561 bigendian
|
Line 1565 bigendian
|
\ add regions real address in our memory |
\ add regions real address in our memory |
r> >rmem @ + ; |
r> >rmem @ + ; |
|
|
|
: (>regionramimage) ( taddr -- 'taddr ) |
|
\G same as (>regionimage) but aborts if the region is rom |
|
dup |
|
\ find region we want to address |
|
taddr>region-abort |
|
>r |
|
r@ >rrom @ ABORT" CROSS: region is write-protected!" |
|
\ calculate offset in region |
|
r@ >rstart @ - |
|
\ add regions real address in our memory |
|
r> >rmem @ + ; |
|
|
: (>regionbm) ( taddr -- 'taddr bitmaskbaseaddr ) |
: (>regionbm) ( taddr -- 'taddr bitmaskbaseaddr ) |
dup |
dup |
\ find region we want to address |
\ find region we want to address |
Line 1609 CREATE Bittable 80 c, 40 c, 20 c, 10 c,
|
Line 1625 CREATE Bittable 80 c, 40 c, 20 c, 10 c,
|
: (>image) ( taddr -- absaddr ) image @ + ; |
: (>image) ( taddr -- absaddr ) image @ + ; |
|
|
DEFER >image |
DEFER >image |
|
DEFER >ramimage |
DEFER relon |
DEFER relon |
DEFER reloff |
DEFER reloff |
DEFER correcter |
DEFER correcter |
Line 1618 T has? relocate H
|
Line 1635 T has? relocate H
|
' (relon) IS relon |
' (relon) IS relon |
' (reloff) IS reloff |
' (reloff) IS reloff |
' (>regionimage) IS >image |
' (>regionimage) IS >image |
|
' (>regionimage) IS >ramimage |
[ELSE] |
[ELSE] |
' drop IS relon |
' drop IS relon |
' drop IS reloff |
' drop IS reloff |
' (>regionimage) IS >image |
' (>regionimage) IS >image |
|
' (>regionimage) IS >ramimage |
[THEN] |
[THEN] |
|
|
|
: enforce-writeprotection ( -- ) |
|
['] (>regionramimage) IS >ramimage ; |
|
|
|
: relax-writeprotection ( -- ) |
|
['] (>regionimage) IS >ramimage ; |
|
|
|
: writeprotection-relaxed? ( -- ) |
|
['] >ramimage >body @ ['] (>regionimage) = ; |
|
|
\ Target memory access 06oct92py |
\ Target memory access 06oct92py |
|
|
: align+ ( taddr -- rest ) |
: align+ ( taddr -- rest ) |
Line 1641 T has? relocate H
|
Line 1669 T has? relocate H
|
dup cfalign+ + ; |
dup cfalign+ + ; |
|
|
: @ ( taddr -- w ) >image S@ ; |
: @ ( taddr -- w ) >image S@ ; |
: ! ( w taddr -- ) >image S! ; |
: ! ( w taddr -- ) >ramimage S! ; |
: c@ ( taddr -- char ) >image Sc@ ; |
: c@ ( taddr -- char ) >image Sc@ ; |
: c! ( char taddr -- ) >image Sc! ; |
: c! ( char taddr -- ) >ramimage Sc! ; |
: 2@ ( taddr -- x1 x2 ) T dup cell+ @ swap @ H ; |
: 2@ ( taddr -- x1 x2 ) T dup cell+ @ swap @ H ; |
: 2! ( x1 x2 taddr -- ) T tuck ! cell+ ! H ; |
: 2! ( x1 x2 taddr -- ) T tuck ! cell+ ! H ; |
|
|
Line 2410 Cond: chars ;Cond
|
Line 2438 Cond: chars ;Cond
|
|
|
\ some special literals 27jan97jaw |
\ some special literals 27jan97jaw |
|
|
\ !! Known Bug: Special Literals and plug-ins work only correct |
|
\ on 16 and 32 Bit Targets and 32 Bit Hosts! |
|
|
|
\ This section could be done with dlit, now. But first I need |
|
\ some test code JAW |
|
|
|
Cond: MAXU |
Cond: MAXU |
tcell 1 cells u> |
-1 s>d dlit, |
IF compile lit tcell 0 ?DO FF T c, H LOOP |
|
ELSE ffffffff lit, THEN |
|
;Cond |
;Cond |
|
|
|
tcell 2 = tcell 4 = or tcell 8 = or 0= |
|
[IF] |
|
.( Warning: MINI and MAXI may not work with this host) cr |
|
[THEN] |
|
|
Cond: MINI |
Cond: MINI |
tcell 1 cells u> |
tcell 2 = IF $8000 ELSE $80000000 THEN 0 |
IF compile lit bigendian |
tcell 8 = IF swap THEN dlit, |
IF 80 T c, H tcell 1 ?DO 0 T c, H LOOP |
|
ELSE tcell 1 ?DO 0 T c, H LOOP 80 T c, H |
|
THEN |
|
ELSE tcell 2 = IF 8000 ELSE 80000000 THEN lit, THEN |
|
;Cond |
;Cond |
|
|
Cond: MAXI |
Cond: MAXI |
tcell 1 cells u> |
tcell 2 = IF $7fff ELSE $7fffffff THEN 0 |
IF compile lit bigendian |
tcell 8 = IF drop -1 swap THEN dlit, |
IF 7F T c, H tcell 1 ?DO FF T c, H LOOP |
;Cond |
ELSE tcell 1 ?DO FF T c, H LOOP 7F T c, H |
|
THEN |
|
ELSE tcell 2 = IF 7fff ELSE 7fffffff THEN lit, THEN |
|
;Cond |
|
|
|
>CROSS |
>CROSS |
|
|