mirror of
https://git.sr.ht/~crc_/retroforth
synced 2024-11-16 19:48:56 +01:00
new build options for reduced memory footprint
FossilOrigin-Name: 3840737baf324f7716e539da1c8711f17fec0fbe4926dafdec0cd544a725c3ec
This commit is contained in:
parent
c050ea936d
commit
125d76e059
4 changed files with 120 additions and 44 deletions
|
@ -2351,6 +2351,28 @@ Output is written to stdout; redirect as neeeded.
|
|||
|
||||
# Advanced Builds
|
||||
|
||||
## Reduced Memory
|
||||
|
||||
RETRO can be built for reduced memory targets. This is primarily
|
||||
intendeded for use with embedded targets, but can be useful on
|
||||
large machines as well.
|
||||
|
||||
To do this, `make` with `CFLAGS` set to `-DMEM1024K`, `-DMEM512K`,
|
||||
`-DMEM256K`, `-DMEM192K`, `-DMEM128K`' or `-DMEM96K`. These will
|
||||
target memory sizes as specified per the following table.
|
||||
|
||||
| | 1024kB | 512kB | 256kB | 192kB | 128kB | 96kB |
|
||||
| ------------- | --------- | ------- | ------- | ------- | ------- | ------ |
|
||||
| Total Bytes | 1,048,579 | 524,288 | 262,144 | 196,608 | 131,072 | 98,304 |
|
||||
| Image | 968,000 | 384,000 | 192,000 | 126,000 | 96,000 | 72,000 |
|
||||
| Data Stack | 512 | 512 | 512 | 512 | 512 | 512 |
|
||||
| Address Stack | 1,024 | 1,024 | 1,024 | 1,024 | 1,024 | 1,024 |
|
||||
| Remaining | 79,040 | 138,752 | 68,608 | 69,072 | 33,536 | 24,768 |
|
||||
|
||||
The remaining memory is available for use by the VM.
|
||||
|
||||
## Custom Image
|
||||
|
||||
For users of BSD, Linux, macOS, you can customize the image at
|
||||
build time.
|
||||
|
||||
|
|
|
@ -1,5 +1,27 @@
|
|||
# Advanced Builds
|
||||
|
||||
## Reduced Memory
|
||||
|
||||
RETRO can be built for reduced memory targets. This is primarily
|
||||
intendeded for use with embedded targets, but can be useful on
|
||||
large machines as well.
|
||||
|
||||
To do this, `make` with `CFLAGS` set to `-DMEM1024K`, `-DMEM512K`,
|
||||
`-DMEM256K`, `-DMEM192K`, `-DMEM128K`' or `-DMEM96K`. These will
|
||||
target memory sizes as specified per the following table.
|
||||
|
||||
| | 1024kB | 512kB | 256kB | 192kB | 128kB | 96kB |
|
||||
| ------------- | --------- | ------- | ------- | ------- | ------- | ------ |
|
||||
| Total Bytes | 1,048,579 | 524,288 | 262,144 | 196,608 | 131,072 | 98,304 |
|
||||
| Image | 968,000 | 384,000 | 192,000 | 126,000 | 96,000 | 72,000 |
|
||||
| Data Stack | 512 | 512 | 512 | 512 | 512 | 512 |
|
||||
| Address Stack | 1,024 | 1,024 | 1,024 | 1,024 | 1,024 | 1,024 |
|
||||
| Remaining | 79,040 | 138,752 | 68,608 | 69,072 | 33,536 | 24,768 |
|
||||
|
||||
The remaining memory is available for use by the VM.
|
||||
|
||||
## Custom Image
|
||||
|
||||
For users of BSD, Linux, macOS, you can customize the image at
|
||||
build time.
|
||||
|
||||
|
|
|
@ -1,49 +1,29 @@
|
|||
# RETRO Cross Reference
|
||||
# Forth to RETRO Cross Reference
|
||||
|
||||
Definitions
|
||||
-----------
|
||||
RETRO :name ;
|
||||
ANS : name ;
|
||||
This is a quick overview of some differences between RETRO
|
||||
and traditional Forth.
|
||||
|
||||
| Category | Forth | RETRO |
|
||||
| ---------------------- | ----------------------- | ----------------------------- |
|
||||
| Definitions | `: name ;` | `:name ;` |
|
||||
| Numbers | `100 -12` | `#100 #-12` |
|
||||
| Characters (interpret) | `CHAR A CHAR D` | `$A $D` |
|
||||
| Characters (compile) | `[CHAR] A [CHAR] D` | `$A $D` |
|
||||
| Comments | `( This is a comment )` | `(This_is_a_comment)` |
|
||||
| Pointers (interpret) | `' Compiler` | `&Compiler` |
|
||||
| Pointers (compile) | `['] Compiler | `&Compiler` |
|
||||
| Conditionals #1 | `IF 1 THEN` | `[ #1 ] if` |
|
||||
| Conditionals #2 | `NOT IF 1 THEN` | `[ #1 ] -if` |
|
||||
| Conditionals #3 | `IF 1 ELSE 2 THEN` | `[ #1 ] [ #2 ] choose` |
|
||||
| Counted Loops | `10 0 DO LOOP` | `#10 [ ] times` |
|
||||
| Counted Loops w/Index | `10 0 DO I LOOP` | `#10 [ I ] times<with-index>` |
|
||||
| Unconditional Loops | `BEGIN AGAIN` | `repeat again` |
|
||||
| Return Stack | `10 >R ... R>` | `#10 push ... pop` |
|
||||
|
||||
Numbers
|
||||
-------
|
||||
RETRO #100 #-12
|
||||
ANS 100 -12
|
||||
RETRO conditionals and loops can be used outside of definitions, ANS ones can not.
|
||||
|
||||
Some forms are replaced by combinators.
|
||||
|
||||
Characters
|
||||
----------
|
||||
RETRO $A $D
|
||||
ANS CHAR A CHAR D
|
||||
|
||||
RETRO :foo $A ;
|
||||
ANS : foo [CHAR] A ;
|
||||
|
||||
|
||||
Comments
|
||||
--------
|
||||
RETRO (This_is_a_comment)
|
||||
ANS ( This is a comment )
|
||||
|
||||
|
||||
Pointers
|
||||
--------
|
||||
RETRO &Compiler
|
||||
ANS ' Compiler
|
||||
RETRO :foo &Heap ;
|
||||
ANS : foo ['] Heap ;
|
||||
|
||||
|
||||
Conditionals
|
||||
------------
|
||||
RETRO (flag) [ 'TRUE ] if
|
||||
ANS ( flag ) IF s" TRUE" THEN
|
||||
|
||||
RETRO (flag) [ 'FALSE ] -if
|
||||
ANS ( flag ) NOT IF s" FALSE" THEN
|
||||
|
||||
RETRO (flag) [ 'TRUE ] [ 'FALSE ] choose
|
||||
ANS ( flag ) IF s" TRUE" ELSE s" FALSE" THEN
|
||||
|
||||
RETRO conditionals can be used outside of definitions, ANS ones can not.
|
||||
FORTH
|
||||
>R ... R> [ ... ] dip
|
||||
DUP >R ... R> [ ... ] sip
|
||||
|
|
|
@ -20,10 +20,62 @@
|
|||
#define D_OFFSET_NAME 3
|
||||
|
||||
#define CELL int32_t
|
||||
|
||||
#define IMAGE_SIZE 524288 * 8
|
||||
#define STACK_DEPTH 4096
|
||||
#define ADDRESSES STACK_DEPTH * 3
|
||||
|
||||
#ifdef MEM1024K
|
||||
#undef IMAGE_SIZE
|
||||
#undef STACK_DEPTH
|
||||
#undef ADDRESSES
|
||||
#define IMAGE_SIZE 242000
|
||||
#define STACK_DEPTH 128
|
||||
#define ADDRESSES 256
|
||||
#else
|
||||
#endif
|
||||
|
||||
#ifdef MEM512K
|
||||
#undef IMAGE_SIZE
|
||||
#undef STACK_DEPTH
|
||||
#undef ADDRESSES
|
||||
#define IMAGE_SIZE 384000
|
||||
#define STACK_DEPTH 128
|
||||
#define ADDRESSES 256
|
||||
#else
|
||||
#endif
|
||||
|
||||
#ifdef MEM256K
|
||||
#undef IMAGE_SIZE
|
||||
#undef STACK_DEPTH
|
||||
#undef ADDRESSES
|
||||
#define IMAGE_SIZE 48000
|
||||
#define STACK_DEPTH 128
|
||||
#define ADDRESSES 256
|
||||
#else
|
||||
#endif
|
||||
|
||||
#ifdef MEM192K
|
||||
#undef IMAGE_SIZE
|
||||
#undef STACK_DEPTH
|
||||
#undef ADDRESSES
|
||||
#define IMAGE_SIZE 31500
|
||||
#define STACK_DEPTH 128
|
||||
#define ADDRESSES 256
|
||||
#else
|
||||
#endif
|
||||
|
||||
#ifdef MEM128K
|
||||
#undef IMAGE_SIZE
|
||||
#undef STACK_DEPTH
|
||||
#undef ADDRESSES
|
||||
#define IMAGE_SIZE 24000
|
||||
#define STACK_DEPTH 128
|
||||
#define ADDRESSES 256
|
||||
#else
|
||||
#endif
|
||||
|
||||
|
||||
extern CELL sp, rp, ip;
|
||||
extern CELL data[STACK_DEPTH];
|
||||
extern CELL address[ADDRESSES];
|
||||
|
|
Loading…
Reference in a new issue