Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

target-rl78: Implement MOVW sfrp,#word

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...
commit fbe83ec00feae8b47da456c1d35339baa29ecba4 1 parent cefea91
@afaerber authored
Showing with 16 additions and 0 deletions.
  1. +16 −0 target-78k0/translate.c
View
16 target-78k0/translate.c
@@ -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,
};
Please sign in to comment.
Something went wrong with that request. Please try again.