Exemplo n.º 1
0
        public void PLAShouldPullStackValueInAccumulator()
        {
            byte value = 0x42;

            cpu.A = 0x00;
            cpu.PushOnStack(value);
            byte[] instructions = new byte[]
            {
                0x68                         // PLA
            };
            InitializeMemory(instructions);

            // Act
            cpu.Execute(1);

            // Assert
            Assert.AreEqual <byte>(value, cpu.A, "Accumulator should get value from stack after PLA.");
        }
Exemplo n.º 2
0
        public void RTIShouldRestorePreInterruptState()
        {
            cpu.PC         = 0x0201;     // Use different address than 0x0200, because high and low byte of address would be same 0x0202
            memory[0x0201] = 0x40;       // RTI instruction
            byte processorStatus = 0x72;

            cpu.PushOnStack(0x13);
            cpu.PushOnStack(0x37);
            cpu.PushOnStack(processorStatus);

            // Act
            cpu.Execute(1);

            // Assert
            Assert.AreEqual <ushort>(0x1337, cpu.PC, "Program counter is not restored to correct address.");
            Assert.AreEqual <byte>(processorStatus, cpu.ProcessorStatus, "Processor status is not restored.");
        }