diff options
author | Ian Moffett <ian@osmora.org> | 2025-07-27 23:14:07 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-07-28 03:31:01 -0400 |
commit | 840480cb57f092b3869a1993588271d478f398e4 (patch) | |
tree | eb9b65e2602d4261322295fe26f18a6fddd0a8ee | |
parent | effbb5ce401d3c8f78ff5465683a1bcd4a68c0b6 (diff) |
oemu: cpu: Add decoding for OR instruction
Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r-- | usr.bin/oemu/cpu.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/usr.bin/oemu/cpu.c b/usr.bin/oemu/cpu.c index f3b6a23..709cf0e 100644 --- a/usr.bin/oemu/cpu.c +++ b/usr.bin/oemu/cpu.c @@ -204,6 +204,23 @@ cpu_and(struct oemu_cpu *cpu, inst_t *inst) inst->rd, inst->imm, inst->rd, regs->xreg[inst->rd]); } +static void +cpu_or(struct oemu_cpu *cpu, inst_t *inst) +{ + struct cpu_regs *regs = &cpu->regs; + imm_t imm; + + if (inst->rd > NELEM(regs->xreg)) { + printf("bad register operand for 'or'\n"); + return; + } + + imm = inst->imm; + regs->xreg[inst->rd] |= imm; + printf("X%d | %x -> X%d, new=%d\n", + inst->rd, inst->imm, inst->rd, regs->xreg[inst->rd]); +} + /* * Decode the INST_DIV instruction * @@ -420,6 +437,9 @@ cpu_kick(struct oemu_cpu *cpu, struct sysmem *mem) case INST_AND: cpu_and(cpu, inst); break; + case INST_OR: + cpu_or(cpu, inst); + break; case INST_BR: cpu_br(cpu, inst); break; |