示例#1
0
        // Generates static relocation unit from or to static
        public RelocationUnit(Region region, ROM rom, bool isFromStatic)
        {
            int segmentedAddress = rom.GetSegmentedAddress(region.romStart);

            if (segmentedAddress == -1)
            {
                throw new ArgumentException("Failed to get segmented address");
            }

            int segment = SegmentedAddressHelper.GetSegment(segmentedAddress);
            int staticSegmentedAddress = SegmentedAddressHelper.GetStaticSegmentedAddress(segment);

            length = region.length;

            if (!isFromStatic)
            {
                start    = segmentedAddress;
                newStart = staticSegmentedAddress;
            }
            else
            {
                start    = staticSegmentedAddress;
                newStart = segmentedAddress;
            }
        }
示例#2
0
        public int GetROMAddress(int segmentedAddress)
        {
            int segment = SegmentedAddressHelper.GetSegment(segmentedAddress);
            int offset  = SegmentedAddressHelper.GetOffset(segmentedAddress);

            if (segment > 0x20)
            {
                return(-1);
            }

            if (segments[segment] == null)
            {
                return(-1);
            }

            return(segments[segment].start + offset);
        }
示例#3
0
        private static void RegionParse_cmd06(ROM rom, List <Region> regions, RegionParseState state)
        {
            int segmentedAddress = rom.Read32(4);
            int segment          = SegmentedAddressHelper.GetSegment(segmentedAddress);

            // 06 command will return one way or another, so just wait for it
            if (segment != 0x19)
            {
                return;
            }

            CutRegion(rom, regions, state, rom.offset, state.regionState);

            state.retAddressStack.Push(rom.offset + rom.Read8(1));
            int offset = (int)rom.GetROMAddress(segmentedAddress);

            rom.offset  = offset - 8; // kostul for next cmd switching
            state.start = offset;
        }