Пример #1
0
        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);
        }
Пример #2
0
        /// <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);
        }
Пример #3
0
        private static bool Bit(uint uInstr, H8Disassembler dasm)
        {
            var imm = bfImm.Read(uInstr);

            dasm.ops.Add(ImmediateOperand.Byte((byte)imm));
            return(true);
        }
Пример #4
0
        /// <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);
        }
Пример #5
0
        /// <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);
        }
Пример #6
0
        /// <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);
        }
Пример #7
0
        /// <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);
        }
Пример #8
0
 /// <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);
 }
Пример #9
0
 /// <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);
 }
Пример #10
0
        /// <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);
        }
Пример #11
0
        /// <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);
        }
Пример #12
0
        /// <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);
        }
Пример #13
0
        /// <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);
        }
Пример #14
0
        /// <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);
        }
Пример #15
0
        /// <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);
        }
Пример #16
0
 private static bool b(uint _, H8Disassembler dasm)
 {
     dasm.dataSize = PrimitiveType.Byte;
     dasm.regs     = Registers.Gp8Registers;
     return(true);
 }
Пример #17
0
 private static bool ccr(uint _, H8Disassembler dasm)
 {
     dasm.ops.Add(new RegisterOperand(Registers.CcRegister));
     return(true);
 }
Пример #18
0
 private static bool l(uint _, H8Disassembler dasm)
 {
     dasm.dataSize = PrimitiveType.Word32;
     dasm.regs     = Registers.GpRegisters;
     return(true);
 }