diff --git a/Components/9918/Implementation/9918Base.hpp b/Components/9918/Implementation/9918Base.hpp index 47cc5fd84..b274a4b06 100644 --- a/Components/9918/Implementation/9918Base.hpp +++ b/Components/9918/Implementation/9918Base.hpp @@ -123,21 +123,21 @@ struct LineBufferPointer { }; template struct Base { + Base(); + static constexpr int output_lag = 11; // i.e. pixel output will occur 11 cycles // after corresponding data read. static constexpr uint32_t palette_pack(uint8_t r, uint8_t g, uint8_t b) { - uint32_t result = 0; - uint8_t *const result_ptr = reinterpret_cast(&result); - result_ptr[0] = r; - result_ptr[1] = g; - result_ptr[2] = b; - result_ptr[3] = 0; - return result; + #if TARGET_RT_BIG_ENDIAN + return uint32_t((r << 24) | (g << 16) | (b << 8)); + #else + return uint32_t((b << 16) | (g << 8) | r); + #endif } // The default TMS palette. - const uint32_t palette[16] = { + static constexpr std::array palette { palette_pack(0, 0, 0), palette_pack(0, 0, 0), palette_pack(33, 200, 66), @@ -159,8 +159,6 @@ template struct Base { palette_pack(255, 255, 255) }; - Base(); - Outputs::CRT::CRT crt_; TVStandard tv_standard_ = TVStandard::NTSC;