diff --git a/src/insn.c b/src/insn.c index 1a1a223..1758719 100644 --- a/src/insn.c +++ b/src/insn.c @@ -89,6 +89,15 @@ void insn_sw(cpu_t *cpu, uint32_t insn) { cpu_write32(cpu, cpu->regs[rt], imm + cpu->regs[rs]); } +void insn_sll(cpu_t *cpu, uint32_t insn) { + const uint8_t rd = RD(insn); + const uint8_t rt = RT(insn); + const uint8_t imm5 = IMM5(insn); + + debug("SLL %s, %s, %u", REG_NAMES[rd], REG_NAMES[rt], imm5); + cpu->regs[rd] = cpu->regs[rt] << imm5; +} + static cpu_insn_handler primary_insn_handler[TABLE_SIZE] = { [LW] = insn_lw, [ADDIU] = insn_addiu, @@ -96,6 +105,7 @@ static cpu_insn_handler primary_insn_handler[TABLE_SIZE] = { }; static cpu_insn_handler secondary_insn_handler[TABLE_SIZE] = { + [SLL] = insn_sll, [ADDU] = insn_addu, [SRL] = insn_srl, };