diff options
-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; |