2023-09-09 17:57:57 +00:00
|
|
|
#ifndef CHIP8_CHIP8_H
|
|
|
|
#define CHIP8_CHIP8_H
|
|
|
|
|
|
|
|
#include <string>
|
2023-09-09 18:20:10 +00:00
|
|
|
#include <stack>
|
|
|
|
#include "display.h"
|
2023-09-09 17:57:57 +00:00
|
|
|
|
|
|
|
class InstructionHandler;
|
|
|
|
|
|
|
|
class Chip8 {
|
|
|
|
private:
|
|
|
|
unsigned char memory[0xFFF] = {};
|
|
|
|
unsigned char v[0x10] = {};
|
2023-09-09 18:20:10 +00:00
|
|
|
std::stack<unsigned short> stack{};
|
2023-09-09 17:57:57 +00:00
|
|
|
unsigned short pc;
|
2023-09-09 18:20:10 +00:00
|
|
|
Display display;
|
2023-09-09 17:57:57 +00:00
|
|
|
InstructionHandler* instructionHandler;
|
|
|
|
public:
|
|
|
|
Chip8();
|
|
|
|
~Chip8();
|
2023-09-09 18:20:10 +00:00
|
|
|
void loadRom(const std::string&);
|
|
|
|
[[nodiscard]] Display getDisplay() const;
|
2023-09-09 17:57:57 +00:00
|
|
|
void emulateCycle();
|
2023-09-09 18:20:10 +00:00
|
|
|
[[nodiscard]] unsigned short popFromStack();
|
|
|
|
void setProgramCounter(unsigned short);
|
2023-09-09 17:57:57 +00:00
|
|
|
};
|
|
|
|
#endif //CHIP8_CHIP8_H
|