コード例 #1
0
 public void Setup()
 {
     sc = new ServiceContainer();
     mr = new MockRepository();
     addrLoad = Address.Ptr32(0x00100000);
     fileImage = new byte[0x4000];
     writer = new LeImageWriter(fileImage);
 }
コード例 #2
0
 protected MachineInstruction Disassemble(uint instr)
 {
     var image = new LoadedImage(Address.Ptr32(0x00100000), new byte[4]);
     LeImageWriter w = new LeImageWriter(image.Bytes);
     w.WriteLeUInt32(0, instr);
     var arch = CreateArchitecture();
     var dasm = CreateDisassembler(arch, image.CreateLeReader(0));
     Assert.IsTrue(dasm.MoveNext());
     return dasm.Current;
 }
コード例 #3
0
ファイル: HeuristicTestBase.cs プロジェクト: killbug2004/reko
 protected LoadedImage CreateImage(Address addr, params uint[] opcodes)
 {
     byte[] bytes = new byte[0x20];
     var writer = new LeImageWriter(bytes);
     uint offset = 0;
     for (int i = 0; i < opcodes.Length; ++i, offset += 4)
     {
         writer.WriteLeUInt32(offset, opcodes[i]);
     }
     return new LoadedImage(addr, bytes);
 }
コード例 #4
0
 protected MachineInstruction DisassembleBits(string bitPattern)
 {
     var image = new LoadedImage(Address.Ptr32(0x00100000), new byte[4]);
     LeImageWriter w = new LeImageWriter(image.Bytes);
     uint instr = ParseBitPattern(bitPattern);
     w.WriteLeUInt32(0, instr);
     var b = image.Bytes;
     Debug.Print("Instruction bytes: {0:X2} {1:X2} {2:X2} {3:X2}", b[0], b[1], b[2], b[3]);
     var arch = CreateArchitecture();
     var dasm = arch.CreateDisassembler(image.CreateLeReader(0));
     return dasm.First();
 }
コード例 #5
0
ファイル: DisassemblerTests.cs プロジェクト: killbug2004/reko
 private MachineInstruction RunTest(params ushort [] words)
 {
     var bytes = new byte[words.Length * 2];
     LeImageWriter writer = new LeImageWriter(bytes);
     foreach (ushort word in words)
     {
         writer.WriteLeUInt16(word);
     }
     var image = new LoadedImage(Address.Ptr16(0x200), bytes);
     var rdr = new LeImageReader(image, 0);
     var arch = new Pdp11Architecture();
     var dasm = new Pdp11Disassembler(rdr, arch);
     return dasm.First();
 }
コード例 #6
0
 private byte[] CreateMsdosHeader()
 {
     ImageWriter stm = new LeImageWriter(new byte[16]);
     stm.WriteByte(0x4D);    // MZ
     stm.WriteByte(0x5A);
     stm.WriteBytes(0xCC, 4);
     stm.WriteLeUInt16(0x0090);
     stm.WriteBytes(0xCC, 0x12);
     stm.WriteByte(0x00);
     stm.WriteByte(0x00);
     stm.WriteByte(0x05);
     stm.WriteByte(0x21);
     stm.WriteString("PKLITE", Encoding.ASCII);
     stm.WriteBytes(0xCC, 0x0C);
     return stm.Bytes;
 }
コード例 #7
0
 private ImageWriter Memory(uint address)
 {
     image = new LoadedImage(Address.Ptr32(address), new byte[1024]);
     var mem = new LeImageWriter(image.Bytes);
     return mem;
 }