2015-11-16 08:38:05 +00:00
|
|
|
auto APU::FIFO::read() -> void {
|
2012-04-09 06:19:32 +00:00
|
|
|
if(size == 0) return;
|
|
|
|
size--;
|
|
|
|
output = sample[rdoffset++];
|
|
|
|
}
|
|
|
|
|
2015-11-16 08:38:05 +00:00
|
|
|
auto APU::FIFO::write(int8 byte) -> void {
|
2015-08-02 06:23:13 +00:00
|
|
|
if(size == 32) rdoffset++;
|
|
|
|
else size++;
|
2012-04-09 06:19:32 +00:00
|
|
|
sample[wroffset++] = byte;
|
|
|
|
}
|
|
|
|
|
2015-11-16 08:38:05 +00:00
|
|
|
auto APU::FIFO::reset() -> void {
|
2013-05-05 09:21:30 +00:00
|
|
|
for(auto& byte : sample) byte = 0;
|
2012-04-09 06:19:32 +00:00
|
|
|
output = 0;
|
|
|
|
|
|
|
|
rdoffset = 0;
|
|
|
|
wroffset = 0;
|
|
|
|
size = 0;
|
|
|
|
}
|
|
|
|
|
2015-11-16 08:38:05 +00:00
|
|
|
auto APU::FIFO::power() -> void {
|
2012-04-09 06:19:32 +00:00
|
|
|
reset();
|
|
|
|
|
|
|
|
lenable = 0;
|
|
|
|
renable = 0;
|
|
|
|
timer = 0;
|
|
|
|
}
|