aboutsummaryrefslogtreecommitdiffstats
path: root/pack.py
diff options
context:
space:
mode:
authors-ol <s+removethis@s-ol.nu>2021-07-06 10:03:57 +0000
committers-ol <s+removethis@s-ol.nu>2021-07-06 10:04:36 +0000
commit912b5df8aef99aa00848d2a87bb5e5cebc7ff6b2 (patch)
tree3c62b2a7db782bd6c142a2fdb37d232f31f16eb1 /pack.py
parentupdate ex.subv to work with new pipeline (diff)
downloadsubv-912b5df8aef99aa00848d2a87bb5e5cebc7ff6b2.tar.gz
subv-912b5df8aef99aa00848d2a87bb5e5cebc7ff6b2.zip
fix and finish new pipeline
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