changeset 94:915e2ca2813d

armdis: ldm/stm decoding implemented
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sun, 30 Mar 2014 07:11:41 +0000
parents 5ebebbc74622
children 9ed4d0fcb1f6
files arm7dis/armdis.c
diffstat 1 files changed, 28 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/arm7dis/armdis.c	Sun Mar 30 01:55:46 2014 +0000
+++ b/arm7dis/armdis.c	Sun Mar 30 07:11:41 2014 +0000
@@ -397,6 +397,33 @@
 		multiply(word);
 }
 
+static void
+ldm_stm(word)
+	unsigned word;
+{
+	int r, flag;
+
+	printf("%s%s%c%c\t%s", word&0x100000 ? "ldm" : "stm",
+		condition_decode[word>>28],
+		word&0x800000 ? 'i' : 'd', word&0x01000000 ? 'b' : 'a',
+		regnames[(word>>16)&0xF]);
+	if (word & 0x200000)
+		putchar('!');
+	fputs(", {", stdout);
+	flag = 0;
+	for (r = 0; r < 16; r++)
+		if (word & (1 << r)) {
+			if (flag)
+				fputs(", ", stdout);
+			fputs(regnames[r], stdout);
+			flag = 1;
+		}
+	putchar('}');
+	if (word & 0x400000)
+		putchar('^');
+	putchar('\n');
+}
+
 void
 arm_disasm_line(off)
 	unsigned off;
@@ -435,7 +462,7 @@
 		return;
 	case 8:
 	case 9:
-		printf("<ldm/stm>\n");
+		ldm_stm(word);
 		return;
 	case 0xA:
 	case 0xB: