diff options
author | Denis Chertykov <denisc@overta.ru> | 2000-05-01 08:45:11 +0000 |
---|---|---|
committer | Denis Chertykov <denisc@overta.ru> | 2000-05-01 08:45:11 +0000 |
commit | 187afcf8696f40cb5d7af87a95e46a57884535f3 (patch) | |
tree | 3f08c705651d32249c5f607c2ff78d4df0484914 /opcodes/avr-dis.c | |
parent | 1506f8a80d0b3ff44422b43099b690318fad4bd6 (diff) | |
download | gdb-187afcf8696f40cb5d7af87a95e46a57884535f3.tar.gz |
* avr-dis.c (reg_fmul_d): New. Extract destination register from
FMUL instruction.
(reg_fmul_r): New. Extract source register from FMUL instruction.
(reg_muls_d): New. Extract destination register from MULS instruction.
(reg_muls_r): New. Extract source register from MULS instruction.
(reg_movw_d): New. Extract destination register from MOVW instruction.
(reg_movw_r): New. Extract source register from MOVW instruction.
(print_insn_avr): Handle MOVW, MULS, MULSU, FMUL, FMULS, FMULSU,
EICALL, EIJMP, LPM r,Z, ELPM r,Z, SPM, ESPM instructions.
Diffstat (limited to 'opcodes/avr-dis.c')
-rw-r--r-- | opcodes/avr-dis.c | 121 |
1 files changed, 118 insertions, 3 deletions
diff --git a/opcodes/avr-dis.c b/opcodes/avr-dis.c index a2d0c29c31a..6fcd58cc6f8 100644 --- a/opcodes/avr-dis.c +++ b/opcodes/avr-dis.c @@ -29,7 +29,7 @@ typedef unsigned long u32; #define IFMASK(a,b) ((opcode & (a)) == (b)) static char* SREG_flags = "CZNVSHTI"; -static char* sect94[] = {"COM","NEG","SWAP","INC","NULL","ASR","LSR","ROR", +static char* sect94[] = {"COM","NEG","SWAP","INC",0,"ASR","LSR","ROR", 0,0,"DEC",0,0,0,0,0}; static char* sect98[] = {"CBI","SBIC","SBI","SBIS"}; static char* branchs[] = { @@ -115,6 +115,72 @@ reg20w (opcode, dest) } +static void reg_fmul_d PARAMS ((u16, char *)); + +static void +reg_fmul_d (opcode, dest) + u16 opcode; + char *dest; +{ + sprintf(dest, "R%d", 16 + ((opcode >> 4) & 7)); +} + + +static void reg_fmul_r PARAMS ((u16, char *)); + +static void +reg_fmul_r (opcode, dest) + u16 opcode; + char *dest; +{ + sprintf(dest, "R%d", 16 + (opcode & 7)); +} + + +static void reg_muls_d PARAMS ((u16, char *)); + +static void +reg_muls_d (opcode, dest) + u16 opcode; + char *dest; +{ + sprintf(dest, "R%d", 16 + ((opcode >> 4) & 0xf)); +} + + +static void reg_muls_r PARAMS ((u16, char *)); + +static void +reg_muls_r (opcode, dest) + u16 opcode; + char *dest; +{ + sprintf(dest, "R%d", 16 + (opcode & 0xf)); +} + + +static void reg_movw_d PARAMS ((u16, char *)); + +static void +reg_movw_d (opcode, dest) + u16 opcode; + char *dest; +{ + sprintf(dest, "R%d", 2 * ((opcode >> 4) & 0xf)); +} + + +static void reg_movw_r PARAMS ((u16, char *)); + +static void +reg_movw_r (opcode, dest) + u16 opcode; + char *dest; +{ + sprintf(dest, "R%d", 2 * (opcode & 0xf)); +} + + static void lit404 PARAMS ((u16, char *)); static void @@ -223,7 +289,33 @@ print_insn_avr(addr, info) switch (opcode & 0x0c00) { case 0x0000: - (*prin) (stream, " NOP"); + switch (opcode & 0x0300) + { + case 0x0000: + (*prin) (stream, " NOP"); + break; + case 0x0100: + reg_movw_d(opcode, rd); + reg_movw_r(opcode, rr); + (*prin) (stream, " MOVW %s,%s", rd, rr); + break; + case 0x0200: + reg_muls_d(opcode, rd); + reg_muls_r(opcode, rr); + (*prin) (stream, " MULS %s,%s", rd, rr); + break; + case 0x0300: + reg_fmul_d(opcode, rd); + reg_fmul_r(opcode, rr); + if (IFMASK(0x88, 0)) + (*prin) (stream, " MULSU %s,%s", rd, rr); + else if (IFMASK(0x88, 8)) + (*prin) (stream, " FMUL %s,%s", rd, rr); + else if (IFMASK(0x88, 0x80)) + (*prin) (stream, " FMULS %s,%s", rd, rr); + else + (*prin) (stream, " FMULSU %s,%s", rd, rr); + } break; case 0x0400: (*prin) (stream, " CPC %s,%s", rd, rr); @@ -336,6 +428,18 @@ print_insn_avr(addr, info) case 0x2: (*prin) (stream, " LD %s,-Z", rd); break; + case 0x4: + (*prin) (stream, " LPM %s,Z", rd); + break; + case 0x5: + (*prin) (stream, " LPM %s,Z+", rd); + break; + case 0x6: + (*prin) (stream, " ELPM %s,Z", rd); + break; + case 0x7: + (*prin) (stream, " ELPM %s,Z+", rd); + break; case 0x9: (*prin) (stream, " LD %s,Y+", rd); break; @@ -422,13 +526,20 @@ print_insn_avr(addr, info) else (*prin) (stream, " SE%c", SREG_flags[sf]); } - else if (IFMASK(0x000f, 0x0009)) + else if (IFMASK(0x001f, 0x0009)) { if (opcode & 0x0100) (*prin) (stream, " ICALL"); else (*prin) (stream, " IJMP"); } + else if (IFMASK(0x001f, 0x0019)) + { + if (opcode & 0x0100) + (*prin) (stream, " EICALL"); + else + (*prin) (stream, " EIJMP"); + } else if (IFMASK(0x010f, 0x0108)) { if (IFMASK(0x0090, 0x0000)) @@ -443,6 +554,10 @@ print_insn_avr(addr, info) (*prin) (stream, " LPM"); else if (IFMASK(0x00f0, 0x00d0)) (*prin) (stream, " ELPM"); + else if (IFMASK(0x00f0, 0x00e0)) + (*prin) (stream, " SPM"); + else if (IFMASK(0x00f0, 0x00f0)) + (*prin) (stream, " ESPM"); else (*prin) (stream, " ????"); } |