Align string tables to 4 bytes

This commit is contained in:
jeffman 2018-12-14 00:48:47 -05:00
parent 90fa5d4748
commit cb0182f324
2 changed files with 9 additions and 0 deletions

View File

@ -44,5 +44,11 @@ namespace ScriptTool
int value = rom[address] | (rom[address + 1] << 8);
return value;
}
public static int AlignTo(this int address, int alignBytes)
{
int mask = alignBytes - 1;
return ((address - 1) & ~mask) + alignBytes;
}
}
}

View File

@ -543,6 +543,9 @@ namespace ScriptTool
static IList<int> CompileM12FixedStringCollection(string name, ref int referenceAddress)
{
// Align to 4 bytes
referenceAddress = referenceAddress.AlignTo(4);
int baseAddress = referenceAddress;
var buffer = new List<byte>();
var newPointers = new List<int>();