Basic: refactor memory layout.
authorJoel Martin <github@martintribe.org>
Fri, 18 Nov 2016 06:54:04 +0000 (00:54 -0600)
committerJoel Martin <github@martintribe.org>
Fri, 18 Nov 2016 07:26:23 +0000 (01:26 -0600)
commitd7a6c2d6c9c39c726a130c0599432a89d8cb7825
tree356e00f6af2ea98f39351e39aca6bb544fc6efd6
parent6aaee33ea88f2e05350e0d129337875733e3ca63
Basic: refactor memory layout.

Use a one dimensional array for the Z% value array. This enables
lists, vectors, environments and metadata pointers to all save off
1 word (2 bytes) of space.

Split the memory init and functions into mem.in.bas.

In addition, change type 14 to be metdata rather than any type 16-31.

This change saves about 560 bytes (no second array dimension
subscripts) and reduces Z% value usage by 10%-15%.

Bump the number of Z% words by 200 (to 8591). This enables
self-hosting up to step7 (without step8-stepA functions in core.mal).
19 files changed:
basic/Makefile
basic/core.in.bas
basic/debug.in.bas
basic/env.in.bas
basic/mem.in.bas [new file with mode: 0644]
basic/printer.in.bas
basic/reader.in.bas
basic/step1_read_print.in.bas
basic/step2_eval.in.bas
basic/step3_env.in.bas
basic/step4_if_fn_do.in.bas
basic/step5_tco.in.bas
basic/step6_file.in.bas
basic/step7_quote.in.bas
basic/step8_macros.in.bas
basic/step9_try.in.bas
basic/stepA_mal.in.bas
basic/types.in.bas
basic/variables.txt