The Apu class represents the Audio Processing Unit (APU) of a system. More...
#include <apu.h>
Public Member Functions | |
Apu (MemoryImpl &memory) | |
void | Init () |
void | Reset () |
void | RunCycles (uint64_t cycles) |
uint8_t | SpcRead (uint16_t address) |
void | SpcWrite (uint16_t address, uint8_t data) |
void | SpcIdle (bool waiting) |
void | Cycle () |
uint8_t | Read (uint16_t address) |
void | Write (uint16_t address, uint8_t data) |
auto | dsp () -> Dsp & |
auto | spc700 () -> Spc700 & |
uint64_t | GetCycles () const |
void | set_handshake_tracker (debug::ApuHandshakeTracker *tracker) |
uint8_t | GetStatus () const |
uint8_t | GetControl () const |
void | GetSamples (int16_t *buffer, int count, bool loop=false) |
void | WriteDma (uint16_t address, const uint8_t *data, int count) |
Public Attributes | |
std::array< uint8_t, 6 > | in_ports_ |
std::array< uint8_t, 4 > | out_ports_ |
std::vector< uint8_t > | ram = std::vector<uint8_t>(0x10000, 0) |
Private Attributes | |
bool | rom_readable_ = false |
uint8_t | dsp_adr_ = 0 |
uint32_t | cycles_ = 0 |
uint8_t | transfer_size_ = 0 |
bool | in_transfer_ = false |
MemoryImpl & | memory_ |
std::array< Timer, 3 > | timer_ |
debug::ApuHandshakeTracker * | handshake_tracker_ = nullptr |
ApuCallbacks | callbacks_ |
Dsp | dsp_ {ram} |
Spc700 | spc700_ {callbacks_} |
The Apu class represents the Audio Processing Unit (APU) of a system.
The Apu class is responsible for generating audio samples and managing the APU state. It interacts with the Memory, AudioRam, and Clock classes to read/write data and update the clock. The class also implements the Observer interface to receive notifications from the system.
The region at $FFC0-FFFF will normally read from the 64-byte IPL ROM, but the underlying RAM can always be written to, and the high bit of the Control register $F1 can be cleared to unmap the IPL ROM and allow read access to this RAM.
|
inline |
void yaze::emu::Apu::Init | ( | ) |
Definition at line 45 of file apu.cc.
References ram.
Referenced by yaze::emu::Snes::Init(), yaze::emu::ApuDspTest::SetUp(), yaze::emu::ApuIplHandshakeTest::SetUp(), and yaze::emu::TEST().
void yaze::emu::Apu::Reset | ( | ) |
Definition at line 52 of file apu.cc.
References cycles_, dsp_, dsp_adr_, handshake_tracker_, in_ports_, in_transfer_, LOG_DEBUG, out_ports_, ram, yaze::emu::Spc700::read_word(), yaze::emu::Dsp::Reset(), yaze::emu::debug::ApuHandshakeTracker::Reset(), yaze::emu::Spc700::Reset(), rom_readable_, spc700_, timer_, and transfer_size_.
Referenced by yaze::emu::Snes::Reset(), yaze::emu::ApuDspTest::SetUp(), yaze::emu::ApuIplHandshakeTest::SetUp(), and yaze::emu::TEST().
void yaze::emu::Apu::RunCycles | ( | uint64_t | cycles | ) |
Definition at line 84 of file apu.cc.
References Cycle(), cycles_, handshake_tracker_, in_ports_, LOG_DEBUG, memory_, yaze::emu::debug::ApuHandshakeTracker::OnSpcPCChange(), out_ports_, yaze::emu::MemoryImpl::pal_timing(), yaze::emu::Spc700::PC, ram, rom_readable_, spc700_, yaze::emu::Spc700::Step(), and yaze::emu::Spc700::Y.
Referenced by yaze::emu::Snes::CatchUpApu().
uint8_t yaze::emu::Apu::SpcRead | ( | uint16_t | address | ) |
void yaze::emu::Apu::SpcWrite | ( | uint16_t | address, |
uint8_t | data | ||
) |
void yaze::emu::Apu::SpcIdle | ( | bool | waiting | ) |
void yaze::emu::Apu::Cycle | ( | ) |
Definition at line 161 of file apu.cc.
References yaze::emu::Dsp::Cycle(), cycles_, dsp_, and timer_.
Referenced by RunCycles(), SpcIdle(), SpcRead(), SpcWrite(), and yaze::emu::TEST().
uint8_t yaze::emu::Apu::Read | ( | uint16_t | address | ) |
Definition at line 186 of file apu.cc.
References dsp_, dsp_adr_, in_ports_, LOG_DEBUG, yaze::emu::Spc700::PC, ram, yaze::emu::Dsp::Read(), rom_readable_, spc700_, and timer_.
Referenced by SpcRead().
void yaze::emu::Apu::Write | ( | uint16_t | address, |
uint8_t | data | ||
) |
Definition at line 233 of file apu.cc.
References cycles_, dsp_, dsp_adr_, handshake_tracker_, in_ports_, in_transfer_, LOG_DEBUG, yaze::emu::debug::ApuHandshakeTracker::OnSpcPCChange(), yaze::emu::debug::ApuHandshakeTracker::OnSpcPortWrite(), out_ports_, yaze::emu::Spc700::PC, ram, rom_readable_, spc700_, timer_, transfer_size_, and yaze::emu::Dsp::Write().
Referenced by SpcWrite(), and yaze::emu::TEST_F().
|
inline |
Definition at line 70 of file apu.h.
References dsp_.
Referenced by yaze::emu::Snes::RunCycle(), and yaze::emu::Snes::SetSamples().
|
inline |
Definition at line 71 of file apu.h.
References spc700_.
Referenced by yaze::emu::TEST(), and yaze::emu::TEST_F().
|
inline |
|
inline |
Definition at line 76 of file apu.h.
References handshake_tracker_.
Referenced by yaze::emu::Snes::Init().
|
inline |
|
inline |
|
inline |
Definition at line 81 of file apu.h.
References dsp_, and yaze::emu::Dsp::GetSamples().
|
inline |
std::array<uint8_t, 6> yaze::emu::Apu::in_ports_ |
Definition at line 91 of file apu.h.
Referenced by Read(), Reset(), RunCycles(), Write(), and yaze::emu::Snes::WriteBBus().
std::array<uint8_t, 4> yaze::emu::Apu::out_ports_ |
Definition at line 92 of file apu.h.
Referenced by yaze::emu::Snes::ReadBBus(), Reset(), RunCycles(), and Write().
std::vector<uint8_t> yaze::emu::Apu::ram = std::vector<uint8_t>(0x10000, 0) |
Definition at line 93 of file apu.h.
Referenced by GetControl(), GetStatus(), Init(), Read(), Reset(), RunCycles(), Write(), and WriteDma().
|
private |
|
private |
|
private |
Definition at line 99 of file apu.h.
Referenced by Cycle(), GetCycles(), Reset(), RunCycles(), and Write().
|
private |
|
private |
|
private |
Definition at line 105 of file apu.h.
Referenced by RunCycles().
|
private |
|
private |
Definition at line 109 of file apu.h.
Referenced by Reset(), RunCycles(), set_handshake_tracker(), and Write().
|
private |
|
private |