1.1 --- a/src/aica/armdasm.c Mon Jul 14 07:44:42 2008 +0000
1.2 +++ b/src/aica/armdasm.c Wed Aug 13 10:27:49 2008 +0000
1.5 #define IMM8(ir) (ir&0xFF)
1.6 #define IMM12(ir) (ir&0xFFF)
1.7 +#define IMMSPLIT8(ir) (((ir&0xF00)>>4)|(ir&0x0F))
1.8 #define SHIFTIMM(ir) ((ir>>7)&0x1F)
1.9 #define IMMROT(ir) ((ir>>7)&0x1E)
1.10 #define SHIFT(ir) ((ir>>4)&0x07)
1.11 @@ -186,6 +187,30 @@
1.15 +static int arm_disasm_address3_operand( uint32_t ir, char *buf, int len, int pc )
1.17 + char sign = UFLAG(ir) ? '+' : '-';
1.19 + switch( (ir>>21) & 0x0B) {
1.20 + case 0: /* Rn -= Rm (post-indexed) [5.3.7 A5-48] */
1.21 + case 1: /* UNPREDICTABLE */
1.22 + return snprintf( buf, len, "[R%d], R%d %c= R%d", RN(ir), RN(ir), sign, RM(ir) ) ;
1.23 + case 2: /* Rn -= imm (post-indexed) [5.3.6 A5-46] */
1.24 + case 3: /* UNPREDICTABLE */
1.25 + return snprintf( buf, len, "[R%d], R%d %c= #%04Xh", RN(ir), RN(ir), sign, IMMSPLIT8(ir) );
1.26 + case 8: /* Rn - Rm [5.3.3 A5-38] */
1.27 + return snprintf( buf, len, "[R%d %c R%d]", RN(ir), sign, RM(ir) );
1.28 + case 9: /* Rn -= Rm (pre-indexed) [5.3.5 A5-42] */
1.29 + return snprintf( buf, len, "[R%d %c= R%d]", RN(ir), sign, RM(ir) );
1.30 + case 10: /* Rn - imm offset [5.3.2 A5-36] */
1.31 + return snprintf( buf, len, "[R%d %c #%04Xh]", RN(ir), sign, IMMSPLIT8(ir) );
1.32 + case 11: /* Rn -= imm offset (pre-indexed) [5.3.4 A5-40] */
1.33 + return snprintf( buf, len, "[R%d %c= #%04Xh]", RN(ir), sign, IMMSPLIT8(ir) );
1.35 + return UNIMP(ir); /* Unreachable */
1.39 uint32_t arm_disasm_instruction( uint32_t pc, char *buf, int len, char *opcode )
1.42 @@ -278,26 +303,28 @@
1.50 + arm_disasm_address3_operand( ir, operand, sizeof(operand), pc );
1.51 + if( LFLAG(ir) ) { /* LDRH */
1.52 + snprintf(buf, len, "LDR%sH R%d, %s", cond, RD(ir), operand );
1.53 + } else { /* STRH */
1.54 + snprintf(buf, len, "STR%sH R%d, %s", cond, RD(ir), operand );
1.61 + if( LFLAG(ir) ) { /* LDRSB */
1.62 + arm_disasm_address3_operand( ir, operand, sizeof(operand), pc );
1.63 + snprintf(buf, len, "LDR%sSB R%d, %s", cond, RD(ir), operand );
1.72 + if( LFLAG(ir) ) { /* LDRSH */
1.73 + arm_disasm_address3_operand( ir, operand, sizeof(operand), pc );
1.74 + snprintf(buf, len, "LDR%sSH R%d, %s", cond, RD(ir), operand );