Ejemplo n.º 1
0
        private static void ReadProject(BinaryReader br, Disassembler project)
        {
            int count, i;

            ReadStatic(br, ProjectMarker);
            project.Filename = br.ReadString();
            project.AcquireROM();

            ReadStatic(br, InstructionMarker);
            count = br.ReadInt32();
            for (i = 0; i < count; i++)
            {
                uint address = br.ReadUInt32();
                project.Instructions[address] = new Instruction(project, (OpCode)project.ROM[address], address);
            }

            ReadStatic(br, NameMarker);
            count = br.ReadInt32();
            for (i = 0; i < count; i++)
            {
                uint   address = br.ReadUInt32();
                string name    = br.ReadString();
                project.Namer.Names[address] = name;
            }

            ReadStatic(br, LabelMarker);
            count = br.ReadInt32();
            for (i = 0; i < count; i++)
            {
                uint   address = br.ReadUInt32();
                string label   = br.ReadString();
                project.Labeller.Labels[address] = label;
            }

            ReadStatic(br, CommentMarker);
            count = br.ReadInt32();
            for (i = 0; i < count; i++)
            {
                uint   address = br.ReadUInt32();
                string label   = br.ReadString();
                project.Comments[address] = label;
            }

            ReadStatic(br, CustomOperandMarker);
            count = br.ReadInt32();
            for (i = 0; i < count; i++)
            {
                uint address  = br.ReadUInt32();
                int  copCount = br.ReadInt32();
                for (int j = 0; j < copCount; j++)
                {
                    int index = br.ReadInt32();
                    project.AddCustomOperand(address, index, ReadOperand(br));
                }
            }

            ReadStatic(br, DataTypeMarker);
            count = br.ReadInt32();
            for (i = 0; i < count; i++)
            {
                uint address = br.ReadUInt32();
                uint type    = br.ReadUInt32();
                project.DataTypes[address] = (DataType)type;
            }
        }