remove a duplication of load_rom and load_asm

This commit is contained in:
Bryan Bishop
2013-01-27 17:00:51 -06:00
parent 0ee57e94db
commit f22bbdd722
2 changed files with 12 additions and 16 deletions

View File

@@ -7,6 +7,8 @@ from crystal import (
get_label_from_line,
get_address_from_line_comment,
AsmSection,
direct_load_rom,
direct_load_asm,
)
from romstr import (
@@ -17,22 +19,12 @@ from romstr import (
def load_rom(path):
""" Loads a ROM file into an abbreviated RomStr object.
"""
fh = open(path, "r")
x = RomStr(fh.read())
fh.close()
return x
return direct_load_rom(filename=path)
def load_asm(path):
""" Loads source ASM into an abbreviated AsmList object.
"""
fh = open(path, "r")
x = AsmList(fh.read().split("\n"))
fh.close()
return x
return direct_load_asm(filename=path)
def findall_iter(sub, string):
# url: http://stackoverflow.com/a/3874760/687783