-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bus.h
52 lines (40 loc) · 1.05 KB
/
Bus.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#pragma once
#include <stdint.h>
#include <string>
#include "Debug.h"
class Memory;
class Nes6502;
struct State6502;
class PPU;
class Game;
class Debug;
class Bus
{
public:
Bus();
~Bus();
void runNES(); // Run the emulator, will emulate CPU instruction by instruction
Memory& memory();
Nes6502& cpu();
State6502& cpuState();
PPU& ppu();
Game& game();
void loadGame(std::string filename);
void cpuCycle(); // Called on every memory read/write
void finalizeCPUInstruction(); // Called once entire CPU instruction is done
uint32_t cpuCycleCount();
uint32_t ppuCycleCount();
uint32_t busCycleCount();
// Debug
Debug& debug();
uint32_t instructionCyclesCount();
private:
Memory* nesmemory;
Nes6502* nescpu;
PPU* nesppu;
Game* nesgame;
uint32_t busCycles; // Total number of bus clock cycles
uint32_t instructionCycles; // Number of cycles taken for the current instruction, used for debugging
// Debug
Debug* nesdebug;
};