diff options
Diffstat (limited to 'pp2cc.py')
-rwxr-xr-x | pp2cc.py | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -724,10 +724,12 @@ class Parse(object): if str.startswith("$0"): return int(str[2:], 16) else: - # anything with a leading 8 or higher is padded... assembler - # bug? + # if the leftmost bit of a 4-bit group is set, the preceding + # bits should be 1 as well. E.g. $7 end with 0111 and is + # therefore interpreted as 7 where $8 ends with 1111 which is + # interpreted as -1 (all bits are set) val = str[1:] - if int(val[1]) >= 8: + if int(val[1], 16) & 0b1000: hexsize = len(hex(pow(2, self.WORDSIZE) - 1)[2:]) val = val.rjust(hexsize, "F") return int(val, 16) |