示例#1
0
        void ReportInstanceErrors(AssemblingStatus status, MixInstruction.Instance instance)
        {
            var errorArray = instance.Validate();

            if (errorArray != null)
            {
                int causeStartIndex = 0;
                int causeLength     = 0;

                foreach (InstanceValidationError error in errorArray)
                {
                    switch (error.Source)
                    {
                    case InstanceValidationError.Sources.Address:
                        causeStartIndex = 0;
                        causeLength     = mIndexPartCharIndex;
                        break;

                    case InstanceValidationError.Sources.Index:
                        causeStartIndex = mIndexPartCharIndex;
                        causeLength     = mFieldPartCharIndex - mIndexPartCharIndex;
                        break;

                    case InstanceValidationError.Sources.FieldSpec:
                        causeStartIndex = mFieldPartCharIndex;
                        causeLength     = mTextLength - mFieldPartCharIndex;
                        break;
                    }

                    status.ReportError(LineSection.AddressField, causeStartIndex, causeLength, error);
                }
            }
        }
示例#2
0
        int LoadInstructionInstance(MixInstruction.Instance instance, int locationCounter)
        {
            var validationErrors = instance.Validate();

            if (validationErrors != null)
            {
                ReportLoadInstanceErrors(locationCounter, validationErrors);
            }

            FullMemory[locationCounter].MagnitudeLongValue = instance.InstructionWord.MagnitudeLongValue;
            FullMemory[locationCounter].Sign       = instance.InstructionWord.Sign;
            FullMemory[locationCounter].SourceLine = instance.SourceLine;

            return(locationCounter + 1);
        }