should work correctly

master
Reese 3 years ago
parent 58297bd0bc
commit c84533c2e1

@ -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')

@ -0,0 +1,7 @@
01000001;00000001;00100000;
01000001;00000001;01100000;
01000011;00100000;00000010;
11000011;00100000;01100000;
01000011;00100000;01100000;
01000011;01000000;00100000;
01100010;00000010;00000000;

@ -1,11 +1,8 @@
MOV 1 A
MOV 1 B
MOV 100 C
!loop
MOV A DBGO
ADD A B
MOV ACC DBGO
XOR A B NOT
JMP marker
!marker
OR A B
MOV A B
MOV ACC A
JMP loop

@ -1,9 +0,0 @@
01000001;00000001;00100000;
01000001;00000001;01100000;
01000001;01100100;00010000;
11000011;00100000;01100000;
01000011;01000000;00000010;
01100010;00001001
00000000;00000000;00000000
00000000;00000000;00000000
11100011;00100000;01100000;

@ -0,0 +1,5 @@
00000000;00000000;00000000
01000001;01100100;01100000;
01000000;01100100;01100100;
01000001;00000001;00100000;
01000001;00000101;01100000;

@ -1,5 +0,0 @@
00000000
01000001;0010011;01100000
01000000;0010011;0010011
01000001;1;00100000
01000001;101;01100000
Loading…
Cancel
Save