// SPDX-License-Identifier: MIT //! 2600 mode: the hand-off of SALLY, the TIA and the RIOT to a2600-rust's board (the //! reference's tests/test_mode2600.py). The full gates (die traces, timer ROMs, the smoke //! group, the #699 tables) run from `a7800-gates`; here a short lockstep and the BIOS path. mod common; use a2600::cartridge::Rom; use a2600::gates::lockstep; use a2600::machine::NTSC_7800; use a7800::machine::{NTSC, PAL}; use a7800::mode2600::{make_system, System2600}; #[test] fn direct_start_is_the_2600_board_cycle_for_cycle() { let Some(rom) = common::a2600("Combat (Europe).zip") else { return; }; let (agreed, difference) = lockstep(&rom, &make_system, NTSC_7800, 60_000).unwrap(); assert!(difference.is_none() && agreed >= 60_000); } #[test] fn the_chips_are_the_same_ones() { // The reference asserts object identity; here: SALLY's state moved whole, the RIOT // shared, the TIA moved (the old board keeps a fresh one it never runs). let Some(rom) = common::a2600("Combat (Europe).zip") else { return; }; let system = System2600::from_rom(Rom::Bytes(&rom), NTSC, "direct", None, 0, None, Default::default()).unwrap(); let (old, new) = (&system.seven.cpu, &system.system.cpu); assert_eq!(old.capture_state(), new.capture_state()); assert_eq!(old.frame, new.frame); assert!(std::rc::Rc::ptr_eq( &system.seven.board().riot, &system.system.board().riot )); assert_eq!(system.system.board().cycles, system.seven.board().periods); } #[test] fn bios_hands_a_2600_cartridge_over() { for machine in [NTSC, PAL] { let Some(rom) = common::a2600("Combat (Europe).zip") else { return; }; let Ok(mut system) = System2600::from_rom(Rom::Bytes(&rom), machine, "bios", None, 0, None, Default::default()) else { eprintln!("skipped: no BIOS for {}", machine.name); return; }; assert_eq!(system.system.board().cycles, system.seven.board().periods); system.system.run_frames(5); assert!(system.system.board().tia.frame >= 5); } }