various build system improvements
This commit is contained in:
1 parent
d6bb5771cb
commit
faf520dec7
11 files changed
+196
-196
No files matched your search
@@ -181,31 +181,27 @@ HYBRID_WARNING = "*** WARNING *** Distributing kernal_hybrid.rom violates both o
|
||||
|
||||
GIT_COMMIT:= $(shell git log -1 --pretty='%h' | tr '[:lower:]' '[:upper:]')
|
||||
|
||||
# Rules - main XXX fast build does not always succeed, not yet clear, why
|
||||
# Rules - main - XXX building ROMs in parallel sometimes fails - most likely due to rules producing multiple targets
|
||||
|
||||
.PHONY: all clean updatebin
|
||||
|
||||
all:
|
||||
@echo
|
||||
@echo --- Building tools ---
|
||||
@echo
|
||||
$(MAKE) -j64 --output-sync=target $(TOOLS_LIST)
|
||||
@echo
|
||||
@echo --- Building Open ROMs ---
|
||||
@echo
|
||||
$(MAKE) $(TARGET_LIST) $(EXT_TARGET_LIST)
|
||||
@$(MAKE) -s $(DIR_ACME) $(SRC_ACME)
|
||||
@$(MAKE) -s -j`nproc` --output-sync=target $(TOOLS_LIST)
|
||||
@$(MAKE) -s --output-sync=target $(TARGET_LIST) $(EXT_TARGET_LIST)
|
||||
|
||||
clean:
|
||||
@rm -rf build src/basic/combined.s src/kernal/combined.s
|
||||
|
||||
updatebin:
|
||||
$(MAKE) -j64 --output-sync=target $(TARGET_LIST) $(TOOL_RELEASE)
|
||||
$(TOOL_RELEASE) -i ./build -o ./bin $(patsubst build/%,%,$(REL_TARGET_LIST))
|
||||
cp build/chargen_openroms.rom bin/chargen_openroms.rom
|
||||
@$(MAKE) -s $(DIR_ACME) $(SRC_ACME)
|
||||
@$(MAKE) --output-sync=target $(TARGET_LIST) $(TOOL_RELEASE)
|
||||
@$(TOOL_RELEASE) -i ./build -o ./bin $(patsubst build/%,%,$(REL_TARGET_LIST))
|
||||
@cp build/chargen_openroms.rom bin/chargen_openroms.rom
|
||||
|
||||
# Rules - tools
|
||||
|
||||
$(DIR_ACME) $(SRC_ACME) $(HDR_ACME):
|
||||
$(DIR_ACME) $(SRC_ACME):
|
||||
@echo
|
||||
@echo Fetching ACME source code...
|
||||
@git submodule init
|
||||
@@ -213,41 +209,41 @@ $(DIR_ACME) $(SRC_ACME) $(HDR_ACME):
|
||||
|
||||
$(TOOL_ASSEMBLER): $(DIR_ACME) $(SRC_ACME) $(HDR_ACME)
|
||||
@echo
|
||||
@echo Building $@ ...
|
||||
@echo Compiling tool $@ ...
|
||||
@mkdir -p build/tools
|
||||
@$(CC) -o $(TOOL_ASSEMBLER) $(SRC_ACME) -lm -w -I./assembler/acme/src
|
||||
|
||||
$(TOOL_PNGPREPARE): tools/pngprepare.c
|
||||
@echo
|
||||
@echo Building $@ ...
|
||||
@echo Compiling tool $@ ...
|
||||
@mkdir -p build/tools
|
||||
@$(CC) -O2 -Wall -I/usr/local/include -L/usr/local/lib -o $@ $< -lpng
|
||||
|
||||
build/tools/%: tools/%.c
|
||||
@echo
|
||||
@echo Building $@ ...
|
||||
@echo Compiling tool $@ ...
|
||||
@mkdir -p build/tools
|
||||
@$(CC) -O2 -Wall -o $@ $<
|
||||
|
||||
build/tools/%: tools/%.cc tools/common.h
|
||||
@echo
|
||||
@echo Building $@ ...
|
||||
@echo Compiling tool $@ ...
|
||||
@mkdir -p build/tools
|
||||
@$(CXX) -O2 -Wall -o $@ $<
|
||||
|
||||
# Rules - CHARGEN
|
||||
|
||||
build/chargen_openroms.rom: $(TOOL_PNGPREPARE) assets/8x8font.png
|
||||
$(TOOL_PNGPREPARE) charrom assets/8x8font.png $@
|
||||
@$(TOOL_PNGPREPARE) charrom assets/8x8font.png $@ 1>build/pngprepare.log
|
||||
|
||||
build/chargen_pxlfont.rom: bin/chargen_pxlfont_2.3.rom
|
||||
cp $< $@
|
||||
@cp $< $@
|
||||
|
||||
build/chargen_openroms.patched: $(TOOL_PATCH_CHARGEN) build/chargen_openroms.rom
|
||||
$(TOOL_PATCH_CHARGEN) -i build/chargen_openroms.rom -o $@ -n 7px-OpenROMs
|
||||
@$(TOOL_PATCH_CHARGEN) -i build/chargen_openroms.rom -o $@ -n 7px-OpenROMs
|
||||
|
||||
build/chargen_pxlfont.patched: $(TOOL_PATCH_CHARGEN) build/chargen_pxlfont.rom
|
||||
$(TOOL_PATCH_CHARGEN) -i build/chargen_pxlfont.rom -o $@ -n 6px-PXLfont
|
||||
@$(TOOL_PATCH_CHARGEN) -i build/chargen_pxlfont.rom -o $@ -n 6px-PXLfont
|
||||
|
||||
# Dependencies - BASIC, DOS, and KERNAL
|
||||
|
||||
@@ -415,37 +411,37 @@ $(DIR_X16)/kernal.seg_1 $(DIR_X16)/KERNAL_1_combined.vs $(DIR_X16)/KERNAL_1_comb
|
||||
|
||||
.PRECIOUS: build/target_%/OUTx_x.BIN
|
||||
build/target_%/OUTx_x.BIN:
|
||||
cat build/target_$*/OUTB_x.BIN build/target_$*/OUTK_x.BIN > $@
|
||||
@cat build/target_$*/OUTB_x.BIN build/target_$*/OUTK_x.BIN > $@
|
||||
|
||||
.PRECIOUS: build/kernal_%.rom
|
||||
build/kernal_%.rom:
|
||||
dd if=build/target_$*/OUTx_x.BIN bs=8192 count=1 skip=2 of=$@
|
||||
@dd if=build/target_$*/OUTx_x.BIN bs=8192 count=1 skip=2 of=$@ status=none
|
||||
|
||||
.PRECIOUS: build/basic_%.rom
|
||||
build/basic_%.rom:
|
||||
dd if=build/target_$*/OUTx_x.BIN bs=8192 count=1 skip=0 of=$@
|
||||
@dd if=build/target_$*/OUTx_x.BIN bs=8192 count=1 skip=0 of=$@ status=none
|
||||
|
||||
.PRECIOUS: build/symbols_%.vs
|
||||
build/symbols_%.vs:
|
||||
sort build/target_$*/BASIC_combined.vs build/target_$*/KERNAL_combined.vs | uniq | grep -v "__" > $@
|
||||
@sort build/target_$*/BASIC_combined.vs build/target_$*/KERNAL_combined.vs | uniq | grep -v "__" > $@
|
||||
|
||||
$(DIR_M65)/OUTx_0.BIN:
|
||||
cat $(DIR_M65)/OUTB_0.BIN $(DIR_M65)/OUTK_0.BIN > $@
|
||||
@cat $(DIR_M65)/OUTB_0.BIN $(DIR_M65)/OUTK_0.BIN > $@
|
||||
|
||||
$(DIR_M65)/kernal.seg_0: $(DIR_M65)/OUTx_0.BIN
|
||||
dd if=$(DIR_M65)/OUTx_0.BIN bs=8192 count=1 skip=2 of=$@
|
||||
@dd if=$(DIR_M65)/OUTx_0.BIN bs=8192 count=1 skip=2 of=$@ status=none
|
||||
|
||||
$(DIR_M65)/basic.seg_0: $(DIR_M65)/OUTx_0.BIN
|
||||
dd if=$(DIR_M65)/OUTx_0.BIN bs=8192 count=1 skip=0 of=$@
|
||||
@dd if=$(DIR_M65)/OUTx_0.BIN bs=8192 count=1 skip=0 of=$@ status=none
|
||||
|
||||
$(DIR_X16)/OUTx_0.BIN:
|
||||
cat $(DIR_X16)/OUTB_0.BIN $(DIR_X16)/OUTK_0.BIN > $@
|
||||
@cat $(DIR_X16)/OUTB_0.BIN $(DIR_X16)/OUTK_0.BIN > $@
|
||||
|
||||
$(DIR_X16)/kernal.seg_0: $(DIR_X16)/OUTx_0.BIN
|
||||
dd if=$(DIR_X16)/OUTx_0.BIN bs=8192 count=1 skip=1 of=$@
|
||||
@dd if=$(DIR_X16)/OUTx_0.BIN bs=8192 count=1 skip=1 of=$@ status=none
|
||||
|
||||
$(DIR_X16)/basic.seg_0: $(DIR_X16)/OUTx_0.BIN
|
||||
dd if=$(DIR_X16)/OUTx_0.BIN bs=8192 count=1 skip=0 of=$@
|
||||
@dd if=$(DIR_X16)/OUTx_0.BIN bs=8192 count=1 skip=0 of=$@ status=none
|
||||
|
||||
build/kernal_hybrid.rom: kernal $(DIR_GEN)/OUTK_x.BIN
|
||||
@echo
|
||||
@@ -457,44 +453,59 @@ build/kernal_hybrid.rom: kernal $(DIR_GEN)/OUTK_x.BIN
|
||||
cat $(DIR_GEN)/OUTK_x.BIN) > $@
|
||||
|
||||
build/symbols_hybrid.vs: $(DIR_GEN)/KERNAL_combined.vs
|
||||
sort $(DIR_GEN)/KERNAL_combined.vs | uniq | grep -v "__" > $@
|
||||
@sort $(DIR_GEN)/KERNAL_combined.vs | uniq | grep -v "__" > $@
|
||||
|
||||
# Rules - MEGA65 platform specific
|
||||
|
||||
build/padding_64_KB:
|
||||
@mkdir -p build
|
||||
dd if=/dev/zero bs=8192 count=8 of=build/padding_64_KB
|
||||
@dd if=/dev/zero bs=8192 count=8 of=build/padding_64_KB status=none
|
||||
|
||||
$(TARGET_M65_x) $(TARGET_M65_x_PXL): $(SEG_LIST_M65) build/padding_64_KB build/chargen_openroms.rom build/chargen_openroms.patched build/chargen_pxlfont.rom build/chargen_pxlfont.patched
|
||||
@echo
|
||||
cat $(DIR_M65)/dos.seg_1 > $(TARGET_M65_x)
|
||||
cat $(DIR_M65)/kernal.seg_1 >> $(TARGET_M65_x)
|
||||
cat $(DIR_M65)/basic.seg_1 >> $(TARGET_M65_x)
|
||||
cat $(DIR_M65)/basic.seg_0 >> $(TARGET_M65_x)
|
||||
cat build/chargen_openroms.rom >> $(TARGET_M65_x)
|
||||
cat build/chargen_openroms.patched >> $(TARGET_M65_x)
|
||||
cat $(DIR_M65)/kernal.seg_0 >> $(TARGET_M65_x)
|
||||
cat build/padding_64_KB >> $(TARGET_M65_x)
|
||||
@echo
|
||||
cat $(DIR_M65)/dos.seg_1 > $(TARGET_M65_x_PXL)
|
||||
cat $(DIR_M65)/kernal.seg_1 >> $(TARGET_M65_x_PXL)
|
||||
cat $(DIR_M65)/basic.seg_1 >> $(TARGET_M65_x_PXL)
|
||||
cat $(DIR_M65)/basic.seg_0 >> $(TARGET_M65_x_PXL)
|
||||
cat build/chargen_pxlfont.rom >> $(TARGET_M65_x_PXL)
|
||||
cat build/chargen_pxlfont.patched >> $(TARGET_M65_x_PXL)
|
||||
cat $(DIR_M65)/kernal.seg_0 >> $(TARGET_M65_x_PXL)
|
||||
cat build/padding_64_KB >> $(TARGET_M65_x_PXL)
|
||||
@echo
|
||||
@echo //-------------------------------------------------------------------------------------------
|
||||
@echo // Making ROM image for MEGA65 - with Open ROMs chargen
|
||||
@echo //-------------------------------------------------------------------------------------------
|
||||
@cat $(DIR_M65)/dos.seg_1 > $(TARGET_M65_x)
|
||||
@cat $(DIR_M65)/kernal.seg_1 >> $(TARGET_M65_x)
|
||||
@cat $(DIR_M65)/basic.seg_1 >> $(TARGET_M65_x)
|
||||
@cat $(DIR_M65)/basic.seg_0 >> $(TARGET_M65_x)
|
||||
@cat build/chargen_openroms.rom >> $(TARGET_M65_x)
|
||||
@cat build/chargen_openroms.patched >> $(TARGET_M65_x)
|
||||
@cat $(DIR_M65)/kernal.seg_0 >> $(TARGET_M65_x)
|
||||
@cat build/padding_64_KB >> $(TARGET_M65_x)
|
||||
@echo
|
||||
@echo
|
||||
@echo
|
||||
@echo //-------------------------------------------------------------------------------------------
|
||||
@echo // Making ROM image for MEGA65 - with PXL font chargen
|
||||
@echo //-------------------------------------------------------------------------------------------
|
||||
@cat $(DIR_M65)/dos.seg_1 > $(TARGET_M65_x_PXL)
|
||||
@cat $(DIR_M65)/kernal.seg_1 >> $(TARGET_M65_x_PXL)
|
||||
@cat $(DIR_M65)/basic.seg_1 >> $(TARGET_M65_x_PXL)
|
||||
@cat $(DIR_M65)/basic.seg_0 >> $(TARGET_M65_x_PXL)
|
||||
@cat build/chargen_pxlfont.rom >> $(TARGET_M65_x_PXL)
|
||||
@cat build/chargen_pxlfont.patched >> $(TARGET_M65_x_PXL)
|
||||
@cat $(DIR_M65)/kernal.seg_0 >> $(TARGET_M65_x_PXL)
|
||||
@cat build/padding_64_KB >> $(TARGET_M65_x_PXL)
|
||||
@echo
|
||||
|
||||
# Rules - platform 'Commander X16' specific
|
||||
|
||||
$(TARGET_X16_x): $(SEG_LIST_X16) build/chargen_openroms.rom
|
||||
@echo
|
||||
cat $(DIR_X16)/basic.seg_0 > $(TARGET_X16_x)
|
||||
cat $(DIR_X16)/kernal.seg_0 >> $(TARGET_X16_x)
|
||||
cat build/chargen_openroms.rom >> $(TARGET_X16_x)
|
||||
cat $(DIR_X16)/basic.seg_1 >> $(TARGET_X16_x)
|
||||
cat $(DIR_X16)/kernal.seg_1 >> $(TARGET_X16_x)
|
||||
@echo
|
||||
@echo
|
||||
@echo //-------------------------------------------------------------------------------------------
|
||||
@echo // Making ROM image for Commander X16 - with Open ROMs chargen
|
||||
@echo //-------------------------------------------------------------------------------------------
|
||||
@cat $(DIR_X16)/basic.seg_0 > $(TARGET_X16_x)
|
||||
@cat $(DIR_X16)/kernal.seg_0 >> $(TARGET_X16_x)
|
||||
@cat build/chargen_openroms.rom >> $(TARGET_X16_x)
|
||||
@cat $(DIR_X16)/basic.seg_1 >> $(TARGET_X16_x)
|
||||
@cat $(DIR_X16)/kernal.seg_1 >> $(TARGET_X16_x)
|
||||
@echo
|
||||
|
||||
# Rules - tests
|
||||
|
||||
+13
-13
@@ -11,14 +11,14 @@
|
||||
|
||||
|
||||
|
||||
; Hardware platform and brand
|
||||
; --- Hardware platform and brand
|
||||
|
||||
;; #CONFIG# PLATFORM_COMMODORE_64 YES
|
||||
;; #CONFIG# BRAND_CUSTOM_BUILD YES
|
||||
!macro CONFIG_CUSTOM_BRAND { !pet "custom build" }
|
||||
|
||||
|
||||
; Processor instruction set
|
||||
; --- Processor instruction set
|
||||
|
||||
;; #CONFIG# CPU_MOS_6502 YES
|
||||
;; #CONFIG# CPU_DTV_6502 NO
|
||||
@@ -28,7 +28,7 @@
|
||||
;; #CONFIG# CPU_CSG_65CE02 NO
|
||||
|
||||
|
||||
; Memory model
|
||||
; --- Memory model
|
||||
|
||||
;; #CONFIG# MEMORY_MODEL_38K NO
|
||||
;; #CONFIG# MEMORY_MODEL_46K NO
|
||||
@@ -36,7 +36,7 @@
|
||||
;; #CONFIG# MEMORY_MODEL_60K NO
|
||||
|
||||
|
||||
; IEC bus configuration
|
||||
; --- IEC bus configuration
|
||||
|
||||
;; #CONFIG# IEC YES
|
||||
;; #CONFIG# IEC_DOLPHINDOS YES
|
||||
@@ -47,7 +47,7 @@
|
||||
;; #CONFIG# IEC_BURST_CIA2 NO ; please keep disabled for now
|
||||
|
||||
|
||||
; Tape deck configuration
|
||||
; --- Tape deck configuration
|
||||
|
||||
;; #CONFIG# TAPE_NORMAL YES
|
||||
;; #CONFIG# TAPE_TURBO YES
|
||||
@@ -56,14 +56,14 @@
|
||||
;; #CONFIG# TAPE_NO_MOTOR_CONTROL NO
|
||||
|
||||
|
||||
; RS-232 configuration
|
||||
; --- RS-232 configuration
|
||||
|
||||
;; #CONFIG# RS232_ACIA NO ; please keep disabled for now
|
||||
;; #CONFIG# RS232_UP2400 NO ; please keep disabled for now
|
||||
;; #CONFIG# RS232_UP9600 NO ; please keep disabled for now
|
||||
|
||||
|
||||
; Sound support
|
||||
; --- Sound support
|
||||
|
||||
;; #CONFIG# SID_2ND_ADDRESS NO
|
||||
;; #CONFIG# SID_3RD_ADDRESS NO
|
||||
@@ -73,7 +73,7 @@
|
||||
;; #CONFIG# SID_D7XX NO
|
||||
|
||||
|
||||
; Keyboard settings
|
||||
; --- Keyboard settings
|
||||
|
||||
;; #CONFIG# LEGACY_SCNKEY NO
|
||||
;; #CONFIG# KEYBOARD_C128 NO
|
||||
@@ -122,13 +122,13 @@
|
||||
;; #CONFIG# KEYCMD_F14 NO
|
||||
|
||||
|
||||
; Screen editor
|
||||
; --- Screen editor
|
||||
|
||||
;; #CONFIG# EDIT_STOPQUOTE YES
|
||||
;; #CONFIG# EDIT_TABULATORS NO
|
||||
|
||||
|
||||
; Software features
|
||||
; --- Software features
|
||||
|
||||
;; #CONFIG# PANIC_SCREEN YES
|
||||
;; #CONFIG# DOS_WEDGE YES
|
||||
@@ -137,7 +137,7 @@
|
||||
;; #CONFIG# BCD_SAFE_INTERRUPTS YES
|
||||
|
||||
|
||||
; Eye candy
|
||||
; --- Eye candy
|
||||
|
||||
;; #CONFIG# COLORS_BRAND NO
|
||||
;; #CONFIG# BANNER_SIMPLE NO
|
||||
@@ -145,12 +145,12 @@
|
||||
;; #CONFIG# SHOW_FEATURES YES
|
||||
|
||||
|
||||
; Debug options
|
||||
; --- Debug options
|
||||
|
||||
;; #CONFIG# DBG_STUBS_BRK NO
|
||||
;; #CONFIG# DBG_PRINTF NO
|
||||
|
||||
|
||||
; Other
|
||||
; --- Other
|
||||
|
||||
;; #CONFIG# COMPRESSION_LVL_2 NO
|
||||
+9
-8
@@ -10,17 +10,17 @@
|
||||
|
||||
|
||||
|
||||
; Hardware platform and brand
|
||||
; --- Hardware platform and brand
|
||||
|
||||
;; #CONFIG# PLATFORM_COMMANDER_X16 YES
|
||||
|
||||
|
||||
; Memory model
|
||||
; --- Memory model
|
||||
|
||||
;; #CONFIG# MEMORY_MODEL_38K YES
|
||||
|
||||
|
||||
; Keyboard settings
|
||||
; --- Keyboard settings
|
||||
|
||||
;; #CONFIG# PROGRAMMABLE_KEYS NO
|
||||
|
||||
@@ -44,13 +44,13 @@
|
||||
;; #CONFIG# KEYCMD_F14 NO
|
||||
|
||||
|
||||
; Screen editor
|
||||
; --- Screen editor
|
||||
|
||||
;; #CONFIG# EDIT_STOPQUOTE NO
|
||||
;; #CONFIG# EDIT_TABULATORS NO
|
||||
|
||||
|
||||
; Software features
|
||||
; --- Software features
|
||||
|
||||
;; #CONFIG# PANIC_SCREEN NO
|
||||
;; #CONFIG# DOS_WEDGE NO
|
||||
@@ -59,7 +59,7 @@
|
||||
;; #CONFIG# BCD_SAFE_INTERRUPTS YES
|
||||
|
||||
|
||||
; Eye candy
|
||||
; --- Eye candy
|
||||
|
||||
;; #CONFIG# COLORS_BRAND NO
|
||||
;; #CONFIG# BANNER_SIMPLE NO
|
||||
@@ -67,11 +67,12 @@
|
||||
;; #CONFIG# SHOW_FEATURES NO
|
||||
|
||||
|
||||
; Debug options
|
||||
; --- Debug options
|
||||
|
||||
;; #CONFIG# DBG_STUBS_BRK NO
|
||||
;; #CONFIG# DBG_PRINTF NO
|
||||
|
||||
; Other
|
||||
|
||||
; --- Other
|
||||
|
||||
;; #CONFIG# COMPRESSION_LVL_2 NO
|
||||
+12
-12
@@ -11,13 +11,13 @@
|
||||
|
||||
|
||||
|
||||
; Hardware platform and brand
|
||||
; --- Hardware platform and brand
|
||||
|
||||
;; #CONFIG# PLATFORM_COMMODORE_64 YES
|
||||
;; #CONFIG# BRAND_GENERIC YES
|
||||
|
||||
|
||||
; Processor instruction set
|
||||
; --- Processor instruction set
|
||||
|
||||
;; #CONFIG# CPU_MOS_6502 YES
|
||||
;; #CONFIG# CPU_DTV_6502 NO
|
||||
@@ -27,7 +27,7 @@
|
||||
;; #CONFIG# CPU_CSG_65CE02 NO
|
||||
|
||||
|
||||
; Memory model
|
||||
; --- Memory model
|
||||
|
||||
;; #CONFIG# MEMORY_MODEL_38K NO
|
||||
;; #CONFIG# MEMORY_MODEL_46K NO
|
||||
@@ -35,7 +35,7 @@
|
||||
;; #CONFIG# MEMORY_MODEL_60K NO
|
||||
|
||||
|
||||
; IEC bus configuration
|
||||
; --- IEC bus configuration
|
||||
|
||||
;; #CONFIG# IEC YES
|
||||
;; #CONFIG# IEC_DOLPHINDOS YES
|
||||
@@ -44,7 +44,7 @@
|
||||
;; #CONFIG# IEC_JIFFYDOS_BLANK YES
|
||||
|
||||
|
||||
; Tape deck configuration
|
||||
; --- Tape deck configuration
|
||||
|
||||
;; #CONFIG# TAPE_NORMAL YES
|
||||
;; #CONFIG# TAPE_TURBO YES
|
||||
@@ -53,7 +53,7 @@
|
||||
;; #CONFIG# TAPE_NO_MOTOR_CONTROL NO
|
||||
|
||||
|
||||
; Sound support
|
||||
; --- Sound support
|
||||
|
||||
;; #CONFIG# SID_2ND_ADDRESS NO
|
||||
;; #CONFIG# SID_3RD_ADDRESS NO
|
||||
@@ -63,7 +63,7 @@
|
||||
;; #CONFIG# SID_D7XX NO
|
||||
|
||||
|
||||
; Keyboard settings
|
||||
; --- Keyboard settings
|
||||
|
||||
;; #CONFIG# LEGACY_SCNKEY NO
|
||||
;; #CONFIG# KEYBOARD_C128 NO
|
||||
@@ -110,13 +110,13 @@
|
||||
;; #CONFIG# KEYCMD_F14 NO
|
||||
|
||||
|
||||
; Screen editor
|
||||
; --- Screen editor
|
||||
|
||||
;; #CONFIG# EDIT_STOPQUOTE YES
|
||||
;; #CONFIG# EDIT_TABULATORS NO
|
||||
|
||||
|
||||
; Software features
|
||||
; --- Software features
|
||||
|
||||
;; #CONFIG# PANIC_SCREEN YES
|
||||
;; #CONFIG# DOS_WEDGE YES
|
||||
@@ -125,7 +125,7 @@
|
||||
;; #CONFIG# BCD_SAFE_INTERRUPTS YES
|
||||
|
||||
|
||||
; Eye candy
|
||||
; --- Eye candy
|
||||
|
||||
;; #CONFIG# COLORS_BRAND YES
|
||||
;; #CONFIG# BANNER_SIMPLE NO
|
||||
@@ -133,12 +133,12 @@
|
||||
;; #CONFIG# SHOW_FEATURES YES
|
||||
|
||||
|
||||
; Debug options
|
||||
; --- Debug options
|
||||
|
||||
;; #CONFIG# DBG_STUBS_BRK NO
|
||||
;; #CONFIG# DBG_PRINTF NO
|
||||
|
||||
|
||||
; Other
|
||||
; --- Other
|
||||
|
||||
;; #CONFIG# COMPRESSION_LVL_2 NO
|
||||
+10
-10
@@ -11,20 +11,20 @@
|
||||
|
||||
|
||||
|
||||
; Hardware platform
|
||||
; --- Hardware platform
|
||||
|
||||
;; #CONFIG# PLATFORM_COMMODORE_64 YES
|
||||
;; #CONFIG# MB_M65 YES
|
||||
|
||||
|
||||
; Memory model
|
||||
; --- Memory model
|
||||
|
||||
;; #CONFIG# MEMORY_MODEL_38K NO
|
||||
;; #CONFIG# MEMORY_MODEL_46K NO
|
||||
;; #CONFIG# MEMORY_MODEL_50K YES
|
||||
|
||||
|
||||
; IEC bus configuration
|
||||
; --- IEC bus configuration
|
||||
|
||||
;; #CONFIG# IEC YES
|
||||
;; #CONFIG# IEC_DOLPHINDOS NO
|
||||
@@ -34,7 +34,7 @@
|
||||
;; #CONFIG# IEC_BURST_M65 NO ; please keep disabled for now
|
||||
|
||||
|
||||
; Tape deck configuration
|
||||
; --- Tape deck configuration
|
||||
|
||||
;; #CONFIG# TAPE_NORMAL YES
|
||||
;; #CONFIG# TAPE_TURBO YES
|
||||
@@ -43,7 +43,7 @@
|
||||
;; #CONFIG# TAPE_NO_MOTOR_CONTROL YES
|
||||
|
||||
|
||||
; Keyboard settings
|
||||
; --- Keyboard settings
|
||||
|
||||
;; #CONFIG# LEGACY_SCNKEY NO
|
||||
;; #CONFIG# KEYBOARD_C65 NO ; untested
|
||||
@@ -95,13 +95,13 @@
|
||||
!macro CONFIG_KEYCMD_F14 { !pet "rem f14" }
|
||||
|
||||
|
||||
; Screen editor
|
||||
; --- Screen editor
|
||||
|
||||
;; #CONFIG# EDIT_STOPQUOTE YES
|
||||
;; #CONFIG# EDIT_TABULATORS NO
|
||||
|
||||
|
||||
; Software features
|
||||
; --- Software features
|
||||
|
||||
;; #CONFIG# PANIC_SCREEN YES
|
||||
;; #CONFIG# DOS_WEDGE YES
|
||||
@@ -110,19 +110,19 @@
|
||||
;; #CONFIG# BCD_SAFE_INTERRUPTS YES
|
||||
|
||||
|
||||
; Built-in DOS configuration
|
||||
; --- Built-in DOS configuration
|
||||
|
||||
;; #CONFIG# UNIT_SDCARD 0 ; do not change, DOS is not implemented yet
|
||||
;; #CONFIG# UNIT_FLOPPY 0 ; do not change, DOS is not implemented yet
|
||||
;; #CONFIG# UNIT_RAMDISK 0 ; do not change, DOS is not implemented yet
|
||||
|
||||
|
||||
; Debug options
|
||||
; --- Debug options
|
||||
|
||||
;; #CONFIG# DBG_STUBS_BRK NO
|
||||
;; #CONFIG# DBG_PRINTF NO
|
||||
|
||||
|
||||
; Other
|
||||
; --- Other
|
||||
|
||||
;; #CONFIG# COMPRESSION_LVL_2 NO
|
||||
+12
-12
@@ -11,13 +11,13 @@
|
||||
|
||||
|
||||
|
||||
; Hardware platform and brand
|
||||
; --- Hardware platform and brand
|
||||
|
||||
;; #CONFIG# PLATFORM_COMMODORE_64 YES
|
||||
;; #CONFIG# BRAND_TESTING YES
|
||||
|
||||
|
||||
; Processor instruction set
|
||||
; --- Processor instruction set
|
||||
|
||||
;; #CONFIG# CPU_MOS_6502 YES
|
||||
;; #CONFIG# CPU_DTV_6502 NO
|
||||
@@ -27,7 +27,7 @@
|
||||
;; #CONFIG# CPU_CSG_65CE02 NO
|
||||
|
||||
|
||||
; Memory model
|
||||
; --- Memory model
|
||||
|
||||
;; #CONFIG# MEMORY_MODEL_38K NO
|
||||
;; #CONFIG# MEMORY_MODEL_46K NO
|
||||
@@ -35,7 +35,7 @@
|
||||
;; #CONFIG# MEMORY_MODEL_60K YES
|
||||
|
||||
|
||||
; IEC bus configuration
|
||||
; --- IEC bus configuration
|
||||
|
||||
;; #CONFIG# IEC YES
|
||||
;; #CONFIG# IEC_DOLPHINDOS YES
|
||||
@@ -44,7 +44,7 @@
|
||||
;; #CONFIG# IEC_JIFFYDOS_BLANK NO
|
||||
|
||||
|
||||
; Tape deck configuration
|
||||
; --- Tape deck configuration
|
||||
|
||||
;; #CONFIG# TAPE_NORMAL NO
|
||||
;; #CONFIG# TAPE_TURBO YES
|
||||
@@ -53,7 +53,7 @@
|
||||
;; #CONFIG# TAPE_NO_MOTOR_CONTROL NO
|
||||
|
||||
|
||||
; Sound support
|
||||
; --- Sound support
|
||||
|
||||
;; #CONFIG# SID_2ND_ADDRESS NO
|
||||
;; #CONFIG# SID_3RD_ADDRESS NO
|
||||
@@ -63,7 +63,7 @@
|
||||
;; #CONFIG# SID_D7XX NO
|
||||
|
||||
|
||||
; Keyboard settings
|
||||
; --- Keyboard settings
|
||||
|
||||
;; #CONFIG# LEGACY_SCNKEY YES
|
||||
;; #CONFIG# KEYBOARD_C128 NO
|
||||
@@ -110,13 +110,13 @@
|
||||
;; #CONFIG# KEYCMD_F14 NO
|
||||
|
||||
|
||||
; Screen editor
|
||||
; --- Screen editor
|
||||
|
||||
;; #CONFIG# EDIT_STOPQUOTE YES
|
||||
;; #CONFIG# EDIT_TABULATORS YES
|
||||
|
||||
|
||||
; Software features
|
||||
; --- Software features
|
||||
|
||||
;; #CONFIG# PANIC_SCREEN YES
|
||||
;; #CONFIG# DOS_WEDGE YES
|
||||
@@ -125,7 +125,7 @@
|
||||
;; #CONFIG# BCD_SAFE_INTERRUPTS YES
|
||||
|
||||
|
||||
; Eye candy
|
||||
; --- Eye candy
|
||||
|
||||
;; #CONFIG# COLORS_BRAND NO
|
||||
;; #CONFIG# BANNER_SIMPLE YES
|
||||
@@ -133,12 +133,12 @@
|
||||
;; #CONFIG# SHOW_FEATURES YES
|
||||
|
||||
|
||||
; Debug options
|
||||
; --- Debug options
|
||||
|
||||
;; #CONFIG# DBG_STUBS_BRK NO
|
||||
;; #CONFIG# DBG_PRINTF YES
|
||||
|
||||
|
||||
; Other
|
||||
; --- Other
|
||||
|
||||
;; #CONFIG# COMPRESSION_LVL_2 NO
|
||||
+11
-11
@@ -11,13 +11,13 @@
|
||||
|
||||
|
||||
|
||||
; Hardware platform and brand
|
||||
; --- Hardware platform and brand
|
||||
|
||||
;; #CONFIG# PLATFORM_COMMODORE_64 YES
|
||||
;; #CONFIG# MB_U64 YES
|
||||
|
||||
|
||||
; Memory model
|
||||
; --- Memory model
|
||||
|
||||
;; #CONFIG# MEMORY_MODEL_38K NO
|
||||
;; #CONFIG# MEMORY_MODEL_46K NO
|
||||
@@ -25,7 +25,7 @@
|
||||
;; #CONFIG# MEMORY_MODEL_60K NO
|
||||
|
||||
|
||||
; IEC bus configuration
|
||||
; --- IEC bus configuration
|
||||
|
||||
;; #CONFIG# IEC YES
|
||||
;; #CONFIG# IEC_DOLPHINDOS YES
|
||||
@@ -34,7 +34,7 @@
|
||||
;; #CONFIG# IEC_JIFFYDOS_BLANK YES
|
||||
|
||||
|
||||
; Tape deck configuration
|
||||
; --- Tape deck configuration
|
||||
|
||||
;; #CONFIG# TAPE_NORMAL YES
|
||||
;; #CONFIG# TAPE_TURBO YES
|
||||
@@ -43,7 +43,7 @@
|
||||
;; #CONFIG# TAPE_NO_MOTOR_CONTROL NO
|
||||
|
||||
|
||||
; Sound support
|
||||
; --- Sound support
|
||||
|
||||
;; #CONFIG# SID_2ND_ADDRESS NO
|
||||
;; #CONFIG# SID_3RD_ADDRESS NO
|
||||
@@ -53,7 +53,7 @@
|
||||
;; #CONFIG# SID_D7XX NO
|
||||
|
||||
|
||||
; Keyboard settings
|
||||
; --- Keyboard settings
|
||||
|
||||
;; #CONFIG# LEGACY_SCNKEY NO
|
||||
;; #CONFIG# KEYBOARD_C128 NO
|
||||
@@ -100,13 +100,13 @@
|
||||
;; #CONFIG# KEYCMD_F14 NO
|
||||
|
||||
|
||||
; Screen editor
|
||||
; --- Screen editor
|
||||
|
||||
;; #CONFIG# EDIT_STOPQUOTE YES
|
||||
;; #CONFIG# EDIT_TABULATORS NO
|
||||
|
||||
|
||||
; Software features
|
||||
; --- Software features
|
||||
|
||||
;; #CONFIG# PANIC_SCREEN YES
|
||||
;; #CONFIG# DOS_WEDGE YES
|
||||
@@ -115,7 +115,7 @@
|
||||
;; #CONFIG# BCD_SAFE_INTERRUPTS YES
|
||||
|
||||
|
||||
; Eye candy
|
||||
; --- Eye candy
|
||||
|
||||
;; #CONFIG# COLORS_BRAND YES
|
||||
;; #CONFIG# BANNER_SIMPLE NO
|
||||
@@ -123,12 +123,12 @@
|
||||
;; #CONFIG# SHOW_FEATURES YES
|
||||
|
||||
|
||||
; Debug options
|
||||
; --- Debug options
|
||||
|
||||
;; #CONFIG# DBG_STUBS_BRK NO
|
||||
;; #CONFIG# DBG_PRINTF NO
|
||||
|
||||
|
||||
; Other
|
||||
; --- Other
|
||||
|
||||
;; #CONFIG# COMPRESSION_LVL_2 NO
|
||||
+59
-71
@@ -54,17 +54,10 @@ void printUsage()
|
||||
" <input dir/file list>" << "\n\n";
|
||||
}
|
||||
|
||||
void printBannerCollectAnalyse()
|
||||
void printBanner()
|
||||
{
|
||||
printBannerLineTop();
|
||||
std::cout << "// Segment '" << CMD_segInfo << "' - collecting and analysing routines" << "\n";
|
||||
printBannerLineBottom();
|
||||
}
|
||||
|
||||
void printBannerBinCompile()
|
||||
{
|
||||
printBannerLineTop();
|
||||
std::cout << "// Segment '" << CMD_segInfo << "' - binning and compiling the assembly" << "\n";
|
||||
std::cout << "// Building segment '" << CMD_segInfo << "'" << "\n";
|
||||
printBannerLineBottom();
|
||||
}
|
||||
|
||||
@@ -140,10 +133,10 @@ public:
|
||||
bool isSolved() const;
|
||||
|
||||
void addToProblem(SourceFile *routine);
|
||||
void fillGap(DualStream &logOutput, int gapAddress, const std::list<SourceFile *> &routines);
|
||||
void placeHighRoutines(DualStream &logOutput);
|
||||
void performObviousSteps(DualStream &logOutput);
|
||||
void removeUselessGaps(DualStream &logOutput);
|
||||
void fillGap(std::ofstream &dbgOutput, int gapAddress, const std::list<SourceFile *> &routines);
|
||||
void placeHighRoutines(std::ofstream &dbgOutput);
|
||||
void performObviousSteps(std::ofstream &dbgOutput);
|
||||
void removeUselessGaps(std::ofstream &dbgOutput);
|
||||
void sortFloatingRoutinesBySize();
|
||||
|
||||
std::map<int, SourceFile *> fixedRoutines; // routines with location already fixed
|
||||
@@ -158,7 +151,7 @@ public:
|
||||
class Solver
|
||||
{
|
||||
public:
|
||||
explicit Solver(BinningProblem &problem) : problem(problem), logOutput(logFile, std::cout) {}
|
||||
explicit Solver(BinningProblem &problem) : problem(problem), logOutput(dbgOutput, std::cout) {}
|
||||
|
||||
void run();
|
||||
|
||||
@@ -168,9 +161,9 @@ public:
|
||||
private:
|
||||
|
||||
BinningProblem &problem;
|
||||
std::ofstream logFile;
|
||||
|
||||
DualStream logOutput;
|
||||
std::ofstream dbgOutput;
|
||||
DualStream logOutput;
|
||||
};
|
||||
|
||||
//
|
||||
@@ -344,10 +337,11 @@ void calcRoutineSizes()
|
||||
|
||||
// All written - now launch the assembler
|
||||
|
||||
const std::string cmd = "cd " + filePath + " && " + CMD_assembler +
|
||||
" --color --outfile /dev/null --symbollist " + CMD_segName + "_sizetest.sym " +
|
||||
outFileNameBare;
|
||||
std::cout << "command: " << cmd << "\n" << std::flush;
|
||||
const std::string cmdParams = std::string(" ") + "--color --outfile /dev/null --symbollist " +
|
||||
CMD_segName + "_sizetest.sym " + outFileNameBare;
|
||||
const std::string cmd = "cd " + filePath + " && " + CMD_assembler + cmdParams;
|
||||
|
||||
std::cout << "asm call:" << cmdParams << "\n" << std::flush;
|
||||
if (0 != system(cmd.c_str()))
|
||||
{
|
||||
ERROR("assembler running failed");
|
||||
@@ -441,8 +435,8 @@ void prepareBinningProblem()
|
||||
|
||||
const std::string logFileNamePath = CMD_outDir + DIR_SEPARATOR + CMD_segName + "_binproblem.log";
|
||||
unlink(logFileNamePath.c_str());
|
||||
std::ofstream logFile(logFileNamePath, std::fstream::out | std::fstream::trunc);
|
||||
DualStream logOutput(logFile, std::cout);
|
||||
std::ofstream dbgOutput(logFileNamePath, std::fstream::out | std::fstream::trunc);
|
||||
DualStream logOutput(dbgOutput, std::cout);
|
||||
|
||||
// Print out code length information
|
||||
|
||||
@@ -465,7 +459,7 @@ void prepareBinningProblem()
|
||||
floating_high = " ";
|
||||
}
|
||||
|
||||
logOutput << "file: " << floating_high << sourceFile.fileName << spacing << "size: " << std::to_string(sourceFile.codeLength) << "\n";
|
||||
dbgOutput << "file: " << floating_high << sourceFile.fileName << spacing << "size: " << std::to_string(sourceFile.codeLength) << "\n";
|
||||
}
|
||||
|
||||
// Create the binning problem
|
||||
@@ -492,22 +486,20 @@ void prepareBinningProblem()
|
||||
|
||||
for (auto& gap : GLOBAL_binningProblem.gaps)
|
||||
{
|
||||
logOutput << "gap address: $" << std::uppercase << std::hex << gap.first <<
|
||||
dbgOutput << "gap address: $" << std::uppercase << std::hex << gap.first <<
|
||||
" size: " << std::to_string(gap.second) << "\n";
|
||||
}
|
||||
|
||||
logOutput << "\n";
|
||||
dbgOutput << "\n";
|
||||
|
||||
// Close the log file
|
||||
|
||||
if (!logFile.good()) ERROR(std::string("error writing log file '") + logFileNamePath + "'");
|
||||
logFile.close();
|
||||
if (!dbgOutput.good()) ERROR(std::string("error writing log file '") + logFileNamePath + "'");
|
||||
dbgOutput.close();
|
||||
}
|
||||
|
||||
void solveBinningProblem()
|
||||
{
|
||||
std::cout << "trying to solve the routine binning problem" << "\n\n";
|
||||
|
||||
// Do some routine actions on the binning problem object
|
||||
|
||||
Solver solver(GLOBAL_binningProblem);
|
||||
@@ -527,13 +519,11 @@ void compileSegment()
|
||||
|
||||
const std::string outFileNameBare = CMD_segName + "_combined.s";
|
||||
const std::string vlfFileNamePath = CMD_segName + "_combined.vs";
|
||||
const std::string repFileNamePath = CMD_segName + "_combined.rep";
|
||||
const std::string symFileNamePath = CMD_segName + "_combined.sym";
|
||||
const std::string filePath = CMD_outDir + DIR_SEPARATOR;
|
||||
const std::string outFileNamePath = filePath + outFileNameBare;
|
||||
unlink(outFileNamePath.c_str());
|
||||
unlink(vlfFileNamePath.c_str());
|
||||
unlink(repFileNamePath.c_str());
|
||||
unlink(symFileNamePath.c_str());
|
||||
std::ofstream outFile(outFileNamePath, std::fstream::out | std::fstream::trunc);
|
||||
if (!outFile.good()) ERROR(std::string("can't open temporary file '") + outFileNamePath + "'");
|
||||
@@ -575,14 +565,14 @@ void compileSegment()
|
||||
|
||||
// All written - now launch the assembler
|
||||
|
||||
const std::string cmd = "cd " + filePath + " && " + CMD_assembler +
|
||||
" --strict-segments --color" +
|
||||
" --outfile " + CMD_outFile +
|
||||
" --symbollist " + symFileNamePath +
|
||||
" --vicelabels " + vlfFileNamePath +
|
||||
" --report " + repFileNamePath +
|
||||
" " + outFileNameBare;
|
||||
std::cout << "command: " << cmd << "\n" << std::flush;
|
||||
const std::string cmdParams = std::string(" ") + "--strict-segments --color" +
|
||||
" --outfile " + CMD_outFile +
|
||||
" --symbollist " + symFileNamePath +
|
||||
" --vicelabels " + vlfFileNamePath +
|
||||
" " + outFileNameBare;
|
||||
const std::string cmd = "cd " + filePath + " && " + CMD_assembler + cmdParams;
|
||||
|
||||
std::cout << "asm call:" << cmdParams << "\n" << std::flush;
|
||||
if (0 != system(cmd.c_str()))
|
||||
{
|
||||
ERROR("assembler running failed");
|
||||
@@ -597,14 +587,12 @@ int main(int argc, char **argv)
|
||||
{
|
||||
parseCommandLine(argc, argv);
|
||||
|
||||
printBannerCollectAnalyse();
|
||||
printBanner();
|
||||
|
||||
readSourceFiles();
|
||||
checkInputFileLabels();
|
||||
calcRoutineSizes();
|
||||
|
||||
printBannerBinCompile();
|
||||
|
||||
prepareBinningProblem();
|
||||
solveBinningProblem();
|
||||
compileSegment();
|
||||
@@ -629,24 +617,23 @@ SourceFile::SourceFile(const std::string &fileName, const std::string &dirName)
|
||||
layoutProcessingDone(false)
|
||||
{
|
||||
const std::string fileNameWithPath = dirName + DIR_SEPARATOR + fileName;
|
||||
std::cout << "reading file: " << fileNameWithPath << "\n";
|
||||
|
||||
// Open the file
|
||||
|
||||
std::ifstream inFile;
|
||||
inFile.open(fileNameWithPath);
|
||||
if (!inFile.good()) ERROR("unable to open file");
|
||||
if (!inFile.good()) ERROR(fileNameWithPath + " - unable to open file");
|
||||
|
||||
// Read the content
|
||||
|
||||
inFile.seekg(0, inFile.end);
|
||||
auto fileLength = inFile.tellg();
|
||||
if (fileLength == 0) ERROR("file is empty");
|
||||
if (fileLength == 0) ERROR(fileNameWithPath + " - file is empty");
|
||||
content.resize(fileLength);
|
||||
|
||||
inFile.seekg(0);
|
||||
inFile.read(&content[0], fileLength);
|
||||
if (!inFile.good()) ERROR("error reading file content");
|
||||
if (!inFile.good()) ERROR(fileNameWithPath + " - error reading file content");
|
||||
if (content.back() != '\n') content.push_back('\n');
|
||||
|
||||
inFile.close();
|
||||
@@ -1054,7 +1041,7 @@ void BinningProblem::addToProblem(SourceFile *routine)
|
||||
}
|
||||
}
|
||||
|
||||
void BinningProblem::fillGap(DualStream &logOutput, int gapAddress, const std::list<SourceFile *> &routines)
|
||||
void BinningProblem::fillGap(std::ofstream &dbgOutput, int gapAddress, const std::list<SourceFile *> &routines)
|
||||
{
|
||||
int offset = 0;
|
||||
std::string spacing;
|
||||
@@ -1064,7 +1051,7 @@ void BinningProblem::fillGap(DualStream &logOutput, int gapAddress, const std::l
|
||||
int targetAddr = gapAddress + offset;
|
||||
|
||||
spacing.resize(GLOBAL_maxFileNameLen + 4 - routine->fileName.length(), ' ');
|
||||
logOutput << " $" << std::hex << targetAddr << std::dec << ": " <<
|
||||
dbgOutput << " $" << std::hex << targetAddr << std::dec << ": " <<
|
||||
routine->fileName << spacing << "size: " << routine->codeLength << "\n";
|
||||
|
||||
fixedRoutines[targetAddr] = routine;
|
||||
@@ -1080,22 +1067,22 @@ void BinningProblem::fillGap(DualStream &logOutput, int gapAddress, const std::l
|
||||
|
||||
if (offset == gaps[gapAddress])
|
||||
{
|
||||
logOutput << "filled to the last byte" << "\n";
|
||||
dbgOutput << "filled to the last byte" << "\n";
|
||||
}
|
||||
else if (!isSolved())
|
||||
{
|
||||
logOutput << "filled in - dropped bytes: " << gaps[gapAddress] - offset << "\n";
|
||||
dbgOutput << "filled in - dropped bytes: " << gaps[gapAddress] - offset << "\n";
|
||||
statWasted += gaps[gapAddress] - offset;
|
||||
}
|
||||
else
|
||||
{
|
||||
logOutput << "out of routines" << "\n";
|
||||
dbgOutput << "out of routines" << "\n";
|
||||
}
|
||||
|
||||
gaps.erase(gapAddress);
|
||||
}
|
||||
|
||||
void BinningProblem::placeHighRoutines(DualStream &logOutput)
|
||||
void BinningProblem::placeHighRoutines(std::ofstream &dbgOutput)
|
||||
{
|
||||
// Place routines which has to be stored in the high ROM area
|
||||
// It is expected there will be very few of them, so no complicated algorithms here
|
||||
@@ -1159,11 +1146,11 @@ void BinningProblem::placeHighRoutines(DualStream &logOutput)
|
||||
fixedRoutines[targetAddr] = *iterRoutine;
|
||||
statFree -= routineSize;
|
||||
|
||||
logOutput << "reducing gap $" << std::hex << gapAddress << std::dec <<
|
||||
dbgOutput << "reducing gap $" << std::hex << gapAddress << std::dec <<
|
||||
" to size " << gaps[gapAddress] << "\n";
|
||||
|
||||
spacing.resize(GLOBAL_maxFileNameLen + 4 - (*iterRoutine)->fileName.length(), ' ');
|
||||
logOutput << " $" << std::hex << targetAddr << std::dec << ": " <<
|
||||
dbgOutput << " $" << std::hex << targetAddr << std::dec << ": " <<
|
||||
(*iterRoutine)->fileName << spacing << "size: " <<
|
||||
(*iterRoutine)->codeLength << "\n";
|
||||
|
||||
@@ -1172,7 +1159,7 @@ void BinningProblem::placeHighRoutines(DualStream &logOutput)
|
||||
}
|
||||
}
|
||||
|
||||
void BinningProblem::performObviousSteps(DualStream &logOutput)
|
||||
void BinningProblem::performObviousSteps(std::ofstream &dbgOutput)
|
||||
{
|
||||
// Get the size of the biggest routine; if there is just one gap which
|
||||
// can handle it - put the routine exactly there
|
||||
@@ -1201,7 +1188,7 @@ void BinningProblem::performObviousSteps(DualStream &logOutput)
|
||||
if (!lastGap && gaps.size() == 1)
|
||||
{
|
||||
lastGap = true;
|
||||
logOutput << "selected gap: $" << std::hex << gapAddress << std::dec <<
|
||||
dbgOutput << "selected gap: $" << std::hex << gapAddress << std::dec <<
|
||||
" (size: " << gaps[gapAddress] << ") - the last remaining" << "\n";
|
||||
}
|
||||
|
||||
@@ -1216,12 +1203,12 @@ void BinningProblem::performObviousSteps(DualStream &logOutput)
|
||||
|
||||
if (gaps.size() > 1)
|
||||
{
|
||||
logOutput << "forced reducing gap $" << std::hex << gapAddress << std::dec <<
|
||||
dbgOutput << "forced reducing gap $" << std::hex << gapAddress << std::dec <<
|
||||
" to size " << gaps[gapAddress] << "\n";
|
||||
}
|
||||
|
||||
spacing.resize(GLOBAL_maxFileNameLen + 4 - floatingRoutines.back()->fileName.length(), ' ');
|
||||
logOutput << " $" << std::hex << targetAddr << std::dec << ": " <<
|
||||
dbgOutput << " $" << std::hex << targetAddr << std::dec << ": " <<
|
||||
floatingRoutines.back()->fileName << spacing << "size: " <<
|
||||
floatingRoutines.back()->codeLength << "\n";
|
||||
|
||||
@@ -1233,7 +1220,7 @@ void BinningProblem::performObviousSteps(DualStream &logOutput)
|
||||
}
|
||||
}
|
||||
|
||||
void BinningProblem::removeUselessGaps(DualStream &logOutput)
|
||||
void BinningProblem::removeUselessGaps(std::ofstream &dbgOutput)
|
||||
{
|
||||
// Get the size of the smallest floating routine,
|
||||
// remove all the gaps which are smaller in size
|
||||
@@ -1248,7 +1235,7 @@ void BinningProblem::removeUselessGaps(DualStream &logOutput)
|
||||
{
|
||||
if (gap.second < minUsefulSize)
|
||||
{
|
||||
logOutput << "dropping gap: $" << std::hex << gap.first << std::dec << " (size: " << gap.second << ")" << "\n";
|
||||
dbgOutput << "dropping gap: $" << std::hex << gap.first << std::dec << " (size: " << gap.second << ")" << "\n";
|
||||
statWasted += gap.second;
|
||||
gaps.erase(gap.first);
|
||||
repeat = true;
|
||||
@@ -1276,7 +1263,7 @@ void Solver::run()
|
||||
|
||||
const std::string logFileNamePath = CMD_outDir + DIR_SEPARATOR + CMD_segName + "_binsolution.log";
|
||||
unlink(logFileNamePath.c_str());
|
||||
logFile.open(logFileNamePath, std::fstream::out | std::fstream::trunc);
|
||||
dbgOutput.open(logFileNamePath, std::fstream::out | std::fstream::trunc);
|
||||
|
||||
// Sort the floating routines, just to be extra sure
|
||||
|
||||
@@ -1284,42 +1271,43 @@ void Solver::run()
|
||||
|
||||
// Place routines which should be stored in high-ROM
|
||||
|
||||
problem.placeHighRoutines(logOutput);
|
||||
problem.placeHighRoutines(dbgOutput);
|
||||
|
||||
// Run the solver until all is done
|
||||
|
||||
while (!problem.gaps.empty() && !problem.floatingRoutines.empty())
|
||||
{
|
||||
problem.performObviousSteps(logOutput);
|
||||
problem.removeUselessGaps(logOutput);
|
||||
problem.performObviousSteps(dbgOutput);
|
||||
problem.removeUselessGaps(dbgOutput);
|
||||
|
||||
if (problem.gaps.empty() || problem.floatingRoutines.empty()) break;
|
||||
|
||||
int gapAddr = selectGapToFill();
|
||||
|
||||
logOutput << "selected gap: $" << std::hex << gapAddr << std::dec << " (size: " << problem.gaps[gapAddr] << ")" << "\n";
|
||||
dbgOutput << "selected gap: $" << std::hex << gapAddr << std::dec << " (size: " << problem.gaps[gapAddr] << ")" << "\n";
|
||||
|
||||
std::list<SourceFile *> partialSolution;
|
||||
findPartialSolution(problem.gaps[gapAddr], partialSolution);
|
||||
problem.fillGap(logOutput, gapAddr, partialSolution);
|
||||
problem.fillGap(dbgOutput, gapAddr, partialSolution);
|
||||
}
|
||||
|
||||
// Print out the result
|
||||
|
||||
if (problem.isSolved())
|
||||
{
|
||||
logOutput << "\n" << "all the routines sucessfully placed" << "\n\n";
|
||||
|
||||
dbgOutput << "\n";
|
||||
logOutput << "all routines sucessfully placed" << "\n";
|
||||
dbgOutput << "\n";
|
||||
logOutput << "segment statistics:" << "\n";
|
||||
// logOutput << " - total size: " << problem.statSize << "\n"; - for BASIC contains filling gap too
|
||||
logOutput << " - wasted bytes: " << problem.statWasted << "\n";
|
||||
logOutput << " - still free: " << problem.statFree - problem.statWasted << "\n\n";
|
||||
logOutput << " - still free: " << problem.statFree - problem.statWasted << "\n";
|
||||
}
|
||||
|
||||
// Close the log file
|
||||
|
||||
if (!logFile.good()) ERROR(std::string("error writing log file '") + logFileNamePath + "'");
|
||||
logFile.close();
|
||||
if (!dbgOutput.good()) ERROR(std::string("error writing log file '") + logFileNamePath + "'");
|
||||
dbgOutput.close();
|
||||
}
|
||||
|
||||
int Solver::selectGapToFill()
|
||||
|
||||
@@ -248,7 +248,7 @@ void writeConstants()
|
||||
|
||||
outFile.close();
|
||||
|
||||
std::cout << std::string("Constants written to: ") + CMD_outFile + "\n\n";
|
||||
std::cout << std::string("floating point constants written to: ") + CMD_outFile + "\n\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1106,7 +1106,7 @@ void DataSet::addStrings(const StringEntryList &stringList)
|
||||
|
||||
void DataSet::process()
|
||||
{
|
||||
std::cout << "Processing file '" << CMD_cnfFile << "', layout '" << layoutName() << "'" << std::endl;
|
||||
std::cout << "processing file '" << CMD_cnfFile << "', layout '" << layoutName() << "'" << std::endl;
|
||||
|
||||
generateConfigDepStrings();
|
||||
validateLists();
|
||||
@@ -1792,7 +1792,7 @@ void printUsage()
|
||||
void printBanner()
|
||||
{
|
||||
printBannerLineTop();
|
||||
std::cout << "; Generating compressed messages and BASIC tokens\n";
|
||||
std::cout << "// Generating compressed messages and BASIC tokens\n";
|
||||
printBannerLineBottom();
|
||||
}
|
||||
|
||||
@@ -1907,7 +1907,7 @@ void writeStrings()
|
||||
|
||||
outFile.close();
|
||||
|
||||
std::cout << std::string("Compressed strings written to: ") + CMD_outFile + "\n\n";
|
||||
std::cout << std::string("compressed strings written to: '") + CMD_outFile + "'\n\n";
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
+1
-1
@@ -361,7 +361,7 @@ void process_file(int mode, char *outputfilename)
|
||||
// 4KB = 2x 256 char = 2KB charsets
|
||||
for(charsets = 0 ; charsets<2 ; charsets++) {
|
||||
if (bytes>=4096) break;
|
||||
fprintf(stderr,"yheight=%d\n",height);
|
||||
fprintf(stdout,"yheight=%d\n",height);
|
||||
for (y=0; y<height; y++) {
|
||||
png_byte* row = row_pointers[y];
|
||||
int byte=0;
|
||||
|
||||
Reference in new issue
Block a user