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

@@ -145,14 +145,18 @@ def load_rom(filename="../baserom.gbc"):
elif os.lstat(filename).st_size != len(rom):
return direct_load_rom(filename)
def load_asm(filename="../main.asm"):
"""loads the asm source code into memory"""
global asm
def direct_load_asm(filename="../main.asm"):
"""returns asm source code (AsmList) from a file"""
asm = open(filename, "r").read().split("\n")
asm = AsmList(asm)
return asm
def load_asm(filename="../main.asm"):
"""returns asm source code (AsmList) from a file (uses a global)"""
global asm
asm = direct_load_asm(filename=filename)
return asm
def grouper(some_list, count=2):
"""splits a list into sublists
given: [1, 2, 3, 4]