1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-22 12:33:29 +00:00

Loop in vsync as a potential tape input.

This commit is contained in:
Thomas Harte 2024-09-10 20:59:05 -04:00
parent 584b6df40d
commit 2b7382a014
3 changed files with 30 additions and 3 deletions

View File

@ -576,7 +576,9 @@ template <Analyser::Static::Oric::Target::DiskInterface disk_interface, CPU::MOS
break; break;
} }
video_ += Cycles(1); if(video_ += Cycles(1)) {
set_via_port_b_input();
}
return Cycles(1); return Cycles(1);
} }
@ -621,9 +623,18 @@ template <Analyser::Static::Oric::Target::DiskInterface disk_interface, CPU::MOS
} }
// to satisfy Storage::Tape::BinaryTapePlayer::Delegate // to satisfy Storage::Tape::BinaryTapePlayer::Delegate
void tape_did_change_input(Storage::Tape::BinaryTapePlayer *tape_player) final { void tape_did_change_input(Storage::Tape::BinaryTapePlayer *) final {
set_via_port_b_input();
}
void set_via_port_b_input() {
// set CB1 // set CB1
via_.set_control_line_input(MOS::MOS6522::Port::B, MOS::MOS6522::Line::One, !tape_player->get_input()); via_.set_control_line_input(
MOS::MOS6522::Port::B, MOS::MOS6522::Line::One,
tape_player_.get_motor_control() ?
!tape_player_.get_input() :
!video_->vsync()
);
} }
// for Utility::TypeRecipient::Delegate // for Utility::TypeRecipient::Delegate

View File

@ -115,6 +115,21 @@ bool VideoOutput::vsync() {
return counter_ >= v_sync_start_position_ && counter_ < v_sync_end_position_; return counter_ >= v_sync_start_position_ && counter_ < v_sync_end_position_;
} }
Cycles VideoOutput::next_sequence_point() const {
if(counter_ < v_sync_start_position_) {
return Cycles(v_sync_start_position_ - counter_);
} else if(counter_ < v_sync_end_position_) {
return Cycles(v_sync_end_position_ - counter_);
} else {
// After vsync the length of the next frame is baked in, so this is safe
// (but should probably be factored out).
return Cycles(
counter_period_ + static_cast<int>(next_frame_is_sixty_hertz_ ? PAL60VSyncStartPosition : PAL50VSyncStartPosition)
- counter_
);
}
}
void VideoOutput::run_for(const Cycles cycles) { void VideoOutput::run_for(const Cycles cycles) {
// Horizontal: 0-39: pixels; otherwise blank; 48-53 sync, 54-56 colour burst. // Horizontal: 0-39: pixels; otherwise blank; 48-53 sync, 54-56 colour burst.
// Vertical: 0-223: pixels; otherwise blank; 256-259 (50Hz) or 234-238 (60Hz) sync. // Vertical: 0-223: pixels; otherwise blank; 256-259 (50Hz) or 234-238 (60Hz) sync.

View File

@ -23,6 +23,7 @@ class VideoOutput {
void set_colour_rom(const std::vector<uint8_t> &colour_rom); void set_colour_rom(const std::vector<uint8_t> &colour_rom);
void run_for(const Cycles cycles); void run_for(const Cycles cycles);
Cycles next_sequence_point() const;
bool vsync(); bool vsync();