From f932bb1a1df49fe2db02e3f8d332372587c829d4 Mon Sep 17 00:00:00 2001 From: Daniel Serpell Date: Sun, 4 Aug 2024 00:54:46 -0400 Subject: [PATCH] Build an integer version of the command line compiler. Thanks to Piotr D. Kaczorowski for the initial patch. --- Makefile | 6 +++++- manual.md | 6 +++++- rules.mak | 12 ++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index ab4ed34..d796e83 100644 --- a/Makefile +++ b/Makefile @@ -98,7 +98,7 @@ include version.mk ATR=build/fastbasic.atr ZIPFILE=build/fastbasic.zip -PROGS=build/bin/fb.xex build/bin/fbi.xex build/bin/fbc.xex +PROGS=build/bin/fb.xex build/bin/fbi.xex build/bin/fbc.xex build/bin/fbci.xex # To allow cross-compilation (ie, from Linux to Windows), we build two versions # of the compiler, one for the host (build machine) and one for the target. @@ -146,6 +146,7 @@ SAMPLE_X_BAS=$(SAMPLE_FP_BAS:fp/%=%) $(SAMPLE_INT_BAS:int/%=%) FILES=\ build/disk/fb.com \ build/disk/fbc.com \ + build/disk/fbci.com \ build/disk/fbi.com \ build/disk/readme \ build/disk/manual.txt \ @@ -334,9 +335,11 @@ CMD_BAS_SRC=\ RT_OBJS_FP=$(RT_AS_SRC:src/%.asm=build/obj/fp/%.o) IDE_OBJS_FP=$(IDE_AS_SRC:src/%.asm=build/obj/fp/%.o) CMD_OBJS_FP=$(CMD_AS_SRC:src/%.asm=build/obj/fp/%.o) +CMD_OBJS_INT=$(CMD_AS_SRC:src/%.asm=build/obj/int/%.o) A800_FP_OBJS=$(A800_FP_AS_SRC:src/%.asm=build/obj/fp/%.o) IDE_BAS_OBJS_FP=$(IDE_BAS_SRC:src/%.bas=build/obj/fp/%.o) CMD_BAS_OBJS_FP=$(CMD_BAS_SRC:build/gen/%.bas=build/obj/fp/%.o) +CMD_BAS_OBJS_INT=$(CMD_BAS_SRC:build/gen/%.bas=build/obj/int/%.o) RT_OBJS_ROM_FP=$(RT_AS_SRC:src/%.asm=build/obj/rom-fp/%.o) A800_FP_ROM_OBJS=$(A800_FP_AS_SRC:src/%.asm=build/obj/rom-fp/%.o) @@ -649,6 +652,7 @@ OBJS=$(RT_OBJS_FP) \ $(A5200_OBJS) \ $(RT_OBJS_ROM_FP) $(A800_FP_ROM_OBJS) \ $(CMD_OBJS_FP) $(CMD_BAS_OBJS_FP) \ + $(CMD_OBJS_INT) $(CMD_BAS_OBJS_INT) \ $(RT_OBJS_INT) \ $(IDE_OBJS_INT) $(IDE_BAS_OBJS_INT) \ $(A800_OBJS) \ diff --git a/manual.md b/manual.md index 9f994be..7429809 100644 --- a/manual.md +++ b/manual.md @@ -46,7 +46,7 @@ Currently, FastBasic supports: - Available as a full version `FB.COM`, as a smaller integer-only `FBI.COM`, and as a command-line compiler - `FBC.COM`. + `FBC.COM` and `FBCI.COM`. First Steps @@ -192,6 +192,10 @@ file names in the command line; if not given the compiler will prompt you to input a file name. +If you don't use floating point, using +the integer versions (`FBI` and `FBCI`) +will compile to a smaller file. + Advanced Editor Usage ===================== diff --git a/rules.mak b/rules.mak index 038d9f0..eb58905 100644 --- a/rules.mak +++ b/rules.mak @@ -40,6 +40,7 @@ distclean: clean build/gen/int/editor.asm build/gen/fp/editor.asm \ $(CMD_BAS_SRC) \ $(CMD_BAS_SRC:build/gen/%.bas=build/gen/fp/%.asm) \ + $(CMD_BAS_SRC:build/gen/%.bas=build/gen/int/%.asm) \ $(COMPILER_HOST) $(COMPILER_TARGET) $(COMPILER_COMMON) \ $(COMPILER_MANIFESTS) $(Q)printf "%s\n" $(BUILD_FOLDERS) | sort -r | while read folder; do \ @@ -190,6 +191,13 @@ build/bin/fbc.xex: $(CMD_OBJS_FP) $(A800_FP_OBJS) $(CMD_BAS_OBJS_FP) | build/bin @$(SED) -n -e 's/^[^ ]* 00\([0-9A-F]*\) .*HEAP_RUN.*/\1/p' $(@:.xex=.lbl) @printf "\e[0m" +build/bin/fbci.xex: $(CMD_OBJS_INT) $(A800_OBJS) $(CMD_BAS_OBJS_INT) | build/bin $(LD65_HOST) + $(ECHO) "Linking command line integer compiler" + $(Q)$(LD65_HOST) $(LD65_FLAGS) -Ln $(@:.xex=.lbl) -vm -m $(@:.xex=.map) -o $@ $^ + @printf "\e[1;33mCOMMAND LINE INTEGER COMPILER HEAP START: " + @$(SED) -n -e 's/^[^ ]* 00\([0-9A-F]*\) .*HEAP_RUN.*/\1/p' $(@:.xex=.lbl) + @printf "\e[0m" + build/bin/fbi.xex: $(IDE_OBJS_INT) $(A800_OBJS) $(IDE_BAS_OBJS_INT) | build/bin $(LD65_HOST) $(ECHO) "Linking integer IDE" $(Q)$(LD65_HOST) $(LD65_FLAGS) -Ln $(@:.xex=.lbl) -vm -m $(@:.xex=.map) -o $@ $^ @@ -211,6 +219,10 @@ build/gen/fp/%.asm: build/gen/%.bas $(FASTBASIC_HOST) | build/gen/fp $(ECHO) "Compiling FP BASIC $<" $(Q)$(FASTBASIC_HOST) $(FB_FP_FLAGS) -o $@ -c $< +build/gen/int/%.asm: build/gen/%.bas $(FASTBASIC_HOST) | build/gen/int + $(ECHO) "Compiling INT BASIC $<" + $(Q)$(FASTBASIC_HOST) $(FB_INT_FLAGS) -o $@ -c $< + build/gen/fp/%.asm: src/%.bas $(FASTBASIC_HOST) | build/gen/fp $(ECHO) "Compiling FP BASIC $<" $(Q)$(FASTBASIC_HOST) $(FB_FP_FLAGS) -o $@ -c $<