1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-02-27 15:29:34 +00:00

Add a further state, seemingly to fix high-res mode.

This commit is contained in:
Thomas Harte 2022-03-18 08:27:46 -04:00
parent 88767e402c
commit 359ec257c0
2 changed files with 21 additions and 15 deletions

View File

@ -507,27 +507,31 @@ template <int cycle, bool stop_if_cpu> bool Chipset::perform_cycle() {
// Top priority: bitplane collection. // Top priority: bitplane collection.
if(cycle == fetch_window_[0]) { if(cycle == fetch_window_[0]) {
// printf("Enabled: %d; ", cycle); horizontal_fetch_ = HorizontalFetch::Started;
horizontal_fetch_ = HorizontalFetch::Enabled;
horizontal_offset_ = cycle; horizontal_offset_ = cycle;
} }
if(horizontal_fetch_ != HorizontalFetch::Disabled) { if(cycle == fetch_window_[1]) {
if(!((cycle - horizontal_offset_)&7)) { horizontal_fetch_ = HorizontalFetch::WillRequestStop;
if(horizontal_fetch_ == HorizontalFetch::StopRequested) { }
// printf("Disabled: %d\n", cycle); if(horizontal_fetch_ != HorizontalFetch::Stopped) {
horizontal_fetch_ = HorizontalFetch::Disabled; if(!((cycle - horizontal_offset_) & 7)) {
switch(horizontal_fetch_) {
case HorizontalFetch::WillRequestStop: horizontal_fetch_ = HorizontalFetch::StopRequested; break;
case HorizontalFetch::StopRequested: horizontal_fetch_ = HorizontalFetch::Stopped; break;
default: break;
} }
} }
if(horizontal_fetch_ != HorizontalFetch::Disabled && (dma_control_ & BitplaneFlag) == BitplaneFlag && fetch_vertical_ && bitplanes_.advance_dma(cycle - horizontal_offset_)) { if(
horizontal_fetch_ != HorizontalFetch::Stopped &&
(dma_control_ & BitplaneFlag) == BitplaneFlag &&
fetch_vertical_ &&
bitplanes_.advance_dma(cycle - horizontal_offset_)
) {
did_fetch_ = true; did_fetch_ = true;
return false; return false;
} }
} }
if(cycle == fetch_window_[1]) {
// printf("Disabling: %d; ", cycle);
horizontal_fetch_ = HorizontalFetch::StopRequested;
}
// Contradictory snippets from the Hardware Reference manual: // Contradictory snippets from the Hardware Reference manual:
// //
@ -721,7 +725,7 @@ template <bool stop_on_cpu> Chipset::Changes Chipset::run(HalfCycles length) {
previous_bitplanes_.clear(); previous_bitplanes_.clear();
} }
did_fetch_ = false; did_fetch_ = false;
horizontal_fetch_ = HorizontalFetch::Disabled; horizontal_fetch_ = HorizontalFetch::Stopped;
if(y_ == short_field_height_ + is_long_field_) { if(y_ == short_field_height_ + is_long_field_) {
++vsyncs; ++vsyncs;
@ -928,6 +932,7 @@ void Chipset::write(uint32_t address, uint16_t value, bool allow_conversion) {
case 0x092: // DDFSTRT case 0x092: // DDFSTRT
if(fetch_window_[0] != value) { if(fetch_window_[0] != value) {
LOG("Fetch window start set to " << std::dec << value); LOG("Fetch window start set to " << std::dec << value);
std::cout << "Fetch window start set to " << std::dec << value << std::endl;
} }
fetch_window_[0] = value & 0xfe; fetch_window_[0] = value & 0xfe;
break; break;
@ -936,6 +941,7 @@ void Chipset::write(uint32_t address, uint16_t value, bool allow_conversion) {
// means a + 8 is needed below for high-res displays. Investigate. // means a + 8 is needed below for high-res displays. Investigate.
if(fetch_window_[1] != value) { if(fetch_window_[1] != value) {
LOG("Fetch window stop set to " << std::dec << fetch_window_[1]); LOG("Fetch window stop set to " << std::dec << fetch_window_[1]);
std::cout << "Fetch window stop set to " << std::dec << fetch_window_[1] << std::endl;
} }
fetch_window_[1] = value & 0xfe; fetch_window_[1] = value & 0xfe;
break; break;

View File

@ -172,8 +172,8 @@ class Chipset: private ClockingHint::Observer {
int horizontal_offset_ = 0; int horizontal_offset_ = 0;
enum HorizontalFetch { enum HorizontalFetch {
Disabled, Enabled, StopRequested Started, WillRequestStop, StopRequested, Stopped
} horizontal_fetch_ = HorizontalFetch::Disabled; } horizontal_fetch_ = HorizontalFetch::Stopped;
// Output state. // Output state.
uint16_t border_colour_ = 0; uint16_t border_colour_ = 0;