Save about 400 bytes.
Increase value Z% array by 100 to 4195.
Reduce string array by 1 (to 199) since in BASIC the value is the last
index not the size.
In core move incrementing of function index into
INIT_CORE_SET_FUNCTION. Switch 3 IF GOTO to ON GOTO. Reuse some
temporary variables.
Saves about 480 bytes.
Bump value array from 3950 to 4096. This allows step4 (sumdown 2) to
pass. Previously only (sumdown 1) passed.
Uses stack PUSH*/POP*/PEEK* routines instead of direct X% and Y%
access. Seems to be about the same performance (maybe a 5% performance
hit at most).
This gives us a larger stack (1920 2-byte words of $C000 rather
than 200 words as before). The release stack at $CF00 stays the same
size (64 4-byte addr/level entries).
Also saves over 1K or program and array space. So take the opportunity
to expand Z% entry space from 3712 to 3950.
- Save over 450 bytes. Bump up Z values by 128.
- Fix function printing when function is embedded in something else by
using strings storage as a stack while printing rather than using
RR$
- Simplify some error messages and sanity checks in RELEASE.
- Strip linefeeds in run_argv_test.sh so that step6 arg test passes
for basic.
- Add gensym and convert or macro.
- Add gitignore entries for transpiled basic sources.
- Add conj/seq stubs so that step4 self-host loads (if non-step4
functions are commented out in core.mal)
- Bump up Z% value space by 256 spaces (1K)
- Remove old qb2cbm.sh
- Stop let binding eval on error. Also don't continue into EVAL if
error.
- if without a false position was freeing up too much when it
finished.
- fix reader so that it doesn't keep incrementing ref cnt of static
empty sequences.
step4 runs out of space attempting to load the program. Step2 and
step3 run out of memory (stack exhaustion) for more complicated forms.
- Use GOTO with return label on our stack instead of GOSUB for:
- APPLY function in types.in.bas
- "apply", "map" and "swap!" core functions
- Implement DO TCO. Change EVAL_AST to detect if we are called from DO
and exit one element early.
- Remove GOSUB recursion from EQUAL_Q
- Inline PAIR_Q. Reduce REPLACE stack use.
- Remove one level of GOSUB/stack by calling REP with GOTO
- Simplify mal/step2_eval.mal to remove use of (or ) macro in
eval_ast.
- Fix ON GOTO/GOSUB line detection in basicpp
- Add read-file which is similar to read-string but from a file name
rather than a string. This allows steps 0-2 to load although each
one eventuall crashes with out of memory after evaluating "123"
a few times.
- basicpp:
- Renumber the line numbers so they are ordinally increasing. This
saves 150 or so bytes because GOTO/GOSUB calls have smaller line
numbers.
- Shrink 'IF 123' -> 'IF123' for almost 300 byte savings.[:w
- Simplify PR_MEMORY_SUMMARY output. Save 75 bytes
- Add missing runtest.py change that allows basic tests to pass.
- Metadata support required expanding the type size (to 5 bits). This
also implies that ref cnt now only has 11 bits (2048).
- Added ^ reader macro (with-meta) which required some refactoring of
READ_MACRO to share code.
- Rename some more variables:
ZJ -> S
S% -> X%
ZR% -> Y%
ZM% -> Y
RE% -> D
This removes remaining % variables apart from the pre-allocated
arrays Z%, S% and X%.
- Modify ALLOC to take a type (rather than size) and take default
values to set for the 1-3 values/pointers. Let alloc do the
ownership taking of the referred values when appropriate.
- Add FORCE_SEQ_TYPE function to coerce sequence to given type. Fixes
apply and rest on vector. Simplifies concat.
- Use a double ON GOTO structure for calling the native functions in
DO_FUNCTION.
- Add some stub core functions.
- Move CHECK_FREE_LIST to debug.in.bas
- All changes together save over 1K
- Move apply logic in swap! to APPLY function in types and use that
for macroexpand
- Abort def! if error before updating the environment
- let* wasn't properly saving A2% for the final eval. Also, the
environment release check should be against the top-level EVAL env,
not the root repl env.
- (concat (list) ...) was broken so fix it to ignore empty lists that
aren't in the trailing position.
- nil, false and true in the reader were always being returned as
references (with an ref cnt) but we have the assumption that
references (14) are not ref cnt'd and are always part of a compound
type so fix the reader to just return the interned addresses.