Files
ComSquare/sources/APU/DSP/Timer.cpp
Melefo b0fb1e3351 new MemoryMap architecture
starting to working of voices and so on BRR, Envelopes, Gauss and Timers as they use each others
2021-02-04 00:06:39 +01:00

22 lines
440 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;
}
}