diff options
author | Raghuram Subramani <raghus2247@gmail.com> | 2023-10-25 11:55:15 +0530 |
---|---|---|
committer | Raghuram Subramani <raghus2247@gmail.com> | 2023-10-25 11:55:15 +0530 |
commit | 087b1d7e5407fde2869fa2ea86fd2236dd337b1c (patch) | |
tree | 73c8ea1e1178e9064cd04b918f7028099262d1e3 /src/table.hpp | |
parent | 82f5cc27ec8dea7aa476717882aab9e16d289c10 (diff) |
abstract opcode table to a new class
Diffstat (limited to 'src/table.hpp')
-rw-r--r-- | src/table.hpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/table.hpp b/src/table.hpp new file mode 100644 index 0000000..f1eaeb7 --- /dev/null +++ b/src/table.hpp @@ -0,0 +1,31 @@ +#ifndef TABLE_HPP_ +#define TABLE_HPP_ + +#include <functional> + +#include "chip8.hpp" + +class Chip8; + +class Table { + public: + Table(Chip8* chip8); + + private: + Chip8* chip8; + + public: + using OpcodeFunction = std::function<void()>; + OpcodeFunction table[0x10u]; + OpcodeFunction table0[0xFu]; + OpcodeFunction table8[0xFu]; + OpcodeFunction tableE[0xFu]; + OpcodeFunction tableF[0x66u]; + + void Table0(); + void Table8(); + void TableE(); + void TableF(); +}; + +#endif |