Fix warnings

This commit is contained in:
Kevin Hamacher 2020-02-19 12:45:47 +01:00
parent 60d098e83c
commit 6efb1507ff
2 changed files with 11 additions and 13 deletions

View File

@ -22,7 +22,7 @@ const FLAG_H: u8 = 1 << 5;
const FLAG_C: u8 = 1 << 4;
use interconnect::TickResult;
enum CpuTickResult {
pub enum CpuTickResult {
Continue { cycles_executed: usize },
Shutdown { cycles_executed: usize },
}
@ -585,9 +585,6 @@ impl CPU {
}
self.set_8bit_reg(reg_id, reg_content | (1 << 7));
}
_ => {
panic!("Unsupported prefix instruction: {:x}", instruction);
}
}
}
@ -1755,7 +1752,6 @@ impl CPU {
8
}
0xFF => self.rst(0x38),
_ => panic!("Unknown instruction: {:02x}", instruction),
};
}

View File

@ -43,7 +43,7 @@ const STAT_MODE_HBLANK_INT: u8 = 1 << 3;
const SPRITE_OBJ_BG_PRIORITY: u8 = 1 << 7;
const SPRITE_Y_FLIP: u8 = 1 << 6;
const SPRITE_X_FLIP: u8 = 1 << 5;
const SPRITE_PALETTE_NO: u8 = 1 << 4; // NonCGB only
//const SPRITE_PALETTE_NO: u8 = 1 << 4; // NonCGB only
const SPRITE_TILE_VRAM_BANK: u8 = 1 << 3; // CGB only
// Display color
@ -54,13 +54,13 @@ const MONOCHROME_PALETTE: &'static [[f64; 3]; 4] = &[
[0.188, 0.383, 0.188],
[0.059, 0.219, 0.059],
];
*/
const MONOCHROME_PALETTE: &'static [[u8; 3]; 4] = &[
[255, 255, 255],
[200, 200, 200],
[125, 125, 12],
[50, 50, 50],
];
*/
#[derive(Copy, Clone)]
struct CgbPalette([u8; 8]);
@ -78,10 +78,10 @@ impl CgbPalette {
let r = r as u16;
let g = g as u16;
let b = b as u16;
let rR = ((r * 13 + g * 2 + b) >> 1) as u8;
let rG = ((g * 3 + b) << 1) as u8;
let rB = ((r * 3 + g * 2 + b * 11) >> 1) as u8;
sdl2::pixels::Color::RGB(rR, rG, rB)
let mapped_r = ((r * 13 + g * 2 + b) >> 1) as u8;
let mapped_g = ((g * 3 + b) << 1) as u8;
let mapped_b = ((r * 3 + g * 2 + b * 11) >> 1) as u8;
sdl2::pixels::Color::RGB(mapped_r, mapped_g, mapped_b)
}
}
@ -700,10 +700,12 @@ impl Display {
pub fn dump_vram(&self) {
std::fs::File::create("vram0.dat")
.unwrap()
.write_all(&self.vram0);
.write_all(&self.vram0)
.unwrap();
std::fs::File::create("vram1.dat")
.unwrap()
.write_all(&self.vram1);
.write_all(&self.vram1)
.unwrap();
}
#[inline]