Major work
Some checks failed
Cargo Build & Test / Rust project - latest (stable) (push) Failing after 10s
Some checks failed
Cargo Build & Test / Rust project - latest (stable) (push) Failing after 10s
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
mod cpu_reset_ram;
|
||||
mod instr_test_v3;
|
||||
mod ppu;
|
||||
mod interrupts;
|
||||
|
||||
use crate::hex_view::Memory;
|
||||
|
||||
@@ -38,23 +40,35 @@ pub(crate) use rom_test;
|
||||
|
||||
rom_test!(basic_cpu, "basic-cpu.nes", |nes| {
|
||||
assert_eq!(nes.last_instruction, "0x8001 HLT :2 []");
|
||||
// Off by one from Mesen, since Mesen doesn't count the clock cycle attempting to execute the 'invalid' opcode
|
||||
assert_eq!(nes.cycle, 11);
|
||||
// This is off by one from Mesen, because Mesen is left pointing at the 'invalid' opcode
|
||||
assert_eq!(nes.cpu.pc, 0x8002);
|
||||
// Off by one from Mesen, since Mesen doesn't count the clock cycle attempting to execute the 'invalid' opcode
|
||||
assert_eq!(nes.ppu.pixel, 35);
|
||||
assert_eq!(nes.cycle, 10);
|
||||
assert_eq!(nes.cpu.pc, 0x8001);
|
||||
assert_eq!(nes.ppu.pixel, 34);
|
||||
|
||||
assert_eq!(nes.cpu.sp, 0xFD);
|
||||
|
||||
nes.repl_nop();
|
||||
nes.run_with_timeout(200);
|
||||
assert_eq!(nes.last_instruction, "0x8002 HLT :2 []");
|
||||
assert_eq!(nes.cycle, 12);
|
||||
assert_eq!(nes.cpu.pc, 0x8002);
|
||||
assert_eq!(nes.ppu.pixel, 40);
|
||||
|
||||
assert_eq!(nes.cpu.sp, 0xFD);
|
||||
});
|
||||
|
||||
rom_test!(basic_cpu_with_nop, "basic-cpu-nop.nes", |nes| {
|
||||
assert_eq!(nes.last_instruction, "0x8002 HLT :2 []");
|
||||
assert_eq!(nes.cycle, 12);
|
||||
assert_eq!(nes.cpu.pc, 0x8002);
|
||||
assert_eq!(nes.ppu.pixel, 40);
|
||||
|
||||
assert_eq!(nes.cpu.sp, 0xFD);
|
||||
// assert_eq!(nes.cpu.a, 0x00);
|
||||
// assert_eq!(nes.cpu.x, 0x00);
|
||||
// assert_eq!(nes.cpu.y, 0x00);
|
||||
});
|
||||
|
||||
rom_test!(read_write, "read_write.nes", |nes| {
|
||||
assert_eq!(nes.last_instruction, "0x8011 HLT :2 []");
|
||||
assert_eq!(nes.cycle, 31);
|
||||
assert_eq!(nes.cpu.pc, 0x8012);
|
||||
assert_eq!(nes.last_instruction, "0x800C HLT :2 []");
|
||||
assert_eq!(nes.cycle, 25);
|
||||
assert_eq!(nes.cpu.pc, 0x800C);
|
||||
assert_eq!(nes.cpu.sp, 0xFD);
|
||||
|
||||
assert_eq!(nes.cpu.a, 0xAA);
|
||||
@@ -67,8 +81,8 @@ rom_test!(read_write, "read_write.nes", |nes| {
|
||||
|
||||
rom_test!(basic_init_0, "basic_init_0.nes", |nes| {
|
||||
assert_eq!(nes.last_instruction, "0x8017 HLT :2 []");
|
||||
assert_eq!(nes.cycle, 41);
|
||||
assert_eq!(nes.cpu.pc, 0x8018);
|
||||
assert_eq!(nes.cycle, 40);
|
||||
assert_eq!(nes.cpu.pc, 0x8017);
|
||||
assert_eq!(nes.cpu.sp, 0xFF);
|
||||
|
||||
assert_eq!(nes.cpu.a, 0x00);
|
||||
@@ -78,9 +92,9 @@ rom_test!(basic_init_0, "basic_init_0.nes", |nes| {
|
||||
|
||||
rom_test!(basic_init_1, "basic_init_1.nes", |nes| {
|
||||
assert_eq!(nes.last_instruction, "0x801C HLT :2 []");
|
||||
assert_eq!(nes.cycle, 27403);
|
||||
assert_eq!(nes.cpu.pc, 0x801D);
|
||||
assert_eq!(nes.ppu.pixel, 30);
|
||||
assert_eq!(nes.cycle, 27402);
|
||||
assert_eq!(nes.cpu.pc, 0x801C);
|
||||
assert_eq!(nes.ppu.pixel, 29);
|
||||
|
||||
assert_eq!(nes.cpu.sp, 0xFF);
|
||||
assert_eq!(nes.cpu.a, 0x00);
|
||||
@@ -90,9 +104,9 @@ rom_test!(basic_init_1, "basic_init_1.nes", |nes| {
|
||||
|
||||
rom_test!(basic_init_2, "basic_init_2.nes", |nes| {
|
||||
assert_eq!(nes.last_instruction, "0x8021 HLT :2 []");
|
||||
assert_eq!(nes.cycle, 57180);
|
||||
assert_eq!(nes.cpu.pc, 0x8022);
|
||||
assert_eq!(nes.ppu.pixel, 19);
|
||||
assert_eq!(nes.cycle, 57179);
|
||||
assert_eq!(nes.cpu.pc, 0x8021);
|
||||
assert_eq!(nes.ppu.pixel, 18);
|
||||
|
||||
assert_eq!(nes.cpu.sp, 0xFF);
|
||||
assert_eq!(nes.cpu.a, 0x00);
|
||||
@@ -102,9 +116,9 @@ rom_test!(basic_init_2, "basic_init_2.nes", |nes| {
|
||||
|
||||
rom_test!(basic_init_3, "basic_init_3.nes", |nes| {
|
||||
assert_eq!(nes.last_instruction, "0x8026 HLT :2 []");
|
||||
assert_eq!(nes.cycle, 86964);
|
||||
assert_eq!(nes.cpu.pc, 0x8027);
|
||||
assert_eq!(nes.ppu.pixel, 29);
|
||||
assert_eq!(nes.cycle, 86963);
|
||||
assert_eq!(nes.cpu.pc, 0x8026);
|
||||
assert_eq!(nes.ppu.pixel, 28);
|
||||
|
||||
assert_eq!(nes.cpu.sp, 0xFF);
|
||||
assert_eq!(nes.cpu.a, 0x00);
|
||||
@@ -114,9 +128,9 @@ rom_test!(basic_init_3, "basic_init_3.nes", |nes| {
|
||||
|
||||
rom_test!(even_odd, "even_odd.nes", |nes| {
|
||||
assert_eq!(nes.last_instruction, "0x8023 HLT :2 []");
|
||||
assert_eq!(nes.cycle, 57182);
|
||||
assert_eq!(nes.cpu.pc, 0x8024);
|
||||
assert_eq!(nes.ppu.pixel, 25);
|
||||
assert_eq!(nes.cycle, 57181);
|
||||
assert_eq!(nes.cpu.pc, 0x8023);
|
||||
assert_eq!(nes.ppu.pixel, 24);
|
||||
|
||||
assert_eq!(nes.cpu.sp, 0xFF);
|
||||
assert_eq!(nes.cpu.a, 0x00);
|
||||
|
||||
Reference in New Issue
Block a user