News for hackers. Stuff that matters.
Re:Emudore: a C64 emulator written from scratch using C++11 ... by kazinator on Wednesday April 20, 2016 @02:39PM (#11536685)
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.

There are no comments on this comment yet.