Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Array fixer for the AS' "too many arguments" error in some disassemblies
- fin = open("rom_mars.lst", "rt",encoding='ascii', errors='ignore')
- fout = open("out.txt", "wt",encoding='ascii', errors='ignore')
- line_list = list()
- # a5 replace
- for line in fin:
- wrline = line
- a = "S2NA.asm"
- if line.find(a) > 0:
- a = "):"
- if line.find(a) > 0:
- a = line[13:].split(")")
- a = a[0][1:]
- line_list.append(a)
- fin = open("S2NA.asm", "r",encoding='ascii', errors='ignore')
- curr_num = 1
- curr_indx = 0
- for line in fin:
- wrline = line
- c = int(line_list[curr_indx])
- if curr_num == c:
- print(c)
- curr_indx += 1
- a = line
- b = a.find(":") # pick label
- if b > 0:
- c = line[:b]
- fout.write(c+":"+"\n") # write label
- a = line[b+1:]
- else:
- a = a.replace("\t","")
- e = a[:5].replace("\t","")
- print(e)
- a = a[5:].replace("$","").split(",")
- b = a[-1].find(";")
- if b > 0:
- b = a[-1][:b]
- a[-1] = b.replace(" ","")
- # make new list
- c = len(a)
- d = 0
- while c:
- f = a[d].replace(" ","")
- fout.write("\t\t"+e+" $"+f+"\n")
- c -= 1
- d += 1
- #fout.write("\t\talign 2")
- else:
- fout.write(wrline)
- curr_num += 1
- #numof_lines = len(line_list)
- #indx = 0
- #while numof_lines:
- #numof_lines -= 1
- #indx += 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement