mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-22 12:33:29 +00:00
Avoid missed interrupts on wraparound.
This commit is contained in:
parent
12846317cb
commit
b5932edff3
@ -237,18 +237,27 @@ void VideoOutput::run_for(const Cycles cycles) {
|
|||||||
const auto start_position = output_position_;
|
const auto start_position = output_position_;
|
||||||
output_position_ = (output_position_ + number_of_cycles) % cycles_per_frame;
|
output_position_ = (output_position_ + number_of_cycles) % cycles_per_frame;
|
||||||
|
|
||||||
if(
|
const auto test_range = [&](int start, int end) {
|
||||||
(start_position < real_time_clock_interrupt_1 && output_position_ >= real_time_clock_interrupt_1) ||
|
if(
|
||||||
(start_position < real_time_clock_interrupt_2 && output_position_ >= real_time_clock_interrupt_2)
|
(start < real_time_clock_interrupt_1 && end >= real_time_clock_interrupt_1) ||
|
||||||
) {
|
(start < real_time_clock_interrupt_2 && end >= real_time_clock_interrupt_2)
|
||||||
interrupts_ = Electron::Interrupt(interrupts_ | Electron::Interrupt::RealTimeClock);
|
) {
|
||||||
}
|
interrupts_ = Electron::Interrupt(interrupts_ | Electron::Interrupt::RealTimeClock);
|
||||||
|
}
|
||||||
|
|
||||||
if(
|
if(
|
||||||
(start_position < display_end_interrupt_1 && output_position_ >= display_end_interrupt_1) ||
|
(start < display_end_interrupt_1 && end >= display_end_interrupt_1) ||
|
||||||
(start_position < display_end_interrupt_2 && output_position_ >= display_end_interrupt_2)
|
(start < display_end_interrupt_2 && end >= display_end_interrupt_2)
|
||||||
) {
|
) {
|
||||||
interrupts_ = Electron::Interrupt(interrupts_ | Electron::Interrupt::DisplayEnd);
|
interrupts_ = Electron::Interrupt(interrupts_ | Electron::Interrupt::DisplayEnd);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if(output_position_ >= start_position) {
|
||||||
|
test_range(start_position, output_position_);
|
||||||
|
} else {
|
||||||
|
test_range(start_position, cycles_per_frame);
|
||||||
|
test_range(0, output_position_);
|
||||||
}
|
}
|
||||||
|
|
||||||
while(number_of_cycles) {
|
while(number_of_cycles) {
|
||||||
|
Loading…
Reference in New Issue
Block a user