# HG changeset patch # User Michael Spacefalcon # Date 1396597568 0 # Node ID ca82528ec84d61fa7265f4f5f5912353756ba3f5 # Parent d88f2f40e3ae35530c18b2a71fae7585e3210fd6 tiobjd Thumb disasm: compute results of adding to pc diff -r d88f2f40e3ae -r ca82528ec84d ticoff/thumbdis.c --- 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