diff options
author | Ian Moffett <ian@osmora.org> | 2025-10-13 02:27:07 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-10-13 02:27:07 -0400 |
commit | 99af78ce0657c71071ec85375ede2f60d5b15baa (patch) | |
tree | 0897a7f4b8ba4a2b050bea313187083ad79c1369 /emux64/src/cpu/cpu_cycle.c | |
parent | 29faa38e02b492ae82c3bdfa7d1c4ffbe69772cd (diff) |
emux64: cpu: Add emulation of MUL instruction
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'emux64/src/cpu/cpu_cycle.c')
-rw-r--r-- | emux64/src/cpu/cpu_cycle.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/emux64/src/cpu/cpu_cycle.c b/emux64/src/cpu/cpu_cycle.c index 663b300..9f30788 100644 --- a/emux64/src/cpu/cpu_cycle.c +++ b/emux64/src/cpu/cpu_cycle.c @@ -222,6 +222,21 @@ cpu_do_sub(struct osmx_core *core) return 0; } +static int +cpu_do_mul(struct osmx_core *core) +{ + struct arithop ops; + int error; + + error = cpu_arithop(core, &ops); + if (error < 0) { + return error; + } + + core->xn[ops.dest_reg] = ops.op1 * ops.op2; + return 0; +} + int cpu_run(struct osmx_core *core) { @@ -261,6 +276,12 @@ cpu_run(struct osmx_core *core) continue; } break; + case OP_MUL: + if (cpu_do_mul(core) < 0) { + core->run = false; + continue; + } + break; case OP_NOP: break; default: |