Example #1
0
        public void SetSegment(int segment, SegmentDescriptor descriptor)
        {
            if (segment > 0x20)
            {
                return;
            }

            segments[segment] = descriptor;
        }
Example #2
0
        public int GetSegmentedAddress(int romAddress)
        {
            for (int currentSegment = 0; currentSegment < 0x20; currentSegment++)
            {
                SegmentDescriptor descriptor = segments[currentSegment];
                if (descriptor == null)
                {
                    continue;
                }

                if (descriptor.start <= romAddress && romAddress <= descriptor.start + descriptor.length)
                {
                    return(SegmentedAddressHelper.GetSegmentedAddress(currentSegment, romAddress - descriptor.start));
                }
            }

            return(-1);
        }