Conversation
|
I'll pull if you manage to fix the other incompatibilities, although, I'm curious, what are you planning to use this for? It never quite got all the functionality I wanted it to have and then I eventually abandoned it because I got stuck on something else. If this has a legitimate use I might want to come back to it. |
…t is not iterable
28 / 8 in Python 2 is 3 (integer), but in Python 3 is 3.5 (float),
and type(math.ceil(3.5)) is float in Python 2 but int in Python 3.
Force floating-point division and add integer cast so it works in both.
Fixes this Python 2.7.12 error when disassembling:
Traceback (most recent call last):
File "dis.py", line 281, in <module>
ib = InputBuffer(f, file_len, bounds)
File "dis.py", line 116, in __init__
self.access = bytearray(math.ceil(available / 8))
TypeError: 'float' object is not iterable
|
Added a fix for the float not iterable error (bytearray(float) fails in both Python 3 and 2 but 2 was passing an int), but there's still more errors not ready to pull yet, next is:
I pulled a chip from an old DVD player which has a Toshiba TMP91C219F (16-bit TLCS-900/L1 series) micro, just was curious to see what the firmware looked like. Ran into difficulties dumping the complete ROM because of the cumbersome parallel interface, but I did manage to read the first few bytes, if you're curious it disassembles to: (which I think seems to be reasonably correct, modulo my dumping errors). Thanks for making this disassembler, couldn't find any free alternatives (IDA Pro has Toshiba TLCS 900 support but it is quite expensive) |
Adds an import for (the beginning of) Python 2.7 compatibility. Without this change, Python 2 fails with:
with this change,
python dis.pyruns successfully and shows the help usage, although attempting to disassemble with Python 2 fails with a different error:Haven't investigated this second error yet, I went ahead and installed Python 3.5.2 instead and was able to disassemble successfully, but this print_function import is a start towards Python 2 compatibility, hopefully it may be useful.