changeset 122:ca82528ec84d

tiobjd Thumb disasm: compute results of adding to pc
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Fri, 04 Apr 2014 07:46:08 +0000
parents d88f2f40e3ae
children 5f9cc99930a8
files ticoff/thumbdis.c
diffstat 1 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/ticoff/thumbdis.c	Fri Apr 04 07:19:15 2014 +0000
+++ b/ticoff/thumbdis.c	Fri Apr 04 07:46:08 2014 +0000
@@ -208,11 +208,16 @@
 	unsigned loff;
 
 	loff = (word & 0xFF) << 2;
-	printf("add\t%s, %s, #%u", regnames[(word>>8)&7],
-		word&0x800 ? "sp" : "pc", loff);
-	if (loff >= 10)
-		printf("\t; 0x%x", loff);
-	putchar('\n');
+	printf("add\t%s, ", regnames[(word>>8)&7]);
+	if (word & 0x800) {
+		printf("sp, #%u", loff);
+		if (loff >= 10)
+			printf("\t; 0x%x", loff);
+		putchar('\n');
+	} else {
+		off &= ~3;
+		printf("pc, #%u\t; 0x%x\n", loff, off + 4 + loff);
+	}
 }
 
 static void