This also adds support for "#" characters prior to immediates. nop may also now appear in an op_t. The parser no longer generates nop_t--this is instead now represented as an op_t with a zero-length ops vector.
13 lines
223 B
Python
13 lines
223 B
Python
import sys
|
|
import struct
|
|
|
|
with open(sys.argv[1], 'rb') as f:
|
|
b = f.read()
|
|
|
|
assert len(b) % 4 == 0, len(b)
|
|
|
|
for i in range(len(b) // 4):
|
|
word = b[i*4:i*4+4]
|
|
n, = struct.unpack('>I', word)
|
|
print(f'{n:>032b}')
|