Пример #1
0
        public Maps.GetLabelsResult GetLabels(BankID bankId, ushort address)
        {
            BankID mapped;

            return(SourceMaps.GetLabelsAt(bankId, address)
                   ?? SourceMaps.GetLabelsAt(bankId.All, address)
                   ?? SourceMaps.GetLabelsAt(BankID.Unpaged(), address)
                   ?? SourceMaps.GetLabelsAt(mapped = Memory.GetMappedBank(address), address)
                   ?? SourceMaps.GetLabelsAt(mapped.All, address));
        }
Пример #2
0
        public AddressDetails GetAddressDetails(BankID bankId, ushort address, ushort maxLabelDistance = 0x800)
        {
            // get address details of address by checking three levels:
            //  specified bank + specified address
            //  'all' bank + specified address
            //  bank currently paged in to specified address's slot + specified address

            _tempAddressDetails.Clear();
            _tempAddressDetails.Add(SourceMaps.GetAddressDetails(bankId, address, maxLabelDistance));

            if (bankId.Part != BankID.PartEnum.All)
            {
                _tempAddressDetails.Add(SourceMaps.GetAddressDetails(bankId.All, address, maxLabelDistance));
            }

            if (bankId != BankID.Unpaged())
            {
                _tempAddressDetails.Add(SourceMaps.GetAddressDetails(BankID.Unpaged(), address, maxLabelDistance));
            }

            var curBank = Memory.GetMappedBank(address);

            if (bankId != curBank)
            {
                _tempAddressDetails.Add(SourceMaps.GetAddressDetails(curBank, address, maxLabelDistance));
            }

            // now merge the details so move any Source and Label info present to the first entry
            for (var i = 1; i < _tempAddressDetails.Count; i++)
            {
                // shuffle up source info
                if (_tempAddressDetails[0].Source == null && _tempAddressDetails[i].Source != null)
                {
                    _tempAddressDetails[0].Source = _tempAddressDetails[0].Source ?? _tempAddressDetails[i].Source;
                }

                // shuffle up labels & associated info
                if (_tempAddressDetails[0].Labels == null && _tempAddressDetails[i].Labels != null)
                {
                    _tempAddressDetails[0].Labels          = _tempAddressDetails[i].Labels;
                    _tempAddressDetails[0].LabelledAddress = _tempAddressDetails[i].LabelledAddress;
                    _tempAddressDetails[0].LabelledSource  = _tempAddressDetails[i].LabelledSource;
                }
            }

            return(_tempAddressDetails[0]);
        }