Skip to content

Latest commit

 

History

History
173 lines (139 loc) · 6.31 KB

TESTS.md

File metadata and controls

173 lines (139 loc) · 6.31 KB

Nesmulator Tests

Displaying logs

The logs of the CPU and the PPU, including the disassembly of the ROM code, can be displayed in a similar manner to Nintendulator. This has been useful to compare the logs of my emulator to the ones from Nintendulator when nestest.nes is run on automation. The logs are the same on both emulators. They can be displayed using the -l flag.

Additionally, a level of debugging can be chosen with the d flag, followed by a debug level, from 1 to 4 included, 4 being the highest level of debugging.

Test ROMS

I used several test ROMs for testing my emulator. Those can be found here, and the test ROMS for the mappers are here.

Here are some of the results :

CPU

Automatically tested (see Integration tests)

  • nes_instr_test/rom_singles/01-implied
  • nes_instr_test/rom_singles/02-immediate
  • nes_instr_test/rom_singles/03-zero_page
  • nes_instr_test/rom_singles/04-zp_xy
  • nes_instr_test/rom_singles/05-absolute
  • nes_instr_test/rom_singles/06-abs_xy
  • nes_instr_test/rom_singles/07-ind_x
  • nes_instr_test/rom_singles/08-ind_y
  • nes_instr_test/rom_singles/09-branches
  • nes_instr_test/rom_singles/10-stack
  • nes_instr_test/rom_singles/11-special
  • instr_timing/rom_singles/1-instr_timing
  • instr_timing/rom_singles/2-branch_timing
  • instr_misc/rom_singles/01-abs_x_wrap
  • instr_misc/rom_singles/02-branch_wrap
  • instr_misc/rom_singles/03-dummy_reads
  • instr_misc/rom_singles/04-dummy_reads_apu
  • cpu_reset/registers
  • cpu_reset/ram_after_reset
  • cpu_exec_space/test_cpu_exec_space_apu
  • cpu_exec_space/test_cpu_exec_space_ppuio
  • cpu_interrupts_v2/rom_singles/1-cli_latency
  • cpu_interrupts_v2/rom_singles/2-nmi_and_brk
  • cpu_interrupts_v2/rom_singles/3-nmi_and_irq
  • cpu_interrupts_v2/rom_singles/4-irq_and_dma
  • cpu_interrupts_v2/rom_singles/5-branch_delays_irq

Manually tested

  • nestest
  • branch_timing_tests/1.Branch_Basics
  • branch_timing_tests/2.Backward_Branch
  • branch_timing_tests/3.Forward_Branch
  • cpu_timing_test6/cpu_timing_test

PPU

Automatically tested (see Integration tests)

  • ppu_vbl_nmi/rom_singles/01-vbl_basics
  • ppu_vbl_nmi/rom_singles/02-vbl_set_time
  • ppu_vbl_nmi/rom_singles/03-vbl_clear_time
  • ppu_vbl_nmi/rom_singles/04-nmi_control
  • ppu_vbl_nmi/rom_singles/05-nmi_timing
  • ppu_vbl_nmi/rom_singles/06-suppression
  • ppu_vbl_nmi/rom_singles/07-nmi_on_timing
  • ppu_vbl_nmi/rom_singles/08-nmi_off_timing
  • ppu_vbl_nmi/rom_singles/09-even_odd_frames
  • ppu_vbl_nmi/rom_singles/10-even_odd_timing
  • ppu_read_buffer/test_ppu_read_buffer
  • ppu_open_bus/ppu_open_bus
  • oam_read/oam_read
  • oam_stress/oam_stress

Manually tested

  • blargg_ppu_tests_2005.09.15b/palette_ram
  • blargg_ppu_tests_2005.09.15b/sprite_ram
  • blargg_ppu_tests_2005.09.15b/power_up_palette
  • blargg_ppu_tests_2005.09.15b/vbl_clear_time
  • blargg_ppu_tests_2005.09.15b/vram_access
  • sprite_hit_tests_2005.10.05/01.basics
  • sprite_hit_tests_2005.10.05/02.alignment
  • sprite_hit_tests_2005.10.05/03.corners
  • sprite_hit_tests_2005.10.05/04.flip
  • sprite_hit_tests_2005.10.05/05.left_clip
  • sprite_hit_tests_2005.10.05/06.right_edge
  • sprite_hit_tests_2005.10.05/07.screen_bottom
  • sprite_hit_tests_2005.10.05/08.double_height
  • sprite_hit_tests_2005.10.05/09.timing_basics
  • sprite_hit_tests_2005.10.05/10.timing_order
  • sprite_hit_tests_2005.10.05/11.edge_timing
  • sprite_overflow_tests/1.Basics
  • sprite_overflow_tests/2.Details
  • sprite_overflow_tests/3.Timing
  • sprite_overflow_tests/4.Obscure
  • sprite_overflow_tests/5.Emulator
  • scanline/scanline

APU

Automatically tested (see Integration tests)

  • apu_test/rom_singles/1-len_ctr
  • apu_test/rom_singles/2-len_table
  • apu_test/rom_singles/3-irq_flag
  • apu_test/rom_singles/4-jitter
  • apu_test/rom_singles/5-len_timing
  • apu_test/rom_singles/6-irq_flag_timing
  • apu_test/rom_singles/7-dmc_basics
  • apu_test/rom_singles/8-dmc_rates
  • apu_reset/4015_cleared
  • apu_reset/4017_timing
  • apu_reset/4017_written
  • apu_reset/irq_flag_cleared
  • apu_reset/len_ctrs_enabled
  • apu_reset/works_immediately

Manually tested

  • blargg_apu_2005.07.30/01.len_ctr
  • blargg_apu_2005.07.30/02.len_table
  • blargg_apu_2005.07.30/03.irq_flag
  • blargg_apu_2005.07.30/04.clock_jitter
  • blargg_apu_2005.07.30/05.len_timing_mode0
  • blargg_apu_2005.07.30/06.len_timing_mode1
  • blargg_apu_2005.07.30/07.irq_flag_timing
  • blargg_apu_2005.07.30/08.irq_timing
  • blargg_apu_2005.07.30/09.reset_timing
  • blargg_apu_2005.07.30/10.len_halt_timing
  • blargg_apu_2005.07.30/11.len_reload_timing

Mappers

Manually tested

  • M0_P32K_C8K_V
  • M1_P128K
  • M1_P128K_C32K
  • M1_P128K_C32K_S8K
  • M1_P128K_C32K_W8K
  • M1_P128K_C128K
  • M1_P128K_C128K_S8K
  • M1_P128K_C128K_W8K
  • M1_P512K_S8K
  • M1_P512K_S32K
  • M2_P128K_V
  • M3_P32K_C32K_H

Integration tests

Some test ROMs write their output strating at address 0x6000, allowing for automation in running tests. Some of those ROMs can be run automatically using integration tests.

How to setup

Here are the step to follow to run those tests:

  • Download the test ROMs used from this repository.
  • Modify the ROM_PATH_PREFIX in tests/common/mod.rs to link to were you cloned the repository.
  • Run tests using cargo test

Running specific tests

Some tests might fail as the emulator is still in development. This will prevent other tests from running.

cargo test --test cpu  // Run tests in cpu.rs
cargo test nes_instr_test::  // Run test in the nes_instr_test module
cargo test nes_instr_test::implied  // Run test nes_instr_test::implied

Benchmark

A benchmark can be run using cargo bench. The benchmark uses the criterion crate. This will repeatedly run the nestest.nes ROM in automation, restarting the nes emulator when it reaches the end of the ROM.