Chip8.Interpreter.Timer (chip8 v0.1.0)

A timer is an 8-bit integer that decrements at a constant rate.

Timers can have two different states, active and inactive. A timer is active whenever its value is above 0, while in this state, the value decrements whenever a ticks occurs until it reaches 0, when it becomes inactive and stops decrementing. On each tick, the value decrements on steps of 1, and they should run at a rate of 60Hz. Such rate needs to configured externally, it is common that emulators tie up this with the display's refresh rate.

Link to this section Summary

Link to this section Types

@type t() :: %Chip8.Interpreter.Timer{value: non_neg_integer()}

Link to this section Functions

@spec new() :: t()
@spec new(integer()) :: t()
@spec tick(t()) :: t()