1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-09-27 18:55:48 +00:00

Attempt ongoing state for vertical on/off.

This commit is contained in:
Thomas Harte 2023-02-28 22:28:14 -05:00
parent 1ef34b1f18
commit 318cfab67d
2 changed files with 7 additions and 4 deletions

View File

@ -297,6 +297,9 @@ void TMS9918<personality>::run_for(const HalfCycles cycles) {
this->fetch_pointer_.column = 0;
this->fetch_pointer_.row = (this->fetch_pointer_.row + 1) % this->mode_timing_.total_lines;
this->vertical_active_ |= !this->fetch_pointer_.row;
this->vertical_active_ &= this->fetch_pointer_.row != this->mode_timing_.pixel_lines;
// Reset sprite collection, which will be for the line after the new one.
LineBuffer &next_sprite_buffer = this->line_buffers_[(this->fetch_pointer_.row + 1) % this->mode_timing_.total_lines];
next_sprite_buffer.reset_sprite_collection();
@ -786,6 +789,7 @@ void Base<personality>::commit_register(int reg, uint8_t value) {
break;
case 9:
mode_timing_.pixel_lines = (value & 0x80) ? 212 : 192;
LOG("TODO: Yamaha line count, interlace, etc; " << PADHEX(2) << +value);
// b7: 1 = 212 lines of pixels; 0 = 192
// b5 & b4: select simultaneous mode (seems to relate to line length and in-phase colour?)
@ -1155,10 +1159,8 @@ int Base<personality>::fetch_line() const {
template <Personality personality>
VerticalState Base<personality>::vertical_state() const {
// TODO: the Yamaha uses an internal flag for visible region which toggles at contextually-appropriate moments.
// This test won't work properly there.
if(fetch_pointer_.row == mode_timing_.total_lines - 1) return VerticalState::Prefetch;
return fetch_pointer_.row >= mode_timing_.pixel_lines ? VerticalState::Blank : VerticalState::Pixels;
if(vertical_active_) return VerticalState::Pixels;
return fetch_pointer_.row == mode_timing_.total_lines - 1 ? VerticalState::Prefetch : VerticalState::Blank;
}
template <Personality personality>

View File

@ -189,6 +189,7 @@ template <Personality personality> struct Base: public Storage<personality> {
uint8_t line_interrupt_counter_ = 0;
bool enable_line_interrupts_ = false;
bool line_interrupt_pending_ = false;
bool vertical_active_ = false;
ScreenMode screen_mode_, underlying_mode_;
LineBuffer line_buffers_[313];