public void OneOperandTest() { var converter = new AssemblyConverter(); string firstInstruction = "INC R5"; string machineCode = converter.AssemblyConvert(firstInstruction); Assert.NotEmpty(machineCode); Assert.Equal(16, machineCode.Length); Assert.Equal("1110010100000000", machineCode); }
public void TestOneLine() { var converter = new AssemblyConverter(); string firstInstruction = "PUSH R6"; string machineCode = converter.AssemblyConvert(firstInstruction); Assert.NotEmpty(machineCode); Assert.Equal(16, machineCode.Length); Assert.Equal("0000011000000000", machineCode); }
public void TestMov() { var converter = new AssemblyConverter(); string firstInstruction = "MOV R0, R7"; string machineCode = converter.AssemblyConvert(firstInstruction, true); Assert.NotEmpty(machineCode); Assert.Equal(4, machineCode.Length); Assert.Equal("80E0", machineCode); }
public void JumpTest() { var converter = new AssemblyConverter(); string firstInstruction = "JZ R7"; string machineCode = converter.AssemblyConvert(firstInstruction); Assert.NotEmpty(machineCode); Assert.Equal(16, machineCode.Length); Assert.Equal("0100111100000000", machineCode); }
public void TestShift() { var converter = new AssemblyConverter(); string instruction = "SHL R3, A"; string machineCode = converter.AssemblyConvert(instruction, hex: true); Assert.NotEmpty(machineCode); Assert.Equal(4, machineCode.Length); Assert.Equal("B314", machineCode); }
public void EATest() { var converter = new AssemblyConverter(); string firstInstruction = "LDD R1, 0128F"; string machineCode = converter.AssemblyConvert(firstInstruction); Assert.NotEmpty(machineCode); Assert.Contains("\n", machineCode); var lines = machineCode.Split('\n'); string part1 = machineCode.Substring(0, machineCode.IndexOf('\n')); Assert.Equal(16, part1.Length); //Assert.Equal("0011100100000001", part1); //Assert.Equal("1001010001111000", lines[1]); }