mirror of
https://github.com/TomHarte/CLK.git
synced 2025-08-13 00:25:26 +00:00
Use increment_video_counter_
to trigger fetch.
This commit is contained in:
@@ -287,13 +287,15 @@ public:
|
|||||||
next_cursor_.advance();
|
next_cursor_.advance();
|
||||||
}
|
}
|
||||||
if(increment_video_counter_) {
|
if(increment_video_counter_) {
|
||||||
// TODO: I've not fully persuaded myself yet that these shouldn't be the other side of the advance,
|
const uint16_t address = video_matrix_base_ + video_counter_;
|
||||||
// subject to another latch in the pipeline. I need to figure out whether pixel[char/attr] are
|
if(bad_line2_) {
|
||||||
// artefacts of the FPGA version not being able to dump 8 pixels simultaneously or act as extra
|
shifter_.write<1>(pager_.read(address));
|
||||||
// delay. They'll probably need to come back either way once I observe x_scroll_.
|
} else {
|
||||||
//
|
const auto data = pager_.read(address + 0x400);
|
||||||
// Current thinking: these should probably go afterwards, with an equivalent of pixelshiftreg
|
shifter_.write<0>(data);
|
||||||
// adding further delay?
|
if(bad_line()) next_character_.write(data);
|
||||||
|
}
|
||||||
|
|
||||||
next_attribute_.write(shifter_.read<1>());
|
next_attribute_.write(shifter_.read<1>());
|
||||||
if(!bad_line()) next_character_.write(shifter_.read<0>());
|
if(!bad_line()) next_character_.write(shifter_.read<0>());
|
||||||
next_cursor_.write(
|
next_cursor_.write(
|
||||||
@@ -306,23 +308,13 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
shifter_.advance();
|
shifter_.advance();
|
||||||
|
|
||||||
++video_counter_;
|
++video_counter_;
|
||||||
}
|
}
|
||||||
if(increment_character_position_ && character_fetch_) {
|
if(increment_character_position_ && character_fetch_) {
|
||||||
++character_position_;
|
++character_position_;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dma_state_ == DMAState::TDMA) {
|
|
||||||
const uint16_t address = video_matrix_base_ + video_counter_;
|
|
||||||
if(bad_line2_) {
|
|
||||||
shifter_.write<1>(pager_.read(address));
|
|
||||||
} else {
|
|
||||||
const auto data = pager_.read(address + 0x400);
|
|
||||||
shifter_.write<0>(data);
|
|
||||||
if(bad_line()) next_character_.write(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(state == OutputState::Pixels && pixels_) {
|
if(state == OutputState::Pixels && pixels_) {
|
||||||
const auto pixel_address = next_character_.read();
|
const auto pixel_address = next_character_.read();
|
||||||
const auto pixels = pager_.read(uint16_t(
|
const auto pixels = pager_.read(uint16_t(
|
||||||
@@ -422,6 +414,7 @@ public:
|
|||||||
schedule<8>(DelayedEvent::IncrementVerticalLine);
|
schedule<8>(DelayedEvent::IncrementVerticalLine);
|
||||||
next_vertical_counter_ = video_line_ == eos() ? 0 : ((vertical_counter_ + 1) & 511);
|
next_vertical_counter_ = video_line_ == eos() ? 0 : ((vertical_counter_ + 1) & 511);
|
||||||
horizontal_burst_ = true;
|
horizontal_burst_ = true;
|
||||||
|
printf("\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HorizontalEvent::EndExternalFetchWindow:
|
case HorizontalEvent::EndExternalFetchWindow:
|
||||||
@@ -643,7 +636,7 @@ private:
|
|||||||
}
|
}
|
||||||
template<int channel>
|
template<int channel>
|
||||||
void write(uint8_t value) {
|
void write(uint8_t value) {
|
||||||
data_[channel][(cursor_ + 1) % 40] = value;
|
data_[channel][cursor_] = value;
|
||||||
}
|
}
|
||||||
void advance() {
|
void advance() {
|
||||||
++cursor_;
|
++cursor_;
|
||||||
@@ -665,6 +658,7 @@ private:
|
|||||||
return uint8_t(data_);
|
return uint8_t(data_);
|
||||||
}
|
}
|
||||||
void write(uint8_t value) {
|
void write(uint8_t value) {
|
||||||
|
static_assert(cycles_delay < sizeof(data_));
|
||||||
data_ |= uint32_t(value) << (cycles_delay * 8);
|
data_ |= uint32_t(value) << (cycles_delay * 8);
|
||||||
}
|
}
|
||||||
void advance() {
|
void advance() {
|
||||||
@@ -674,8 +668,8 @@ private:
|
|||||||
private:
|
private:
|
||||||
uint32_t data_;
|
uint32_t data_;
|
||||||
};
|
};
|
||||||
ShiftRegister<2> next_attribute_;
|
ShiftRegister<3> next_attribute_;
|
||||||
ShiftRegister<2> next_character_;
|
ShiftRegister<3> next_character_;
|
||||||
ShiftRegister<3> next_cursor_;
|
ShiftRegister<3> next_cursor_;
|
||||||
|
|
||||||
// List of counter-triggered events.
|
// List of counter-triggered events.
|
||||||
|
Reference in New Issue
Block a user