|
|
@ -80,9 +80,19 @@ void insn_addiu(cpu_t *cpu, uint32_t insn) { |
|
|
|
cpu->regs[rt] = cpu->regs[rs] + imm; |
|
|
|
} |
|
|
|
|
|
|
|
void insn_sw(cpu_t *cpu, uint32_t insn) { |
|
|
|
const uint8_t rt = RT(insn); |
|
|
|
const uint8_t rs = RS(insn); |
|
|
|
const uint16_t imm = IMM(insn); |
|
|
|
|
|
|
|
debug("SW %s, [%s + %x]", REG_NAMES[rt], REG_NAMES[rt], imm); |
|
|
|
cpu_write32(cpu, cpu->regs[rt], imm + cpu->regs[rs]); |
|
|
|
} |
|
|
|
|
|
|
|
static cpu_insn_handler primary_insn_handler[TABLE_SIZE] = { |
|
|
|
[LW] = insn_lw, |
|
|
|
[ADDIU] = insn_addiu, |
|
|
|
[SW] = insn_sw, |
|
|
|
}; |
|
|
|
|
|
|
|
static cpu_insn_handler secondary_insn_handler[TABLE_SIZE] = { |
|
|
|