public void TestTasBroken() { TAS.EmulateBrokenTAS = true; bus.WriteWord(4, 0x4AC0); //TAS D0 cpu.SetPC(4); cpu.SetDataRegisterLong(0, 0); cpu.Execute(); int res = cpu.GetDataRegisterLong(0); Assert.Equal(0, (res & 0xFF) >> 7); }
private void TestSUBByteZeroFlag(MC68000 cpu, bool expectedZFlag, long d2_pre, long d2_post) { cpu.SetPC(4); cpu.SetDataRegisterLong(2, (int)d2_pre); cpu.Execute(); Assert.Equal(d2_post, cpu.GetDataRegisterLong(2)); Assert.Equal(0x00, cpu.GetDataRegisterByte(2)); Assert.Equal(expectedZFlag, cpu.IsFlagSet(cpu.ZFlag)); }
public void TestADD() { cpu.SetPC(4); cpu.SetDataRegisterByte(0, 0x40); cpu.SetDataRegisterByte(1, 0x80); bus.WriteWord(4, 0xd001); // add.b d1,d0 int ticks = cpu.Execute(); Assert.Equal(6, cpu.GetPC()); Assert.Equal(0xc0, cpu.GetDataRegisterByte(0)); Assert.Equal(0x80, cpu.GetDataRegisterByte(1)); Assert.Equal(4, ticks); Assert.False(cpu.IsFlagSet(cpu.CFlag)); Assert.False(cpu.IsFlagSet(cpu.VFlag)); Assert.False(cpu.IsFlagSet(cpu.ZFlag)); Assert.True(cpu.IsFlagSet(cpu.NFlag)); Assert.False(cpu.IsFlagSet(cpu.XFlag)); cpu.SetPC(4); cpu.SetDataRegisterWord(0, 0x8000); cpu.SetDataRegisterWord(1, 0x8500); bus.WriteWord(4, 0xd041); // add.w d1,d0 ticks = cpu.Execute(); Assert.Equal(6, cpu.GetPC()); Assert.Equal(0x0500, cpu.GetDataRegisterWord(0)); Assert.Equal(0x8500, cpu.GetDataRegisterWord(1)); Assert.Equal(4, ticks); Assert.True(cpu.IsFlagSet(cpu.CFlag)); Assert.True(cpu.IsFlagSet(cpu.VFlag)); Assert.False(cpu.IsFlagSet(cpu.ZFlag)); Assert.False(cpu.IsFlagSet(cpu.NFlag)); Assert.True(cpu.IsFlagSet(cpu.XFlag)); cpu.SetPC(4); cpu.SetDataRegisterLong(0, -4); cpu.SetDataRegisterLong(1, 0x04); bus.WriteWord(4, 0xd081); // add.l d1,d0 ticks = cpu.Execute(); Assert.Equal(6, cpu.GetPC()); Assert.Equal(0, cpu.GetDataRegisterLong(0)); Assert.Equal(0x04, cpu.GetDataRegisterWord(1)); Assert.Equal(6, ticks); Assert.True(cpu.IsFlagSet(cpu.CFlag)); Assert.False(cpu.IsFlagSet(cpu.VFlag)); Assert.True(cpu.IsFlagSet(cpu.ZFlag)); Assert.False(cpu.IsFlagSet(cpu.NFlag)); Assert.True(cpu.IsFlagSet(cpu.XFlag)); }