Skip to content

Commit

Permalink
Changed the output file extension to cat and max size to 9MB (in line…
Browse files Browse the repository at this point in the history
… with 1.20 firmware for MSXpico
  • Loading branch information
sdsnatcher73 committed Jan 24, 2024
1 parent 022c688 commit 4753c11
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions prepare_msxpico_roms/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,13 @@ internal class Program
static void Main(string[] args)
{
string romFilesDirName = ".";
string concatOutputFileName = "msxpico.bin";
string concatOutputFileName = "msxpico.cat";
UInt32 concatOutputSize = 0;

const UInt32 concatOutputMaxSize = 9 * 1024 * 1024;

const string version = "0.4";

const UInt16 mapperGeneric8 = 0; /* Generic switch, 8kB pages */
const UInt16 mapperGeneric16 = 1; /* Generic switch, 16kB pages */
const UInt16 mapperKonami5 = 2; /* Konami 5000/7000/9000/B000h */
Expand All @@ -70,6 +74,9 @@ static void Main(string[] args)
const UInt16 generationMSX1 = 0;
const UInt16 generationMSX2 = 1;

Console.WriteLine("MSXpico Catalog Preparation v" + version);
Console.WriteLine();

if (args.Length == 1)
{
romFilesDirName = args[0];
Expand Down Expand Up @@ -100,7 +107,7 @@ static void Main(string[] args)
string romGenerationString = romFileInfo.Name.Split('.')[0].Split('_')[2];
romHeader.size = (UInt32) romFileInfo.Length;

if (concatOutputSize + romHeader.size + (2 * 96) < (7 * 1024 * 1024))
if (concatOutputSize + romHeader.size + (2 * 96) < (concatOutputMaxSize))
{
switch (romMapperString)
{
Expand Down Expand Up @@ -232,8 +239,8 @@ static void Main(string[] args)
}
}

Console.WriteLine("Size of msxpico.bin:\t" + ByteSize.FromBytes(concatOutputSize + 96).ToString("#.# KiB"));
Console.WriteLine("Remaining flash space:\t" + ByteSize.FromBytes((7 * 1024 * 1024) - (concatOutputSize + 96)).ToString("#.# KiB"));
Console.WriteLine("Size of msxpico.cat:\t" + ByteSize.FromBytes(concatOutputSize + 96).ToString("#.# KiB"));
Console.WriteLine("Remaining flash space:\t" + ByteSize.FromBytes((concatOutputMaxSize) - (concatOutputSize + 96)).ToString("#.# KiB"));
// Write a terminator header so pico knows he is finished;
byte[] romTerminator = new byte[96];
concatOutputFileStream.Write(romTerminator, 0, 96);
Expand Down

0 comments on commit 4753c11

Please sign in to comment.