Skip to content
This repository was archived by the owner on Apr 25, 2021. It is now read-only.

Commit 8658854

Browse files
committed
Remove debug code in bios.py
1 parent 8c744e8 commit 8658854

File tree

1 file changed

+1
-65
lines changed

1 file changed

+1
-65
lines changed

src/modules/bios.py

Lines changed: 1 addition & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -9,73 +9,9 @@ def bios():
99
crash("no bios found; install a configured EEPROM with Python")
1010

1111
eeprom = eeproms[0]
12-
if True:
13-
invoke(eeprom, 'setLabel', "EEPROM (micropython)")
14-
invoke(eeprom, 'set', b"""#!micropython
15-
16-
17-
def main():
18-
globals().pop('main')
19-
from ucomponent import invoke, get_list as get_components
20-
from ucomputer import crash, get_computer_address
21-
22-
def component(t):
23-
seq = get_components(t)
24-
return seq[0] if seq else None
25-
26-
def check_bootable(filesystems, address):
27-
return address in filesystems and invoke(address, 'exists', '/init.py')
28-
29-
eeprom = __path__
30-
filesystems = get_components("filesystem")
31-
32-
address = invoke(eeprom, 'getData').decode()
33-
if not check_bootable(filesystems, address):
34-
invoke(__path__, 'setData', b'')
35-
for address in filesystems:
36-
if check_bootable(filesystems, address):
37-
invoke(eeprom, 'setData', address.encode())
38-
break
39-
else:
40-
crash("no bootable medium found")
41-
42-
computer = get_computer_address()
43-
invoke(computer, 'beep', 1000, 0.2)
44-
45-
gpu = component("gpu")
46-
monitor = component("monitor")
47-
if gpu and monitor:
48-
invoke(gpu, "bind", monitor)
49-
50-
def load(address):
51-
handle = invoke(address, 'open', '/init.py', 'r')
52-
buffer = []
53-
54-
try:
55-
while True:
56-
buf = invoke(address, 'read', handle, 4096)
57-
if not buf: break
58-
buffer.append(buf)
59-
finally:
60-
invoke(address, 'close', handle)
61-
handle.dispose()
62-
63-
content = b"".join(buffer)
64-
return content.decode()
65-
66-
content = load(address)
67-
context = {'__name__': '__main__', '__path__': address}
68-
func = compile(content, '/init.py', "exec")
69-
exec(func, context)
70-
71-
72-
if __name__ == '__main__':
73-
main()
74-
""")
12+
data = invoke(eeprom, 'get')
7513

7614
comment = b"--[==[", b"]==]"
77-
78-
data = invoke(eeprom, 'get')
7915
if data.startswith(comment[0]) and comment[1] in data:
8016
data = data[len(comment[0]):].partition(comment[1])[0]
8117

0 commit comments

Comments
 (0)