Fix bug with improperly initialized fn ptr table
This commit is contained in:
parent
084f2e9a9c
commit
2b4bd4158f
|
@ -65,6 +65,13 @@ Chip8::Chip8()
|
||||||
table[0xE] = &Chip8::TableE;
|
table[0xE] = &Chip8::TableE;
|
||||||
table[0xF] = &Chip8::TableF;
|
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[0x0] = &Chip8::OP_00E0;
|
||||||
table0[0xE] = &Chip8::OP_00EE;
|
table0[0xE] = &Chip8::OP_00EE;
|
||||||
|
|
||||||
|
@ -81,6 +88,11 @@ Chip8::Chip8()
|
||||||
tableE[0x1] = &Chip8::OP_ExA1;
|
tableE[0x1] = &Chip8::OP_ExA1;
|
||||||
tableE[0xE] = &Chip8::OP_Ex9E;
|
tableE[0xE] = &Chip8::OP_Ex9E;
|
||||||
|
|
||||||
|
for (size_t i = 0; i <= 0x65; i++)
|
||||||
|
{
|
||||||
|
tableF[i] = &Chip8::OP_NULL;
|
||||||
|
}
|
||||||
|
|
||||||
tableF[0x07] = &Chip8::OP_Fx07;
|
tableF[0x07] = &Chip8::OP_Fx07;
|
||||||
tableF[0x0A] = &Chip8::OP_Fx0A;
|
tableF[0x0A] = &Chip8::OP_Fx0A;
|
||||||
tableF[0x15] = &Chip8::OP_Fx15;
|
tableF[0x15] = &Chip8::OP_Fx15;
|
||||||
|
|
|
@ -147,9 +147,9 @@ private:
|
||||||
std::uniform_int_distribution<uint8_t> randByte;
|
std::uniform_int_distribution<uint8_t> randByte;
|
||||||
|
|
||||||
typedef void (Chip8::*Chip8Func)();
|
typedef void (Chip8::*Chip8Func)();
|
||||||
Chip8Func table[0xF + 1]{&Chip8::OP_NULL};
|
Chip8Func table[0xF + 1];
|
||||||
Chip8Func table0[0xE + 1]{&Chip8::OP_NULL};
|
Chip8Func table0[0xE + 1];
|
||||||
Chip8Func table8[0xE + 1]{&Chip8::OP_NULL};
|
Chip8Func table8[0xE + 1];
|
||||||
Chip8Func tableE[0xE + 1]{&Chip8::OP_NULL};
|
Chip8Func tableE[0xE + 1];
|
||||||
Chip8Func tableF[0x65 + 1]{&Chip8::OP_NULL};
|
Chip8Func tableF[0x65 + 1];
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue