public Decompiler(IEnumerable<IControlCode> controlCodes, IDictionary<byte, string> charLookup,
            Func<byte[], int, bool> controlCodePredicate)
        {
            ControlCodes = controlCodes;
            CharLookup = charLookup;
            ControlCodePredicate = controlCodePredicate;

            LabelMap = new LabelMap();
        }
        public Decompiler(IEnumerable <IControlCode> controlCodes, IDictionary <byte, string> charLookup,
                          Func <byte[], int, bool> controlCodePredicate)
        {
            ControlCodes         = controlCodes;
            CharLookup           = charLookup;
            ControlCodePredicate = controlCodePredicate;

            LabelMap = new LabelMap();
        }
        public void ScanRange(byte[] rom, int startAddress, int endAddress)
        {
            if (rom == null)
            {
                throw new ArgumentNullException();
            }

            int address = startAddress;

            while (address < endAddress)
            {
                if (ControlCodePredicate(rom, address))
                {
                    IControlCode code = ControlCodes.FirstOrDefault(c => c.IsMatch(rom, address));

                    if (code == null)
                    {
                        throw new Exception("Control code not found");
                    }

                    IList <int> references = code.GetReferences(rom, address);

                    if (references != null)
                    {
                        LabelMap.AddRange(references);
                    }

                    address += code.ComputeLength(rom, address);
                }

                else
                {
                    address++;
                }
            }
        }