started work on release tool
This commit is contained in:
1 parent
f9e3b57a79
commit
1db03b5921
5 files changed
+225
-51
No files matched your search
@@ -34,6 +34,7 @@ TOOL_COLLECT_DATA = build/tools/collect_data
|
||||
TOOL_COMPRESS_TEXT = build/tools/compress_text
|
||||
TOOL_PNGPREPARE = build/tools/pngprepare
|
||||
TOOL_BUILD_SEGMENT = build/tools/build_segment
|
||||
TOOL_RELEASE = build/tools/release
|
||||
TOOL_SIMILARITY = build/tools/similarity
|
||||
TOOL_ASSEMBLER = assembler/KickAss.jar
|
||||
|
||||
@@ -67,7 +68,7 @@ all: $(STD_TARGET_LIST) $(EXT_TARGET_LIST)
|
||||
clean:
|
||||
@rm -rf build
|
||||
|
||||
updatebin: $(STD_TARGET_LIST)
|
||||
updatebin: $(STD_TARGET_LIST) $(STD_TOOL_RELEASE)
|
||||
cp build/chargen.rom bin/chargen.rom
|
||||
cp build/basic_generic.rom bin/basic_generic.rom
|
||||
cp build/kernal_generic.rom bin/kernal_generic.rom
|
||||
@@ -90,7 +91,7 @@ build/tools/%: src/%.c
|
||||
@mkdir -p build/tools
|
||||
$(CC) -O2 -Wall -o $@ $<
|
||||
|
||||
build/tools/%: src/%.cc
|
||||
build/tools/%: src/%.cc src/common.h
|
||||
@mkdir -p build/tools
|
||||
$(CXX) -O2 -Wall -o $@ $<
|
||||
|
||||
|
||||
@@ -160,6 +160,7 @@ Not all of them - only these we want to have implemented.
|
||||
| `$EA31` | default IRQ | PARTIAL | |
|
||||
| `$EA7E` | ack CIA1 + below | DONE | |
|
||||
| `$EA81` | ret from IRQ/NMI | DONE | |
|
||||
| `$F142` | get key from buffer | DONE | |
|
||||
| `$FD30` | default vectors | DONE | |
|
||||
| `$FE47` | default NMI | PARTIAL | |
|
||||
| `$FE66` | default BRK | DONE | |
|
||||
|
||||
+2
-49
@@ -3,6 +3,8 @@
|
||||
// source files, placing routines where they need to live
|
||||
//
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include <dirent.h>
|
||||
#include <libgen.h>
|
||||
#include <string.h>
|
||||
@@ -13,19 +15,11 @@
|
||||
#include <algorithm>
|
||||
#include <fstream>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
#define DIR_SEPARATOR "\\"
|
||||
#else
|
||||
#define DIR_SEPARATOR "/"
|
||||
#endif
|
||||
|
||||
const std::string ASM_CMD = "java -jar ";
|
||||
|
||||
const std::string LAB_OUT_START = "__routine_START_";
|
||||
@@ -33,8 +27,6 @@ const std::string LAB_OUT_END = "__routine_END_";
|
||||
const std::string LAB_IN_START = ".label __routine_START_";
|
||||
const std::string LAB_IN_END = ".label __routine_END_";
|
||||
|
||||
const std::string BANNER_LINE = "//-------------------------------------------------------------------------------------------";
|
||||
|
||||
//
|
||||
// Command line settings
|
||||
//
|
||||
@@ -53,17 +45,6 @@ std::list<std::string> CMD_inList;
|
||||
// Common helper functions
|
||||
//
|
||||
|
||||
void ERROR()
|
||||
{
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
void ERROR(const std::string &message)
|
||||
{
|
||||
std::cout << "\n" << "ERROR: " << message << "\n\n";
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
void printUsage()
|
||||
{
|
||||
std::cout << "\n" <<
|
||||
@@ -73,16 +54,6 @@ void printUsage()
|
||||
" <input dir/file list>" << "\n\n";
|
||||
}
|
||||
|
||||
void printBannerLineTop()
|
||||
{
|
||||
std::cout << "\n\n\n" << BANNER_LINE << "\n";
|
||||
}
|
||||
|
||||
void printBannerLineBottom()
|
||||
{
|
||||
std::cout << BANNER_LINE << "\n\n";
|
||||
}
|
||||
|
||||
void printBannerCollectAnalyse()
|
||||
{
|
||||
printBannerLineTop();
|
||||
@@ -101,24 +72,6 @@ void printBannerBinCompile()
|
||||
// Class definitions
|
||||
//
|
||||
|
||||
class DualStream
|
||||
{
|
||||
public:
|
||||
DualStream(std::ostream& str1, std::ostream& str2) : str1(str1), str2(str2) {}
|
||||
|
||||
template<class T> DualStream &operator<<(const T& x)
|
||||
{
|
||||
str1 << x;
|
||||
str2 << x;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
std::ostream& str1;
|
||||
std::ostream& str2;
|
||||
};
|
||||
|
||||
class SourceFile
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
//
|
||||
// Common parts of utilities written in C++
|
||||
// for providing uniform user experience
|
||||
//
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
#define DIR_SEPARATOR "\\"
|
||||
#else
|
||||
#define DIR_SEPARATOR "/"
|
||||
#endif
|
||||
|
||||
|
||||
const std::string BANNER_LINE = "//-------------------------------------------------------------------------------------------";
|
||||
|
||||
|
||||
void ERROR()
|
||||
{
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
void ERROR(const std::string &message)
|
||||
{
|
||||
std::cout << "\n" << "ERROR: " << message << "\n\n";
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
void printBannerLineTop()
|
||||
{
|
||||
std::cout << "\n\n\n" << BANNER_LINE << "\n";
|
||||
}
|
||||
|
||||
void printBannerLineBottom()
|
||||
{
|
||||
std::cout << BANNER_LINE << "\n\n";
|
||||
}
|
||||
|
||||
|
||||
class DualStream
|
||||
{
|
||||
public:
|
||||
DualStream(std::ostream& str1, std::ostream& str2) : str1(str1), str2(str2) {}
|
||||
|
||||
template<class T> DualStream &operator<<(const T& x)
|
||||
{
|
||||
str1 << x;
|
||||
str2 << x;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
std::ostream& str1;
|
||||
std::ostream& str2;
|
||||
};
|
||||
+161
@@ -0,0 +1,161 @@
|
||||
//
|
||||
// Utility to prepare a release with automatically
|
||||
// assigned version numbers
|
||||
//
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <list>
|
||||
|
||||
//
|
||||
// Command and enviroment line settings
|
||||
//
|
||||
|
||||
std::string CMD_inDir = "./build";
|
||||
std::string CMD_outDir = "./bin";
|
||||
|
||||
std::list<std::string> CMD_fileList;
|
||||
|
||||
std::string ENV_developerId;
|
||||
|
||||
//
|
||||
// Common helper functions
|
||||
//
|
||||
|
||||
void printUsage()
|
||||
{
|
||||
std::cout << "\n" <<
|
||||
"usage: release [-i <input (build) directory>] [-o <output (release) directory>]" << "\n" <<
|
||||
" <file list>" << "\n\n";
|
||||
}
|
||||
|
||||
//
|
||||
// Top-level functions
|
||||
//
|
||||
|
||||
void parseCommandLine(int argc, char **argv)
|
||||
{
|
||||
int opt;
|
||||
|
||||
// Retrieve command line options
|
||||
|
||||
while ((opt = getopt(argc, argv, "i:o:")) != -1)
|
||||
{
|
||||
switch(opt)
|
||||
{
|
||||
case 'i': CMD_inDir = optarg; break;
|
||||
case 'o': CMD_outDir = optarg; break;
|
||||
default: printUsage(); ERROR();
|
||||
}
|
||||
}
|
||||
|
||||
// Retrieve file/directory list
|
||||
|
||||
for (int idx = optind; idx < argc; idx++)
|
||||
{
|
||||
CMD_fileList.push_back(argv[idx]);
|
||||
}
|
||||
|
||||
if (CMD_fileList.empty()) { printUsage(); ERROR("empty file list"); }
|
||||
}
|
||||
|
||||
void getEnvironmentSettings()
|
||||
{
|
||||
const char* id = getenv("OPEN_ROMS_DEVELOPER_ID");
|
||||
|
||||
// Check whether the developer ID is suitable
|
||||
|
||||
if (id == nullptr)
|
||||
{
|
||||
ERROR("environment variable OPEN_ROMS_DEVELOPER_ID not set");
|
||||
}
|
||||
|
||||
ENV_developerId = id;
|
||||
|
||||
if (ENV_developerId.length() < 2 || ENV_developerId.length() > 3)
|
||||
{
|
||||
ERROR("OPEN_ROMS_DEVELOPER_ID has to be 2 or 3 characters long");
|
||||
}
|
||||
|
||||
for (const char &c : ENV_developerId)
|
||||
{
|
||||
if (!(c >= 'A' && c <= 'Z'))
|
||||
{
|
||||
ERROR("OPEN_ROMS_DEVELOPER_ID can only contain uppercase letters");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void printBanner()
|
||||
{
|
||||
printBannerLineTop();
|
||||
std::cout << "// Preparing ROM set release by '" << ENV_developerId << "'\n";
|
||||
printBannerLineBottom();
|
||||
}
|
||||
|
||||
void readFiles()
|
||||
{
|
||||
// XXX
|
||||
}
|
||||
|
||||
void embedVersionString()
|
||||
{
|
||||
// XXX
|
||||
}
|
||||
|
||||
void writeFiles()
|
||||
{
|
||||
// XXX
|
||||
}
|
||||
|
||||
//
|
||||
// Class definitions
|
||||
//
|
||||
|
||||
class ROMFile
|
||||
{
|
||||
public:
|
||||
|
||||
ROMFile(const std::string &baseFileName);
|
||||
|
||||
private:
|
||||
|
||||
std::string baseFileName;
|
||||
|
||||
std::vector<uint8_t> srcFile;
|
||||
std::vector<uint8_t> dstFile;
|
||||
}
|
||||
|
||||
//
|
||||
// Main function
|
||||
//
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
parseCommandLine(argc, argv);
|
||||
getEnvironmentSettings();
|
||||
|
||||
printBanner();
|
||||
|
||||
readFiles();
|
||||
embedVersionString();
|
||||
writeFiles();
|
||||
|
||||
ERROR("This tool is not finished yet");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Class 'ROMFile'
|
||||
//
|
||||
|
||||
ROMFile::ROMFile(const std::string &baseFileName)
|
||||
{
|
||||
// XXX
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user