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

Support horizontal offsets.

This commit is contained in:
Thomas Harte 2023-04-24 22:43:11 -04:00
parent 1b4df01a28
commit e49e98d309
2 changed files with 9 additions and 3 deletions

View File

@ -419,6 +419,11 @@ void TMS9918<personality>::run_for(const HalfCycles cycles) {
break;
}
if constexpr (is_yamaha_vdp(personality)) {
this->fetch_line_buffer_->first_pixel_output_column += Storage<personality>::adjustment_[0];
this->fetch_line_buffer_->next_border_column += Storage<personality>::adjustment_[0];
}
this->fetch_line_buffer_->vertical_state =
this->screen_mode_ == ScreenMode::Blank ?
VerticalState::Blank :
@ -874,9 +879,8 @@ void Base<personality>::commit_register(int reg, uint8_t value) {
break;
case 18:
if(value) {
LOG("TODO: Yamaha position adjustment; " << PADHEX(2) << +value);
}
Storage<personality>::adjustment_[0] = (8 - ((value & 15) ^ 8)) * 4;
Storage<personality>::adjustment_[1] = 8 - ((value >> 4) ^ 8);
// b0-b3: horizontal adjustment
// b4-b7: vertical adjustment
break;

View File

@ -38,6 +38,8 @@ template <Personality personality> struct Storage<personality, std::enable_if_t<
int indirect_register_ = 0;
bool increment_indirect_register_ = false;
int adjustment_[2]{};
std::array<uint32_t, 16> palette_{};
std::array<uint32_t, 16> background_palette_{};
bool solid_background_ = true;