private TWord Read(MachineOperand op) { var r = op as RegisterOperand; if (r != null) { return(ReadRegister(r.Register)); } var i = op as ImmediateOperand; if (i != null) { return(i.Value.ToUInt32()); } var a = op as AddressOperand; if (a != null) { return(a.Address.ToUInt32()); } var m = op as MemoryOperand; if (m != null) { TWord ea = GetEffectiveAddress(m); byte b; switch (op.Width.Size) { case 1: if (!img.TryReadByte(Address.Ptr32(ea), out b)) { throw new IndexOutOfRangeException(); } else { return(b); } case 4: return(img.ReadLeUInt32(Address.Ptr32(ea))); } throw new NotImplementedException(); } throw new NotImplementedException(); }