/
tibuildandrun
executable file
·47 lines (39 loc) · 1.57 KB
/
tibuildandrun
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
#!/data/data/com.termux/files/usr/bin/python
# Script that compiles all .z80-files in current directory,
# converts the result into 83ps,
# loads them (and any depending programs) into a RAM-file,
# and launches AndieGraph.
# The script currently uses hardcoded input/output
import glob
import os
import os.path
os.system('rm -f *.83p')
source_files = glob.glob(os.getcwd() + '/*.z80')
source_files.extend(glob.glob(os.getcwd() + '/*.asm'))
vars_to_load = []
for sf in source_files:
name = sf.split('/')[-1].split('.')[0]
extension = sf.split('.')[-1]
os.system('caz -o ' + name + '.bin ' + name + '.' + extension)
os.system('to8xx ' + name)
os.system('rm ' + name + '.bin')
vars_to_load.append(name + '.83p')
if os.path.exists(os.path.join(os.getcwd(),"dependencies","yoloader.83p")):
loader=b'YOLOADER'
elif os.path.exists(os.path.join(os.getcwd(),"dependencies","zasmload.83p")):
loader=b'ZASMLOAD'
else:
loader=None
if not loader is None:
zname=("A"+name)[:-1]
runfile=open(zname+'.bin','wb')
data=b'\x2a'+name.upper().encode()+b'\x3f\xe7\x39\x5f'+loader
runfile.write(data)
runfile.close()
os.system('to8xx ' + zname)
os.system('rm ' + zname + '.bin')
vars_to_load.append(zname + '.83p')
vars_to_load.extend(glob.glob(os.getcwd() + '/dependencies/*.83p'))
vars_to_load.extend(glob.glob(os.getcwd() + '/dependencies/*.83P'))
os.system('almosttx --parent /sdcard/a-ti-den/clean.ram --child /sdcard/a-ti-den/Ti83.RAM ' + ' '.join(vars_to_load))
os.system('startTI')