private void Jmn(GameEngine engine, EvaluatedOp a, EvaluatedOp b) { var cond = b.IsImmediate ? b.Value : b.Statement.FieldB.CalculateByMod(); if (cond != 0) { engine.JumpTo(a.Addr); } }
private void Mov(GameEngine engine, EvaluatedOp a, EvaluatedOp b) { var newStatement = a.IsImmediate ? b.Statement.SetB(a.Value) : a.Statement; engine.WriteToMemory(b.Addr, newStatement); }
private void Slt(GameEngine engine, EvaluatedOp a, EvaluatedOp b) { var left = a.IsImmediate ? a.Value : a.Statement.FieldB.CalculateByMod(); var right = b.Statement.FieldB.CalculateByMod(); if (left < right) { engine.JumpTo(engine.CurrentIp + 2); } }
private void Djn(GameEngine engine, EvaluatedOp a, EvaluatedOp b) { var bAddr = b.IsImmediate ? engine.CurrentIp : b.Addr; DecrementB(engine, bAddr); var condition = engine.Memory[bAddr].Statement.FieldB.CalculateByMod(); if (condition != 0) { engine.JumpTo(a.Addr); } }
private void Sub(GameEngine engine, EvaluatedOp a, EvaluatedOp b) { var statementB = b.Statement; if (a.IsImmediate) { engine.WriteToMemory(b.Addr, statementB.SetB(statementB.FieldB.Calculate() - a.Value)); } else { var statementA = a.Statement; engine.WriteToMemory(b.Addr, statementB .SetA(statementB.FieldA.Calculate() - statementA.FieldA.Calculate()) .SetB(statementB.FieldB.Calculate() - statementA.FieldB.Calculate())); } }
private void Cmp(GameEngine engine, EvaluatedOp a, EvaluatedOp b) { bool condition; if (a.IsImmediate) { var left = a.Value; var right = b.Statement.FieldB.CalculateByMod(); condition = left == right; } else { condition = a.Statement == b.Statement; } if (condition) { engine.JumpTo(engine.CurrentIp + 2); } }
private void Dat(GameEngine engine, EvaluatedOp a, EvaluatedOp b) { engine.KillCurrentProcess(); }
private void Spl(GameEngine engine, EvaluatedOp a, EvaluatedOp b) { engine.SplitAt(a.Addr); }
private void Jmp(GameEngine engine, EvaluatedOp a, EvaluatedOp b) { engine.JumpTo(a.Addr); }