Something went wrong. Try again.
A cycle-accurate Apple II and Apple IIgs emulator written in Zig, usable as both a program and a library.
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435// SPDX-FileCopyrightText: 2026 Jeffrey C. Ollie <jeff@ocjtech.us>//// SPDX-License-Identifier: MIT
const std = @import("std");
pub const FakeClock = struct { const Self = @This();
cycles: u64,
/// Starts the clock at zero. The speed is accepted and ignored: nothing /// here waits on real time, it only counts. pub fn init(self: *Self, clock_speed: ?u128) void { _ = clock_speed; self.cycles = 0; }
/// How many cycles have elapsed since the last reset. pub fn read(self: *const Self) u64 { return self.cycles; }
/// Spends cycles. Every bus access calls this, so the count is a tally of /// what the processor did rather than a delay. pub fn sleep(self: *Self, cycles: u8) void { self.cycles +%= cycles; }
/// Puts the cycle count back to zero. pub fn reset(self: *Self) void { self.cycles = 0; }};