Пример #1
0
        public void CompareRegisterToValue()
        {
            var process = ProgramLoader.LoadAssembly("CMP_CompareRegisterToValue.asm");

            while (!process.Exited)
            {
                process.Tick();
            }
            Assert.AreEqual(true, process.LessFlag);
        }
Пример #2
0
        public void ExitValue()
        {
            var process = ProgramLoader.LoadAssembly("EXIT_ExitValue.asm");

            while (!process.Exited)
            {
                process.Tick();
            }
            Assert.AreEqual(process.ExitCode, 12345);
        }
Пример #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]);
        }
Пример #4
0
        public void AddNegativeValueToRegister()
        {
            var process = ProgramLoader.LoadAssembly("ADD_AddNegativeValueToRegister.asm");

            while (!process.Exited)
            {
                process.Tick();
            }
            Assert.AreEqual(process.Registers[0], 9);
        }
Пример #5
0
        public void AddIndirectRegisterToRegister()
        {
            var process = ProgramLoader.LoadAssembly("ADD_AddIndirectRegisterToRegister.asm");

            while (!process.Exited)
            {
                process.Tick();
            }
            Assert.AreEqual(process.Registers[0], 110);
        }
Пример #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]);
        }