|
|
|
@ -35,7 +35,7 @@ markers = {}
|
|
|
|
|
file = open(sys.argv[1])
|
|
|
|
|
fullfile = file.readlines()
|
|
|
|
|
file.close()
|
|
|
|
|
output = open(sys.argv[1].strip('.ra') + '.rb', 'w+')
|
|
|
|
|
output = open(sys.argv[1].strip('.ra') + '.out', 'w+')
|
|
|
|
|
line = 0
|
|
|
|
|
|
|
|
|
|
registers = {
|
|
|
|
@ -75,7 +75,7 @@ for i in fullfile:
|
|
|
|
|
|
|
|
|
|
if instruction[0] == 'nul':
|
|
|
|
|
print("nul")
|
|
|
|
|
output.write('00000000\n')
|
|
|
|
|
output.write('00000000;00000000;00000000\n')
|
|
|
|
|
|
|
|
|
|
elif instruction[0] == 'nop':
|
|
|
|
|
print("nop")
|
|
|
|
@ -133,6 +133,8 @@ for i in fullfile:
|
|
|
|
|
temp = temp.replace('y', '1')
|
|
|
|
|
else:
|
|
|
|
|
temp = temp.replace('y', '0')
|
|
|
|
|
print(temp)
|
|
|
|
|
output.write(temp + '\n')
|
|
|
|
|
|
|
|
|
|
elif instruction[0] == 'and':
|
|
|
|
|
print("and")
|
|
|
|
@ -157,30 +159,31 @@ for i in fullfile:
|
|
|
|
|
binified = format(int(instruction[1]), '08b')[:8].replace('-', '1')
|
|
|
|
|
temp = temp + binified + ';'
|
|
|
|
|
temp = temp.replace('a', '0')
|
|
|
|
|
temp = temp + ';00000000;'
|
|
|
|
|
print(temp)
|
|
|
|
|
output.write(temp + '\n')
|
|
|
|
|
output.write(temp+ '\n')
|
|
|
|
|
|
|
|
|
|
elif instruction[0] == 'dbl':
|
|
|
|
|
print("dbl")
|
|
|
|
|
temp = '00001000;00000000;00000000'
|
|
|
|
|
temp = '00001000;00000000;00000000;'
|
|
|
|
|
print(temp)
|
|
|
|
|
output.write(temp + '\n')
|
|
|
|
|
|
|
|
|
|
elif instruction[0] == 'dbb':
|
|
|
|
|
print("dbb")
|
|
|
|
|
temp = '01001000;00000000;00000000'
|
|
|
|
|
temp = '01001000;00000000;00000000;'
|
|
|
|
|
print(temp)
|
|
|
|
|
output.write(temp + '\n')
|
|
|
|
|
|
|
|
|
|
elif instruction[0] == 'hlt':
|
|
|
|
|
print("hlt")
|
|
|
|
|
temp = '00000100;00000000;00000000'
|
|
|
|
|
temp = '00000100;00000000;00000000;'
|
|
|
|
|
print(temp)
|
|
|
|
|
output.write(temp + '\n')
|
|
|
|
|
|
|
|
|
|
elif instruction[0] == '':
|
|
|
|
|
print("newline")
|
|
|
|
|
temp = '00000000;00000000;00000000'
|
|
|
|
|
temp = '00000000;00000000;00000000;'
|
|
|
|
|
print(temp)
|
|
|
|
|
output.write(temp + '\n')
|
|
|
|
|
|
|
|
|
|