2023-03-07 22:17:11 +00:00
|
|
|
#!/usr/bin/env python3
|
2017-12-11 13:46:06 +00:00
|
|
|
|
2018-04-23 12:18:01 +00:00
|
|
|
# script that allows the binary output of sixtypical --output-format=c64-basic-prg --compile to be
|
2017-12-11 13:46:06 +00:00
|
|
|
# disassembled by https://github.com/tcarmelveilleux/dcc6502
|
|
|
|
|
|
|
|
import sys
|
|
|
|
import re
|
|
|
|
from subprocess import check_output
|
|
|
|
from tempfile import NamedTemporaryFile
|
|
|
|
|
2023-03-08 12:50:22 +00:00
|
|
|
try:
|
|
|
|
bytes = sys.stdin.buffer.read()
|
|
|
|
except AttributeError:
|
|
|
|
bytes = sys.stdin.read()
|
2017-12-11 13:46:06 +00:00
|
|
|
|
|
|
|
bytes = bytes[14:]
|
|
|
|
|
|
|
|
f = NamedTemporaryFile(delete=False)
|
|
|
|
filename = f.name
|
|
|
|
f.write(bytes)
|
|
|
|
f.close()
|
|
|
|
|
2023-03-07 22:17:11 +00:00
|
|
|
output = check_output("dcc6502 -o 2061 {}".format(filename), shell=True)
|
|
|
|
output_lines = output.decode('utf-8').split('\n')
|
|
|
|
lines = [line for line in output_lines if line and not line.startswith(';')]
|
2017-12-11 13:46:06 +00:00
|
|
|
lines = [re.sub(r'\s*\;.*$', '', line) for line in lines]
|
|
|
|
sys.stdout.write('\n'.join(lines))
|