public override Program LoadProgram(Address?addrLoad) { addrLoad ??= PreferredBaseAddress; var cfgSvc = Services.RequireService <IConfigurationService>(); arch = (M68kArchitecture)cfgSvc.GetArchitecture("m68k") !; var imgReader = new BeImageReader(RawImage, 0); var parse = new HunkFileParser(imgReader, false); this.hunkFile = parse.Parse(); BuildSegments(); this.firstCodeHunk = parse.FindFirstCodeHunk(); var platform = cfgSvc.GetEnvironment("amigaOS").Load(Services, arch); var imageMap = platform.CreateAbsoluteMemoryMap(); var mem = new ByteMemoryArea(addrLoad, RelocateBytes(addrLoad)); var program = new Program( new SegmentMap( mem.BaseAddress, new ImageSegment( "code", mem, AccessMode.ReadWriteExecute)), arch, platform); var sym = ImageSymbol.Procedure(program.Architecture, addrLoad, state: arch.CreateProcessorState()); program.ImageSymbols[sym.Address] = sym; program.EntryPoints[sym.Address] = sym; return(program); }
public void Hfp_DebugHunk() { var rdr = hm.MakeImageReader( //0x3F3, 2, 0x00, 1234, 0x12345678); var parser = new HunkFileParser(rdr); parser.ParseDebug(q => { }); var nextWord = rdr.ReadBeInt32(); Assert.AreEqual(0x12345678, nextWord); }
public void Hfp_CodeBlock() { var rdr = hm.MakeImageReader( //0x3E9, // Assumes this is already read 2, 3, 4); var parser = new HunkFileParser(rdr); TextHunk code = parser.ParseText(q => { }); Assert.AreEqual(12, rdr.Offset); Assert.AreEqual(new byte[] { 0, 0, 0, 3, 0, 0, 0, 4 }, code.Data); }
public override Program Load(Address addrLoad) { arch = new M68kArchitecture(); var imgReader = new BeImageReader(RawImage, 0); var parse = new HunkFileParser(imgReader, false); this.hunkFile = parse.Parse(); BuildSegments(); this.firstCodeHunk = parse.FindFirstCodeHunk(); var image = new LoadedImage(addrLoad, RelocateBytes(addrLoad)); return new Program( image, image.CreateImageMap(), arch, new AmigaOSPlatform(Services, arch)); }
public override Program Load(Address addrLoad) { arch = new M68kArchitecture(); var imgReader = new BeImageReader(RawImage, 0); var parse = new HunkFileParser(imgReader, false); this.hunkFile = parse.Parse(); BuildSegments(); this.firstCodeHunk = parse.FindFirstCodeHunk(); var image = new LoadedImage(addrLoad, RelocateBytes(addrLoad)); return(new Program( image, image.CreateImageMap(), arch, new AmigaOSPlatform(Services, arch))); }
public override Program Load(Address addrLoad) { var cfgSvc = Services.RequireService<IConfigurationService>(); arch = (M68kArchitecture) cfgSvc.GetArchitecture("m68k"); var imgReader = new BeImageReader(RawImage, 0); var parse = new HunkFileParser(imgReader, false); this.hunkFile = parse.Parse(); BuildSegments(); this.firstCodeHunk = parse.FindFirstCodeHunk(); var image = new LoadedImage(addrLoad, RelocateBytes(addrLoad)); return new Program( image, image.CreateImageMap(), arch, cfgSvc.GetEnvironment("amigaOS").Load(Services, arch)); }
public override Program Load(Address addrLoad) { var cfgSvc = Services.RequireService <IConfigurationService>(); arch = (M68kArchitecture)cfgSvc.GetArchitecture("m68k"); var imgReader = new BeImageReader(RawImage, 0); var parse = new HunkFileParser(imgReader, false); this.hunkFile = parse.Parse(); BuildSegments(); this.firstCodeHunk = parse.FindFirstCodeHunk(); var image = new LoadedImage(addrLoad, RelocateBytes(addrLoad)); return(new Program( image, image.CreateImageMap(), arch, cfgSvc.GetEnvironment("amigaOS").Load(Services, arch))); }
public override Program Load(Address addrLoad) { var cfgSvc = Services.RequireService<IConfigurationService>(); arch = (M68kArchitecture) cfgSvc.GetArchitecture("m68k"); var imgReader = new BeImageReader(RawImage, 0); var parse = new HunkFileParser(imgReader, false); this.hunkFile = parse.Parse(); BuildSegments(); this.firstCodeHunk = parse.FindFirstCodeHunk(); var platform = cfgSvc.GetEnvironment("amigaOS").Load(Services, arch); var imageMap = platform.CreateAbsoluteMemoryMap(); var mem = new MemoryArea(addrLoad, RelocateBytes(addrLoad)); return new Program( new SegmentMap( mem.BaseAddress, new ImageSegment( "code", mem, AccessMode.ReadWriteExecute)), arch, platform); }
public override Program Load(Address addrLoad) { var cfgSvc = Services.RequireService <IConfigurationService>(); arch = (M68kArchitecture)cfgSvc.GetArchitecture("m68k"); var imgReader = new BeImageReader(RawImage, 0); var parse = new HunkFileParser(imgReader, false); this.hunkFile = parse.Parse(); BuildSegments(); this.firstCodeHunk = parse.FindFirstCodeHunk(); var mem = new MemoryArea(addrLoad, RelocateBytes(addrLoad)); return(new Program( new ImageMap( mem.BaseAddress, new ImageSegment( "code", mem, AccessMode.ReadWriteExecute)), arch, cfgSvc.GetEnvironment("amigaOS").Load(Services, arch))); }
public void Hfp_HeaderBlock() { var rdr = hm.MakeImageReader( //0x3F3, "Hello", "", 2, 0, 1, 4, 16); var parser = new HunkFileParser(rdr); HeaderHunk hdr = parser.ParseHeader(q => { }); Assert.AreEqual(1, hdr.HunkNames.Count); Assert.AreEqual("Hello", hdr.HunkNames[0]); Assert.AreEqual(0, hdr.FirstHunkId); Assert.AreEqual(1, hdr.LastHunkId); Assert.AreEqual(2, hdr.HunkInfos.Count); Assert.AreEqual(16, hdr.HunkInfos[0].Size); Assert.AreEqual(64, hdr.HunkInfos[1].Size); }
public void Hfp_ReadString_ZeroLength() { var bytes = hm.MakeImageReader(0); var parser = new HunkFileParser( bytes); Assert.AreEqual("", parser.ReadString()); }
public void Hfp_ReadString_TrailingZeros() { var bytes = hm.MakeImageReader("a"); var parser = new HunkFileParser(bytes); Assert.AreEqual("a", parser.ReadString()); }