Exemplo n.º 1
0
        public TextHunk ParseText(Action <Hunk> fn)
        {
            var hunk = new TextHunk();

            fn(hunk);
            var num_longs = this.read_long();

            if (num_longs < 0)
            {
                throw new BadImageFormatException(string.Format("{0} has invalid size.", hunk.HunkType));
            }

            // Read in the hunk data
            var size = num_longs * 4;

            hunk.alloc_size = size & ~Hunk.HUNKF_ALL;
            var flags = size & Hunk.HUNKF_ALL;

            hunk.memf             = this.SetMemoryFlags(flags, 30);
            hunk.data_file_offset = (uint)f.Offset;
            hunk.Data             = f.ReadBytes(hunk.alloc_size);
            Debug.WriteLineIf(trace.TraceVerbose, string.Format("  alloc_size:  {0:X8}", hunk.alloc_size));
            Debug.WriteLineIf(trace.TraceVerbose, string.Format("  file_offset: {0:X8}", hunk.data_file_offset));
            return(hunk);
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
        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)));
        }
Exemplo n.º 4
0
        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));
        }
Exemplo n.º 5
0
        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)));
        }
Exemplo n.º 6
0
 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);
 }
Exemplo n.º 7
0
        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)));
        }
Exemplo n.º 8
0
        public TextHunk ParseText(Action<Hunk> fn)
        {
            var hunk = new TextHunk();
            fn(hunk);
            var num_longs = this.read_long();
            if (num_longs < 0)
                throw new BadImageFormatException(string.Format("{0} has invalid size.", hunk.HunkType));

            // Read in the hunk data
            var size = num_longs * 4;
            hunk.alloc_size = size & ~Hunk.HUNKF_ALL;
            var flags = size & Hunk.HUNKF_ALL;
            hunk.memf = this.SetMemoryFlags(flags, 30);
            hunk.data_file_offset = (uint)f.Offset;
            hunk.Data = f.ReadBytes(hunk.alloc_size);
            Debug.WriteLineIf(trace.TraceVerbose, string.Format("  alloc_size:  {0:X8}", hunk.alloc_size));
            Debug.WriteLineIf(trace.TraceVerbose, string.Format("  file_offset: {0:X8}", hunk.data_file_offset));
            return hunk;
        }