fallout-term/fallout_boot.py

111 lines
2.9 KiB
Python
Raw Normal View History

2015-05-27 01:11:31 +00:00
from fallout_functions import slowWrite
from fallout_functions import INPUT_PAUSE
from fallout_functions import TYPE_DELAY
from fallout_functions import upperInput
import curses
2015-05-27 01:11:31 +00:00
######################## global 'constants' ##############
2024-04-28 15:02:47 +00:00
ENTRY_1 = "SET TERMINAL/INQUIRE"
2024-04-28 15:02:47 +00:00
ENTRY_2 = "SET FILE/PROTECTION=OWNER:RWED ACCOUNTS.F"
2024-04-28 15:02:47 +00:00
ENTRY_3 = "SET HALT RESTART/MAINT"
2024-04-28 15:02:47 +00:00
ENTRY_4 = "RUN DEBUG/ACCOUNTS.F"
2015-05-27 01:11:31 +00:00
######################## text strings ####################
2024-04-28 15:02:47 +00:00
MESSAGE_1 = "WELCOME TO ROBCO INDUSTRIES (TM) TERMLINK"
2015-05-27 01:11:31 +00:00
2024-04-28 15:02:47 +00:00
MESSAGE_2 = "RIT-V300"
2015-05-27 01:11:31 +00:00
2024-04-27 22:17:19 +00:00
MESSAGE_3 = [
2024-04-28 15:02:47 +00:00
"\nInitializing 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\n\n",
2024-04-27 22:17:19 +00:00
]
2015-05-27 01:11:31 +00:00
######################## functions #######################
2024-04-28 15:02:47 +00:00
def runBoot(scr, hardMode):
2015-05-27 01:11:31 +00:00
"""
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
2015-05-27 01:11:31 +00:00
"""
curses.use_default_colors()
scr.erase()
scr.move(0, 0)
curses.noecho()
scr.scrollok(True)
2024-04-27 22:06:26 +00:00
2024-04-28 15:02:47 +00:00
slowWrite(scr, MESSAGE_1 + "\n\n")
if hardMode:
# use must enter the correct text to proceed
2024-04-28 15:02:47 +00:00
entry = ""
while entry.upper() != ENTRY_1.upper():
2024-04-28 15:02:47 +00:00
slowWrite(scr, ">")
entry = upperInput(scr)
else:
# input is entered for them
2024-04-28 15:02:47 +00:00
slowWrite(scr, ">")
curses.napms(INPUT_PAUSE)
2024-04-28 15:02:47 +00:00
slowWrite(scr, ENTRY_1 + "\n", TYPE_DELAY, True)
2024-04-28 15:02:47 +00:00
slowWrite(scr, "\n" + MESSAGE_2 + "\n\n")
if hardMode:
2024-04-28 15:02:47 +00:00
entry = ""
while entry.upper() != ENTRY_2.upper():
2024-04-28 15:02:47 +00:00
slowWrite(scr, ">")
entry = upperInput(scr)
while entry.upper() != ENTRY_3.upper():
2024-04-28 15:02:47 +00:00
slowWrite(scr, ">")
entry = upperInput(scr)
else:
2024-04-28 15:02:47 +00:00
slowWrite(scr, ">")
curses.napms(INPUT_PAUSE)
2024-04-28 15:02:47 +00:00
slowWrite(scr, ENTRY_2 + "\n", TYPE_DELAY, True)
slowWrite(scr, ">")
curses.napms(INPUT_PAUSE)
2024-04-28 15:02:47 +00:00
slowWrite(scr, ENTRY_3 + "\n", TYPE_DELAY, True)
2015-05-27 01:11:31 +00:00
2024-04-27 22:17:19 +00:00
for LINE in MESSAGE_3:
2024-04-28 15:02:47 +00:00
slowWrite(scr, LINE)
2015-05-27 01:11:31 +00:00
if hardMode:
2024-04-28 15:02:47 +00:00
entry = ""
while entry.upper() != ENTRY_4.upper():
2024-04-28 15:02:47 +00:00
slowWrite(scr, ">")
entry = upperInput(scr)
else:
2024-04-28 15:02:47 +00:00
slowWrite(scr, ">")
curses.napms(INPUT_PAUSE)
2024-04-28 15:02:47 +00:00
slowWrite(scr, ENTRY_4 + "\n", TYPE_DELAY, True)
2024-04-27 22:06:26 +00:00
curses.napms(INPUT_PAUSE)
2015-05-27 01:11:31 +00:00
return True
2024-04-28 15:02:47 +00:00
2015-05-27 01:11:31 +00:00
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)
2015-05-27 01:11:31 +00:00
return res