-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.pwsl
81 lines (81 loc) · 1.82 KB
/
main.pwsl
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
// SMC Computer BIOS
//
// Copyright (C) 2021 adazem009
//
// The default BIOS of SMC Computer.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//
include/"import.pwsl"
include/"menu.pwsl"
clear
// BIOS version
set/"ver","0.2.1"
bgcolor/"000000000"
showlogo
enabletext
print/"Hold S to enter setup...",\n
wait/0.5
getkey/"keys"
getitem/"keys",1/"key"
if/[key == "s"]
// Enter setup menu
print/"Entering setup...",\n
_setup_menu
bgcolor/"000000000"
clear
endif
clear
// List disks
listdisk/"disks"
getlistlength/"disks"/"diskcount"
// Ask for PC code if no disks are found
if/[diskcount == 0]
print/"Error: No disks found.",\n
print/"Trying to get a bootable code...",\n,\n
_boot_media
else
// Try to boot from every disk
// If this, fails, show an error message
set/"i",0
while/[i < diskcount]
// Boot from disk
calc/"i=i+1"
// Read MBR
cpdisk/i/"mbr"
// Leave BIOS-space
leavebios
// Execute MBR
run/mbr,"bg",1,4096/i
wait/1
if/[%ps != 1]
set/"i",diskcount
endif
endloop
endif
// Wait until all processes stop
while/[%ps > 1]
wait/10
endloop
// Boot failure
warp
clear
print>
"Error: Failed to boot."
""
"Please check the PC/media code you used."
<print
endwarp
wait/10
shutdown