Exemple #1
0
 private void WriteByteSequence(IC6502 cpu, ushort offset, params byte[] bytes)
 {
     for (ushort i = offset; i < (bytes.Length + offset); i++)
     {
         cpu.Memory[i] = bytes[i - offset];
     }
 }
Exemple #2
0
 protected void SetFlag(IC6502 cpu, StatusFlags flag, Func <bool> predicate)
 {
     if (predicate())
     {
         cpu.State.SetFlag((byte)flag);
     }
     else
     {
         cpu.State.ClearFlag((byte)flag);
     }
 }
Exemple #3
0
        public void C6502_Execute_STY_Absolute()
        {
            // Store value of Y (0xFF) in #$DEAD.
            IC6502 c = CreateTestCPU();

            c.Memory[0x00] = 0xA0;
            c.Memory[0x01] = 0xFF;
            c.Memory[0x02] = 0x8C;
            c.Memory[0x03] = 0xAD;
            c.Memory[0x04] = 0xDE;

            c.Step(2);
            Assert.AreEqual(c.State.RegY, 0xFF, "Loading value of X (0xFF) into memory @ address 0xDEAD.");
        }
Exemple #4
0
        public void C6502_Execute_STA_Absolute()
        {
            // Store value of A (0xFF) in #$DEAD.
            IC6502 c = CreateTestCPU();

            c.Memory[0x00] = 0xA9;
            c.Memory[0x01] = 0xFF;
            c.Memory[0x02] = 0x8D; // lol smiley face.
            c.Memory[0x03] = 0xAD;
            c.Memory[0x04] = 0xDE;

            c.Step(2);
            Assert.AreEqual(c.State.RegA, 0xFF, "Loading value of A (0xFF) into memory @ address 0xDEAD.");
        }
Exemple #5
0
 protected void SetOverflow(IC6502 cpu, Func <bool> predicate)
 {
     SetFlag(cpu, StatusFlags.Overflow, predicate);
 }
Exemple #6
0
 protected void SetCarry(IC6502 cpu, Func <bool> predicate)
 {
     SetFlag(cpu, StatusFlags.Carry, predicate);
 }
Exemple #7
0
 protected void SetNegative(IC6502 cpu, Func <bool> predicate)
 {
     SetFlag(cpu, StatusFlags.Negative, predicate);
 }
Exemple #8
0
 protected void SetZero(IC6502 cpu, Func <bool> predicate)
 {
     SetFlag(cpu, StatusFlags.Zero, predicate);
 }