From 650b9a139b0cd34fc01683853490897f24128ad0 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Fri, 19 Mar 2021 08:38:21 -0400 Subject: [PATCH] Tweak Master System blue scale. --- Components/9918/Implementation/9918Base.hpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Components/9918/Implementation/9918Base.hpp b/Components/9918/Implementation/9918Base.hpp index 9ecea6943..c0bb8c86d 100644 --- a/Components/9918/Implementation/9918Base.hpp +++ b/Components/9918/Implementation/9918Base.hpp @@ -350,11 +350,14 @@ class Base { case MemoryAccess::Write: if(master_system_.cram_is_selected) { - // Adjust the palette. + // Adjust the palette. In a Master System blue has a slightly different + // scale; cf. https://www.retrorgb.com/sega-master-system-non-linear-blue-channel-findings.html + constexpr uint8_t rg_scale[] = {0, 85, 170, 255}; + constexpr uint8_t b_scale[] = {0, 104, 170, 255}; master_system_.colour_ram[ram_pointer_ & 0x1f] = palette_pack( - uint8_t(((read_ahead_buffer_ >> 0) & 3) * 255 / 3), - uint8_t(((read_ahead_buffer_ >> 2) & 3) * 255 / 3), - uint8_t(((read_ahead_buffer_ >> 4) & 3) * 255 / 3) + rg_scale[(read_ahead_buffer_ >> 0) & 3], + rg_scale[(read_ahead_buffer_ >> 2) & 3], + b_scale[(read_ahead_buffer_ >> 4) & 3] ); // Schedule a CRAM dot; this is scheduled for wherever it should appear