diff --git a/Components/9918/Implementation/9918.cpp b/Components/9918/Implementation/9918.cpp index e66e09554..62626b6c3 100644 --- a/Components/9918/Implementation/9918.cpp +++ b/Components/9918/Implementation/9918.cpp @@ -844,10 +844,9 @@ void Base::write_palette(uint8_t value) { write_phase_ = false; - // TODO: the below scales the palette into the range 0–252 rather than 0–255; correct. - const uint8_t r = ((Storage::new_colour_ >> 4) & 7) * 36; - const uint8_t g = (value & 7) * 36; - const uint8_t b = (Storage::new_colour_ & 7) * 36; + const uint8_t r = ((Storage::new_colour_ >> 4) & 7) * 255 / 7; + const uint8_t g = (value & 7) * 255 / 7; + const uint8_t b = (Storage::new_colour_ & 7) * 255 / 7; Storage::palette_[Storage::palette_entry_ & 0xf] = palette_pack(r, g, b); ++Storage::palette_entry_;