aboutsummaryrefslogtreecommitdiffstats
path: root/format.py
diff options
context:
space:
mode:
authors-ol <s+removethis@s-ol.nu>2021-05-22 14:24:21 +0000
committers-ol <s+removethis@s-ol.nu>2021-05-22 14:24:21 +0000
commit79a5f333d7ccb5f581108d81637628287788550d (patch)
treef09b43e833e500f4298665691201dfb02fea38e3 /format.py
parentmore error reporting in format.py (diff)
downloadsubv-79a5f333d7ccb5f581108d81637628287788550d.tar.gz
subv-79a5f333d7ccb5f581108d81637628287788550d.zip
support non-byte aligned data lines
Diffstat (limited to 'format.py')
-rwxr-xr-xformat.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/format.py b/format.py
index d43f835..419f6df 100755
--- a/format.py
+++ b/format.py
@@ -283,7 +283,6 @@ instr_map = {
}
def format(iter):
- segment = None
for line_no, raw_line in enumerate(iter, start=1):
try:
line = subv.parse(raw_line)
@@ -296,7 +295,7 @@ parsed as {}
raise Exception(message) from e
try:
- if segment == 'code' and line['type'] == 'instr':
+ if line['type'] == 'instr':
op = line['instr'][0]
assert len(op) == 2, 'instruction without op label: {}'.format(op)
@@ -308,11 +307,11 @@ parsed as {}
raise ValueError("opcode {} doesn't match label {} (expected {})"
.format(op, label, expected))
- line['instr'] = formatter(line['instr'])
+ formatted = formatter(line['instr'])
+ formatted[0] = (*formatted[0], label)
+ line['instr'] = formatted
yield subv.format(line)
else:
- if line['type'] == 'segment':
- segment = line['segment'][0]
yield line['raw']
except AssertionError as e:
message = '''