private static bool PostEh(uint uInstr, H8Disassembler dasm) { var iReg = hi3.Read(uInstr); dasm.ops.Add(MemoryOperand.Post(dasm.dataSize !, Registers.GpRegisters[iReg])); return(true); }
/// <summary> /// 8-bit register encoded in 4 bits at bit position 8 /// </summary> private static bool rb8(uint uInstr, H8Disassembler dasm) { var iReg = r8_4.Read(uInstr); dasm.ops.Add(new RegisterOperand(Registers.Gp8Registers[iReg])); return(true); }
private static bool Bit(uint uInstr, H8Disassembler dasm) { var imm = bfImm.Read(uInstr); dasm.ops.Add(ImmediateOperand.Byte((byte)imm)); return(true); }
/// <summary> /// Immediate 8-bit number encoded in low 8 bits. /// </summary> private static bool I8(uint uInstr, H8Disassembler dasm) { var imm = (byte)uInstr; dasm.ops.Add(ImmediateOperand.Byte(imm)); return(true); }
/// <summary> /// 8-bit absolute memory access, stored in the low 8 bits of this instruction. /// </summary> private static bool aa8(uint uInstr, H8Disassembler dasm) { uint uAddr = uInstr & 0xFF; dasm.ops.Add(MemoryOperand.Abs(dasm.dataSize !, uAddr, PrimitiveType.Byte)); return(true); }
/// <summary> /// Memory access with base register. /// </summary> private static bool Mind(uint uInstr, H8Disassembler dasm) { var iBaseReg = hi3.Read(uInstr); dasm.ops.Add(MemoryOperand.BaseOffset(dasm.dataSize !, 0, PrimitiveType.Ptr16, Registers.GpRegisters[iBaseReg])); return(true); }
/// <summary> /// Deferred 8-bit absolute memory access, stored in the low 8 bits of this instruction. /// </summary> private static bool Def_aa8(uint uInstr, H8Disassembler dasm) { uint uAddr = uInstr & 0xFF; var mop = MemoryOperand.Abs(dasm.dataSize !, uAddr, PrimitiveType.Byte); mop.Deferred = true; dasm.ops.Add(mop); return(true); }
/// <summary> /// Immediate 16-bit number encoded in next 16 bits. /// </summary> private static bool I16(uint _, H8Disassembler dasm) { if (!dasm.rdr.TryReadBeUInt16(out var imm)) { return(false); } dasm.ops.Add(ImmediateOperand.Word16(imm)); return(true); }
/// <summary> /// 16-bit absolute memory access, stored in the next 16 bits. /// </summary> private static bool aa16(uint uInstr, H8Disassembler dasm) { if (!dasm.rdr.TryReadUInt16(out ushort uAddr)) { return(false); } dasm.ops.Add(MemoryOperand.Abs(dasm.dataSize !, uAddr, PrimitiveType.Ptr16)); return(true); }
/// <summary> /// Memory access with base register and 16-bit displacement; displacement follows opcode. /// </summary> private static bool Md16(uint uInstr, H8Disassembler dasm) { if (!dasm.rdr.TryReadBeInt16(out short offset)) { return(false); } var iBaseReg = hi3.Read(uInstr); dasm.ops.Add(MemoryOperand.BaseOffset(dasm.dataSize !, offset, PrimitiveType.Ptr16, Registers.GpRegisters[iBaseReg])); return(true); }
/// <summary> /// 16-bit register encoded in 4 bits at bit position 8 /// </summary> private static bool r8(uint uInstr, H8Disassembler dasm) { var iReg = r8_4.Read(uInstr); if (iReg >= dasm.regs.Length) { return(false); } dasm.ops.Add(new RegisterOperand(dasm.regs[iReg])); return(true); }
/// <summary> /// 32-bit register encoded in low 4 bits. /// </summary> private static bool rgpl(uint uInstr, H8Disassembler dasm) { var iReg = r0_4.Read(uInstr); if ((iReg & 8) != 0) { return(false); } dasm.ops.Add(new RegisterOperand(Registers.GpRegisters[iReg])); return(true); }
/// <summary> /// 24-bit absolute memory access, stored in the low 8 bits of the instruction /// and the next 16 bits. /// </summary> private static bool aa24_16(uint uInstr, H8Disassembler dasm) { if (!dasm.rdr.TryReadUInt16(out ushort uLow16)) { return(false); } uint uAddr = ((uInstr & 0xFF) << 16) | uLow16; dasm.ops.Add(MemoryOperand.Abs(dasm.dataSize !, uAddr, dasm.arch.Ptr24)); return(true); }
/// <summary> /// 8 bit signed displacement from the low byte of the instruction. /// </summary> private static bool disp8(uint uInstr, H8Disassembler dasm) { var disp = (sbyte)uInstr; if ((disp & 1) != 0) { return(false); // Branch destination must be even. } var addrTarget = dasm.rdr.Address + disp; dasm.ops.Add(AddressOperand.Create(addrTarget)); return(true); }
/// <summary> /// 24-bit absolute memory access, stored in the next 24 bits. /// </summary> private static bool aa24(uint uInstr, H8Disassembler dasm) { if (!dasm.rdr.TryReadUInt16(out ushort uHigh16)) { return(false); } if (!dasm.rdr.TryReadByte(out byte uLow8)) { return(false); } uint uAddr = (uint)uHigh16 << 8; uAddr |= uLow8; dasm.ops.Add(MemoryOperand.Abs(dasm.dataSize !, uAddr, dasm.arch.Ptr24)); return(true); }
private static bool b(uint _, H8Disassembler dasm) { dasm.dataSize = PrimitiveType.Byte; dasm.regs = Registers.Gp8Registers; return(true); }
private static bool ccr(uint _, H8Disassembler dasm) { dasm.ops.Add(new RegisterOperand(Registers.CcRegister)); return(true); }
private static bool l(uint _, H8Disassembler dasm) { dasm.dataSize = PrimitiveType.Word32; dasm.regs = Registers.GpRegisters; return(true); }