-
Notifications
You must be signed in to change notification settings - Fork 11
/
main.py
39 lines (36 loc) · 1.31 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
from minecraft.combine import get_assembly, get_world
from assembler.preprocessor import preprocess
from assembler.translator import translate
from assembler.formats import Instruction
from emulator.emulator import Chungus2
from schemgenerator.schem import generate_schematic
import time
if __name__ == "__main__":
lines = []
with open("chasm_scripts/ports.s", "r") as f:
for line in f:
lines.append(line.strip())
with open("chasm_scripts/constants.s", "r") as f:
for line in f:
lines.append(line.strip())
with open("chasm_scripts/bank1.s", "r") as f:
for line in f:
lines.append(line.strip())
with open("chasm_scripts/bank2.s", "r") as f:
for line in f:
lines.append(line.strip())
lines = [Instruction(line, index) for index, line in enumerate(lines)]
lines = preprocess.preprocess(lines)
#print([e.text for e in lines])
if True:
lines = lines[0:2048] # bank 1
lines = translate.translate(lines)
generate_schematic(lines, "bank1")
else:
lines = lines[2048:] # bank 2
lines = translate.translate(lines)
generate_schematic(lines, "bank2")
# chungus = Chungus2(lines)
# chungus.set_ram(get_world())
# print(chungus.run_program(100000000))
# time.sleep(100)