-
Notifications
You must be signed in to change notification settings - Fork 11
/
fallout_boot.py
105 lines (81 loc) · 2.87 KB
/
fallout_boot.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
from fallout_functions import slowWrite
from fallout_functions import INPUT_PAUSE
from fallout_functions import TYPE_DELAY
from fallout_functions import upperInput
import curses
######################## global 'constants' ##############
ENTRY_1 = 'SET TERMINAL/INQUIRE'
ENTRY_2 = 'SET FILE/PROTECTION=OWNER:RWED ACCOUNTS.F'
ENTRY_3 = 'SET HALT RESTART/MAINT'
ENTRY_4 = 'RUN DEBUG/ACCOUNTS.F'
######################## text strings ####################
MESSAGE_1 = 'WELCOME TO ROBCO INDUSTRIES (TM) TERMLINK'
MESSAGE_2 = 'RIT-V300'
MESSAGE_3 = 'Initializing Robco Industries(TM) MF Boot Agent v2.3.0\n' \
'RETROS BIOS\n' \
'RBIOS-4.02.08.00 52EE5.E7.E8\n' \
'Copyright 2201-2203 Robco Ind.\n' \
'Uppermem: 64 KB\n' \
'Root (5A8)\n' \
'Maintenance Mode'
######################## functions #######################
def runBoot(scr, hardMode):
"""
Start the boot portion of the terminal
hardMode - boolean indicating whether the user has to enter the ENTRY
constants, or if they are entered automatically
"""
curses.use_default_colors()
scr.erase()
scr.move(0, 0)
curses.noecho()
scr.scrollok(True)
slowWrite(scr, MESSAGE_1 + '\n\n')
if hardMode:
# use must enter the correct text to proceed
entry = ''
while entry.upper() != ENTRY_1.upper():
slowWrite(scr, '>')
entry = upperInput(scr)
else:
# input is entered for them
slowWrite(scr, '>')
curses.napms(INPUT_PAUSE)
slowWrite(scr, ENTRY_1 + '\n', TYPE_DELAY)
slowWrite(scr, '\n' + MESSAGE_2 + '\n\n')
if hardMode:
entry = ''
while entry.upper() != ENTRY_2.upper():
slowWrite(scr, '>')
entry = upperInput(scr)
while entry.upper() != ENTRY_3.upper():
slowWrite(scr, '>')
entry = upperInput(scr)
else:
slowWrite(scr, '>')
curses.napms(INPUT_PAUSE)
slowWrite(scr, ENTRY_2 + '\n', TYPE_DELAY)
slowWrite(scr, '>')
curses.napms(INPUT_PAUSE)
slowWrite(scr, ENTRY_3 + '\n', TYPE_DELAY)
slowWrite(scr, '\n' + MESSAGE_3 + '\n\n')
if hardMode:
entry = ''
while entry.upper() != ENTRY_4.upper():
slowWrite(scr, '>')
entry = upperInput(scr)
else:
slowWrite(scr, '>')
curses.napms(INPUT_PAUSE)
slowWrite(scr, ENTRY_4 + '\n', TYPE_DELAY)
curses.napms(INPUT_PAUSE)
return True
def beginBoot(hardMode):
"""
Initialize curses and start the boot process
hardMode - boolean indicating whether the user has to enter the ENTRY
constants, or if they are entered automatically
Returns true if hardMode == false or if the user entered the correct string
"""
res = curses.wrapper(runBoot, hardMode)
return res