mirror of
https://github.com/TomHarte/CLK.git
synced 2024-09-30 07:55:01 +00:00
Fix: signal is 'flyback', not sync.
This commit is contained in:
parent
6c6cda3db5
commit
c134c7bdc2
@ -202,7 +202,7 @@ struct InputOutputController: public ClockingHint::Observer {
|
|||||||
uint8_t value = control_ | 0xc0;
|
uint8_t value = control_ | 0xc0;
|
||||||
value &= ~(i2c_.clock() ? 0x02 : 0x00);
|
value &= ~(i2c_.clock() ? 0x02 : 0x00);
|
||||||
value &= ~(i2c_.data() ? 0x01 : 0x00);
|
value &= ~(i2c_.data() ? 0x01 : 0x00);
|
||||||
value &= ~(video_.vsync_active() ? 0x80 : 0x00);
|
value &= ~(video_.flyback_active() ? 0x00 : 0x80); // i.e. high during flyback.
|
||||||
set_byte(value);
|
set_byte(value);
|
||||||
// logger.error().append("IOC control read: C:%d D:%d", !(value & 2), !(value & 1));
|
// logger.error().append("IOC control read: C:%d D:%d", !(value & 2), !(value & 1));
|
||||||
} break;
|
} break;
|
||||||
|
@ -134,19 +134,21 @@ struct Video {
|
|||||||
const auto old_phase = vertical_state_.phase();
|
const auto old_phase = vertical_state_.phase();
|
||||||
vertical_state_.increment_position(vertical_timing_);
|
vertical_state_.increment_position(vertical_timing_);
|
||||||
pixel_count_ = 0;
|
pixel_count_ = 0;
|
||||||
if(vertical_state_.did_restart()) {
|
|
||||||
entered_sync_ = true;
|
|
||||||
interrupt_observer_.update_interrupts();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
const auto phase = vertical_state_.phase();
|
||||||
|
if(phase != old_phase) {
|
||||||
// I don't have good information on this; first guess: copy frame and
|
// I don't have good information on this; first guess: copy frame and
|
||||||
// cursor start addresses into counters at the start of the first vertical
|
// cursor start addresses into counters at the start of the first vertical
|
||||||
// display line.
|
// display line.
|
||||||
const auto phase = vertical_state_.phase();
|
if(phase == Phase::Display) {
|
||||||
if(phase != old_phase && phase == Phase::Display) {
|
|
||||||
address_ = frame_start_;
|
address_ = frame_start_;
|
||||||
cursor_address_ = cursor_start_;
|
cursor_address_ = cursor_start_;
|
||||||
}
|
}
|
||||||
|
if(old_phase == Phase::Display) {
|
||||||
|
entered_flyback_ = true;
|
||||||
|
interrupt_observer_.update_interrupts();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Determine which next 8 bytes will be the cursor image for this line.
|
// Determine which next 8 bytes will be the cursor image for this line.
|
||||||
// Pragmatically, updating cursor_address_ once per line avoids probable
|
// Pragmatically, updating cursor_address_ once per line avoids probable
|
||||||
@ -321,13 +323,13 @@ struct Video {
|
|||||||
/// @returns @c true if a vertical retrace interrupt has been signalled since the last call to @c interrupt(); @c false otherwise.
|
/// @returns @c true if a vertical retrace interrupt has been signalled since the last call to @c interrupt(); @c false otherwise.
|
||||||
bool interrupt() {
|
bool interrupt() {
|
||||||
// Guess: edge triggered?
|
// Guess: edge triggered?
|
||||||
const bool interrupt = entered_sync_;
|
const bool interrupt = entered_flyback_;
|
||||||
entered_sync_ = false;
|
entered_flyback_ = false;
|
||||||
return interrupt;
|
return interrupt;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool vsync_active() const {
|
bool flyback_active() const {
|
||||||
return vertical_state_.phase() == Phase::Sync;
|
return vertical_state_.phase() != Phase::Display;
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_frame_start(uint32_t address) { frame_start_ = address; }
|
void set_frame_start(uint32_t address) { frame_start_ = address; }
|
||||||
@ -461,7 +463,7 @@ private:
|
|||||||
// An interrupt flag; more closely related to the interface by which
|
// An interrupt flag; more closely related to the interface by which
|
||||||
// my implementation of the IOC picks up an interrupt request than
|
// my implementation of the IOC picks up an interrupt request than
|
||||||
// to hardware.
|
// to hardware.
|
||||||
bool entered_sync_ = false;
|
bool entered_flyback_ = false;
|
||||||
|
|
||||||
// The divider that would need to be applied to a 24Mhz clock to
|
// The divider that would need to be applied to a 24Mhz clock to
|
||||||
// get half the current pixel clock; counting is in units of half
|
// get half the current pixel clock; counting is in units of half
|
||||||
|
Loading…
Reference in New Issue
Block a user