doc(emu): properly document + simply constants
This commit is contained in:
parent
14b24787ab
commit
4eb715a138
|
@ -9,18 +9,22 @@ const FpsTracker = @import("../util.zig").FpsTracker;
|
||||||
const Timer = std.time.Timer;
|
const Timer = std.time.Timer;
|
||||||
const Atomic = std.atomic.Atomic;
|
const Atomic = std.atomic.Atomic;
|
||||||
|
|
||||||
// 228 Lines which consist of 308 dots (which are 4 cycles long)
|
/// 4 Cycles in 1 dot
|
||||||
const cycles_per_frame: u64 = 228 * (308 * 4); //280896
|
const cycles_per_dot = 4;
|
||||||
const clock_rate: u64 = 1 << 24; // 16.78MHz
|
|
||||||
|
|
||||||
// TODO: Don't truncate this, be more accurate w/ timing
|
/// The GBA draws 228 Horizontal which each consist 308 dots
|
||||||
// 59.6046447754ns (truncated to just 59ns)
|
/// (note: not all lines are visible)
|
||||||
const clock_period: u64 = std.time.ns_per_s / clock_rate;
|
const cycles_per_frame = 228 * (308 * cycles_per_dot); //280896
|
||||||
const frame_period = (clock_period * cycles_per_frame);
|
|
||||||
|
|
||||||
// 59.7275005696Hz
|
/// The GBA ARM7TDMI runs at 2^24 Hz
|
||||||
pub const frame_rate = @intToFloat(f64, std.time.ns_per_s) /
|
const clock_rate = 1 << 24; // 16.78MHz
|
||||||
((@intToFloat(f64, std.time.ns_per_s) / @intToFloat(f64, clock_rate)) * @intToFloat(f64, cycles_per_frame));
|
|
||||||
|
/// The # of nanoseconds a frame should take
|
||||||
|
const frame_period = (std.time.ns_per_s * cycles_per_frame) / clock_rate;
|
||||||
|
|
||||||
|
/// Exact Value: 59.7275005696Hz
|
||||||
|
/// The inverse of the frame period
|
||||||
|
pub const frame_rate: f64 = @intToFloat(f64, clock_rate) / cycles_per_frame;
|
||||||
|
|
||||||
const log = std.log.scoped(.Emulation);
|
const log = std.log.scoped(.Emulation);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue