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

Hack in vertical scrolling.

This commit is contained in:
Thomas Harte 2023-01-26 21:38:51 -05:00
parent 1bf8406e7e
commit 5d5098acb2
2 changed files with 15 additions and 10 deletions

View File

@ -200,28 +200,32 @@ void TMS9918<personality>::run_for(const HalfCycles cycles) {
// ------------------------
// Perform memory accesses.
// ------------------------
#define fetch(function, clock) { \
#define fetch(function, clock, offset) { \
const int first_window = from_internal<personality, clock>(this->fetch_pointer_.column);\
const int final_window = from_internal<personality, clock>(end_column); \
if(first_window == final_window) break; \
if(final_window != clock_rate<personality, clock>()) { \
function<true>( \
this->line_buffers_[this->fetch_pointer_.row], this->fetch_pointer_.row, \
this->line_buffers_[this->fetch_pointer_.row], this->fetch_pointer_.row + offset, \
first_window, final_window); \
} else { \
function<false>( \
this->line_buffers_[this->fetch_pointer_.row], this->fetch_pointer_.row, \
this->line_buffers_[this->fetch_pointer_.row], this->fetch_pointer_.row + offset, \
first_window, final_window); \
} \
}
switch(line_buffer.line_mode) {
case LineMode::Text: fetch(this->template fetch_tms_text, Clock::TMSMemoryWindow); break;
case LineMode::Character: fetch(this->template fetch_tms_character, Clock::TMSMemoryWindow); break;
case LineMode::SMS: fetch(this->template fetch_sms, Clock::TMSMemoryWindow); break;
case LineMode::Refresh: fetch(this->template fetch_tms_refresh, Clock::TMSMemoryWindow); break;
case LineMode::Text: fetch(this->template fetch_tms_text, Clock::TMSMemoryWindow, 0); break;
case LineMode::Character: fetch(this->template fetch_tms_character, Clock::TMSMemoryWindow, 0); break;
case LineMode::SMS: fetch(this->template fetch_sms, Clock::TMSMemoryWindow, 0); break;
case LineMode::Refresh: fetch(this->template fetch_tms_refresh, Clock::TMSMemoryWindow, 0); break;
case LineMode::Yamaha: fetch(this->template fetch_yamaha, Clock::Internal); break;
case LineMode::Yamaha:
if constexpr (is_yamaha_vdp(personality)) {
fetch(this->template fetch_yamaha, Clock::Internal, Storage<personality>::vertical_offset_);
}
break;
}
#undef fetch
@ -801,8 +805,7 @@ void Base<personality>::commit_register(int reg, uint8_t value) {
break;
case 23:
LOG("TODO: Yamaha vertical offset; " << PADHEX(2) << +value);
// i.e. scrolling.
Storage<personality>::vertical_offset_ = value;
break;
case 32: Storage<personality>::command_context_.source.template set<0, false>(value); break;

View File

@ -136,6 +136,8 @@ template <Personality personality> struct Storage<personality, std::enable_if_t<
uint8_t mode_ = 0;
uint8_t vertical_offset_ = 0;
/// Describes an _observable_ memory access event. i.e. anything that it is safe
/// (and convenient) to treat as atomic in between external slots.
struct Event {