Exemplo n.º 1
0
        private void InsertJump(Instruction i, VM.Opcode opcode)
        {
            byte reg;

            // for conditional jumps, fetch the appropriate register for the conditional value
            if (opcode != VM.Opcode.JMP)
            {
                reg = FetchRegister(i.a.target);
            }
            else
            {
                reg = 0;
            }

            _output.EmitJump(opcode, i.b.target, reg);
        }
Exemplo n.º 2
0
        private void InsertOp(Instruction i, VM.Opcode Opcode)
        {
            if (i.b != null)
            {
                var a   = FetchRegister(i.a.target);
                var b   = FetchRegister(i.b.target);
                var dst = FetchRegister(i.target);

                _output.Emit(Opcode, new byte[] { a, b, dst });
            }
            else
            {
                var src = FetchRegister(i.a.target);
                var dst = FetchRegister(i.target);

                _output.Emit(Opcode, new byte[] { src, dst });
            }
        }