diff options
-rw-r--r-- | src/apu.rs | 5 | ||||
-rw-r--r-- | src/bin.rs | 14 | ||||
-rw-r--r-- | src/lib.rs | 4 | ||||
-rw-r--r-- | testroms/checklist.rst | 39 |
4 files changed, 52 insertions, 10 deletions
@@ -26,8 +26,9 @@ impl LPFilter { } fn output(&mut self, input: i16) -> i16 { - let out = cutoff((input as i32 - self.prev_out as i32) - * LP_FACTOR / AUDIO_LEVEL_MAX); + let out = cutoff(self.prev_out as i32 + + (input as i32 - self.prev_out as i32) + * LP_FACTOR / AUDIO_LEVEL_MAX); self.prev_out = out; out } @@ -5,8 +5,7 @@ use std::sync::{Mutex, Condvar}; use std::io::Read; use std::cell::RefCell; use std::intrinsics::transmute; -//use std::time::{Instant, Duration}; -//use std::thread; +use std::process::exit; extern crate sdl2; #[macro_use] extern crate clap; @@ -211,7 +210,7 @@ impl<'a> ppu::Screen for SDLWindow<'a> { self.canvas.clear(); self.canvas.copy(&self.texture, self.copy_area, None).unwrap(); self.canvas.present(); - if self.poll() {std::process::exit(0);} + if self.poll() { exit(0) } } } @@ -360,7 +359,7 @@ fn main() { let fname = matches.value_of("INPUT").unwrap(); let mut file = File::open(fname).unwrap(); let mut rheader = [0; 16]; - println!("read {}", file.read(&mut rheader[..]).unwrap()); + file.read(&mut rheader[..]).unwrap(); let header = unsafe{transmute::<[u8; 16], INesHeader>(rheader)}; let mirror = match ((header.flags6 >> 2) & 2) | (header.flags6 & 1) { 0 => MirrorType::Horizontal, @@ -370,8 +369,11 @@ fn main() { _ => MirrorType::Four, }; let mapper_id = (header.flags7 & 0xf0) | (header.flags6 >> 4); - println!("magic:{}, prg size:{}, chr size:{}, mirror type:{}, mapper:{}", - std::str::from_utf8(&header.magic).unwrap(), + if std::str::from_utf8(&header.magic).unwrap() != "NES\x1a" { + println!("not an iNES file"); + exit(1); + } + println!("prg size:{}, chr size:{}, mirror type:{}, mapper:{}", header.prg_rom_nbanks, header.chr_rom_nbanks, mirror as u8, @@ -1,5 +1,5 @@ -//#![no_std] -extern crate core; +#![no_std] +//extern crate core; mod memory; #[macro_use] mod mos6502; mod ppu; diff --git a/testroms/checklist.rst b/testroms/checklist.rst new file mode 100644 index 0000000..4048992 --- /dev/null +++ b/testroms/checklist.rst @@ -0,0 +1,39 @@ + +================================ ================================ + testcase result +================================ ================================ +color_test passed +blargg_ppu_tests_2005.09.15b passed +full_palette failed, no display +nmi_sync passed +ntsc_torture passed +oam_read passed +oam_stress failed +oamtest3 need mapper 7 +palette passed +ppu_open_bus not emulated +ppu_read_buffer need mapper 3 +ppu_sprite_hit 09 failed, others passed +ppu_sprite_overflow 03 failed, others passed +ppu_vbl_nmi passed +scanline passed +sprite_hit_tests_2005.10.05 passed +sprite_overflow_tests 03 failed, others passed +sprdma_and_dmc_dma not emulated +tvpassfail aspect ratio failed (not emulated), others passed +vbl_nmi_timing passed, same as ppu_vbl_nmi +apu_mixer passed +apu_phase_reset passed +apu_test failed +blargg_apu_2005.07.30 failed +dmc_dma_during_read4 failed +dpcmletterbox ? +square_timer_div2 passed +test_apu_2 (1-10) failed +test_apu_2 (11) failed +test_apu_env failed +test_apu_sweep failed +test_apu_timers failed +test_tri_lin_ctr failed +volume_tests ? +================================ ================================ |