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]; } }
protected void SetFlag(IC6502 cpu, StatusFlags flag, Func <bool> predicate) { if (predicate()) { cpu.State.SetFlag((byte)flag); } else { cpu.State.ClearFlag((byte)flag); } }
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."); }
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."); }
protected void SetOverflow(IC6502 cpu, Func <bool> predicate) { SetFlag(cpu, StatusFlags.Overflow, predicate); }
protected void SetCarry(IC6502 cpu, Func <bool> predicate) { SetFlag(cpu, StatusFlags.Carry, predicate); }
protected void SetNegative(IC6502 cpu, Func <bool> predicate) { SetFlag(cpu, StatusFlags.Negative, predicate); }
protected void SetZero(IC6502 cpu, Func <bool> predicate) { SetFlag(cpu, StatusFlags.Zero, predicate); }