diff --git a/bin/basic_generic.rom b/bin/basic_generic.rom index fbaa3d1d..5142820f 100644 Binary files a/bin/basic_generic.rom and b/bin/basic_generic.rom differ diff --git a/bin/basic_ultimate64.rom b/bin/basic_ultimate64.rom index ab9365d2..4334a793 100644 Binary files a/bin/basic_ultimate64.rom and b/bin/basic_ultimate64.rom differ diff --git a/bin/kernal_generic.rom b/bin/kernal_generic.rom index 990b2455..97c6d72b 100644 Binary files a/bin/kernal_generic.rom and b/bin/kernal_generic.rom differ diff --git a/bin/kernal_ultimate64.rom b/bin/kernal_ultimate64.rom index 67f8e1ac..6a81a5a5 100644 Binary files a/bin/kernal_ultimate64.rom and b/bin/kernal_ultimate64.rom differ diff --git a/bin/mega65.rom b/bin/mega65.rom index a80de589..c828dca1 100644 Binary files a/bin/mega65.rom and b/bin/mega65.rom differ diff --git a/bin/mega65_pxlfont.rom b/bin/mega65_pxlfont.rom index 3f2626dd..a04ae20e 100644 Binary files a/bin/mega65_pxlfont.rom and b/bin/mega65_pxlfont.rom differ diff --git a/src/dos_m65/4010.dos_datestr.s b/src/dos_m65/4010.dos_datestr.s new file mode 100644 index 00000000..ec666df1 --- /dev/null +++ b/src/dos_m65/4010.dos_datestr.s @@ -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 diff --git a/src/dos_m65/4000.dos_vectable.s b/src/dos_m65/4020.dos_vectable.s similarity index 100% rename from src/dos_m65/4000.dos_vectable.s rename to src/dos_m65/4020.dos_vectable.s diff --git a/src/kernal/iec_fast/m65dos_bridge.s b/src/kernal/iec_fast/m65dos_bridge.s index 0c39b5b2..f0d2b00b 100644 --- a/src/kernal/iec_fast/m65dos_bridge.s +++ b/src/kernal/iec_fast/m65dos_bridge.s @@ -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: diff --git a/tools/release.cc b/tools/release.cc index 573d0dba..425fb7c5 100644 --- a/tools/release.cc +++ b/tools/release.cc @@ -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 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 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 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 STR_OR = { 0x4F, 0x52 }; const std::vector STR_SNAPSHOT = { 0x28, 0x44, 0x45, 0x56, 0x45, 0x4C, 0x20, 0x53, 0x4E, 0x41, 0x50, 0x53, 0x48, 0x4F, 0x54, 0x29, 0x00 }; +const std::vector STR_DOSDATE = { 0x4F, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58 }; const std::string STR_DEV = "DEV."; @@ -78,6 +83,7 @@ std::list 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()