1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-27 01:31:42 +00:00

Makes an attempt at tracking video sequence points.

This commit is contained in:
Thomas Harte 2019-10-08 23:06:50 -04:00
parent 74fe32da23
commit 42ebe06474
2 changed files with 12 additions and 1 deletions

View File

@ -272,9 +272,18 @@ class ConcreteMachine:
private:
forceinline void advance_time(HalfCycles length) {
video_ += length;
cycles_since_audio_update_ += length;
mfp_ += length;
while(length >= cycles_until_video_event_) {
length -= cycles_until_video_event_;
video_ += cycles_until_video_event_;
cycles_until_video_event_ = video_->get_next_sequence_point();
// TODO: push v/hsync/display_enable elsewhere.
}
cycles_until_video_event_ -= length;
video_ += length;
}
void update_audio() {
@ -284,6 +293,7 @@ class ConcreteMachine:
CPU::MC68000::Processor<ConcreteMachine, true> mc68000_;
JustInTimeActor<Video, HalfCycles> video_;
JustInTimeActor<Motorola::MFP68901::MFP68901, HalfCycles> mfp_;
HalfCycles cycles_until_video_event_;
Concurrency::DeferringAsyncTaskQueue audio_queue_;
GI::AY38910::AY38910 ay_;

View File

@ -167,6 +167,7 @@ HalfCycles Video::get_next_sequence_point() {
} else if(y >= mode_params.final_video_line ) {
vertical_lines = mode_params.first_video_line + mode_params.lines_per_frame - y;
}
if(horizontal_cycles < 0) ++vertical_lines;
cycles_until_display_enable = HalfCycles(horizontal_cycles + vertical_lines * mode_params.line_length);
}