Пример #1
0
        public void STA_Abs()
        {
            Ram.Load(0x4000, new byte[] { 0x90, 0x88, 0x99, 0x50, 0x00 });

            Driver.Clock();
            Driver.Clock();
            Assert.AreEqual(Ram[0x5000], 0x88);
        }
Пример #2
0
        public void BLDX_Imm()
        {
            Ram.Load(0x4000, new byte[] { 0xA0, 0x77, 0x88 });

            Driver.Clock();

            Assert.AreEqual(Cpu.X.Value, 0x7788);
        }
Пример #3
0
        public void LDA_Abs()
        {
            Ram.Load(0x4000, new byte[] { 0x91, 0x50, 0x00 });
            Ram.Load(0x5000, new byte[] { 0x88 });

            Driver.Clock();

            Assert.AreEqual(Cpu.Acc.Value, 0x88);
        }
Пример #4
0
 public void SUB_Carry2()
 {
     Ram.Load(0x4000, new byte[] { 0x90, 0x04, 0x20, 0x05 });
     Driver.Clock();
     Driver.Clock();
     Assert.AreEqual(Cpu.Acc.Value, 0xFF);
     Assert.AreEqual(Cpu.Status.Carry, false);
     Assert.AreEqual(Cpu.Status.Overflow, false);
 }
Пример #5
0
        public void INCA_Imp()
        {
            Ram.Load(0x4000, new byte[] { 0x90, 0x05, 0x80, 0x80 });

            Driver.Clock();
            Driver.Clock();
            Driver.Clock();

            Assert.AreEqual(Cpu.Acc.Value, 0x07);
        }
Пример #6
0
        public void LDA_IndX()
        {
            Ram.Load(0x4000, new byte[] { 0xa0, 0x00, 0x05, 0x95, 0x50, 0x00 });
            Ram.Load(0x5000, new byte[] { 0x60, 0x00 });
            Ram.Load(0x6005, new byte[] { 0x88 });

            Driver.Clock();
            Driver.Clock();

            Assert.AreEqual(Cpu.Acc.Value, 0x88);
        }
Пример #7
0
        public void SUB_Overflow1()
        {
            //120 - (10) = 130 = (2)
            //x78 - xF6 = x82

            Ram.Load(0x4000, new byte[] { 0x90, 0x78, 0x20, 0xF6 });
            Driver.Clock();
            Driver.Clock();
            Assert.AreEqual(Cpu.Status.Carry, false);
            Assert.AreEqual(Cpu.Status.Overflow, true);
        }
Пример #8
0
 public void ADD_Carry2()
 {
     Ram.Load(0x4000, new byte[] { 0x90, 0xFF, 0x10, 0x01 });
     Driver.Clock();
     Driver.Clock();
     Assert.AreEqual(Cpu.Acc.Value, 0x00);
     Assert.AreEqual(Cpu.Status.Carry, true);
     Assert.AreEqual(Cpu.Status.Overflow, false);
     Assert.AreEqual(Cpu.Status.Zero, true);
     Assert.AreEqual(Cpu.Status.Negative, false);
 }
Пример #9
0
        public void STA_IndX()
        {
            Ram.Load(0x4000, new byte[] { 0x90, 0x88, 0xa0, 0x00, 0x05, 0x9D, 0x50, 0x00 });
            Ram.Load(0x5000, new byte[] { 0x60, 0x00 });

            Driver.Clock();
            Driver.Clock();
            Driver.Clock();

            Assert.AreEqual(Ram[0x6005], 0x88);
        }
Пример #10
0
        public void SUB_Imm()
        {
            Ram.Load(0x4000, new byte[] { 0x90, 0x02, 0x20, 0x02 });

            Driver.Clock();
            Driver.Clock();

            Assert.AreEqual(Cpu.Acc.Value, 0x00);
            Assert.AreEqual(Cpu.Status.Carry, true);
            Assert.AreEqual(Cpu.Status.Overflow, false);
            Assert.AreEqual(Cpu.Status.Zero, true);
            Assert.AreEqual(Cpu.Status.Negative, false);
        }
Пример #11
0
        public void OR_Imm()
        {
            Ram.Load(0x4000, new byte[] { 0x90, 0x0A, 0x38, 0x04 });

            Driver.Clock();
            Driver.Clock();

            Assert.AreEqual(Cpu.Acc.Value, 0x0E);
            Assert.AreEqual(Cpu.Status.Carry, false);
            Assert.AreEqual(Cpu.Status.Overflow, false);
            Assert.AreEqual(Cpu.Status.Zero, false);
            Assert.AreEqual(Cpu.Status.Negative, false);
        }
Пример #12
0
        public void LDA_Imm()
        {
            Ram.Load(0x4000, new byte[] { 0x90, 0x88, 0x90, 0x00 });

            Driver.Clock();
            Assert.AreEqual(Cpu.Acc.Value, 0x88);
            Assert.AreEqual(Cpu.Status.Negative, true);
            Assert.AreEqual(Cpu.Status.Zero, false);

            Driver.Clock();
            Assert.AreEqual(Cpu.Acc.Value, 0x00);
            Assert.AreEqual(Cpu.Status.Negative, false);
            Assert.AreEqual(Cpu.Status.Zero, true);
        }
Пример #13
0
        public void ADD_Overflow1()
        {
            //120 + 10 = 130 = (2)
            //x78 + x0A = x82

            Ram.Load(0x4000, new byte[] { 0x90, 0x78, 0x10, 0x0A });
            Driver.Clock();
            Driver.Clock();
            Assert.AreEqual(Cpu.Acc.Value, 0x82);
            Assert.AreEqual(Cpu.Status.Carry, false);
            Assert.AreEqual(Cpu.Status.Overflow, true);
            Assert.AreEqual(Cpu.Status.Zero, false);
            Assert.AreEqual(Cpu.Status.Negative, true);
        }
Пример #14
0
        public void ADD_Abs()
        {
            Ram.Load(0x4000, new byte[] { 0x90, 0x02, 0x11, 0x50, 0x00 });
            Ram.Load(0x5000, new byte[] { 0x02 });

            Driver.Clock();
            Driver.Clock();

            Assert.AreEqual(Cpu.Acc.Value, 0x04);
            Assert.AreEqual(Cpu.Status.Carry, false);
            Assert.AreEqual(Cpu.Status.Overflow, false);
            Assert.AreEqual(Cpu.Status.Zero, false);
            Assert.AreEqual(Cpu.Status.Negative, false);
        }
Пример #15
0
 public void Run()
 {
     cpu.Process();
     ram.Load();
     hdd.Read();
 }