aboutsummaryrefslogtreecommitdiffstats
path: root/pack.py
diff options
context:
space:
mode:
Diffstat (limited to 'pack.py')
-rwxr-xr-xpack.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/pack.py b/pack.py
index 4a21ab5..930c120 100755
--- a/pack.py
+++ b/pack.py
@@ -69,13 +69,9 @@ def pack(iter):
buf = bits.empty
def flush_bytes():
- tmp = out[:]
+ line = " ".join("{:02x}".format(b.val) for b in out)
out.clear()
- return {
- "type": "instr",
- "instr": tmp,
- "comment": None,
- }
+ return line
last_segment = None
for segment, line in iter:
@@ -93,15 +89,18 @@ def pack(iter):
while buf.size >= 8:
byte = buf[7:0]
buf = buf.slice_allowempty(slice(buf.size - 1, 8))
- out.append((byte.val,))
+ out.append(byte)
if len(out) == 4:
- yield subv.format(flush_bytes())
+ yield flush_bytes()
last_segment = segment
assert buf.size == 0, "segment '{}' end isn't byte-aligned".format(segment)
+ if len(out) > 0:
+ yield flush_bytes()
+
if __name__ == "__main__":
import sys