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>();

            // Read the JSON
            FixedStringCollection stringCollection = JsonConvert.DeserializeObject <FixedStringCollection>(
                File.ReadAllText(Path.Combine(options.WorkingDirectory, name + ".json")));

            // Open the data ASM file
            using (var offsetFile = File.CreateText(Path.Combine(options.WorkingDirectory, name + ".asm")))
            {
                // Include the binfile
                offsetFile.WriteLine(String.Format(".org 0x{0:X} :: .incbin \"{1}.bin\"",
                                                   baseAddress | 0x8000000, name));
                offsetFile.WriteLine();

                // Update table pointers
                foreach (int tablePointer in stringCollection.TablePointers)
                {
                    offsetFile.WriteLine(String.Format(".org 0x{0:X} :: dw 0x{1:X8}",
                                                       tablePointer | 0x8000000, baseAddress | 0x8000000));
                }

                // Compile all strings
                foreach (var str in stringCollection.StringRefs.OrderBy(s => s.Index))
                {
                    newPointers.Add(referenceAddress);
                    m12Compiler.CompileString(str.New, buffer, ref referenceAddress, ebCharLookup, stringCollection.EntryLength);
                }
            }

            // Write the buffer
            File.WriteAllBytes(Path.Combine(options.WorkingDirectory, name + ".bin"), buffer.ToArray());

            // Add to the include file
            IncludeFile.WriteLine(".include \"" + name + ".asm\"");

            return(newPointers);
        }
        static void DecompileFixedStringCollection(IDecompiler decompiler, byte[] rom, string name, FixedStringCollection fixedStringCollection)
        {
            // Decompile the strings
            foreach (var fixedStringRef in fixedStringCollection.StringRefs)
            {
                fixedStringRef.Old     =
                    fixedStringRef.New =
                        decompiler.DecompileString(rom, fixedStringRef.OldPointer, false);
            }

            // Write JSON
            File.WriteAllText(Path.Combine(options.WorkingDirectory, name + ".json"),
                              JsonConvert.SerializeObject(fixedStringCollection, Formatting.Indented));
        }