Example #1
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));
        }
Example #2
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;
        }