-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
60 lines (55 loc) · 1.14 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
code = {
'A': '$26',
'B': '$27',
'C': '$28',
'D': '$29',
'E': '$2A',
'F': '$2B',
'G': '$2C',
'H': '$2D',
'I': '$2E',
'J': '$2F',
'K': '$30',
'L': '$31',
'M': '$32',
'N': '$33',
'O': '$34',
'P': '$35',
'Q': '$36',
'R': '$37',
'S': '$38',
'T': '$39',
'U': '$3A',
'V': '$3B',
'W': '$3C',
'X': '$3D',
'Y': '$3E',
'Z': '$3F',
}
def main():
try:
file = open('data/answers.txt', 'r')
except:
print("Cannot open /data/answers.txt for reading")
exit()
try:
fileout = open('wordmaster.asm', 'w')
except:
print("Cannot open wordmaster.asm for writing")
letter = 0
while (c:= file.read(1)):
if c ==('\n'):
continue
if letter == 0:
print('DEFB ',end='', file=fileout)
print(code[c.upper()],end='',file=fileout)
if letter == 4:
print('\n',end='',file=fileout)
letter = 0
else:
print(',',end='',file=fileout)
letter += 1
file.close()
fileout.close()
if __name__ == '__main__':
main()