2023-09-09 17:57:57 +00:00
|
|
|
#ifndef CHIP8_INSTRUCTION_H
|
|
|
|
#define CHIP8_INSTRUCTION_H
|
2023-09-09 19:35:24 +00:00
|
|
|
/**
|
|
|
|
* The instruction class stores the opcode and allows easier access to the Chip8 values
|
|
|
|
*/
|
2023-09-09 17:57:57 +00:00
|
|
|
class Instruction {
|
|
|
|
private:
|
2023-09-09 19:35:24 +00:00
|
|
|
/**
|
|
|
|
* The basic opcode
|
|
|
|
*/
|
2023-09-09 17:57:57 +00:00
|
|
|
const unsigned short opcode;
|
|
|
|
public:
|
2023-09-09 19:35:24 +00:00
|
|
|
explicit Instruction(unsigned short opcode);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the NNN Chip8 value
|
|
|
|
* @return
|
|
|
|
*/
|
2023-09-09 17:57:57 +00:00
|
|
|
[[nodiscard]] unsigned short nnn() const;
|
2023-09-09 19:35:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the N Chip8 value
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
[[nodiscard]] unsigned char n() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the KK/Byte/NN Chip8 value
|
|
|
|
* @return
|
|
|
|
*/
|
2023-09-09 17:57:57 +00:00
|
|
|
[[nodiscard]] unsigned short kk() const;
|
2023-09-09 19:35:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the X Chip8 value
|
|
|
|
* @return
|
|
|
|
*/
|
2023-09-09 17:57:57 +00:00
|
|
|
[[nodiscard]] unsigned char x() const;
|
2023-09-09 19:35:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the Y Chip8 value
|
|
|
|
* @return
|
|
|
|
*/
|
2023-09-09 17:57:57 +00:00
|
|
|
[[nodiscard]] unsigned char y() const;
|
|
|
|
};
|
|
|
|
#endif //CHIP8_INSTRUCTION_H
|