Exemple #1
0
        public override ILoadedImage Load(Address?addrLoad)
        {
            addrLoad ??= PreferredBaseAddress;
            List <ArchiveDirectoryEntry> entries = LoadDiskDirectory();
            IArchiveBrowserService       abSvc   = Services.GetService <IArchiveBrowserService>();

            if (abSvc != null)
            {
                if (abSvc.UserSelectFileFromArchive(entries) is D64FileEntry selectedFile)
                {
                    this.program = LoadImage(addrLoad, selectedFile);
                    return(program);
                }
            }
            var arch       = new Mos6502Architecture(Services, "mos6502", new Dictionary <string, object>());
            var mem        = new ByteMemoryArea(Address.Ptr16(0), RawImage);
            var segmentMap = new SegmentMap(mem.BaseAddress);

            segmentMap.AddSegment(mem, "code", AccessMode.ReadWriteExecute);
            return(new Program
            {
                SegmentMap = segmentMap,
                Architecture = arch,
                Platform = new DefaultPlatform(Services, arch)
            });
        }
Exemple #2
0
        public override Program Load(Address addrLoad)
        {
            List <ArchiveDirectoryEntry> entries = LoadDiskDirectory();
            IArchiveBrowserService       abSvc   = Services.GetService <IArchiveBrowserService>();

            if (abSvc != null)
            {
                var selectedFile = abSvc.UserSelectFileFromArchive(entries) as D64FileEntry;
                if (selectedFile != null)
                {
                    this.program = LoadImage(addrLoad, selectedFile);
                    return(program);
                }
            }
            var arch       = new Mos6502ProcessorArchitecture("mos6502");
            var mem        = new MemoryArea(Address.Ptr16(0), RawImage);
            var segmentMap = new SegmentMap(mem.BaseAddress);

            segmentMap.AddSegment(mem, "code", AccessMode.ReadWriteExecute);
            return(new Program {
                SegmentMap = segmentMap,
                Architecture = arch,
                Platform = new DefaultPlatform(Services, arch)
            });
        }
Exemple #3
0
        public override Program Load(Address addrLoad)
        {
            BinHexDecoder      dec = new BinHexDecoder(new StringReader(Encoding.ASCII.GetString(RawImage)));
            IEnumerator <byte> stm = dec.GetBytes().GetEnumerator();
            BinHexHeader       hdr = LoadBinHexHeader(stm);

            byte[] dataFork = LoadFork(hdr.DataForkLength, stm);
            byte[] rsrcFork = LoadFork(hdr.ResourceForkLength, stm);

            var arch     = new M68kArchitecture();
            var platform = new MacOSClassic(Services, arch);

            if (hdr.FileType == "PACT")
            {
                Cpt.CompactProArchive        archive = new Cpt.CompactProArchive();
                List <ArchiveDirectoryEntry> items   = archive.Load(new MemoryStream(dataFork));
                IArchiveBrowserService       abSvc   = Services.GetService <IArchiveBrowserService>();
                if (abSvc != null)
                {
                    var selectedFile = abSvc.UserSelectFileFromArchive(items);
                    if (selectedFile != null)
                    {
                        var image = selectedFile.GetBytes();
                        this.rsrcFork = new ResourceFork(image, arch);
                        this.image    = new LoadedImage(addrLoad, image);
                        this.imageMap = new ImageMap(addrLoad, image.Length);
                        return(new Program(this.image, this.imageMap, arch, platform));
                    }
                }
            }

            var li = new LoadedImage(addrLoad, dataFork);

            return(new Program(li, li.CreateImageMap(), arch, platform));
        }
Exemple #4
0
        public override Program Load(Address?addrLoad)
        {
            addrLoad ??= PreferredBaseAddress;
            BinHexDecoder      dec = new BinHexDecoder(new StringReader(Encoding.ASCII.GetString(RawImage)));
            IEnumerator <byte> stm = dec.GetBytes().GetEnumerator();
            BinHexHeader       hdr = LoadBinHexHeader(stm);

            byte[] dataFork = LoadFork(hdr.DataForkLength, stm);
            byte[] rsrcFork = LoadFork(hdr.ResourceForkLength, stm);

            var cfgSvc   = Services.RequireService <IConfigurationService>();
            var arch     = cfgSvc.GetArchitecture("m68k") !;
            var platform = (MacOSClassic)cfgSvc.GetEnvironment("macOs").Load(Services, arch);

            if (hdr.FileType == "PACT")
            {
                Cpt.CompactProArchive        archive = new Cpt.CompactProArchive();
                List <ArchiveDirectoryEntry> items   = archive.Load(new MemoryStream(dataFork));
                IArchiveBrowserService       abSvc   = Services.GetService <IArchiveBrowserService>();
                if (abSvc != null)
                {
                    var selectedFile = abSvc.UserSelectFileFromArchive(items);
                    if (selectedFile != null)
                    {
                        var image = selectedFile.GetBytes();
                        this.rsrcFork   = new ResourceFork(platform, image);
                        this.bmem       = new ByteMemoryArea(addrLoad, image);
                        this.segmentMap = new SegmentMap(addrLoad);
                        return(new Program(this.segmentMap, arch, platform));
                    }
                }
            }
            if (hdr.FileType == "MPST" || hdr.FileType == "APPL")
            {
                this.bmem       = new ByteMemoryArea(addrLoad, rsrcFork);
                this.rsrcFork   = new ResourceFork(platform, rsrcFork);
                this.segmentMap = new SegmentMap(addrLoad);
                return(new Program(this.segmentMap, arch, platform));
            }
            this.bmem = new ByteMemoryArea(addrLoad, dataFork);
            return(new Program(
                       new SegmentMap(bmem.BaseAddress,
                                      new ImageSegment("", bmem, AccessMode.ReadWriteExecute)),
                       arch,
                       platform));
        }
Exemple #5
0
        public override Program Load(Address addrLoad)
        {
            List <ArchiveDirectoryEntry> entries = LoadDiskDirectory();
            IArchiveBrowserService       abSvc   = Services.GetService <IArchiveBrowserService>();

            if (abSvc != null)
            {
                var selectedFile = abSvc.UserSelectFileFromArchive(entries) as D64FileEntry;
                if (selectedFile != null)
                {
                    this.program = LoadImage(addrLoad, selectedFile);
                    return(program);
                }
            }
            var arch  = new Mos6502ProcessorArchitecture();
            var image = new LoadedImage(Address.Ptr16(0), RawImage);

            return(new Program {
                Image = image,
                ImageMap = image.CreateImageMap(),
                Architecture = arch,
                Platform = new DefaultPlatform(Services, arch)
            });
        }