Skip to content

Commit

Permalink
Build an integer version of the command line compiler.
Browse files Browse the repository at this point in the history
Thanks to Piotr D. Kaczorowski for the initial patch.
  • Loading branch information
dmsc committed Aug 4, 2024
1 parent 3d369f2 commit f932bb1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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 \
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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) \
Expand Down
6 changes: 5 additions & 1 deletion manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
=====================
Expand Down
12 changes: 12 additions & 0 deletions rules.mak
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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 $@ $^
Expand All @@ -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 $<
Expand Down

0 comments on commit f932bb1

Please sign in to comment.