diff --git a/src/disasm.c b/src/disasm.c index 8f4bd4e0..ccaa5a5a 100644 --- a/src/disasm.c +++ b/src/disasm.c @@ -265,7 +265,6 @@ int disasm_init(const AVRPART *p) { * 8 untreated opcodes and 20 "unofficial" ones * * OPCODE_lds_rc - * OPCODE_spm_zz * OPCODE_sts_rc * * OPCODE_x_bld @@ -372,6 +371,7 @@ int disasm_init(const AVRPART *p) { Register_Opcode(ldz4_Callback, "10q0 qq0d dddd 0qqq", OPCODE_ldd_2); Register_Opcode(ldi_Callback, "1110 KKKK dddd KKKK", OPCODE_ldi); Register_Opcode(lds_Callback, "1001 000d dddd 0000 kkkk kkkk kkkk kkkk", OPCODE_lds); + Register_Opcode(lds_rc_Callback, "1010 0kkk dddd kkkk", OPCODE_lds_rc); Register_Opcode(lpm1_Callback, "1001 0101 1100 1000", OPCODE_lpm_1); Register_Opcode(lpm2_Callback, "1001 000d dddd 0100", OPCODE_lpm_2); Register_Opcode(lpm3_Callback, "1001 000d dddd 0101", OPCODE_lpm_3); diff --git a/src/disasm_callbacks_assembly.c b/src/disasm_callbacks_assembly.c index 6e862956..a95c305b 100644 --- a/src/disasm_callbacks_assembly.c +++ b/src/disasm_callbacks_assembly.c @@ -565,6 +565,21 @@ CALLBACK(lds_Callback) { } } +CALLBACK(lds_rc_Callback) { + const char *MemAddress; + + /* + * ADDR[7:0] ← (/INST[8], INST[8], INST[10], INST[9], INST[3], INST[2], INST[1], INST[0]) + * ADDR[7:0] ← (/k[4], k[4], k[6], k[5], k[3], k[2], k[1], k[0]) + */ + int addr = (Rk & 0xf) | ((Rk >> 1) & 0x30) | ((Rk & 0x10) << 2) | (((Rk & 0x10) ^ 0x10) << 3); + + snprintf(cx->dis_code, 255, "%-7s r%d, 0x%02x", avr_opcodes[mnemo].opcode, Rd+16, addr); + MemAddress = Tagfile_Resolve_Mem_Address(addr); + if(MemAddress) + snprintf(cx->dis_comment, 255, "%s", MemAddress); +} + CALLBACK(lpm1_Callback) { Operation_Simple(mnemo); } diff --git a/src/disasm_private.h b/src/disasm_private.h index cf86894a..fe7d409b 100644 --- a/src/disasm_private.h +++ b/src/disasm_private.h @@ -134,6 +134,7 @@ void ldz3_Callback(const char *Bitstream, int Position, AVR_opcode mnemo); void ldz4_Callback(const char *Bitstream, int Position, AVR_opcode mnemo); void ldi_Callback(const char *Bitstream, int Position, AVR_opcode mnemo); void lds_Callback(const char *Bitstream, int Position, AVR_opcode mnemo); +void lds_rc_Callback(const char *Bitstream, int Position, AVR_opcode mnemo); void lpm1_Callback(const char *Bitstream, int Position, AVR_opcode mnemo); void lpm2_Callback(const char *Bitstream, int Position, AVR_opcode mnemo); void lpm3_Callback(const char *Bitstream, int Position, AVR_opcode mnemo);