protected static void Cmd06 <T>(ROM rom, T 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 && segment != 0x0E) { return; } int romAddr = rom.GetROMAddress(segmentedAddress); rom.PushOffset(romAddr - 0x8); // -8 to trick the adding after cmd }
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); }
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); }