예제 #1
0
 public Pdp11Assembler(Pdp11Architecture arch, Address addrBase, IEmitter emitter)
 {
     this.arch = arch;
     this.BaseAddress = addrBase;
     this.emitter = emitter;
     this.Equates = new Dictionary<string, object>();
     this.symtab = new SymbolTable();
 }
예제 #2
0
		public OperandParser(Lexer lexer, SymbolTable symtab, Address addrBase, PrimitiveType defaultWordWidth, PrimitiveType defaultAddressWidth)
		{
			this.lexer = lexer;
			this.symtab = symtab;
			this.addrBase = addrBase;
			this.defaultWordWidth = defaultWordWidth;
			this.defaultAddressWidth = defaultAddressWidth;
            this.segOverride = RegisterStorage.None;
		}
예제 #3
0
		public void SymCreateSymbol()
		{
			SymbolTable symtab = new SymbolTable();
			Symbol sym = symtab.CreateSymbol("foo");
			StringWriter writer = new StringWriter();
			symtab.Write(writer);
			Assert.AreEqual(
@"foo: unresolved 00000000 patches: 0 (foo)
", writer.ToString());
		}
예제 #4
0
		public void SymUndefinedSymbols()
		{
			SymbolTable symtab = new SymbolTable();
			Symbol foo = symtab.CreateSymbol("foo");
			Symbol bar = symtab.CreateSymbol("bar");
			Symbol fred = symtab.DefineSymbol("fred", 0x10);
			Symbol [] undef = symtab.GetUndefinedSymbols();
			Assert.AreEqual(2, undef.Length);
			Assert.AreSame(bar, undef[0]);
			Assert.AreSame(foo, undef[1]);
		}
예제 #5
0
		public void SymResolveReference()
		{
			SymbolTable symtab = new SymbolTable();
			Symbol sym = symtab.CreateSymbol("foo");
			Symbol sym2 = symtab.DefineSymbol("foo", 3);
			StringWriter writer = new StringWriter();
			symtab.Write(writer);
			Assert.AreEqual(
@"foo: resolved 00000003 patches: 0 (foo)
", 
				writer.ToString());
		}
예제 #6
0
        private Dictionary<Symbol, AssembledSegment> symbolSegments;        // The segment to which a symbol belongs.

        public X86Assembler(IntelArchitecture arch, Address addrBase, List<EntryPoint> entryPoints)
        {
            this.arch = arch;
            this.Platform = new MsdosPlatform(null, arch);
            this.addrBase = addrBase;
            this.entryPoints = entryPoints;
            this.defaultWordSize = arch.WordWidth;
            this.textEncoding = Encoding.GetEncoding("ISO_8859-1");
            symtab = new SymbolTable();
            importReferences = new Dictionary<Address, ImportReference>();
            segments = new List<AssembledSegment>();
            mpNameToSegment = new Dictionary<string, AssembledSegment>();
            symbolSegments = new Dictionary<Symbol, AssembledSegment>();
            this.SegmentOverride = RegisterStorage.None;

            unknownSegment = new AssembledSegment(new Emitter(), symtab.DefineSymbol("", 0));
            segments.Add(unknownSegment);

            SwitchSegment(unknownSegment);

            SetDefaultWordWidth(defaultWordSize);
        }
예제 #7
0
		public void Setup()
		{
			symtab = new SymbolTable();
		}