open-story-teller/story-editor/src/app/debug_context.h
anthony@rabine.fr 8a2f70ea01
Some checks failed
Build-StoryEditor / build_linux (push) Has been cancelled
Build-StoryEditor / build_win32 (push) Has been cancelled
Deploy-Documentation / deploy (push) Has been cancelled
Intermediatre commit: separation between logic and UI
2025-08-07 22:51:23 +02:00

52 lines
1.4 KiB
C++

#pragma once
#include <set>
#include <stdint.h>
#include "chip32_assembler.h"
#include "chip32_vm.h"
struct DebugContext
{
uint32_t event_mask{0};
bool wait_event{0};
bool free_run{false};
uint32_t line{0};
chip32_result_t run_result{VM_FINISHED};
std::set<int> m_breakpoints;
void Stop() {
run_result = VM_FINISHED;
}
bool IsValidEvent(uint32_t event) {
return (event_mask & event) != 0;
}
static void DumpCodeAssembler(Chip32::Assembler & assembler) {
for (std::vector<Chip32::Instr>::const_iterator iter = assembler.Begin();
iter != assembler.End(); ++iter)
{
if (iter->isRomCode() || iter->isRomData)
{
std::cout << "-------------------" << std::endl;
std::cout << "Instr: " << iter->mnemonic.c_str() << std::endl;
std::cout << "Addr: " << std::hex << iter->addr << std::endl;
std::cout << "Line: " << iter->line << std::endl;
std::cout << "\t- Opcode: " << std::hex << iter->code.opcode
<< ", opcode args: " << iter->code.bytes << std::endl;
int i = 1;
for (auto arg : iter->compiledArgs)
{
std::cout << "\t- Arg " << i << " : " << std::hex << arg << std::endl;
i++;
}
}
}
}
};