2018-11-17 05:01:31 +01:00
|
|
|
using Ryujinx.Common.Logging;
|
2018-04-08 21:17:35 +02:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
2019-10-13 08:02:07 +02:00
|
|
|
namespace Ryujinx.Graphics.Gpu
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
|
|
|
class MacroInterpreter
|
|
|
|
{
|
|
|
|
private enum AssignmentOperation
|
|
|
|
{
|
|
|
|
IgnoreAndFetch = 0,
|
|
|
|
Move = 1,
|
|
|
|
MoveAndSetMaddr = 2,
|
|
|
|
FetchAndSend = 3,
|
|
|
|
MoveAndSend = 4,
|
|
|
|
FetchAndSetMaddr = 5,
|
|
|
|
MoveAndSetMaddrThenFetchAndSend = 6,
|
|
|
|
MoveAndSetMaddrThenSendHigh = 7
|
|
|
|
}
|
|
|
|
|
|
|
|
private enum AluOperation
|
|
|
|
{
|
|
|
|
AluReg = 0,
|
|
|
|
AddImmediate = 1,
|
|
|
|
BitfieldReplace = 2,
|
|
|
|
BitfieldExtractLslImm = 3,
|
|
|
|
BitfieldExtractLslReg = 4,
|
|
|
|
ReadImmediate = 5
|
|
|
|
}
|
|
|
|
|
|
|
|
private enum AluRegOperation
|
|
|
|
{
|
|
|
|
Add = 0,
|
|
|
|
AddWithCarry = 1,
|
|
|
|
Subtract = 2,
|
|
|
|
SubtractWithBorrow = 3,
|
|
|
|
BitwiseExclusiveOr = 8,
|
|
|
|
BitwiseOr = 9,
|
|
|
|
BitwiseAnd = 10,
|
|
|
|
BitwiseAndNot = 11,
|
|
|
|
BitwiseNotAnd = 12
|
|
|
|
}
|
|
|
|
|
2019-10-13 08:02:07 +02:00
|
|
|
private GpuContext _context;
|
|
|
|
|
|
|
|
private NvGpuFifo _pFifo;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
|
|
|
public Queue<int> Fifo { get; private set; }
|
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
private int[] _gprs;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
private int _methAddr;
|
|
|
|
private int _methIncr;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
private bool _carry;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
private int _opCode;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
private int _pipeOp;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
private int _pc;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-10-13 08:02:07 +02:00
|
|
|
public MacroInterpreter(GpuContext context, NvGpuFifo pFifo)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
2019-10-13 08:02:07 +02:00
|
|
|
_context = context;
|
|
|
|
_pFifo = pFifo;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
|
|
|
Fifo = new Queue<int>();
|
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
_gprs = new int[8];
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
2019-10-13 08:02:07 +02:00
|
|
|
public void Execute(int[] mme, int position, int param)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
|
|
|
Reset();
|
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
_gprs[1] = param;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
_pc = position;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
FetchOpCode(mme);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-10-13 08:02:07 +02:00
|
|
|
while (Step(mme));
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-07-02 04:39:22 +02:00
|
|
|
// Due to the delay slot, we still need to execute
|
|
|
|
// one more instruction before we actually exit.
|
2019-10-13 08:02:07 +02:00
|
|
|
Step(mme);
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private void Reset()
|
|
|
|
{
|
2019-03-04 02:45:25 +01:00
|
|
|
for (int index = 0; index < _gprs.Length; index++)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
2019-03-04 02:45:25 +01:00
|
|
|
_gprs[index] = 0;
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
_methAddr = 0;
|
|
|
|
_methIncr = 0;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
_carry = false;
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
2019-10-13 08:02:07 +02:00
|
|
|
private bool Step(int[] mme)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
2019-03-04 02:45:25 +01:00
|
|
|
int baseAddr = _pc - 1;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
FetchOpCode(mme);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
if ((_opCode & 7) < 7)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
2019-07-02 04:39:22 +02:00
|
|
|
// Operation produces a value.
|
2019-03-04 02:45:25 +01:00
|
|
|
AssignmentOperation asgOp = (AssignmentOperation)((_opCode >> 4) & 7);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
int result = GetAluResult();
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
switch (asgOp)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
2019-07-02 04:39:22 +02:00
|
|
|
// Fetch parameter and ignore result.
|
2018-04-08 21:17:35 +02:00
|
|
|
case AssignmentOperation.IgnoreAndFetch:
|
|
|
|
{
|
|
|
|
SetDstGpr(FetchParam());
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2019-07-02 04:39:22 +02:00
|
|
|
// Move result.
|
2018-04-08 21:17:35 +02:00
|
|
|
case AssignmentOperation.Move:
|
|
|
|
{
|
2019-03-04 02:45:25 +01:00
|
|
|
SetDstGpr(result);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2019-07-02 04:39:22 +02:00
|
|
|
// Move result and use as Method Address.
|
2018-04-08 21:17:35 +02:00
|
|
|
case AssignmentOperation.MoveAndSetMaddr:
|
|
|
|
{
|
2019-03-04 02:45:25 +01:00
|
|
|
SetDstGpr(result);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
SetMethAddr(result);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2019-07-02 04:39:22 +02:00
|
|
|
// Fetch parameter and send result.
|
2018-04-08 21:17:35 +02:00
|
|
|
case AssignmentOperation.FetchAndSend:
|
|
|
|
{
|
|
|
|
SetDstGpr(FetchParam());
|
|
|
|
|
2019-10-13 08:02:07 +02:00
|
|
|
Send(result);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2019-07-02 04:39:22 +02:00
|
|
|
// Move and send result.
|
2018-04-08 21:17:35 +02:00
|
|
|
case AssignmentOperation.MoveAndSend:
|
|
|
|
{
|
2019-03-04 02:45:25 +01:00
|
|
|
SetDstGpr(result);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-10-13 08:02:07 +02:00
|
|
|
Send(result);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2019-07-02 04:39:22 +02:00
|
|
|
// Fetch parameter and use result as Method Address.
|
2018-04-08 21:17:35 +02:00
|
|
|
case AssignmentOperation.FetchAndSetMaddr:
|
|
|
|
{
|
|
|
|
SetDstGpr(FetchParam());
|
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
SetMethAddr(result);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2019-07-02 04:39:22 +02:00
|
|
|
// Move result and use as Method Address, then fetch and send parameter.
|
2018-04-08 21:17:35 +02:00
|
|
|
case AssignmentOperation.MoveAndSetMaddrThenFetchAndSend:
|
|
|
|
{
|
2019-03-04 02:45:25 +01:00
|
|
|
SetDstGpr(result);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
SetMethAddr(result);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-10-13 08:02:07 +02:00
|
|
|
Send(FetchParam());
|
2018-04-08 21:17:35 +02:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2019-07-02 04:39:22 +02:00
|
|
|
// Move result and use as Method Address, then send bits 17:12 of result.
|
2018-04-08 21:17:35 +02:00
|
|
|
case AssignmentOperation.MoveAndSetMaddrThenSendHigh:
|
|
|
|
{
|
2019-03-04 02:45:25 +01:00
|
|
|
SetDstGpr(result);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
SetMethAddr(result);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-10-13 08:02:07 +02:00
|
|
|
Send((result >> 12) & 0x3f);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-07-02 04:39:22 +02:00
|
|
|
// Branch.
|
2019-03-04 02:45:25 +01:00
|
|
|
bool onNotZero = ((_opCode >> 4) & 1) != 0;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
bool taken = onNotZero
|
2018-04-08 21:17:35 +02:00
|
|
|
? GetGprA() != 0
|
|
|
|
: GetGprA() == 0;
|
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
if (taken)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
2019-03-04 02:45:25 +01:00
|
|
|
_pc = baseAddr + GetImm();
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
bool noDelays = (_opCode & 0x20) != 0;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
if (noDelays)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
2019-03-04 02:45:25 +01:00
|
|
|
FetchOpCode(mme);
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
bool exit = (_opCode & 0x80) != 0;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
return !exit;
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
private void FetchOpCode(int[] mme)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
2019-03-04 02:45:25 +01:00
|
|
|
_opCode = _pipeOp;
|
|
|
|
_pipeOp = mme[_pc++];
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private int GetAluResult()
|
|
|
|
{
|
2019-03-04 02:45:25 +01:00
|
|
|
AluOperation op = (AluOperation)(_opCode & 7);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
switch (op)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
|
|
|
case AluOperation.AluReg:
|
|
|
|
{
|
2019-03-04 02:45:25 +01:00
|
|
|
AluRegOperation aluOp = (AluRegOperation)((_opCode >> 17) & 0x1f);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
return GetAluResult(aluOp, GetGprA(), GetGprB());
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
case AluOperation.AddImmediate:
|
|
|
|
{
|
|
|
|
return GetGprA() + GetImm();
|
|
|
|
}
|
|
|
|
|
|
|
|
case AluOperation.BitfieldReplace:
|
|
|
|
case AluOperation.BitfieldExtractLslImm:
|
|
|
|
case AluOperation.BitfieldExtractLslReg:
|
|
|
|
{
|
2019-03-04 02:45:25 +01:00
|
|
|
int bfSrcBit = (_opCode >> 17) & 0x1f;
|
|
|
|
int bfSize = (_opCode >> 22) & 0x1f;
|
|
|
|
int bfDstBit = (_opCode >> 27) & 0x1f;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
int bfMask = (1 << bfSize) - 1;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
int dst = GetGprA();
|
|
|
|
int src = GetGprB();
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
switch (op)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
|
|
|
case AluOperation.BitfieldReplace:
|
|
|
|
{
|
2019-03-04 02:45:25 +01:00
|
|
|
src = (int)((uint)src >> bfSrcBit) & bfMask;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
dst &= ~(bfMask << bfDstBit);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
dst |= src << bfDstBit;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
return dst;
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
case AluOperation.BitfieldExtractLslImm:
|
|
|
|
{
|
2019-03-04 02:45:25 +01:00
|
|
|
src = (int)((uint)src >> dst) & bfMask;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
return src << bfDstBit;
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
case AluOperation.BitfieldExtractLslReg:
|
|
|
|
{
|
2019-03-04 02:45:25 +01:00
|
|
|
src = (int)((uint)src >> bfSrcBit) & bfMask;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
return src << dst;
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case AluOperation.ReadImmediate:
|
|
|
|
{
|
|
|
|
return Read(GetGprA() + GetImm());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
throw new ArgumentException(nameof(_opCode));
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
private int GetAluResult(AluRegOperation aluOp, int a, int b)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
2019-03-04 02:45:25 +01:00
|
|
|
switch (aluOp)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
|
|
|
case AluRegOperation.Add:
|
|
|
|
{
|
2019-03-04 02:45:25 +01:00
|
|
|
ulong result = (ulong)a + (ulong)b;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
_carry = result > 0xffffffff;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
return (int)result;
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
case AluRegOperation.AddWithCarry:
|
|
|
|
{
|
2019-03-04 02:45:25 +01:00
|
|
|
ulong result = (ulong)a + (ulong)b + (_carry ? 1UL : 0UL);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
_carry = result > 0xffffffff;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
return (int)result;
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
case AluRegOperation.Subtract:
|
|
|
|
{
|
2019-03-04 02:45:25 +01:00
|
|
|
ulong result = (ulong)a - (ulong)b;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
_carry = result < 0x100000000;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
return (int)result;
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
case AluRegOperation.SubtractWithBorrow:
|
|
|
|
{
|
2019-03-04 02:45:25 +01:00
|
|
|
ulong result = (ulong)a - (ulong)b - (_carry ? 0UL : 1UL);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
_carry = result < 0x100000000;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
return (int)result;
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
case AluRegOperation.BitwiseExclusiveOr: return a ^ b;
|
|
|
|
case AluRegOperation.BitwiseOr: return a | b;
|
|
|
|
case AluRegOperation.BitwiseAnd: return a & b;
|
|
|
|
case AluRegOperation.BitwiseAndNot: return a & ~b;
|
|
|
|
case AluRegOperation.BitwiseNotAnd: return ~(a & b);
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
throw new ArgumentOutOfRangeException(nameof(aluOp));
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private int GetImm()
|
|
|
|
{
|
2019-07-02 04:39:22 +02:00
|
|
|
// Note: The immediate is signed, the sign-extension is intended here.
|
2019-03-04 02:45:25 +01:00
|
|
|
return _opCode >> 14;
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
private void SetMethAddr(int value)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
2019-03-04 02:45:25 +01:00
|
|
|
_methAddr = (value >> 0) & 0xfff;
|
|
|
|
_methIncr = (value >> 12) & 0x3f;
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
private void SetDstGpr(int value)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
2019-03-04 02:45:25 +01:00
|
|
|
_gprs[(_opCode >> 8) & 7] = value;
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private int GetGprA()
|
|
|
|
{
|
2019-03-04 02:45:25 +01:00
|
|
|
return GetGprValue((_opCode >> 11) & 7);
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private int GetGprB()
|
|
|
|
{
|
2019-03-04 02:45:25 +01:00
|
|
|
return GetGprValue((_opCode >> 14) & 7);
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
private int GetGprValue(int index)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
2019-03-04 02:45:25 +01:00
|
|
|
return index != 0 ? _gprs[index] : 0;
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private int FetchParam()
|
|
|
|
{
|
2019-03-04 02:45:25 +01:00
|
|
|
int value;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
if (!Fifo.TryDequeue(out value))
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
2018-11-17 05:01:31 +01:00
|
|
|
Logger.PrintWarning(LogClass.Gpu, "Macro attempted to fetch an inexistent argument.");
|
|
|
|
|
|
|
|
return 0;
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
return value;
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
private int Read(int reg)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
2019-10-13 08:02:07 +02:00
|
|
|
return _context.State.Read(reg);
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
2019-10-13 08:02:07 +02:00
|
|
|
private void Send(int value)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
2019-10-13 08:02:07 +02:00
|
|
|
MethodParams meth = new MethodParams(_methAddr, value);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-10-13 08:02:07 +02:00
|
|
|
_context.State.CallMethod(meth);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
_methAddr += _methIncr;
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|