diff options
Diffstat (limited to 'sim/tic80/interp.c')
-rw-r--r-- | sim/tic80/interp.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/sim/tic80/interp.c b/sim/tic80/interp.c index b8ba567..8fda287 100644 --- a/sim/tic80/interp.c +++ b/sim/tic80/interp.c @@ -129,3 +129,30 @@ engine_run_until_stop (SIM_DESC sd, engine_halt (sd, cpu, cia, sim_stopped, SIGINT); } } + + +void +engine_step (SIM_DESC sd) +{ + if (!setjmp (sd->path_to_halt)) + { + instruction_address cia; + sim_cpu *cpu = STATE_CPU (sd, 0); + sd->halt_ok = 1; + setjmp (sd->path_to_restart); + sd->restart_ok = 1; + cia = cpu->cia; + if (cia.ip == -1) + { + /* anulled instruction */ + cia.ip = cia.dp; + cia.dp = cia.dp + sizeof (instruction_word); + } + else + { + instruction_word insn = IMEM (cia.ip); + cia = idecode_issue (sd, insn, cia); + } + engine_halt (sd, cpu, cia, sim_stopped, SIGTRAP); + } +} |