Skip to content

Commit

Permalink
target-rl78: Implement MOVW sfrp,#word
Browse files Browse the repository at this point in the history
This is the first instruction of GCC-generated _start, thus starting to
make target-rl78 "usable".

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
  • Loading branch information
afaerber committed Dec 24, 2013
1 parent 1322605 commit 1d97af0
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions target-78k0/translate.c
Expand Up @@ -82,7 +82,23 @@ static int rl78_disas_mov_addr16_byte(RL78CPU *cpu, uint8_t opcode, DisasContext
return 4;
}

/* MOVW sfrp,#word */
static int rl78_disas_movw_sfrp_word(RL78CPU *cpu, uint8_t opcode, DisasContext *s)
{
uint8_t sfrp = cpu_ldub_code(&cpu->env, s->pc + 1) & ~0x1;
uint16_t data = cpu_lduw_code(&cpu->env, s->pc + 2);
TCGv addr = tcg_const_tl(0xFFF00 | sfrp);
TCGv val = tcg_const_tl(data);

LOG_ASM("MOVW %02" PRIx8 "H, #%04" PRIx16 "H\n", sfrp, data);
tcg_gen_qemu_st16(val, addr, 0);
tcg_temp_free(addr);
tcg_temp_free(val);
return 4;
}

static const OpcodeHandler rl78_1st_map[256] = {
[0xCB] = rl78_disas_movw_sfrp_word,
[0xCF] = rl78_disas_mov_addr16_byte,
};

Expand Down

0 comments on commit 1d97af0

Please sign in to comment.