diff --git a/Source/Chip8.cpp b/Source/Chip8.cpp index 363d427..8d3807e 100644 --- a/Source/Chip8.cpp +++ b/Source/Chip8.cpp @@ -65,6 +65,13 @@ Chip8::Chip8() table[0xE] = &Chip8::TableE; table[0xF] = &Chip8::TableF; + for (size_t i = 0; i <= 0xE; i++) + { + table0[i] = &Chip8::OP_NULL; + table8[i] = &Chip8::OP_NULL; + tableE[i] = &Chip8::OP_NULL; + } + table0[0x0] = &Chip8::OP_00E0; table0[0xE] = &Chip8::OP_00EE; @@ -81,6 +88,11 @@ Chip8::Chip8() tableE[0x1] = &Chip8::OP_ExA1; tableE[0xE] = &Chip8::OP_Ex9E; + for (size_t i = 0; i <= 0x65; i++) + { + tableF[i] = &Chip8::OP_NULL; + } + tableF[0x07] = &Chip8::OP_Fx07; tableF[0x0A] = &Chip8::OP_Fx0A; tableF[0x15] = &Chip8::OP_Fx15; diff --git a/Source/Chip8.hpp b/Source/Chip8.hpp index cba6cef..0157394 100644 --- a/Source/Chip8.hpp +++ b/Source/Chip8.hpp @@ -147,9 +147,9 @@ private: std::uniform_int_distribution randByte; typedef void (Chip8::*Chip8Func)(); - Chip8Func table[0xF + 1]{&Chip8::OP_NULL}; - Chip8Func table0[0xE + 1]{&Chip8::OP_NULL}; - Chip8Func table8[0xE + 1]{&Chip8::OP_NULL}; - Chip8Func tableE[0xE + 1]{&Chip8::OP_NULL}; - Chip8Func tableF[0x65 + 1]{&Chip8::OP_NULL}; + Chip8Func table[0xF + 1]; + Chip8Func table0[0xE + 1]; + Chip8Func table8[0xE + 1]; + Chip8Func tableE[0xE + 1]; + Chip8Func tableF[0x65 + 1]; };