WIP cgram viewer

This commit is contained in:
2024-11-04 18:29:55 -05:00
parent 090a2172da
commit a61bf8e01a
4 changed files with 77 additions and 6 deletions
+4
View File
@@ -448,6 +448,10 @@ impl PPURegisters {
value
}
pub fn read_cgram(&self, address: u8) -> u16 {
self.cgram[address as usize]
}
fn write_cgram(&mut self, data: u8) {
let cgram_index = self.get_cgram_index() as usize;
match self.cgram_data_read_flipflop {
+5 -5
View File
@@ -1,4 +1,4 @@
pub fn rbg555_to_rgb888(rgb555: (u8, u8, u8)) -> (u8, u8, u8) {
pub fn rgb555_to_rgb888(rgb555: (u8, u8, u8)) -> (u8, u8, u8) {
let red = rgb555.0 & 0b11111;
let green = rgb555.1 & 0b11111;
let blue = rgb555.2 & 0b11111;
@@ -15,14 +15,14 @@ mod color_tests {
use super::*;
#[test]
fn test_rbg555_to_rgb888() {
assert_eq!(rbg555_to_rgb888((0x00, 0x00, 0x00)), (0x00, 0x00, 0x00));
fn test_rgb555_to_rgb888() {
assert_eq!(rgb555_to_rgb888((0x00, 0x00, 0x00)), (0x00, 0x00, 0x00));
assert_eq!(
rbg555_to_rgb888((0b0001_1111, 0b0001_1111, 0b0001_1111)),
rgb555_to_rgb888((0b0001_1111, 0b0001_1111, 0b0001_1111)),
(0xFF, 0xFF, 0xFF)
);
assert_eq!(
rbg555_to_rgb888((0b10101, 0b01010, 0b11011)),
rgb555_to_rgb888((0b10101, 0b01010, 0b11011)),
(0xAD, 0x52, 0xDE)
);
}