コード例 #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
ファイル: Tlcs900Disassembler.cs プロジェクト: erenes/reko
 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
ファイル: Tlcs900Disassembler.cs プロジェクト: erenes/reko
            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
ファイル: Tlcs900Disassembler.cs プロジェクト: erenes/reko
 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
ファイル: Tlcs900Disassembler.cs プロジェクト: erenes/reko
            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
ファイル: Tlcs900Disassembler.cs プロジェクト: erenes/reko
            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,
                });
            }