Add lds command for reduced-core ATtiny

This commit is contained in:
Stefan Rueger
2024-07-18 20:02:32 +01:00
parent fe5a40b93c
commit a1050419f9
3 changed files with 17 additions and 1 deletions

View File

@@ -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);

View File

@@ -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);
}

View File

@@ -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);