started docs on cpu

This commit is contained in:
Lauchmelder 2022-02-28 16:57:23 +01:00
parent 7c424b3137
commit dfef02df47
No known key found for this signature in database
GPG key ID: C2403C69D78F011D
2 changed files with 91 additions and 30 deletions

View file

@ -53,14 +53,13 @@ uint8_t CPU::Tick()
RESET_DEBUG_STRING();
APPEND_DEBUG_STRING(std::setw(4) << pc.Raw << " ");
// Implement instructions
pastPCs.push_back(pc.Raw);
if (pastPCs.size() > 50)
pastPCs.pop_front();
Byte opcode = Read(pc.Raw++);
currentInstruction = &(InstructionTable[opcode]);
pastPCs.push_back(currentInstruction);
if (pastPCs.size() > 50)
pastPCs.pop_front();
if (currentInstruction->Operation == nullptr || currentInstruction->Mode == nullptr)
{
LOG_DEBUG_ERROR("Unknown instruction {0:02X} at ${1:04X}", opcode, pc.Raw);