import json
import sys
import re
if len(sys.argv)!=2:
print('provide path to disassembly text')
exit()
with open("../src/map.json") as f:
obj = json.loads(f.read())
with open(sys.argv[1]) as f:
dasm = f.read()
def findDASM(key):
for i,line in enumerate(dasm.splitlines()):
if line[0:4].lower()==key[2:].lower():
for j in range(i-2,i+3):
print(dasm.splitlines()[j])
return
trimmedKey = key[2:]
if trimmedKey[0]=='0' and trimmedKey[1]=='0':
trimmedKey = key[4:]
patt = 'EQU\\s+\\$' + trimmedKey.upper()
for i,line in enumerate(dasm.splitlines()):
matches = re.search(patt,line)
if matches!=None:
print(line)
for key in obj:
print(key)
print(obj[key])
findDASM(key)
input()