Exemplo n.º 1
0
        private Program LoadImage(Address addrLoad, T64FileEntry selectedFile)
        {
            switch (selectedFile.FileType)
            {
            default:
                throw new NotImplementedException();

            case FileType.PRG:
                return(LoadPrg(selectedFile));
            }
        }
Exemplo n.º 2
0
        private Program LoadPrg(T64FileEntry selectedFile)
        {
            var image = new ByteMemoryArea(
                Address.Ptr16(selectedFile.LoadAddress),
                selectedFile.GetBytes());
            var rdr      = new C64BasicReader(image, 0x0801);
            var lines    = rdr.ToSortedList(line => (ushort)line.LineNumber, line => line);
            var cfgSvc   = Services.RequireService <IConfigurationService>();
            var arch6502 = cfgSvc.GetArchitecture("m6502") !;
            var arch     = new C64Basic(Services, lines);
            var platform = cfgSvc.GetEnvironment("c64").Load(Services, arch);
            var segMap   = platform.CreateAbsoluteMemoryMap() !;

            segMap.AddSegment(image, "code", AccessMode.ReadWriteExecute);
            var program = new Program(segMap, arch, platform);

            program.Architectures.Add(arch6502.Name, arch6502);
            var addrBasic = Address.Ptr16(lines.Keys[0]);
            var sym       = ImageSymbol.Procedure(arch, addrBasic, state: arch.CreateProcessorState());

            program.EntryPoints.Add(sym.Address, sym);
            return(program);
        }