@@ -2,9 +2,8 @@ use bitflags::bitflags;
2
2
3
3
use crate :: {
4
4
addr_register:: AddrRegister ,
5
- palette:: { self , SYSTEM_PALETTE } ,
5
+ palette:: { SYSTEM_PALETTE } ,
6
6
rom:: Mirroring ,
7
- utility:: { addr_from, split_addr} ,
8
7
} ;
9
8
10
9
// TODO: move UI rendering stuff that ties to SDL2 out of PPU
@@ -221,7 +220,7 @@ impl Ppu {
221
220
let p_idx = palette_idx. 0 ;
222
221
assert ! ( p_idx < 8 ) ;
223
222
224
- let start = ( p_idx * 4 ) as usize ;
223
+ let start = ( p_idx * 4 ) ;
225
224
[
226
225
// The first entry is a special case
227
226
if is_background { self . palettes [ 0 ] } else { 0 } ,
@@ -507,7 +506,8 @@ impl Ppu {
507
506
let name_table_idx = base / 0x0400 ;
508
507
509
508
// and ROM-configured mirroring
510
- let mirrored = match ( self . mirroring , name_table_idx) {
509
+
510
+ match ( self . mirroring , name_table_idx) {
511
511
( Mirroring :: Horizontal , 1 ) | ( Mirroring :: Horizontal , 2 ) => base - 0x0400 ,
512
512
( Mirroring :: Vertical , 2 ) | ( Mirroring :: Vertical , 3 ) | ( Mirroring :: Horizontal , 3 ) => {
513
513
base - 0x0800
@@ -516,8 +516,7 @@ impl Ppu {
516
516
( Mirroring :: FourScreen , _) => {
517
517
todo ! ( "Four Screen requires specicial setup with more RAM. More info: https://www.nesdev.org/wiki/Mirroring#4-Screen" )
518
518
}
519
- } ;
520
- mirrored
519
+ }
521
520
}
522
521
523
522
pub fn write_to_data ( & mut self , data : u8 ) {
@@ -693,20 +692,19 @@ mod tests {
693
692
694
693
assert_eq ! ( ppu. get_tick_status( ) , ( 0 , 0 ) ) ;
695
694
assert_eq ! ( ppu. nmi_interrupt, None ) ;
696
- assert_eq ! (
697
- ppu. registers. status. contains( StatusRegister :: VBLANK_FLAG ) ,
698
- false ,
695
+ assert ! (
696
+ !ppu. registers. status. contains( StatusRegister :: VBLANK_FLAG ) ,
699
697
) ;
700
- assert_eq ! ( ppu. is_vblank_nmi_enabled( ) , false ) ;
698
+ assert ! ( ! ppu. is_vblank_nmi_enabled( ) ) ;
701
699
702
700
ppu. registers
703
701
. control
704
702
. insert ( ControlRegister :: VBLANK_NMI_ENABLE ) ;
705
- assert_eq ! ( ppu. is_vblank_nmi_enabled( ) , true ) ;
703
+ assert ! ( ppu. is_vblank_nmi_enabled( ) ) ;
706
704
707
- ppu. tick ( 1 * 341 ) ;
705
+ ppu. tick ( 341 ) ;
708
706
assert_eq ! ( ppu. get_tick_status( ) , ( 1 , 341 ) ) ;
709
- assert_eq ! ( get_ppu_vblank_status( & mut ppu) , false ) ;
707
+ assert ! ( ! get_ppu_vblank_status( & mut ppu) ) ;
710
708
711
709
let should_rerender = ppu. tick ( 240 * 341 ) ;
712
710
assert_eq ! ( ppu. get_tick_status( ) , ( 241 , 241 * 341 ) ) ;
0 commit comments