Implemented CMP.

This commit is contained in:
2025-08-26 23:51:58 +10:00
parent 7e57c4ded6
commit f62e96494d
4 changed files with 374 additions and 2 deletions

View File

@@ -215,6 +215,34 @@ namespace SVM.Core
}
break;
case PrimaryInstruction.Cmp:
{
var InstAlt = Instruction.CastAs<SVMInstruction, SVMInstruction_InSeparateBytes>(0);
var OP = (CompareOperator)InstAlt.D0;
switch (OP)
{
case CompareOperator.LT:
CompareFunctions.LT(this.registers, InstAlt);
break;
case CompareOperator.GT:
CompareFunctions.GT(this.registers, InstAlt);
break;
case CompareOperator.GE:
CompareFunctions.GE(this.registers, InstAlt);
break;
case CompareOperator.EQ:
CompareFunctions.EQ(this.registers, InstAlt);
break;
case CompareOperator.LE:
CompareFunctions.LE(this.registers, InstAlt);
break;
case CompareOperator.NE:
CompareFunctions.NE(this.registers, InstAlt);
break;
default:
break;
}
}
break;
case PrimaryInstruction.SD:
{
@@ -550,4 +578,16 @@ namespace SVM.Core
}
}
}
[StructLayout(LayoutKind.Sequential)]
public unsafe struct SVMInstruction_InSeparateBytes
{
public byte D0;
public byte D1;
public byte D2;
public byte D3;
public byte D4;
public byte D5;
public byte D6;
public byte D7;
}
}