fix asmsplit
This commit is contained in:
parent
313e5be3cc
commit
2f2f75c5b2
1 changed files with 5 additions and 4 deletions
|
@ -10,7 +10,6 @@ import sys
|
||||||
basedir = 'asm/'
|
basedir = 'asm/'
|
||||||
macros = 'macros.inc'
|
macros = 'macros.inc'
|
||||||
|
|
||||||
filename_counter = 0
|
|
||||||
filenames = {}
|
filenames = {}
|
||||||
lastfile = None
|
lastfile = None
|
||||||
|
|
||||||
|
@ -20,8 +19,7 @@ with open(sys.argv[1]) as mapfile:
|
||||||
if match and match.group(2) != lastfile:
|
if match and match.group(2) != lastfile:
|
||||||
lastfile = match.group(2)
|
lastfile = match.group(2)
|
||||||
addr = int(match.group(1), 16)
|
addr = int(match.group(1), 16)
|
||||||
fname = basedir + '/'.join(map(lambda s: os.path.splitext(s)[0], match.group(2).strip().split(' '))) + f"_{filename_counter}" + '.s'
|
fname = basedir + '/'.join(map(lambda s: os.path.splitext(s)[0], match.group(2).strip().split(' '))) + f"_{hex(addr)[2:]}" + '.s'
|
||||||
filename_counter += 1
|
|
||||||
filenames[addr] = fname
|
filenames[addr] = fname
|
||||||
|
|
||||||
curfile = open(macros, 'w')
|
curfile = open(macros, 'w')
|
||||||
|
@ -33,7 +31,10 @@ while asmline := remainder or sys.stdin.readline():
|
||||||
remainder = None
|
remainder = None
|
||||||
trim = asmline.strip()
|
trim = asmline.strip()
|
||||||
if trim.startswith('.section'):
|
if trim.startswith('.section'):
|
||||||
curaddr = int(trim[-23:-13], 0)
|
ex = trim.split("#", 1)
|
||||||
|
comment = ex[1]
|
||||||
|
ex = comment.split(" ")
|
||||||
|
curaddr = int(ex[1], 0)
|
||||||
section = asmline
|
section = asmline
|
||||||
curfile.close()
|
curfile.close()
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue