Chip8-CPP/include/instruction.h

46 lines
884 B
C
Raw Normal View History

2023-09-09 17:57:57 +00:00
#ifndef CHIP8_INSTRUCTION_H
#define CHIP8_INSTRUCTION_H
/**
* 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:
/**
* The basic opcode
*/
2023-09-09 17:57:57 +00:00
const unsigned short opcode;
public:
explicit Instruction(unsigned short opcode);
/**
* Gets the NNN Chip8 value
* @return
*/
2023-09-09 17:57:57 +00:00
[[nodiscard]] unsigned short nnn() const;
/**
* 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;
/**
* Gets the X Chip8 value
* @return
*/
2023-09-09 17:57:57 +00:00
[[nodiscard]] unsigned char x() const;
/**
* Gets the Y Chip8 value
* @return
*/
2023-09-09 17:57:57 +00:00
[[nodiscard]] unsigned char y() const;
};
#endif //CHIP8_INSTRUCTION_H