Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mos6502/src/virtual_mos6502.rs
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ trait Private: Sized + Context {
}
self.set_flags( StatusFlag::Zero, ((reg_a.wrapping_add(op).wrapping_add(carry)) & 0xff) == 0 );
self.set_flags( StatusFlag::Sign, (tmp & 0x80) != 0 );
self.set_flags( StatusFlag::Overflow, (((reg_a ^ tmp) & 0x80) != 0 && ((reg_a ^ op) & 0x80) == 0) );
self.set_flags( StatusFlag::Overflow, ((reg_a ^ tmp) & 0x80) != 0 && ((reg_a ^ op) & 0x80) == 0 );
if (tmp & 0x1f0) > 0x90 {
tmp = tmp.wrapping_add(0x60);
}
Expand Down
3 changes: 0 additions & 3 deletions mos6502/src/virtual_mos6502_decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -707,9 +707,6 @@ macro_rules! decoding_logic {
253 => exec_sbc,
254 => exec_incdec_1,
255 => exec_unk,
_ => unsafe {
fast_unreachable!()
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions nes-testsuite/src/harness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ impl TestcaseState {
}

pub trait EmulatorInterface: Sized {
fn new( rom_data: &[u8], testcase_state: TestcaseState ) -> Result< Self, Box< Error >>;
fn run( &mut self ) -> Result< (), Box< Error >>;
fn new( rom_data: &[u8], testcase_state: TestcaseState ) -> Result< Self, Box< dyn Error >>;
fn run( &mut self ) -> Result< (), Box< dyn Error >>;
fn peek_memory( &mut self, address: u16 ) -> u8;
fn poke_memory( &mut self, address: u16, value: u8 );
fn get_framebuffer( &mut self, output: &mut [u8] );
Expand Down
10 changes: 5 additions & 5 deletions nes/src/mappers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl Mapper for MapperNull {
}
}

pub fn create_mapper( rom: NesRom ) -> Result< Box< Mapper >, LoadError > {
pub fn create_mapper( rom: NesRom ) -> Result< Box< dyn Mapper >, LoadError > {
match rom.mapper {
0 => {
try!( rom.check_rom_bank_count( &[1, 2] ) );
Expand All @@ -70,25 +70,25 @@ pub fn create_mapper( rom: NesRom ) -> Result< Box< Mapper >, LoadError > {
},
1 => {
MapperMMC1::from_rom( rom ).map( |mapper| {
let boxed: Box< Mapper > = Box::new( mapper );
let boxed: Box< dyn Mapper > = Box::new( mapper );
boxed
})
},
2 => {
MapperUxROM::from_rom( rom ).map( |mapper| {
let boxed: Box< Mapper > = Box::new( mapper );
let boxed: Box< dyn Mapper > = Box::new( mapper );
boxed
})
},
7 => {
MapperAxROM::from_rom( rom ).map( |mapper| {
let boxed: Box< Mapper > = Box::new( mapper );
let boxed: Box< dyn Mapper > = Box::new( mapper );
boxed
})
},
30 => {
MapperUNROM512::from_rom( rom ).map( |mapper| {
let boxed: Box< Mapper > = Box::new( mapper );
let boxed: Box< dyn Mapper > = Box::new( mapper );
boxed
})
},
Expand Down
4 changes: 2 additions & 2 deletions nes/src/testsuite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl nes::Context for Instance {
}

impl nes_testsuite::EmulatorInterface for Instance {
fn new( rom_data: &[u8], testcase_state: nes_testsuite::TestcaseState ) -> Result< Self, Box< Error >> {
fn new( rom_data: &[u8], testcase_state: nes_testsuite::TestcaseState ) -> Result< Self, Box< dyn Error >> {
let mut instance = Instance {
state: nes::State::new(),
testcase_state: testcase_state
Expand All @@ -43,7 +43,7 @@ impl nes_testsuite::EmulatorInterface for Instance {
Ok( instance )
}

fn run( &mut self ) -> Result< (), Box< Error >> {
fn run( &mut self ) -> Result< (), Box< dyn Error >> {
nes::Interface::execute_until_vblank( self )
}

Expand Down
18 changes: 9 additions & 9 deletions nes/src/virtual_nes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ pub trait Interface: Sized + Context {
Private::copy_into_memory( self, offset, data )
}

fn execute_until_vblank( &mut self ) -> Result< (), Box< Error > > {
fn execute_until_vblank( &mut self ) -> Result< (), Box< dyn Error > > {
Private::execute_until_vblank( self )
}

fn execute_for_a_frame( &mut self ) -> Result< (), Box< Error > > {
fn execute_for_a_frame( &mut self ) -> Result< (), Box< dyn Error > > {
Private::execute_for_a_frame( self )
}

fn execute_cycle( &mut self ) -> Result< bool, Box< Error > > {
fn execute_cycle( &mut self ) -> Result< bool, Box< dyn Error > > {
Private::execute_cycle( self )
}

Expand Down Expand Up @@ -98,8 +98,8 @@ pub struct State {
ppu_state: rp2c02::State,
apu_state: virtual_apu::State,
dma_state: dma::State,
mapper: Box< Mapper >,
error: Option< Box< Error > >,
mapper: Box< dyn Mapper >,
error: Option< Box< dyn Error > >,
ready: bool,
cpu_cycle: u32,
frame_counter: u32,
Expand Down Expand Up @@ -344,7 +344,7 @@ trait Private: Sized + Context {
}

fn hard_reset( &mut self ) {
let mut mapper: Box< Mapper + 'static > = Box::new( MapperNull );
let mut mapper: Box< dyn Mapper + 'static > = Box::new( MapperNull );
mem::swap( &mut mapper, &mut self.state_mut().mapper );
let ready = self.state().ready;

Expand All @@ -370,7 +370,7 @@ trait Private: Sized + Context {
copy_memory( data, &mut self.state_mut().ram[ offset as usize.. ] );
}

fn execute_until_vblank( &mut self ) -> Result< (), Box< Error > > {
fn execute_until_vblank( &mut self ) -> Result< (), Box< dyn Error > > {
if !self.state().ready {
return Ok(());
}
Expand All @@ -392,7 +392,7 @@ trait Private: Sized + Context {
}
}

fn execute_for_a_frame( &mut self ) -> Result< (), Box< Error > > {
fn execute_for_a_frame( &mut self ) -> Result< (), Box< dyn Error > > {
if !self.state().ready {
return Ok(());
}
Expand All @@ -414,7 +414,7 @@ trait Private: Sized + Context {
}
}

fn execute_cycle( &mut self ) -> Result< bool, Box< Error > > {
fn execute_cycle( &mut self ) -> Result< bool, Box< dyn Error > > {
let last_counter_value = self.state().full_frame_counter;
mos6502::Interface::execute( self.newtype_mut() )?;

Expand Down
4 changes: 2 additions & 2 deletions pinky-web/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ impl PinkyWeb {
// in which case we'll temporairly give back the control
// of the main thread back to the web browser so that
// it can handle other events and process audio.
fn run_a_bit( &mut self ) -> Result< bool, Box< Error > > {
fn run_a_bit( &mut self ) -> Result< bool, Box< dyn Error > > {
if self.paused {
return Ok( true );
}
Expand Down Expand Up @@ -623,7 +623,7 @@ fn load_rom( pinky: &Rc< RefCell< PinkyWeb > >, rom_data: &[u8] ) {
show( "change-rom-button" );
}

fn handle_error< E: Into< Box< Error > > >( error: E ) {
fn handle_error< E: Into< Box< dyn Error > > >( error: E ) {
let error_message = format!( "{}", error.into() );
web::document().get_element_by_id( "error-description" ).unwrap().set_text_content( &error_message );

Expand Down
2 changes: 1 addition & 1 deletion pinky-web/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ <h1>Encountered an error!</h1>
</div>
</div>

<script src="js/app.js"></script>
<script src="pinky-web.js"></script>
<script>
if( typeof Module !== "object" ) { // If not running under Emscripten.
var webassembly_supported = typeof WebAssembly === "object" && typeof WebAssembly.instantiate === "function";
Expand Down