Esempio n. 1
0
        public override EvalResult Evaluate(MakeState s)
        {
            // Is it a register?
            if(Program.regs.ContainsKey(val.ToUpper()))
            {
                var e = new EvalResult();
                e.strval = val.ToUpper();
                e.intval = Program.regs[e.strval];
                e.Type = EvalResult.ResultType.Register;
                return e;
            }

            string full_name = val;

            // If defined in the current file, say so
            if (s.lo.ContainsKey(val))
            {
                // Yes - emit a relocation to the label
                Relocation r = new Relocation();
                r.TargetName = val;
                r.TargetSection = s.lo[val].Section;
                r.Addend = addend;
                r.SourceSection = s.cs;
                r.IsPCRel = is_pcrel;

                return new EvalResult(r);
            }
            else
            {
                // ld defines all unknown symbols as externals
                Relocation r = new Relocation();
                r.TargetName = val;
                r.TargetSection = null;
                r.Addend = addend;
                r.SourceSection = s.cs;
                r.IsPCRel = is_pcrel;

                return new EvalResult(r);
            }
            
            /*if (s.IsDefined(val) == true)
                 return s.GetDefine(val);
            {
                // Not defined in the current section.  Is it
                //  in another?
                if (s.lo.ContainsKey(val))
                {
                    // Yes - emit a relocation to the label
                    Relocation r = new Relocation();
                    r.TargetName = val;
                    r.TargetSection = s.lo[val].Section;
                    r.Addend = addend;
                    r.SourceSection = s.cs;
                    r.IsPCRel = is_pcrel;

                    return new EvalResult(r);
                }

                // ld defines all unknown symbols as externals
                Relocation rext = new Relocation();
                rext.TargetName = val;
                rext.TargetSection = null;
                rext.Addend = addend;
                rext.SourceSection = s.cs;
                rext.IsPCRel = is_pcrel;

                return new EvalResult(rext);
            }*/
        }
Esempio n. 2
0
 public EvalResult(Relocation r)
 {
     Type = ResultType.Relocation;
     relocval = r;
 }