pass symbols to VICE emulator
This commit is contained in:
1 parent
33b6b36fcb
commit
041a4750dd
2 files changed
+91
-62
No files matched your search
@@ -89,13 +89,25 @@ build/chargen.rom: $(TOOL_PNGPREPARE) assets/8x8font.png
|
||||
|
||||
# Dependencies - BASIC and KERNAL
|
||||
|
||||
build/target_generic/OUTB.BIN: $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(GEN_BASIC) $(SRCDIR_BASIC_generic) c64/,,config_generic.s $(foreach dir,$(SRCDIR_BASIC_generic),$(wildcard $(dir)/*.s))
|
||||
build/target_mega65/OUTB.BIN: $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(GEN_BASIC) $(SRCDIR_BASIC_mega65) c64/,,config_mega65.s $(foreach dir,$(SRCDIR_BASIC_mega65),$(wildcard $(dir)/*.s))
|
||||
build/target_ultimate64/OUTB.BIN: $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(GEN_BASIC) $(SRCDIR_BASIC_ultimate64) c64/,,config_ultimate64.s $(foreach dir,$(SRCDIR_BASIC_ultimate64),$(wildcard $(dir)/*.s))
|
||||
build/target_generic/OUTB.BIN build/target_generic/BASIC_combined.vs: \
|
||||
$(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(GEN_BASIC) $(SRCDIR_BASIC_generic) \
|
||||
c64/,,config_generic.s $(foreach dir,$(SRCDIR_BASIC_generic),$(wildcard $(dir)/*.s))
|
||||
build/target_mega65/OUTB.BIN build/target_mega65/BASIC_combined.vs: \
|
||||
$(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(GEN_BASIC) $(SRCDIR_BASIC_mega65) \
|
||||
c64/,,config_mega65.s $(foreach dir,$(SRCDIR_BASIC_mega65),$(wildcard $(dir)/*.s))
|
||||
build/target_ultimate64/OUTB.BIN build/target_ultimate64/BASIC_combined.vs: \
|
||||
$(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(GEN_BASIC) $(SRCDIR_BASIC_ultimate64) \
|
||||
c64/,,config_ultimate64.s $(foreach dir,$(SRCDIR_BASIC_ultimate64),$(wildcard $(dir)/*.s))
|
||||
|
||||
build/target_generic/OUTK.BIN: $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(GEN_KERNAL) $(SRCDIR_KERNAL_generic) c64/,,config_generic.s $(foreach dir,$(SRCDIR_KERNAL_generic),$(wildcard $(dir)/*.s))
|
||||
build/target_mega65/OUTK.BIN: $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(GEN_KERNAL) $(SRCDIR_KERNAL_mega65) c64/,,config_mega65.s $(foreach dir,$(SRCDIR_KERNAL_mega65),$(wildcard $(dir)/*.s))
|
||||
build/target_ultimate64/OUTK.BIN: $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(GEN_KERNAL) $(SRCDIR_KERNAL_ultimate64) c64/,,config_ultimate64.s $(foreach dir,$(SRCDIR_KERNAL_ultimate64),$(wildcard $(dir)/*.s))
|
||||
build/target_generic/OUTK.BIN build/target_generic/KERNAL_combined.vs: \
|
||||
$(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(GEN_KERNAL) $(SRCDIR_KERNAL_generic) \
|
||||
c64/,,config_generic.s $(foreach dir,$(SRCDIR_KERNAL_generic),$(wildcard $(dir)/*.s))
|
||||
build/target_mega65/OUTK.BIN build/target_mega65/KERNAL_combined.vs: \
|
||||
$(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(GEN_KERNAL) $(SRCDIR_KERNAL_mega65) \
|
||||
c64/,,config_mega65.s $(foreach dir,$(SRCDIR_KERNAL_mega65),$(wildcard $(dir)/*.s))
|
||||
build/target_ultimate64/OUTK.BIN build/target_ultimate64/KERNAL_combined.vs: \
|
||||
$(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(GEN_KERNAL) $(SRCDIR_KERNAL_ultimate64) \
|
||||
c64/,,config_ultimate64.s $(foreach dir,$(SRCDIR_KERNAL_ultimate64),$(wildcard $(dir)/*.s))
|
||||
|
||||
build/target_generic/newrom: build/target_generic/OUTB.BIN build/target_generic/OUTK.BIN
|
||||
build/target_mega65/newrom: build/target_mega65/OUTB.BIN build/target_mega65/OUTK.BIN
|
||||
@@ -109,27 +121,31 @@ build/basic_generic.rom: build/target_generic/newrom
|
||||
build/basic_mega65.rom: build/target_mega65/newrom
|
||||
build/basic_ultimate64.rom: build/target_ultimate64/newrom
|
||||
|
||||
build/symbols_generic.vs: build/target_generic/BASIC_combined.vs build/target_generic/KERNAL_combined.vs
|
||||
build/symbols_mega65.vs: build/target_generic/BASIC_mega65.vs build/target_generic/KERNAL_mega65.vs
|
||||
build/symbols_ultimate64.vs: build/target_ultimate64/BASIC_combined.vs build/target_ultimate64/KERNAL_combined.vs
|
||||
|
||||
# Rules - BASIC and KERNAL
|
||||
|
||||
build/,generated/packed_messages.s: $(TOOL_COMPRESS_TEXT)
|
||||
@mkdir -p build/,generated
|
||||
$(TOOL_COMPRESS_TEXT) > build/,generated/packed_messages.s
|
||||
|
||||
.PRECIOUS: build/target_%/OUTB.BIN
|
||||
build/target_%/OUTB.BIN:
|
||||
.PRECIOUS: build/target_%/OUTB.BIN build/target_%/BASIC_combined.vs
|
||||
build/target_%/OUTB.BIN build/target_%/BASIC_combined.vs:
|
||||
@mkdir -p build/target_$*
|
||||
@rm -f $@* build/target_$*/BASIC*
|
||||
@$(TOOL_BUILD_SEGMENT) -s BASIC -i BASIC-$* -o OUTB.BIN -t build/target_$* -l a000 -h e4d2 c64/,,config_$*.s $(SRCDIR_BASIC_$*) $(GEN_BASIC)
|
||||
@$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -s BASIC -i BASIC-$* -o OUTB.BIN -d build/target_$* -l a000 -h e4d2 c64/,,config_$*.s $(SRCDIR_BASIC_$*) $(GEN_BASIC)
|
||||
|
||||
.PRECIOUS: build/target_%/OUTK.BIN
|
||||
build/target_%/OUTK.BIN:
|
||||
.PRECIOUS: build/target_%/OUTK.BIN build/target_%/KERNAL_combined.vs
|
||||
build/target_%/OUTK.BIN build/target_%/KERNAL_combined.vs:
|
||||
@mkdir -p build/target_$*
|
||||
@rm -f $@* build/target_$*/KERNAL*
|
||||
@$(TOOL_BUILD_SEGMENT) -s KERNAL -i KERNAL-$* -o OUTK.BIN -t build/target_$* -l e4d3 -h ffff c64/,,config_$*.s $(SRCDIR_KERNAL_$*) $(GEN_KERNAL)
|
||||
@$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -s KERNAL -i KERNAL-$* -o OUTK.BIN -d build/target_$* -l e4d3 -h ffff c64/,,config_$*.s $(SRCDIR_KERNAL_$*) $(GEN_KERNAL)
|
||||
|
||||
.PRECIOUS: build/target_%/newrom
|
||||
build/target_%/newrom:
|
||||
cat build/target_$*/OUTB.BIN build/target_$*/OUTK.BIN > $@
|
||||
cat build/target_$*/OUTB.BIN build/target_$*/OUTK.BIN > $@
|
||||
|
||||
.PRECIOUS: build/kernal_%.rom
|
||||
build/kernal_%.rom:
|
||||
@@ -139,6 +155,10 @@ build/kernal_%.rom:
|
||||
build/basic_%.rom:
|
||||
dd if=build/target_$*/newrom bs=8192 count=1 skip=0 of=$@
|
||||
|
||||
.PRECIOUS: build/symbols_%.vs
|
||||
build/symbols_%.vs:
|
||||
sort build/target_$*/BASIC_combined.vs build/target_$*/KERNAL_combined.vs | uniq > $@
|
||||
|
||||
# Rules - platform 'Mega 65' specific
|
||||
|
||||
build/newc65.rom: build/kernal_mega65.rom build/basic_mega65.rom build/chargen.rom Makefile
|
||||
@@ -150,23 +170,24 @@ build/newc65.rom: build/kernal_mega65.rom build/basic_mega65.rom build/chargen.r
|
||||
|
||||
# Rules - tests
|
||||
|
||||
test: build/kernal_generic.rom build/basic_generic.rom
|
||||
x64 -kernal build/kernal_generic.rom -basic build/basic_generic.rom -8 empty.d64
|
||||
.PHONY: test test_generic test_mega65 test_ultimate64 test_m65 testremote testsimilarity
|
||||
|
||||
test_generic: build/kernal_generic.rom build/basic_generic.rom
|
||||
x64 -kernal build/kernal_generic.rom -basic build/basic_generic.rom -8 empty.d64
|
||||
test: test_generic
|
||||
|
||||
test_mega65: build/kernal_mega65.rom build/basic_mega65.rom
|
||||
x64 -kernal build/kernal_mega65.rom -basic build/basic_mega65.rom -8 empty.d64
|
||||
test_generic: build/kernal_generic.rom build/basic_generic.rom build/symbols_generic.vs
|
||||
x64 -kernal build/kernal_generic.rom -basic build/basic_generic.rom -moncommands build/symbols_generic.vs -8 empty.d64
|
||||
|
||||
test_ultimate64: build/kernal_ultimate64.rom build/basic_ultimate64.rom
|
||||
x64 -kernal build/kernal_ultimate64.rom -basic build/basic_ultimate64.rom -8 empty.d64
|
||||
test_mega65: build/kernal_mega65.rom build/basic_mega65.rom build/symbols_mega65.vs
|
||||
x64 -kernal build/kernal_mega65.rom -basic build/basic_mega65.rom -moncommands build/symbols_mega65.vs -8 empty.d64
|
||||
|
||||
test_ultimate64: build/kernal_ultimate64.rom build/basic_ultimate64.rom build/symbols_ultimate64.vs
|
||||
x64 -kernal build/kernal_ultimate64.rom -basic build/basic_ultimate64.rom -moncommands build/symbols_ultimate64.vs -8 empty.d64
|
||||
|
||||
test_m65: build/newc65
|
||||
m65 -b ../mega65-core/bin/mega65r1.bit -k ../mega65-core/bin/KICKUP.M65 -R build/newc65.rom -4
|
||||
|
||||
testremote: build/kernal_generic.rom build/basic_generic.rom
|
||||
x64 -kernal build/kernal_generic.rom -basic build/basic_generic.rom -remotemonitor
|
||||
testremote: build/kernal_generic.rom build/basic_generic.rom build/symbols_generic.vs
|
||||
x64 -kernal build/kernal_generic.rom -basic build/basic_generic.rom -moncommands build/symbols_generic.vs -remotemonitor
|
||||
|
||||
testsimilarity: build/target_generic/newrom $(TOOL_SIMILARITY)
|
||||
$(TOOL_SIMILARITY) kernal build/target_generic/newrom
|
||||
|
||||
+47
-39
@@ -26,7 +26,7 @@
|
||||
#define DIR_SEPARATOR "/"
|
||||
#endif
|
||||
|
||||
const std::string ASM_CMD = "java -jar assembler/KickAss.jar ";
|
||||
const std::string ASM_CMD = "java -jar ";
|
||||
|
||||
const std::string LAB_OUT_START = "__routine_START_";
|
||||
const std::string LAB_OUT_END = "__routine_END_";
|
||||
@@ -39,8 +39,9 @@ const std::string BANNER_LINE = "//-------------------------------------------
|
||||
// Command line settings
|
||||
//
|
||||
|
||||
std::string CMD_assFile = "KickAss.jar";
|
||||
std::string CMD_outFile = "OUT.BIN";
|
||||
std::string CMD_tmpDir = "./out";
|
||||
std::string CMD_outDir = "./out";
|
||||
std::string CMD_segName = "MAIN";
|
||||
std::string CMD_segInfo = "(unnamed)";
|
||||
int CMD_loAddress = 0xC000;
|
||||
@@ -66,10 +67,10 @@ void ERROR(const std::string &message)
|
||||
void printUsage()
|
||||
{
|
||||
std::cout << "\n" <<
|
||||
"usage: build_segment [-o <out file>] [-d <out dir>] [-t <temp dir>]" << "\n" <<
|
||||
"usage: build_segment [-a <assembler jar file>] [-o <out file>] [-d <out dir>]" << "\n" <<
|
||||
" [-l <start/low address>] [-h <end/high address>]" << "\n" <<
|
||||
" [-s <segment name>] [-i <segment display info>] <input dir/file list>" <<
|
||||
"\n\n";
|
||||
" [-s <segment name>] [-i <segment display info>]" << "\n" <<
|
||||
" <input dir/file list>" << "\n\n";
|
||||
}
|
||||
|
||||
void printBannerLineTop()
|
||||
@@ -195,16 +196,17 @@ void parseCommandLine(int argc, char **argv)
|
||||
|
||||
// Retrieve command line options
|
||||
|
||||
while ((opt = getopt(argc, argv, "o:d:t:l:h:s:i:")) != -1)
|
||||
while ((opt = getopt(argc, argv, "a:o:d:s:i:l:h:")) != -1)
|
||||
{
|
||||
switch(opt)
|
||||
{
|
||||
case 'o': CMD_outFile = optarg; break;
|
||||
case 't': CMD_tmpDir = optarg; break;
|
||||
case 's': CMD_segName = optarg; break;
|
||||
case 'i': CMD_segInfo = optarg; break;
|
||||
case 'l': CMD_loAddress = strtol(optarg, nullptr ,16); break;
|
||||
case 'h': CMD_hiAddress = strtol(optarg, nullptr ,16); break;
|
||||
case 'a': CMD_assFile = optarg; break;
|
||||
case 'o': CMD_outFile = optarg; break;
|
||||
case 'd': CMD_outDir = optarg; break;
|
||||
case 's': CMD_segName = optarg; break;
|
||||
case 'i': CMD_segInfo = optarg; break;
|
||||
case 'l': CMD_loAddress = strtol(optarg, nullptr ,16); break;
|
||||
case 'h': CMD_hiAddress = strtol(optarg, nullptr ,16); break;
|
||||
default: printUsage(); ERROR();
|
||||
}
|
||||
}
|
||||
@@ -297,23 +299,25 @@ void checkInputFileLabels()
|
||||
|
||||
void calcRoutineSizes()
|
||||
{
|
||||
const std::string nameBase = CMD_tmpDir + DIR_SEPARATOR + CMD_segName + "_sizetest";
|
||||
const std::string nameBase = CMD_segName + "_sizetest";
|
||||
const std::string filePath = CMD_outDir + DIR_SEPARATOR;
|
||||
|
||||
const std::string outFileName = nameBase + ".s";
|
||||
const std::string symFileName = nameBase + ".sym";
|
||||
const std::string outFileNameBare = nameBase + ".s";
|
||||
const std::string outFileNamePath = filePath + outFileNameBare;
|
||||
const std::string symFileNamePath = filePath + nameBase + ".sym";
|
||||
|
||||
// Remove old files
|
||||
|
||||
unlink(outFileName.c_str());
|
||||
unlink(symFileName.c_str());
|
||||
unlink(outFileNamePath.c_str());
|
||||
unlink(symFileNamePath.c_str());
|
||||
|
||||
// Write test file to determine routine sizes
|
||||
|
||||
std::ofstream outFile(outFileName, std::fstream::out | std::fstream::trunc);
|
||||
if (!outFile.good()) ERROR(std::string("can't open temporary file '") + outFileName + "'");
|
||||
std::ofstream outFile(outFileNamePath, std::fstream::out | std::fstream::trunc);
|
||||
if (!outFile.good()) ERROR(std::string("can't open temporary file '") + outFileNamePath + "'");
|
||||
|
||||
// Start at $100, so that no local data gets accesses using ZP addressing modes
|
||||
// during this pass, which would otherwise upset things later
|
||||
// during this pass, which would otherwise upset things later
|
||||
|
||||
outFile << "\n" << ".segment " << CMD_segName << " [start=$100, min=$100, max=$FFFF]" << "\n";
|
||||
outFile << "#define SEGMENT_" << CMD_segName << "\n";
|
||||
@@ -331,12 +335,13 @@ void calcRoutineSizes()
|
||||
outFile << LAB_OUT_END << sourceFile.label << ":" << "\n";
|
||||
}
|
||||
|
||||
if (!outFile.good()) ERROR(std::string("error writing temporary file '") + outFileName + "'");
|
||||
if (!outFile.good()) ERROR(std::string("error writing temporary file '") + outFileNamePath + "'");
|
||||
outFile.close();
|
||||
|
||||
// All written - now launch the assembler
|
||||
|
||||
const std::string cmd = ASM_CMD + outFileName + " -symbolfile -o /dev/null";
|
||||
const std::string cmd = "cd " + filePath + " && " + ASM_CMD + CMD_assFile + " " +
|
||||
outFileNameBare + " -symbolfile -o /dev/null";
|
||||
std::cout << "command: " << cmd << "\n" << std::flush;
|
||||
if (0 != system(cmd.c_str()))
|
||||
{
|
||||
@@ -346,8 +351,8 @@ void calcRoutineSizes()
|
||||
// Read addresses
|
||||
|
||||
std::ifstream symFile;
|
||||
symFile.open(symFileName);
|
||||
if (!symFile.good()) ERROR(std::string("unable to open results file '") + symFileName + "'");
|
||||
symFile.open(symFileNamePath);
|
||||
if (!symFile.good()) ERROR(std::string("unable to open results file '") + symFileNamePath + "'");
|
||||
|
||||
std::string line;
|
||||
while (std::getline(symFile, line))
|
||||
@@ -429,9 +434,9 @@ void prepareBinningProblem()
|
||||
{
|
||||
// Prepare the log file
|
||||
|
||||
const std::string logFileName = CMD_tmpDir + DIR_SEPARATOR + CMD_segName + "_binproblem.log";
|
||||
unlink(logFileName.c_str());
|
||||
std::ofstream logFile(logFileName, std::fstream::out | std::fstream::trunc);
|
||||
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);
|
||||
|
||||
// Print out code length information
|
||||
@@ -477,7 +482,7 @@ void prepareBinningProblem()
|
||||
|
||||
// Close the log file
|
||||
|
||||
if (!logFile.good()) ERROR(std::string("error writing log file '") + logFileName + "'");
|
||||
if (!logFile.good()) ERROR(std::string("error writing log file '") + logFileNamePath + "'");
|
||||
logFile.close();
|
||||
}
|
||||
|
||||
@@ -502,10 +507,12 @@ void compileSegment()
|
||||
{
|
||||
// First combine everything into one assembler file
|
||||
|
||||
const std::string outFileName = CMD_tmpDir + DIR_SEPARATOR + CMD_segName + "_combined.s";
|
||||
unlink(outFileName.c_str());
|
||||
std::ofstream outFile(outFileName, std::fstream::out | std::fstream::trunc);
|
||||
if (!outFile.good()) ERROR(std::string("can't open temporary file '") + outFileName + "'");
|
||||
const std::string outFileNameBare = CMD_segName + "_combined.s";
|
||||
const std::string filePath = CMD_outDir + DIR_SEPARATOR;
|
||||
const std::string outFileNamePath = filePath + outFileNameBare;
|
||||
unlink(outFileNamePath.c_str());
|
||||
std::ofstream outFile(outFileNamePath, std::fstream::out | std::fstream::trunc);
|
||||
if (!outFile.good()) ERROR(std::string("can't open temporary file '") + outFileNamePath + "'");
|
||||
|
||||
// Write the header
|
||||
|
||||
@@ -541,12 +548,13 @@ void compileSegment()
|
||||
outFile << "\n";
|
||||
}
|
||||
|
||||
if (!outFile.good()) ERROR(std::string("error writing temporary file '") + outFileName + "'");
|
||||
if (!outFile.good()) ERROR(std::string("error writing temporary file '") + outFileNamePath + "'");
|
||||
outFile.close();
|
||||
|
||||
// All written - now launch the assembler
|
||||
|
||||
const std::string cmd = ASM_CMD + outFileName + " -symbolfile -o " + CMD_outFile;
|
||||
const std::string cmd = "cd " + filePath + " && " + ASM_CMD + CMD_assFile + " " +
|
||||
outFileNameBare + " -symbolfile -vicesymbols -o " + CMD_outFile;
|
||||
std::cout << "command: " << cmd << "\n" << std::flush;
|
||||
if (0 != system(cmd.c_str()))
|
||||
{
|
||||
@@ -852,9 +860,9 @@ void Solver::run()
|
||||
{
|
||||
// Prepare the log file
|
||||
|
||||
const std::string logFileName = CMD_tmpDir + DIR_SEPARATOR + CMD_segName + "_binsolution.log";
|
||||
unlink(logFileName.c_str());
|
||||
logFile.open(logFileName, std::fstream::out | std::fstream::trunc);
|
||||
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);
|
||||
|
||||
// Sort the floating routines, just to be extra sure
|
||||
|
||||
@@ -887,7 +895,7 @@ void Solver::run()
|
||||
|
||||
// Close the log file
|
||||
|
||||
if (!logFile.good()) ERROR(std::string("error writing log file '") + logFileName + "'");
|
||||
if (!logFile.good()) ERROR(std::string("error writing log file '") + logFileNamePath + "'");
|
||||
logFile.close();
|
||||
}
|
||||
|
||||
@@ -945,7 +953,7 @@ int KS(const std::vector<SourceFile *> &routines,
|
||||
auto &cachedS = cacheS[n - 1][C - 1];
|
||||
if (cachedV >= 0)
|
||||
{
|
||||
// We already hold the solution in out cache - return it
|
||||
// We already hold the solution in our cache - return it
|
||||
solution = cachedS;
|
||||
return cachedV;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user