diff --git a/ClockReceiver/JustInTime.hpp b/ClockReceiver/JustInTime.hpp index c351ce767..c8ddf7221 100644 --- a/ClockReceiver/JustInTime.hpp +++ b/ClockReceiver/JustInTime.hpp @@ -26,7 +26,7 @@ Machines that accumulate HalfCycle time but supply to a Cycle-counted device may supply a separate @c TargetTimeScale at template declaration. - If the held object implements get_next_sequence_point() then it'll be used to flush implicitly + If the held object implements @c next_sequence_point() then it'll be used to flush implicitly as and when sequence points are hit. Callers can use will_flush() to predict these. If the held object is a subclass of ClockingHint::Source, this template will register as an @@ -40,7 +40,7 @@ template max translation rather than // allowing the arithmetic to overflow. if constexpr (divider == 1 && std::is_same_v) { - time_until_event_ = object_.get_next_sequence_point(); + time_until_event_ = object_.next_sequence_point(); } else { - const auto time = object_.get_next_sequence_point(); + const auto time = object_.next_sequence_point(); if(time == TargetTimeScale::max()) { time_until_event_ = LocalTimeScale::max(); } else { @@ -272,7 +272,7 @@ template struct has_sequence_points : std::false_type {}; - template struct has_sequence_points().get_next_sequence_point()))> : std::true_type {}; + template struct has_sequence_points().next_sequence_point()))> : std::true_type {}; ClockingHint::Preference clocking_preference_ = ClockingHint::Preference::JustInTime; void set_component_prefers_clocking(ClockingHint::Source *, ClockingHint::Preference clocking) { diff --git a/Components/68901/MFP68901.cpp b/Components/68901/MFP68901.cpp index c2f04d631..7f2551fa2 100644 --- a/Components/68901/MFP68901.cpp +++ b/Components/68901/MFP68901.cpp @@ -207,7 +207,7 @@ void MFP68901::run_for(HalfCycles time) { } } -HalfCycles MFP68901::get_next_sequence_point() { +HalfCycles MFP68901::next_sequence_point() { return HalfCycles::max(); } diff --git a/Components/68901/MFP68901.hpp b/Components/68901/MFP68901.hpp index 4c067d1f2..9eabec622 100644 --- a/Components/68901/MFP68901.hpp +++ b/Components/68901/MFP68901.hpp @@ -40,7 +40,7 @@ class MFP68901: public ClockingHint::Source { /// so that mechanism can also be used to reduce the quantity of calls into this class. /// /// @discussion TODO, alas. - HalfCycles get_next_sequence_point(); + HalfCycles next_sequence_point(); /// Sets the current level of either of the timer event inputs — TAI and TBI in datasheet terms. void set_timer_event_input(int channel, bool value); diff --git a/Components/9918/9918.hpp b/Components/9918/9918.hpp index 0789533a3..6cec30c61 100644 --- a/Components/9918/9918.hpp +++ b/Components/9918/9918.hpp @@ -108,7 +108,7 @@ template class TMS9918: private Base { If get_interrupt_line is true now of if get_interrupt_line would never return true, returns HalfCycles::max(). */ - HalfCycles get_next_sequence_point() const; + HalfCycles next_sequence_point() const; /*! Returns the amount of time until the nominated line interrupt position is diff --git a/Components/9918/Implementation/9918.cpp b/Components/9918/Implementation/9918.cpp index b8a589e35..177e86dda 100644 --- a/Components/9918/Implementation/9918.cpp +++ b/Components/9918/Implementation/9918.cpp @@ -1268,7 +1268,7 @@ uint8_t TMS9918::get_current_line() const { return uint8_t(source_row); } template -HalfCycles TMS9918::get_next_sequence_point() const { +HalfCycles TMS9918::next_sequence_point() const { if(!this->generate_interrupts_ && !this->enable_line_interrupts_) return HalfCycles::max(); if(get_interrupt_line()) return HalfCycles::max(); diff --git a/Machines/Apple/AppleIIgs/AppleIIgs.cpp b/Machines/Apple/AppleIIgs/AppleIIgs.cpp index d440db65a..718cc2a4d 100644 --- a/Machines/Apple/AppleIIgs/AppleIIgs.cpp +++ b/Machines/Apple/AppleIIgs/AppleIIgs.cpp @@ -1171,7 +1171,7 @@ class ConcreteMachine: machine_->update_audio(); } ~AudioUpdater() { - machine_->cycles_until_audio_event_ = machine_->sound_glu_.get_next_sequence_point(); + machine_->cycles_until_audio_event_ = machine_->sound_glu_.next_sequence_point(); } private: ConcreteMachine *machine_; diff --git a/Machines/Apple/AppleIIgs/Sound.cpp b/Machines/Apple/AppleIIgs/Sound.cpp index f1599b1eb..0a5c78869 100644 --- a/Machines/Apple/AppleIIgs/Sound.cpp +++ b/Machines/Apple/AppleIIgs/Sound.cpp @@ -218,7 +218,7 @@ uint8_t GLU::get_address_high() { // MARK: - Update logic. -Cycles GLU::get_next_sequence_point() const { +Cycles GLU::next_sequence_point() const { uint32_t result = std::numeric_limits::max(); for(int c = 0; c < local_.oscillator_count; c++) { diff --git a/Machines/Apple/AppleIIgs/Sound.hpp b/Machines/Apple/AppleIIgs/Sound.hpp index c9cba701e..17d98d0e6 100644 --- a/Machines/Apple/AppleIIgs/Sound.hpp +++ b/Machines/Apple/AppleIIgs/Sound.hpp @@ -31,7 +31,7 @@ class GLU: public Outputs::Speaker::SampleSource { uint8_t get_address_high(); void run_for(Cycles); - Cycles get_next_sequence_point() const; + Cycles next_sequence_point() const; bool get_interrupt_line(); // SampleSource. diff --git a/Machines/Apple/AppleIIgs/Video.cpp b/Machines/Apple/AppleIIgs/Video.cpp index fc44be493..20f132f08 100644 --- a/Machines/Apple/AppleIIgs/Video.cpp +++ b/Machines/Apple/AppleIIgs/Video.cpp @@ -191,7 +191,7 @@ void Video::advance(Cycles cycles) { } } -Cycles Video::get_next_sequence_point() const { +Cycles Video::next_sequence_point() const { const int cycles_into_row = cycles_into_frame_ % CyclesPerLine; const int row = cycles_into_frame_ / CyclesPerLine; diff --git a/Machines/Apple/AppleIIgs/Video.hpp b/Machines/Apple/AppleIIgs/Video.hpp index 9d30f2dff..5933fa99f 100644 --- a/Machines/Apple/AppleIIgs/Video.hpp +++ b/Machines/Apple/AppleIIgs/Video.hpp @@ -60,7 +60,7 @@ class Video: public Apple::II::VideoSwitches { Outputs::Display::DisplayType get_display_type() const; /// Determines the period until video might autonomously update its interrupt lines. - Cycles get_next_sequence_point() const; + Cycles next_sequence_point() const; /// Sets the Mega II interrupt enable state — 1/4-second and VBL interrupts are /// generated here. diff --git a/Machines/Apple/Macintosh/Macintosh.cpp b/Machines/Apple/Macintosh/Macintosh.cpp index 8dcbafb32..525ff8f75 100644 --- a/Machines/Apple/Macintosh/Macintosh.cpp +++ b/Machines/Apple/Macintosh/Macintosh.cpp @@ -575,7 +575,7 @@ template class ConcreteMachin video_.run_for(time_until_video_event_); time_since_video_update_ -= time_until_video_event_; - time_until_video_event_ = video_.get_next_sequence_point(); + time_until_video_event_ = video_.next_sequence_point(); via_.set_control_line_input(MOS::MOS6522::Port::A, MOS::MOS6522::Line::One, !video_.vsync()); } @@ -626,7 +626,7 @@ template class ConcreteMachin forceinline void update_video() { video_.run_for(time_since_video_update_.flush()); - time_until_video_event_ = video_.get_next_sequence_point(); + time_until_video_event_ = video_.next_sequence_point(); } Inputs::Mouse &get_mouse() final { diff --git a/Machines/Apple/Macintosh/Video.cpp b/Machines/Apple/Macintosh/Video.cpp index e1cf1cd4e..37c7ea8e1 100644 --- a/Machines/Apple/Macintosh/Video.cpp +++ b/Machines/Apple/Macintosh/Video.cpp @@ -170,7 +170,7 @@ bool Video::vsync() { return line >= 353 && line < 356; } -HalfCycles Video::get_next_sequence_point() { +HalfCycles Video::next_sequence_point() { const auto line = (frame_position_ / line_length).as_integral(); if(line >= 353 && line < 356) { // Currently in vsync, so get time until start of line 357, diff --git a/Machines/Apple/Macintosh/Video.hpp b/Machines/Apple/Macintosh/Video.hpp index 87aa4b61d..6f60cbc1a 100644 --- a/Machines/Apple/Macintosh/Video.hpp +++ b/Machines/Apple/Macintosh/Video.hpp @@ -80,7 +80,7 @@ class Video { @returns the amount of time until there is next a transition on the vsync signal. */ - HalfCycles get_next_sequence_point(); + HalfCycles next_sequence_point(); private: DeferredAudio &audio_; diff --git a/Machines/Atari/ST/Video.cpp b/Machines/Atari/ST/Video.cpp index cd7ea0298..1aba47372 100644 --- a/Machines/Atari/ST/Video.cpp +++ b/Machines/Atari/ST/Video.cpp @@ -395,7 +395,7 @@ bool Video::display_enabled() { return public_state_.display_enable; } -HalfCycles Video::get_next_sequence_point() { +HalfCycles Video::next_sequence_point() { // The next sequence point will be whenever display_enabled, vsync or hsync next changes. // Sequence of events within a standard line: diff --git a/Machines/Atari/ST/Video.hpp b/Machines/Atari/ST/Video.hpp index 547c02cbe..27b2e621f 100644 --- a/Machines/Atari/ST/Video.hpp +++ b/Machines/Atari/ST/Video.hpp @@ -68,7 +68,7 @@ class Video { @returns the number of cycles until there is next a change in the hsync, vsync or display_enable outputs. */ - HalfCycles get_next_sequence_point(); + HalfCycles next_sequence_point(); /*! @returns @c true if the horizontal sync output is currently active; @c false otherwise. diff --git a/Machines/Electron/Video.cpp b/Machines/Electron/Video.cpp index 31f69fad6..b5e743764 100644 --- a/Machines/Electron/Video.cpp +++ b/Machines/Electron/Video.cpp @@ -370,7 +370,7 @@ void VideoOutput::setup_base_address() { // MARK: - Interrupts -Cycles VideoOutput::get_next_sequence_point() { +Cycles VideoOutput::next_sequence_point() { if(output_position_ < real_time_clock_interrupt_1) { return real_time_clock_interrupt_1 - output_position_; } diff --git a/Machines/Electron/Video.hpp b/Machines/Electron/Video.hpp index db6a4e617..baf2e02e1 100644 --- a/Machines/Electron/Video.hpp +++ b/Machines/Electron/Video.hpp @@ -61,7 +61,7 @@ class VideoOutput { This result may be mutated by calls to @c write. */ - Cycles get_next_sequence_point(); + Cycles next_sequence_point(); /*! @returns a bit mask of all interrupts that have been triggered since the last call to get_interrupt(). diff --git a/Machines/Enterprise/Dave.cpp b/Machines/Enterprise/Dave.cpp index 80c406f5b..e619f6352 100644 --- a/Machines/Enterprise/Dave.cpp +++ b/Machines/Enterprise/Dave.cpp @@ -315,7 +315,7 @@ void TimedInterruptSource::run_for(Cycles duration) { update_channel(1, rate_ == InterruptRate::ToneGenerator1, cycles.as()); } -Cycles TimedInterruptSource::get_next_sequence_point() const { +Cycles TimedInterruptSource::next_sequence_point() const { // Since both the 1kHz and 50Hz timers are integer dividers of the 1Hz timer, there's no need // to factor that one in when determining the next sequence point for either of those. switch(rate_) { diff --git a/Machines/Enterprise/Dave.hpp b/Machines/Enterprise/Dave.hpp index 88e282a2d..69a1449a9 100644 --- a/Machines/Enterprise/Dave.hpp +++ b/Machines/Enterprise/Dave.hpp @@ -144,7 +144,7 @@ class TimedInterruptSource { /// @returns The amount of time from now until the earliest that /// @c get_new_interrupts() _might_ have new interrupts to report. - Cycles get_next_sequence_point() const; + Cycles next_sequence_point() const; private: static constexpr Cycles clock_rate{250000}; diff --git a/Machines/Enterprise/Nick.cpp b/Machines/Enterprise/Nick.cpp index 9ec7d2fe6..6da43d8cb 100644 --- a/Machines/Enterprise/Nick.cpp +++ b/Machines/Enterprise/Nick.cpp @@ -467,7 +467,7 @@ void Nick::set_output_type(OutputType type, bool force_flush) { // MARK: - Sequence points. -Cycles Nick::get_next_sequence_point() const { +Cycles Nick::next_sequence_point() const { constexpr int load_point = 16; // i.e. 16 cycles after the start of the line, the // interrupt line may change. That is, after the // second byte of the mode line has been read. diff --git a/Machines/Enterprise/Nick.hpp b/Machines/Enterprise/Nick.hpp index fa9e670f7..120d7b9cb 100644 --- a/Machines/Enterprise/Nick.hpp +++ b/Machines/Enterprise/Nick.hpp @@ -38,7 +38,7 @@ class Nick { Outputs::Display::ScanStatus get_scaled_scan_status() const; /// @returns The amount of time until the next potential change in interrupt output. - Cycles get_next_sequence_point() const; + Cycles next_sequence_point() const; /*! @returns The current state of the interrupt line — @c true for active; diff --git a/Machines/Sinclair/ZXSpectrum/Video.hpp b/Machines/Sinclair/ZXSpectrum/Video.hpp index fb6008297..7f0f8ac51 100644 --- a/Machines/Sinclair/ZXSpectrum/Video.hpp +++ b/Machines/Sinclair/ZXSpectrum/Video.hpp @@ -315,7 +315,7 @@ template class Video { /*! @returns The amount of time until the next change in the interrupt line, that being the only internally-observeable output. */ - HalfCycles get_next_sequence_point() { + HalfCycles next_sequence_point() { constexpr auto timings = get_timings(); // Is the frame still ahead of this interrupt? diff --git a/OSBindings/Mac/Clock SignalTests/AtariSTVideoTests.mm b/OSBindings/Mac/Clock SignalTests/AtariSTVideoTests.mm index a99487e9e..0dfe03ddb 100644 --- a/OSBindings/Mac/Clock SignalTests/AtariSTVideoTests.mm +++ b/OSBindings/Mac/Clock SignalTests/AtariSTVideoTests.mm @@ -124,7 +124,7 @@ struct VideoTester { display_enable = _video->display_enabled(); vsync = _video->vsync(); hsync = _video->hsync(); - next_event = _video->get_next_sequence_point(); + next_event = _video->next_sequence_point(); } else { NSAssert(display_enable == _video->display_enabled(), @"Unannounced change in display enabled at cycle %zu [%d before next sequence point]", c, next_event.as()); NSAssert(vsync == _video->vsync(), @"Unannounced change in vsync at cycle %zu [%d before next sequence point]", c, next_event.as()); diff --git a/OSBindings/Mac/Clock SignalTests/EnterpriseDaveTests.mm b/OSBindings/Mac/Clock SignalTests/EnterpriseDaveTests.mm index cd8aa3ba8..50eb74f5d 100644 --- a/OSBindings/Mac/Clock SignalTests/EnterpriseDaveTests.mm +++ b/OSBindings/Mac/Clock SignalTests/EnterpriseDaveTests.mm @@ -38,7 +38,7 @@ int toggles = 0; int interrupts = 0; uint8_t dividerState = _interruptSource->get_divider_state() & 1; - int nextSequencePoint = _interruptSource->get_next_sequence_point().as(); + int nextSequencePoint = _interruptSource->next_sequence_point().as(); for(int c = 0; c < 250000 * 5; c++) { // Advance one cycle. Clock is 500,000 Hz. @@ -55,7 +55,7 @@ const uint8_t newInterrupts = _interruptSource->get_new_interrupts(); if(newInterrupts) { XCTAssertEqual(nextSequencePoint, 0); - nextSequencePoint = _interruptSource->get_next_sequence_point().as(); + nextSequencePoint = _interruptSource->next_sequence_point().as(); if(newInterrupts & 0x02) { ++interrupts; @@ -66,7 +66,7 @@ } } - XCTAssertEqual(nextSequencePoint, _interruptSource->get_next_sequence_point().as(), @"At cycle %d", c); + XCTAssertEqual(nextSequencePoint, _interruptSource->next_sequence_point().as(), @"At cycle %d", c); } XCTAssertEqual(toggles, int(expectedInterruptsPerSecond * 5.0)); diff --git a/OSBindings/Mac/Clock SignalTests/EnterpriseNickTests.mm b/OSBindings/Mac/Clock SignalTests/EnterpriseNickTests.mm index 2799b70ae..fee0e2842 100644 --- a/OSBindings/Mac/Clock SignalTests/EnterpriseNickTests.mm +++ b/OSBindings/Mac/Clock SignalTests/EnterpriseNickTests.mm @@ -46,7 +46,7 @@ - (void)testInterruptPrediction { // Run for the number of cycles implied by the number of lines. - int next_sequence_point = _nick->get_next_sequence_point().as(); + int next_sequence_point = _nick->next_sequence_point().as(); bool last_interrupt_line = _nick->get_interrupt_line(); for(int c = 0; c < _totalLines*912; c++) { @@ -61,9 +61,9 @@ last_interrupt_line = interrupt_line; if(!next_sequence_point) { - next_sequence_point = _nick->get_next_sequence_point().as(); + next_sequence_point = _nick->next_sequence_point().as(); } else { - const int expected_next_sequence_point = _nick->get_next_sequence_point().as(); + const int expected_next_sequence_point = _nick->next_sequence_point().as(); XCTAssertEqual(next_sequence_point, expected_next_sequence_point); } } diff --git a/OSBindings/Mac/Clock SignalTests/MacintoshVideoTests.mm b/OSBindings/Mac/Clock SignalTests/MacintoshVideoTests.mm index 932a0165f..2772ae7f2 100644 --- a/OSBindings/Mac/Clock SignalTests/MacintoshVideoTests.mm +++ b/OSBindings/Mac/Clock SignalTests/MacintoshVideoTests.mm @@ -31,14 +31,14 @@ int c = 5; bool vsync = _video->vsync(); while(c--) { - auto remaining_time_in_state = _video->get_next_sequence_point().as_integral(); + auto remaining_time_in_state = _video->next_sequence_point().as_integral(); NSLog(@"Vsync %@ expected for %@ half-cycles", vsync ? @"on" : @"off", @(remaining_time_in_state)); while(remaining_time_in_state--) { XCTAssertEqual(vsync, _video->vsync()); _video->run_for(HalfCycles(1)); if(remaining_time_in_state) - XCTAssertEqual(remaining_time_in_state, _video->get_next_sequence_point().as_integral()); + XCTAssertEqual(remaining_time_in_state, _video->next_sequence_point().as_integral()); } vsync ^= true; } diff --git a/OSBindings/Mac/Clock SignalTests/MasterSystemVDPTests.mm b/OSBindings/Mac/Clock SignalTests/MasterSystemVDPTests.mm index 62a306c7e..1744318c3 100644 --- a/OSBindings/Mac/Clock SignalTests/MasterSystemVDPTests.mm +++ b/OSBindings/Mac/Clock SignalTests/MasterSystemVDPTests.mm @@ -36,7 +36,7 @@ using VDP = TI::TMS::TMS9918; vdp.write(1, 0x8a); // Get time until interrupt. - auto time_until_interrupt = vdp.get_next_sequence_point().as_integral() - 1; + auto time_until_interrupt = vdp.next_sequence_point().as_integral() - 1; // Check that an interrupt is now scheduled. NSAssert(time_until_interrupt != HalfCycles::max().as_integral() - 1, @"No interrupt scheduled"); @@ -55,7 +55,7 @@ using VDP = TI::TMS::TMS9918; NSAssert(!vdp.get_interrupt_line(), @"Interrupt wasn't reset by status read"); // Check interrupt flag isn't set prior to the reported time. - time_until_interrupt = vdp.get_next_sequence_point().as_integral() - 1; + time_until_interrupt = vdp.next_sequence_point().as_integral() - 1; vdp.run_for(HalfCycles(time_until_interrupt)); NSAssert(!vdp.get_interrupt_line(), @"Interrupt line went active early [2]"); @@ -82,7 +82,7 @@ using VDP = TI::TMS::TMS9918; // Clear the pending interrupt and ask about the next one (i.e. the first one). vdp.read(1); - auto time_until_interrupt = vdp.get_next_sequence_point().as_integral() - 1; + auto time_until_interrupt = vdp.next_sequence_point().as_integral() - 1; // Check that an interrupt is now scheduled. NSAssert(time_until_interrupt != HalfCycles::max().as_integral() - 1, @"No interrupt scheduled"); @@ -116,7 +116,7 @@ using VDP = TI::TMS::TMS9918; // Now run through an entire frame... int half_cycles = 262*228*2; - auto last_time_until_interrupt = vdp.get_next_sequence_point().as_integral(); + auto last_time_until_interrupt = vdp.next_sequence_point().as_integral(); while(half_cycles--) { // Validate that an interrupt happened if one was expected, and clear anything that's present. NSAssert(vdp.get_interrupt_line() == (last_time_until_interrupt == HalfCycles::max().as_integral()), @"Unexpected interrupt state change; expected %d but got %d; position %d %d @ %d", (last_time_until_interrupt == 0), vdp.get_interrupt_line(), c, with_eof, half_cycles); @@ -129,7 +129,7 @@ using VDP = TI::TMS::TMS9918; vdp.run_for(HalfCycles(1)); // Get the time until interrupt. - auto time_until_interrupt = vdp.get_next_sequence_point().as_integral(); + auto time_until_interrupt = vdp.next_sequence_point().as_integral(); NSAssert(time_until_interrupt != HalfCycles::max().as_integral() || vdp.get_interrupt_line(), @"No interrupt scheduled; position %d %d @ %d", c, with_eof, half_cycles); NSAssert(time_until_interrupt >= 0, @"Interrupt is scheduled in the past; position %d %d @ %d", c, with_eof, half_cycles);