Files
ComSquare/sources/APU/DSP/Timer.cpp
2021-02-05 14:48:02 +01:00

22 lines
380 B
C++

//
// Created by melefo on 2/3/21.
//
#include "DSP.hpp"
namespace ComSquare::APU::DSP
{
void DSP::timerTick()
{
if (!this->_timer.counter)
this->_timer.counter = 0x7800;
this->_timer.counter -= 1;
}
bool DSP::timerPoll(uint32_t rate)
{
if (!rate)
return false;
return (this->_timer.counter + this->_counterOffset[rate]) % this->_rateModulus[rate] == 0;
}
}