SIGN IN SIGN UP
basic_MODE = cbm
BASICPP_OPTS = --mode $(basic_MODE)
FBC = fbc -lang qb
STEPS4_A = step4_if_fn_do.bas step5_tco.bas step6_file.bas \
step7_quote.bas step8_macros.bas step9_try.bas stepA_mal.bas
STEPS3_A = step3_env.bas $(STEPS4_A)
STEPS1_A = step1_read_print.bas step2_eval.bas $(STEPS3_A)
STEPS0_A = step0_repl.bas $(STEPS1_A)
all: $(if $(filter qbasic,$(basic_MODE)),$(subst .bas,,$(STEPS0_A)),$(STEPS0_A))
$(STEPS0_A): debug.in.bas mem.in.bas readline.in.bas
$(STEPS1_A): types.in.bas reader.in.bas printer.in.bas
$(STEPS3_A): env.in.bas
$(STEPS4_A): core.in.bas
step%.bas: step%.in.bas
./basicpp.py $(BASICPP_OPTS) $< > $@
2016-09-11 21:36:15 -05:00
tests/%.bas: tests/%.in.bas
./basicpp.py $(BASICPP_OPTS) $< > $@
# QBasic specific compilation rule
step%: step%.bas
$(FBC) $< -x $@
# CBM/C64 image rules
Basic: refactor of hashmaps, map loops, remove derefs. - Alternate memory layout of hash-maps: Instead of hash-maps being an alternating sequence of keys and values, combine the key/values into a single entry. In other words, switch from this: 8 -> next Z% index (0 for last) 14 key/value (alternating) To this: 8 -> next Z% index (0 for last) key value This requires refactoring of the sequence reader, EVAL_AST and especially DO_HASHMAP and DO_KEY_VALS. So that leads to the next big refactoring: - Change mapping/lapping constructs to share code: Several pieces of mapping/looping code have a common structure, so this moves that common structure to types.in.bas: MAP_LOOP_START, MAP_LOOP_UPDATE, MAP_LOOP_DONE. Then use this code in: - EVAL_AST - READ_SEQ_* - DO_MAP - DO_HASH_MAP - DO_KEYS_VALS This also fixes the issue that several of these looping constructs were creating new empty sequence entries instead of using the common ones at the beginning of memory. - Remove the use of DEREF_*. This isn't actually needed because we no longer create structure that refer to multiple levels of type 14 references. Replace DEREF_* with VAL_* which gets the value of a particular sequence element i.e. Z%(A+1,1). All together, the above changes save over 300 bytes. Also: - Fix empty nil/false/true entries so they are treated the same as other types of data with regards to reference counting and ALLOC/RELEASE. - Add a new memory summary function in debug.in.bas that just prints out free, value count, and references for the early scalar and empty list elements. Comment out the larger one. This saves about 90 bytes.
2016-11-15 22:38:09 -06:00
%.prg: %.bas
cat $< | tr "A-Z" "a-z" > $<.tmp
#cat $< | sed 's/["]\@<!\<\w\+\>["]\@!/\L&/g' > $<.tmp
petcat -w2 -nc -o $@ $<.tmp
#rm $<.tmp
2016-09-11 21:36:15 -05:00
2016-10-09 20:31:22 -05:00
mal.prg: stepA_mal.prg
cp $< $@
.args.mal.prg: .args.mal
petcat -text -w2 -o $@ $<
core.mal.prg: ../core.mal
petcat -text -w2 -o $@ $<
mal.d64: mal.prg .args.mal.prg core.mal.prg
c1541 -format "mal,01" d64 $@ \
-attach $@ \
-write $< mal \
-write .args.mal.prg .args.mal \
-write core.mal.prg core.mal
# Clean and Stats rules
.PHONY: clean
clean:
rm -f $(STEPS0_A) $(subst .bas,,$(STEPS0_A)) *.d64 *.prg
rm -rf ./internal