// source register (5 bits) private static bool r(uint wInstr, Avr8Disassembler dasm) { var iReg = (int)((wInstr >> 4) & 0x10 | (wInstr >> 4) & 0x0F); dasm.ops.Add(dasm.Register(iReg)); return(true); }
// Relative jump private static bool J(uint wInstr, Avr8Disassembler dasm) { int offset = (short)((wInstr & 0xFFF) << 4); offset = offset >> 3; dasm.ops.Add(AddressOperand.Create(dasm.addr + 2 + offset)); return(true); }
// Trailing 16-bit absolute address private static bool w(uint uInstr, Avr8Disassembler dasm) { if (!dasm.rdr.TryReadLeUInt16(out ushort w2)) { return(false); } dasm.ops.Add(AddressOperand.Ptr16(w2)); return(true); }
public override AvrInstruction Decode(Avr8Disassembler dasm, ushort wInstr) { int slot = (wInstr >> shift) & mask; if (!decoders.TryGetValue(slot, out Decoder decoder)) { return(invalid.Decode(dasm, wInstr)); } return(decoder.Decode(dasm, wInstr)); }
// Branch offset private static bool o(uint wInstr, Avr8Disassembler dasm) { short offset; offset = (short)wInstr; offset = (short)(offset << 6); offset = (short)(offset >> 8); offset = (short)(offset & ~1); dasm.ops.Add(AddressOperand.Create(dasm.addr + offset + 2)); return(true); }
public override AvrInstruction Decode(Avr8Disassembler dasm, ushort wInstr) { int slot = (wInstr >> shift) & mask; OpRec oprec; if (!oprecs.TryGetValue(slot, out oprec)) { return(dasm.Decode(wInstr, Opcode.invalid, InstrClass.Invalid, "")); } return(oprec.Decode(dasm, wInstr)); }
public override AvrInstruction Decode(Avr8Disassembler dasm, ushort wInstr) { int br = (((wInstr >> 7) & 8) | (wInstr & 7)) & 0xF; o(wInstr, dasm); return(new AvrInstruction { iclass = InstrClass.ConditionalTransfer, opcode = branches[br], operands = dasm.ops.ToArray() }); }
// absolute address used by jump and call. private static bool Q(uint wInstr, Avr8Disassembler dasm) { if (!dasm.rdr.TryReadLeUInt16(out ushort w2)) { return(false); } dasm.ops.Add(AddressOperand.Ptr32( (uint)(((wInstr >> 4) & 0x1F) << 18) | (uint)((wInstr & 1) << 17) | (uint)(w2 << 1))); return(true); }
public override AvrInstruction Decode(Avr8Disassembler dasm, ushort wInstr) { foreach (var m in mutators) { if (!m(wInstr, dasm)) { return(invalid.Decode(dasm, wInstr)); } } return(new AvrInstruction { opcode = opcode, iclass = iclass, operands = dasm.ops.ToArray(), }); }
public override AvrInstruction Decode(Avr8Disassembler dasm, ushort wInstr) { int slot = (wInstr >> shift) & mask; return(oprecs[slot].Decode(dasm, wInstr)); }
public override AvrInstruction Decode(Avr8Disassembler dasm, ushort wInstr) { return(dasm.Decode(wInstr, opcode, iclass, fmt)); }
public abstract AvrInstruction Decode(Avr8Disassembler dasm, ushort wInstr);
// Destination register private static bool D(uint wInstr, Avr8Disassembler dasm) { dasm.ops.Add(dasm.Register(((int)wInstr >> 4) & 0x1F)); return(true); }
private static bool z(uint wInstr, Avr8Disassembler dasm) { dasm.ops.Add(dasm.MemD(Avr8Architecture.z, dasm.Displacement((ushort)wInstr))); return(true); }
private static bool Z(uint wInstr, Avr8Disassembler dasm) { dasm.ops.Add(dasm.MemD(Avr8Architecture.z, 0)); return(true); }
// source register (r16-r31) private static bool r4(uint wInstr, Avr8Disassembler dasm) { dasm.ops.Add(dasm.Register(0x10 | (int)wInstr & 0x0F)); return(true); }
// immediate used by adiw/sbiw private static bool s(uint wInstr, Avr8Disassembler dasm) { dasm.ops.Add(ImmediateOperand.Byte((byte)(((wInstr >> 2) & 0x30) | (wInstr & 0xF)))); return(true); }
// register pair used by adiw private static bool q(uint wInstr, Avr8Disassembler dasm) { dasm.ops.Add(dasm.Register(24 + ((int)(wInstr >> 3) & 6))); return(true); }
// register pair source private static bool P(uint wInstr, Avr8Disassembler dasm) { dasm.ops.Add(dasm.Register(((int)wInstr << 1) & ~1)); return(true); }
public override AvrInstruction Decode(Avr8Disassembler dasm, ushort wInstr) { int br = (((wInstr >> 7) & 8) | (wInstr & 7)) & 0xF; return(dasm.Decode(wInstr, branches[br], InstrClass.ConditionalTransfer, "o")); }
// 4-bit immediate at bit 0 private static bool I(uint wInstr, Avr8Disassembler dasm) { dasm.ops.Add(ImmediateOperand.Byte((byte)(wInstr & 0x0F))); return(true); }