Пример #1
0
 public override Tlcs900Instruction Decode(byte b, Tlcs900Disassembler dasm)
 {
     if (!mutator(b, dasm) || !dasm.rdr.TryReadByte(out b))
     {
         return(dasm.CreateInvalidInstruction());
     }
     return(regOpRecs[b].Decode(b, dasm));
 }
Пример #2
0
 public override Tlcs900Instruction Decode(uint bPrev, Tlcs900Disassembler dasm)
 {
     if (!mutator(bPrev, dasm) || !dasm.rdr.TryReadByte(out byte b))
     {
         return(dasm.CreateInvalidInstruction());
     }
     return(memDecoders[b].Decode(b, dasm));
 }
Пример #3
0
            public override Tlcs900Instruction Decode(uint bPrev, Tlcs900Disassembler dasm)
            {
                if (!dasm.rdr.TryReadByte(out byte b))
                {
                    return(null);
                }
                dasm.opSize = width;
                var op = dasm.ExtraRegister(b);

                if (op == null)
                {
                    return(dasm.CreateInvalidInstruction());
                }
                if (!dasm.rdr.TryReadByte(out b))
                {
                    return(dasm.CreateInvalidInstruction());
                }
                dasm.ops.Add(op);
                return(regDecoders[b].Decode(b, dasm));
            }
Пример #4
0
 public override Tlcs900Instruction Decode(uint b, Tlcs900Disassembler dasm)
 {
     foreach (var m in mutators)
     {
         if (!m(b, dasm))
         {
             return(dasm.CreateInvalidInstruction());
         }
     }
     dasm.ops.Reverse();
     return(new Tlcs900Instruction
     {
         Mnemonic = this.mnemonic,
         Address = dasm.addr,
         Operands = dasm.ops.ToArray()
     });
 }
Пример #5
0
            public override Tlcs900Instruction Decode(uint bPrev, Tlcs900Disassembler dasm)
            {
                if (!mutator(bPrev, dasm) || !dasm.rdr.TryReadByte(out byte b))
                {
                    return(dasm.CreateInvalidInstruction());
                }
                var instr = dstDecoders[b].Decode(b, dasm);

                if (instr.Operands.Length >= 2)
                {
                    instr.Operands[0].Width = instr.Operands[1].Width;
                }
                if (instr.Operands.Length >= 2 && instr.Operands[1].Width == null)
                {
                    //$HACK to get conditional calls/jumps to work
                    instr.Operands[1].Width = PrimitiveType.Word32;
                }
                return(instr);
            }
Пример #6
0
            public override Tlcs900Instruction Decode(uint b, Tlcs900Disassembler dasm)
            {
                foreach (var m in mutators)
                {
                    if (!m(b, dasm))
                    {
                        return(dasm.CreateInvalidInstruction());
                    }
                }
                var instr = new Tlcs900Instruction
                {
                    Mnemonic         = opcode,
                    InstructionClass = iclass,
                    Address          = dasm.addr,
                    Operands         = dasm.ops.ToArray()
                };

                return(instr);
            }
Пример #7
0
            public override Tlcs900Instruction Decode(byte b, Tlcs900Disassembler dasm)
            {
                foreach (var m in mutators)
                {
                    if (!m(b, dasm))
                    {
                        return(dasm.CreateInvalidInstruction());
                    }
                }
                bool swap = dasm.ops.Count == 2;

                return(new Tlcs900Instruction
                {
                    Opcode = this.opcode,
                    Address = dasm.addr,
                    op1 = swap ? dasm.ops[1] : dasm.ops[0],
                    op2 = swap ? dasm.ops[0] : null
                });
            }
Пример #8
0
            public override Tlcs900Instruction Decode(byte b, Tlcs900Disassembler dasm)
            {
                if (!mutator(b, dasm) || !dasm.rdr.TryReadByte(out b))
                {
                    return(dasm.CreateInvalidInstruction());
                }
                var instr = dstOpRecs[b].Decode(b, dasm);

                if (instr.op1 != null && instr.op2 != null)
                {
                    instr.op1.Width = instr.op2.Width;
                }
                if (instr.op2 != null && instr.op2.Width == null)
                {
                    //$HACK to get conditional calls/jumps to work
                    instr.op2.Width = PrimitiveType.Word32;
                }
                return(instr);
            }
Пример #9
0
            public override Tlcs900Instruction Decode(uint bPrev, Tlcs900Disassembler dasm)
            {
                if (this.mutator == null)
                {
                    return(new Tlcs900Instruction
                    {
                        Mnemonic = this.mnemonic,
                        Address = dasm.addr,
                        Operands = dasm.ops.ToArray()
                    });
                }

                if (!mutator(bPrev, dasm))
                {
                    return(dasm.CreateInvalidInstruction());
                }
                dasm.ops.Reverse();
                return(new Tlcs900Instruction
                {
                    Mnemonic = this.mnemonic,
                    Address = dasm.addr,
                    Operands = dasm.ops.ToArray()
                });
            }
Пример #10
0
            public override Tlcs900Instruction Decode(byte b, Tlcs900Disassembler dasm)
            {
                if (this.mutator == null)
                {
                    return(new Tlcs900Instruction
                    {
                        Opcode = this.opcode,
                        Address = dasm.addr,
                        op1 = dasm.ops[0]
                    });
                }

                if (!mutator(b, dasm))
                {
                    return(dasm.CreateInvalidInstruction());
                }
                return(new Tlcs900Instruction
                {
                    Opcode = this.opcode,
                    Address = dasm.addr,
                    op1 = dasm.ops.Count > 1 ? dasm.ops[1] : dasm.ops[0],
                    op2 = dasm.ops.Count > 1 ? dasm.ops[0] : null,
                });
            }