1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-06-25 18:30:07 +00:00

Make attempt at the TP background-colour bit.

This commit is contained in:
Thomas Harte 2023-02-26 13:42:59 -05:00
parent b948761f30
commit bfa167fcdf
3 changed files with 12 additions and 1 deletions

View File

@ -773,9 +773,14 @@ void Base<personality>::commit_register(int reg, uint8_t value) {
LOG("Screen mode: " << int(current_screen_mode<true>()));
break;
case 7:
Storage<personality>::background_palette_[0] = Storage<personality>::palette_[background_colour_];
break;
case 8:
LOG("TODO: Yamaha VRAM organisation, sprite disable, etc; " << PADHEX(2) << +value);
Storage<personality>::sprites_enabled_ = !(value & 0x02);
Storage<personality>::solid_background_ = value & 0x20;
// b7: "1 = input on colour bus, enable mouse; 1 = output on colour bus, disable mouse" [documentation clearly in error]
// b6: 1 = enable light pen
// b5: sets the colour of code 0 to the colour of the palette (???)
@ -1013,6 +1018,9 @@ void Base<personality>::write_palette(uint8_t value) {
const uint8_t b = (Storage<personality>::new_colour_ & 7) * 255 / 7;
Storage<personality>::palette_[Storage<personality>::palette_entry_ & 0xf] = palette_pack(r, g, b);
Storage<personality>::background_palette_[Storage<personality>::palette_entry_ & 0xf] = palette_pack(r, g, b);
Storage<personality>::background_palette_[0] = Storage<personality>::palette_[background_colour_];
++Storage<personality>::palette_entry_;
}
}

View File

@ -75,7 +75,7 @@ template <Personality personality> struct Base: public Storage<personality> {
};
const std::array<uint32_t, 16> &palette() {
if constexpr (is_yamaha_vdp(personality)) {
return Storage<personality>::palette_;
return Storage<personality>::solid_background_ ? Storage<personality>::palette_ : Storage<personality>::background_palette_;
}
return default_palette;
}

View File

@ -40,6 +40,9 @@ template <Personality personality> struct Storage<personality, std::enable_if_t<
bool increment_indirect_register_ = false;
std::array<uint32_t, 16> palette_{};
std::array<uint32_t, 16> background_palette_{};
bool solid_background_ = true;
uint8_t new_colour_ = 0;
uint8_t palette_entry_ = 0;
bool palette_write_phase_ = false;