Пример #1
0
static bool memory_view(WINDOW *window, struct program *program,
                        enum STATE *current_state)
{
        int input, jump_address, new_value;

        while (1) {
                set_state(current_state);
                input = wgetch(window);
                if (QUIT == input) {
                        return false;
                } else if (GOBACK == input) {
                        *current_state = MAIN;
                        return true;
                } else if (JUMP == input) {
                        jump_address = popup_window(
                                "Enter a hex address to jump to: ",
                                selectedAddress, false);
                        if (jump_address == selectedAddress)
                                continue;
                        generateContext(window, program, 0, (uint16_t) jump_address);
                } else if (KEYUP == input) {
                        moveContext(window, program, UP);
                } else if (KEYDOWN == input) {
                        moveContext(window, program, DOWN);
                } else if (EDITFILE == input) {
                        new_value = popup_window(
                                "Enter the new instruction (in hex): ",
                                program->simulator.memory[selectedAddress].value,
                                false);
                        program->simulator.memory[selectedAddress].value =
                                (uint16_t) new_value;
                        update(window, program);
                } else if (SETPC == input) {
                        program->simulator.PC = selectedAddress;
                } else if (BREAKPOINTSET == input) {
                        program->simulator.memory[selectedAddress]
                                .isBreakpoint = !program->simulator.memory[
                                selectedAddress].isBreakpoint;
                }
        }
}
Пример #2
0
EmuThread::EmuThread(GRenderWindow* render_window) :
    exec_step(false), running(false), stop_run(false), render_window(render_window) {

    connect(this, SIGNAL(started()), render_window, SLOT(moveContext()));
}