-
Notifications
You must be signed in to change notification settings - Fork 0
/
debugger.h
71 lines (50 loc) · 1.73 KB
/
debugger.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//
// Created by pazuzu on 14/04/19.
//
#ifndef CHIP8_DEBUGGER_H
#define CHIP8_DEBUGGER_H
#include <SFML/Graphics.hpp>
#include <iostream>
#include "chip8.h"
class Debugger {
private:
sf::Font font;
sf::Text text;
Chip8 *chip8;
sf::RenderWindow *window;
std::string getInstruction(u_int16_t opcode, int currentPC);
short getNNN(u_int16_t opcode);
short getByte(u_int16_t opcode);
short getX(u_int16_t opcode);
short getY(u_int16_t opcode);
short getN(u_int16_t opcode);
bool isBranchInstruction(u_int16_t opcode);
void drawText(char *str, float x, float y);
sf::Color *light;
sf::Color *dark;
sf::RectangleShape *background;
int instructionMarker;
u_int16_t currentInstruction;
bool changeRAMLocation = false;
public:
Debugger(sf::RenderWindow *window, Chip8 *chip8)
{
if (!font.loadFromFile("../fonts/5x5.ttf"))
{
std::cout << "Error loading font!\n";
exit(1);
}
text.setFont(font);
text.setCharacterSize(20);
this->chip8 = chip8;
this->window = window;
light = new sf::Color(252, 202, 0);
dark = new sf::Color(176, 91, 0);
background = new sf::RectangleShape(sf::Vector2f(300, 250));
background->setFillColor(*dark);
instructionMarker = *chip8->getPC();
}
void drawRAM();
void drawRegistersStatus();
};
#endif //CHIP8_DEBUGGER_H