put something meaningful instead of C65 DOS version string

This commit is contained in:
FeralChild64 committed 2020-09-20 21:25:56 +02:00
1 parent 4dfddfdcd6
commit fc8385b109
10 files changed
+68 -24

No files matched your search

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
+7
View File
@@ -0,0 +1,7 @@
; A replacement for the original 'VYYMMDD' version string
!pet "o" ; to mark this is Open ROMs
!pet "xxxxxx" ; date, in YYMMDD format
!pet "xx" ; two most significand digits of the year
!pet " " ; reserved for future use
File renamed without changes.
+11 -11
View File
@@ -6,17 +6,17 @@
;
!addr VDOS_INIT = $4000 + 0 * 2
!addr VDOS_CHKUNIT = $4000 + 1 * 2
!addr VDOS_SETUNIT = $4000 + 2 * 2
!addr VDOS_ACPTR = $4000 + 3 * 2
!addr VDOS_CIOUT = $4000 + 4 * 2
!addr VDOS_LISTEN = $4000 + 5 * 2
!addr VDOS_SECOND = $4000 + 6 * 2
!addr VDOS_TALK = $4000 + 7 * 2
!addr VDOS_TKSA = $4000 + 8 * 2
!addr VDOS_UNTLK = $4000 + 9 * 2
!addr VDOS_UNLSN = $4000 + 10 * 2
!addr VDOS_INIT = $4020 + 0 * 2
!addr VDOS_CHKUNIT = $4020 + 1 * 2
!addr VDOS_SETUNIT = $4020 + 2 * 2
!addr VDOS_ACPTR = $4020 + 3 * 2
!addr VDOS_CIOUT = $4020 + 4 * 2
!addr VDOS_LISTEN = $4020 + 5 * 2
!addr VDOS_SECOND = $4020 + 6 * 2
!addr VDOS_TALK = $4020 + 7 * 2
!addr VDOS_TKSA = $4020 + 8 * 2
!addr VDOS_UNTLK = $4020 + 9 * 2
!addr VDOS_UNLSN = $4020 + 10 * 2
m65dos_init:
+50 -13
View File
@@ -22,6 +22,7 @@ typedef struct
size_t fileSize;
size_t signatureOffset1; // offset to 'OR' string
size_t signatureOffset2; // offset to 'OR' string
size_t dosDateOffset; // offset to date of internal DOS
size_t idBasicOffset; // offset to BASIC identification string
size_t idKernalOffset; // offset to KERNAL identification byte
@@ -34,6 +35,7 @@ const std::vector<ROMTypeDescriptionEntry> ROM_DEFINITIONS =
8192, // file size
0x1F52, // signature offset 1
0, // signature offset 2
0, // DOS date offset
0x0007, // BASIC ID offset
0 // KERNAL ID offset
},
@@ -43,6 +45,7 @@ const std::vector<ROMTypeDescriptionEntry> ROM_DEFINITIONS =
8192, // file size
0x04B9, // signature offset 1
0, // signature offset 2
0, // DOS date offset
0, // BASIC ID offset
0x1F80 // KERNAL ID offset
},
@@ -52,6 +55,7 @@ const std::vector<ROMTypeDescriptionEntry> ROM_DEFINITIONS =
128 * 1024, // file size
0xBF52, // signature offset 1
0xE4B9, // signature offset 2
0x10, // DOS date offset
0xA007, // BASIC ID offset
0xFF80 // KERNAL ID offset
},
@@ -64,6 +68,7 @@ const std::vector<uint8_t> STR_OR = { 0x4F, 0x52 };
const std::vector<uint8_t> STR_SNAPSHOT = { 0x28, 0x44, 0x45, 0x56, 0x45, 0x4C, 0x20, 0x53,
0x4E, 0x41, 0x50, 0x53, 0x48, 0x4F, 0x54, 0x29,
0x00 };
const std::vector<uint8_t> STR_DOSDATE = { 0x4F, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58 };
const std::string STR_DEV = "DEV.";
@@ -78,6 +83,7 @@ std::list<std::string> CMD_fileList;
std::string ENV_developerId;
std::string ENV_dateString;
std::string ENV_dateStringExt;
//
// Common helper functions
@@ -100,7 +106,7 @@ public:
ROMFile(const std::string &baseFileName);
void embedRevisionStr(const std::string &newRevisionStr);
void embedRevisionStr(const std::string &newRevisionStr, const std::string &newRevisionStrDOS);
void save();
const ROMTypeDescriptionEntry *descPtr;
@@ -194,17 +200,20 @@ void getDate()
time_t t = time(NULL);
struct tm tm = *localtime(&t);
const std::string year = std::to_string(tm.tm_year % 100);
const std::string month = std::to_string(tm.tm_mon + 1);
const std::string day = std::to_string(tm.tm_mday);
const std::string year = std::to_string(tm.tm_year % 100);
const std::string yearExt = std::to_string((tm.tm_year + 1900) / 100);
const std::string month = std::to_string(tm.tm_mon + 1);
const std::string day = std::to_string(tm.tm_mday);
const std::string zero = "0";
const std::string zero = "0";
ENV_dateString = (year.size() == 2 ? year : zero + year) +
(month.size() == 2 ? month : zero + month) +
(day.size() == 2 ? day : zero + day);
ENV_dateString = (year.size() == 2 ? year : zero + year) +
(month.size() == 2 ? month : zero + month) +
(day.size() == 2 ? day : zero + day);
if (ENV_dateString.size() != 6) ERROR("could not retrieve date");
ENV_dateStringExt = (yearExt.size() == 2 ? yearExt : zero + yearExt);
if (ENV_dateString.size() != 6 || ENV_dateStringExt.size() != 2) ERROR("could not retrieve date");
}
void printBanner()
@@ -267,11 +276,12 @@ void saveFiles()
// Create a new revision string
const std::string newRevStr = STR_DEV + ENV_dateString + "." + ENV_developerId + "." + std::to_string(relId);
const std::string newRevStr = STR_DEV + ENV_dateString + "." + ENV_developerId + "." + std::to_string(relId);
const std::string newRevStrDOS = ENV_dateString + ENV_dateStringExt;
for (auto &file : GLOBAL_ROMFiles)
{
file.embedRevisionStr(newRevStr);
file.embedRevisionStr(newRevStr, newRevStrDOS);
}
std::cout << "Files for release '" << newRevStr << "':\n\n";
@@ -404,6 +414,21 @@ void ROMFile::recognizeSrcFile()
return true;
};
auto checkDosDate = [this](size_t dosDateOffset) -> bool
{
if (dosDateOffset == 0)
{
return true;
}
if (memcmp(&srcFileContent[dosDateOffset], STR_DOSDATE.data(), STR_DOSDATE.size()) != 0)
{
return false;
}
return true;
};
for (auto &SPEC : ROM_DEFINITIONS)
{
if (srcFileContent.size() != SPEC.fileSize) continue;
@@ -419,6 +444,11 @@ void ROMFile::recognizeSrcFile()
continue;
}
if (!checkDosDate(SPEC.dosDateOffset))
{
continue;
}
if (!checkSignature(SPEC.signatureOffset1) || !checkSignature(SPEC.signatureOffset2))
{
continue;
@@ -565,9 +595,9 @@ void ROMFile::analyzeContent()
oldDailyRelId = dstFileContent[idx + devIdLen + 2] - '0';
}
void ROMFile::embedRevisionStr(const std::string &newRevisionStr)
void ROMFile::embedRevisionStr(const std::string &newRevisionStr, const std::string &newRevisionStrDOS)
{
std::string revStr = newRevisionStr;
std::string revStr = newRevisionStr;
while (revStr.length() < 16) revStr = revStr + '\0';
@@ -582,6 +612,13 @@ void ROMFile::embedRevisionStr(const std::string &newRevisionStr)
memcpy(&srcFileContent[descPtr->signatureOffset2 + 3],
revStr.data(), revStr.size());
}
if (descPtr->dosDateOffset != 0)
{
memcpy(&srcFileContent[descPtr->dosDateOffset + 1],
newRevisionStrDOS.data(), newRevisionStrDOS.size());
}
}
void ROMFile::save()