mirror of
https://github.com/robmcmullen/atrcopy.git
synced 2024-11-29 11:51:14 +00:00
Added slice support for binary file writing
This commit is contained in:
parent
5438fa8dce
commit
d50ee6639c
@ -164,8 +164,24 @@ def assemble(image, source_files, data_files):
|
||||
raise AtrError("Data files must include a load address specified with the @ char")
|
||||
name, addr = name.rsplit("@", 1)
|
||||
first = text_to_int(addr)
|
||||
subset = slice(0, -1)
|
||||
if "[" in name and "]" in name:
|
||||
name, slicetext = name.rsplit("[", 1)
|
||||
if ":" in slicetext:
|
||||
start, end = slicetext.split(":", 1)
|
||||
try:
|
||||
start = int(start)
|
||||
except:
|
||||
start = 0
|
||||
if end.endswith("]"):
|
||||
end = end[:-1]
|
||||
try:
|
||||
end = int(end)
|
||||
except:
|
||||
end = None
|
||||
subset = slice(start, end)
|
||||
with open(name, 'rb') as fh:
|
||||
data = fh.read()
|
||||
data = fh.read()[subset]
|
||||
s = segments.add_segment(data, first)
|
||||
print s.name
|
||||
if options.verbose:
|
||||
|
Loading…
Reference in New Issue
Block a user