Ejemplo n.º 1
0
        public void CompareRegisterToValue()
        {
            var process = ProgramLoader.LoadAssembly("CMP_CompareRegisterToValue.asm");

            while (!process.Exited)
            {
                process.Tick();
            }
            Assert.AreEqual(true, process.LessFlag);
        }
Ejemplo n.º 2
0
        public void ExitValue()
        {
            var process = ProgramLoader.LoadAssembly("EXIT_ExitValue.asm");

            while (!process.Exited)
            {
                process.Tick();
            }
            Assert.AreEqual(process.ExitCode, 12345);
        }
Ejemplo n.º 3
0
        public void JumpToLabel()
        {
            var process = ProgramLoader.LoadAssembly("JMP_JumpToLabel.asm");

            while (!process.Exited)
            {
                process.Tick();
            }
            Assert.AreEqual(10, process.Registers[(int)Register.AX]);
        }
Ejemplo n.º 4
0
        public void AddNegativeValueToRegister()
        {
            var process = ProgramLoader.LoadAssembly("ADD_AddNegativeValueToRegister.asm");

            while (!process.Exited)
            {
                process.Tick();
            }
            Assert.AreEqual(process.Registers[0], 9);
        }
Ejemplo n.º 5
0
        public void AddIndirectRegisterToRegister()
        {
            var process = ProgramLoader.LoadAssembly("ADD_AddIndirectRegisterToRegister.asm");

            while (!process.Exited)
            {
                process.Tick();
            }
            Assert.AreEqual(process.Registers[0], 110);
        }
Ejemplo n.º 6
0
        public void PushValueToStack()
        {
            var process = ProgramLoader.LoadAssembly("PUSH_PushValueToStack.asm");

            while (!process.Exited)
            {
                process.Tick();
            }
            Assert.AreEqual(20, process.Stack.Pop());
            Assert.AreEqual(10, process.Registers[(int)Register.AX]);
        }