2 ms·
The GameBoyAdvance class could have a constructor which more directly connects together the pieces. The PPU doesn't care that it's inside a GameBoyAdvance: it h
by kazinator 11y ago
The GameBoyAdvance class could have a constructor which more directly connects together the pieces. The PPU doesn't care that it's inside a GameBoyAdvance: it has a connection to the CPU to raise an interrupt:
// Don't throw away that simple old C++98 so fast.
class GameBoyAdvance {
private:
CPU cpu;
PPU ppu;
public:
GameBoyAdvance()
: cpu(ppu), ppu(cpu) // CPU has ref to PPU and vice versa.
{
}
So now:
void PPU::scanline()
{
cpu.raiseInterrupt(Interrupt::VerticalBlank);
}
Gee, exactly like before, with the namespace. Only now cpu is a member reference to a CPU, inside the PPU object.