autocommented the 16bit compatibility instructions in the execution loop

This commit is contained in:
Anselm Levskaya 2011-12-23 20:21:01 -08:00
parent a91f68e0e9
commit a1931a3bab
2 changed files with 423 additions and 407 deletions

File diff suppressed because it is too large Load Diff

View File

@ -65,33 +65,46 @@ outfile=open("twobyte_dict.json",'w')
json.dump(twodict,outfile) json.dump(twodict,outfile)
outfile.close() outfile.close()
# now transform source file # now transform source file --------------------------------------------------------------------------------
caseline = re.compile("(\s+case )(0x[0-9a-f]+):.*")
# - for normal instruction format: 0xXX
#caseline = re.compile("(\s+case )(0x[0-9a-f]+):.*")
#onebyte_start = 5662
#twobyte_start = 7551
#twobyte_end = 8291
# - for 16bit compat instruction format: 0x1XX
caseline = re.compile("(\s+case )(0x1[0-9a-f]+):.*")
def strip_1(str):
return "0x"+str[-2:]
onebyte_start = 8472
twobyte_start = 9245
twobyte_end = 9647
emulatorlines = open("cpux86-ta.js","r").readlines() emulatorlines = open("cpux86-ta.js","r").readlines()
newlines=[] newlines=[]
for i,line in enumerate(emulatorlines): for i,line in enumerate(emulatorlines):
if i< 5662: if i < onebyte_start:
newlines.append(line) newlines.append(line)
if 5662<=i<7551: #one-byte instructions if onebyte_start <= i < twobyte_start: #one-byte instructions
linematch=caseline.match(line) linematch=caseline.match(line)
if linematch: if linematch:
try: try:
newlines.append(linematch.group(1)+linematch.group(2)+"://"+onedict[linematch.group(2)]+"\n") newlines.append(linematch.group(1)+linematch.group(2)+"://"+onedict[strip_1(linematch.group(2))]+"\n")
except KeyError: except KeyError:
newlines.append(line) newlines.append(line)
else: else:
newlines.append(line) newlines.append(line)
if 7551<=i<8291: #two-byte instructions if twobyte_start <= i < twobyte_end: #two-byte instructions
linematch=caseline.match(line) linematch=caseline.match(line)
if linematch: if linematch:
try: try:
newlines.append(linematch.group(1)+linematch.group(2)+"://"+twodict[linematch.group(2)]+"\n") newlines.append(linematch.group(1)+linematch.group(2)+"://"+twodict[strip_1(linematch.group(2))]+"\n")
except KeyError: except KeyError:
newlines.append(line) newlines.append(line)
else: else:
newlines.append(line) newlines.append(line)
if 8291<=i: if twobyte_end <= i:
newlines.append(line) newlines.append(line)
outfile=open("cpux86-ta-auto-annotated.js",'w') outfile=open("cpux86-ta-auto-annotated.js",'w')