1
0
mirror of synced 2026-01-12 00:02:46 +00:00

Improvements to the bootstrap code. (#37)

This commit is contained in:
Matthieu Bucchianeri 2025-02-26 22:44:18 -08:00 committed by GitHub
parent 4b9a0874b2
commit 3ec351b0a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 177 additions and 156 deletions

View File

@ -1,112 +1,121 @@
#define BOOTROM_ADDR 0xce000
unsigned char BOOTROM[] = {
85, 170, 4, 6, 80, 81, 82, 250, 184, 147, 5, 232, 251, 4, 184, 213,
5, 232, 245, 4, 140, 200, 232, 13, 5, 184, 140, 5, 232, 234, 4, 184,
0, 0, 232, 1, 5, 184, 144, 5, 232, 222, 4, 232, 223, 3, 115, 3,
233, 140, 0, 49, 192, 142, 192, 38, 161, 78, 0, 186, 131, 2, 239, 38,
161, 76, 0, 186, 133, 2, 239, 140, 200, 38, 163, 78, 0, 184, 197, 0,
38, 163, 76, 0, 184, 50, 6, 232, 175, 4, 184, 64, 0, 142, 192, 38,
160, 117, 0, 4, 128, 186, 130, 2, 238, 80, 232, 185, 4, 184, 144, 5,
232, 150, 4, 184, 77, 6, 232, 144, 4, 38, 254, 6, 117, 0, 38, 160,
117, 0, 48, 228, 232, 159, 4, 184, 144, 5, 232, 124, 4, 88, 49, 201,
142, 193, 60, 128, 117, 15, 140, 200, 38, 163, 6, 1, 184, 170, 1, 38,
163, 4, 1, 235, 13, 140, 200, 38, 163, 26, 1, 184, 170, 1, 38, 163,
24, 1, 140, 200, 38, 163, 98, 0, 184, 127, 3, 38, 163, 96, 0, 251,
90, 89, 88, 7, 203, 251, 85, 86, 80, 82, 186, 130, 2, 236, 90, 56,
194, 88, 116, 58, 137, 197, 137, 214, 156, 14, 184, 238, 0, 80, 186, 131,
2, 237, 80, 186, 133, 2, 237, 80, 137, 232, 137, 242, 250, 203, 251, 156,
80, 137, 240, 60, 128, 114, 19, 137, 232, 128, 252, 8, 117, 12, 6, 184,
64, 0, 142, 192, 38, 138, 22, 117, 0, 7, 88, 157, 235, 58, 128, 252,
25, 126, 5, 232, 122, 0, 235, 34, 128, 252, 1, 116, 10, 128, 252, 21,
116, 5, 190, 58, 1, 235, 3, 190, 72, 1, 86, 137, 222, 136, 227, 48,
255, 208, 227, 135, 222, 46, 255, 164, 92, 1, 140, 197, 190, 64, 0, 142,
198, 38, 136, 38, 116, 0, 142, 197, 137, 229, 139, 118, 8, 86, 115, 4,
157, 249, 235, 2, 157, 248, 94, 93, 251, 202, 2, 0, 100, 3, 186, 1,
206, 1, 97, 2, 37, 3, 144, 1, 144, 1, 144, 1, 64, 3, 100, 3,
144, 1, 144, 1, 86, 3, 100, 3, 144, 1, 144, 1, 100, 3, 100, 3,
144, 1, 144, 1, 100, 3, 102, 3, 144, 1, 144, 1, 144, 1, 100, 3,
80, 184, 104, 6, 232, 114, 3, 88, 80, 136, 224, 48, 228, 232, 134, 3,
184, 144, 5, 232, 99, 3, 88, 233, 201, 1, 0, 4, 255, 0, 0, 255,
255, 0, 200, 0, 0, 0, 0, 0, 63, 0, 6, 189, 64, 0, 142, 197,
48, 228, 38, 134, 38, 116, 0, 132, 228, 116, 1, 249, 7, 195, 132, 192,
117, 3, 233, 158, 1, 80, 48, 228, 137, 198, 83, 232, 222, 1, 137, 197,
1, 240, 137, 222, 131, 211, 0, 232, 5, 2, 91, 88, 115, 3, 233, 134,
1, 30, 83, 81, 82, 87, 80, 137, 193, 48, 237, 140, 200, 142, 216, 137,
223, 186, 129, 2, 176, 0, 238, 81, 137, 232, 137, 243, 177, 81, 232, 208,
2, 114, 60, 186, 135, 2, 176, 10, 238, 186, 128, 2, 236, 60, 254, 116,
10, 186, 135, 2, 236, 132, 192, 117, 38, 235, 238, 185, 0, 1, 86, 190,
0, 8, 252, 243, 165, 173, 94, 131, 197, 1, 131, 214, 0, 89, 226, 199,
186, 129, 2, 176, 1, 238, 88, 95, 90, 89, 91, 31, 233, 44, 1, 186,
129, 2, 176, 1, 238, 89, 88, 40, 200, 95, 90, 89, 91, 31, 233, 14,
1, 132, 192, 117, 3, 233, 11, 1, 80, 48, 228, 137, 198, 83, 232, 75,
1, 137, 197, 1, 240, 137, 222, 131, 211, 0, 232, 114, 1, 91, 88, 115,
3, 233, 243, 0, 30, 83, 81, 82, 87, 80, 137, 193, 48, 237, 137, 223,
140, 192, 142, 216, 140, 200, 142, 192, 186, 129, 2, 176, 0, 238, 81, 137,
232, 137, 243, 177, 88, 232, 57, 2, 114, 102, 186, 128, 2, 176, 254, 238,
185, 0, 1, 86, 137, 254, 191, 0, 8, 252, 243, 165, 137, 247, 94, 186,
135, 2, 176, 25, 238, 186, 128, 2, 236, 60, 255, 117, 10, 186, 135, 2,
236, 132, 192, 117, 59, 235, 238, 36, 31, 60, 5, 117, 51, 186, 135, 2,
176, 25, 238, 186, 128, 2, 236, 132, 192, 117, 10, 186, 135, 2, 236, 132,
192, 117, 29, 235, 238, 131, 197, 1, 131, 214, 0, 89, 226, 160, 186, 129,
2, 176, 1, 238, 140, 216, 142, 192, 88, 95, 90, 89, 91, 31, 235, 107,
186, 129, 2, 176, 1, 238, 89, 140, 216, 142, 192, 88, 40, 200, 95, 90,
89, 91, 31, 235, 74, 132, 192, 116, 74, 80, 48, 228, 137, 197, 83, 232,
138, 0, 1, 232, 131, 211, 0, 232, 181, 0, 91, 88, 114, 57, 235, 59,
182, 254, 6, 184, 64, 0, 142, 192, 38, 138, 22, 117, 0, 7, 181, 254,
177, 255, 49, 192, 248, 195, 80, 83, 232, 97, 0, 232, 145, 0, 91, 88,
114, 21, 235, 23, 235, 21, 180, 3, 232, 155, 0, 135, 209, 248, 195, 180,
170, 249, 195, 180, 1, 249, 195, 180, 4, 249, 195, 48, 228, 248, 195, 49,
192, 142, 216, 142, 192, 185, 0, 1, 191, 0, 124, 243, 171, 186, 128, 0,
184, 1, 2, 185, 1, 0, 187, 0, 124, 205, 19, 129, 62, 254, 125, 85,
170, 117, 15, 184, 133, 6, 232, 96, 1, 49, 192, 142, 192, 234, 0, 124,
0, 0, 184, 159, 6, 232, 81, 1, 251, 244, 235, 253, 49, 192, 49, 219,
82, 81, 82, 136, 200, 36, 192, 209, 224, 209, 224, 136, 232, 185, 255, 0,
247, 225, 90, 136, 241, 48, 237, 1, 200, 177, 63, 247, 225, 89, 81, 48,
237, 128, 225, 63, 73, 1, 200, 131, 210, 0, 137, 211, 89, 90, 195, 81,
82, 232, 18, 0, 57, 211, 114, 10, 119, 4, 57, 200, 114, 4, 249, 90,
89, 195, 248, 90, 89, 195, 186, 250, 0, 185, 63, 197, 195, 80, 30, 83,
81, 82, 86, 140, 200, 142, 216, 186, 129, 2, 176, 1, 238, 185, 1, 0,
186, 160, 134, 180, 134, 205, 21, 186, 128, 2, 176, 255, 185, 10, 0, 238,
226, 253, 186, 129, 2, 176, 0, 238, 187, 10, 0, 190, 201, 4, 185, 1,
0, 180, 1, 232, 92, 0, 115, 15, 49, 201, 186, 32, 78, 180, 134, 205,
21, 75, 117, 231, 249, 235, 52, 190, 207, 4, 185, 5, 0, 180, 1, 232,
64, 0, 114, 39, 186, 135, 2, 176, 250, 238, 190, 213, 4, 185, 1, 0,
180, 1, 232, 45, 0, 190, 219, 4, 185, 1, 0, 180, 0, 232, 34, 0,
115, 9, 186, 135, 2, 236, 132, 192, 116, 224, 249, 94, 90, 89, 91, 31,
114, 8, 184, 240, 5, 232, 113, 0, 88, 195, 184, 19, 6, 232, 105, 0,
88, 195, 186, 128, 2, 176, 255, 238, 81, 185, 6, 0, 252, 172, 238, 226,
252, 185, 8, 0, 236, 60, 255, 225, 251, 89, 56, 224, 118, 3, 249, 235,
4, 248, 236, 226, 253, 176, 255, 238, 195, 64, 0, 0, 0, 0, 149, 72,
0, 0, 1, 170, 135, 119, 0, 0, 0, 0, 1, 105, 64, 0, 0, 0,
1, 186, 128, 2, 80, 176, 255, 238, 136, 200, 238, 136, 248, 238, 136, 216,
238, 88, 134, 224, 238, 134, 224, 238, 176, 1, 238, 185, 8, 0, 236, 60,
255, 225, 251, 132, 192, 116, 1, 249, 195, 156, 30, 83, 86, 137, 198, 140,
200, 142, 216, 180, 14, 49, 219, 252, 172, 8, 192, 116, 4, 205, 16, 235,
247, 94, 91, 31, 157, 195, 156, 30, 83, 81, 82, 86, 137, 194, 140, 200,
142, 216, 49, 219, 252, 137, 214, 177, 12, 211, 238, 131, 230, 15, 138, 132,
124, 5, 180, 14, 205, 16, 137, 214, 177, 8, 211, 238, 131, 230, 15, 138,
132, 124, 5, 180, 14, 205, 16, 137, 214, 177, 4, 211, 238, 131, 230, 15,
138, 132, 124, 5, 180, 14, 205, 16, 137, 214, 131, 230, 15, 138, 132, 124,
5, 180, 14, 205, 16, 94, 90, 89, 91, 31, 157, 195, 48, 49, 50, 51,
52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 58, 0, 32, 0,
13, 10, 0, 66, 111, 111, 116, 82, 79, 77, 32, 102, 111, 114, 32, 88,
84, 77, 97, 120, 32, 118, 49, 46, 48, 13, 10, 67, 111, 112, 121, 114,
105, 103, 104, 116, 32, 40, 99, 41, 32, 50, 48, 50, 53, 32, 77, 97,
116, 116, 104, 105, 101, 117, 32, 66, 117, 99, 99, 104, 105, 97, 110, 101,
114, 105, 13, 10, 0, 82, 79, 77, 32, 66, 97, 115, 101, 32, 65, 100,
100, 114, 101, 115, 115, 32, 32, 32, 32, 32, 32, 32, 32, 61, 32, 0,
83, 68, 32, 67, 97, 114, 100, 32, 105, 110, 105, 116, 105, 97, 108, 105,
122, 101, 100, 32, 115, 117, 99, 99, 101, 115, 115, 102, 117, 108, 108, 121,
13, 10, 0, 83, 68, 32, 67, 97, 114, 100, 32, 102, 97, 105, 108, 101,
100, 32, 116, 111, 32, 105, 110, 105, 116, 105, 97, 108, 105, 122, 101, 13,
10, 0, 70, 105, 120, 101, 100, 32, 68, 105, 115, 107, 32, 73, 68, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 61, 32, 0, 84, 111, 116,
97, 108, 32, 70, 105, 120, 101, 100, 32, 68, 105, 115, 107, 32, 68, 114,
105, 118, 101, 115, 32, 61, 32, 0, 85, 110, 115, 117, 112, 112, 111, 114,
116, 101, 100, 32, 73, 78, 84, 49, 51, 104, 32, 70, 117, 110, 99, 116,
105, 111, 110, 32, 0, 66, 111, 111, 116, 105, 110, 103, 32, 102, 114, 111,
109, 32, 83, 68, 32, 67, 97, 114, 100, 46, 46, 46, 13, 10, 0, 78,
111, 116, 32, 98, 111, 111, 116, 97, 98, 108, 101, 13, 10, 0, 0, 0,
85, 170, 4, 6, 80, 81, 82, 250, 184, 209, 5, 232, 57, 5, 184, 19,
6, 232, 51, 5, 140, 200, 232, 75, 5, 184, 202, 5, 232, 40, 5, 184,
0, 0, 232, 63, 5, 184, 206, 5, 232, 28, 5, 232, 29, 4, 115, 3,
233, 151, 0, 49, 192, 142, 192, 38, 161, 78, 0, 186, 131, 2, 239, 38,
161, 76, 0, 186, 133, 2, 239, 140, 200, 38, 163, 78, 0, 184, 208, 0,
38, 163, 76, 0, 184, 112, 6, 232, 237, 4, 184, 64, 0, 142, 192, 38,
160, 117, 0, 4, 128, 186, 130, 2, 238, 80, 232, 247, 4, 184, 206, 5,
232, 212, 4, 184, 139, 6, 232, 206, 4, 38, 254, 6, 117, 0, 38, 160,
117, 0, 48, 228, 232, 221, 4, 184, 206, 5, 232, 186, 4, 88, 49, 201,
142, 193, 60, 128, 117, 15, 140, 200, 38, 163, 6, 1, 184, 181, 1, 38,
163, 4, 1, 235, 13, 140, 200, 38, 163, 26, 1, 184, 181, 1, 38, 163,
24, 1, 140, 200, 38, 163, 98, 0, 38, 163, 102, 0, 184, 176, 3, 38,
163, 96, 0, 184, 138, 3, 38, 163, 100, 0, 251, 90, 89, 88, 7, 203,
251, 85, 86, 80, 82, 186, 130, 2, 236, 90, 56, 194, 88, 116, 58, 137,
197, 137, 214, 156, 14, 184, 249, 0, 80, 186, 131, 2, 237, 80, 186, 133,
2, 237, 80, 137, 232, 137, 242, 250, 203, 251, 156, 80, 137, 240, 60, 128,
114, 19, 137, 232, 128, 252, 8, 117, 12, 6, 184, 64, 0, 142, 192, 38,
138, 22, 117, 0, 7, 88, 157, 235, 58, 128, 252, 25, 126, 5, 232, 122,
0, 235, 34, 128, 252, 1, 116, 10, 128, 252, 21, 116, 5, 190, 69, 1,
235, 3, 190, 83, 1, 86, 137, 222, 136, 227, 48, 255, 208, 227, 135, 222,
46, 255, 164, 103, 1, 140, 197, 190, 64, 0, 142, 198, 38, 136, 38, 116,
0, 142, 197, 137, 229, 139, 118, 8, 86, 115, 4, 157, 249, 235, 2, 157,
248, 94, 93, 251, 202, 2, 0, 111, 3, 197, 1, 217, 1, 108, 2, 48,
3, 155, 1, 155, 1, 155, 1, 75, 3, 111, 3, 155, 1, 155, 1, 97,
3, 111, 3, 155, 1, 155, 1, 111, 3, 111, 3, 155, 1, 155, 1, 111,
3, 113, 3, 155, 1, 155, 1, 155, 1, 111, 3, 80, 184, 166, 6, 232,
165, 3, 88, 80, 136, 224, 48, 228, 232, 185, 3, 184, 206, 5, 232, 150,
3, 88, 233, 201, 1, 0, 4, 255, 0, 0, 255, 255, 0, 200, 0, 0,
0, 0, 0, 63, 0, 6, 189, 64, 0, 142, 197, 48, 228, 38, 134, 38,
116, 0, 132, 228, 116, 1, 249, 7, 195, 132, 192, 117, 3, 233, 158, 1,
80, 48, 228, 137, 198, 83, 232, 17, 2, 137, 197, 1, 240, 137, 222, 131,
211, 0, 232, 56, 2, 91, 88, 115, 3, 233, 134, 1, 30, 83, 81, 82,
87, 80, 137, 193, 48, 237, 140, 200, 142, 216, 137, 223, 186, 129, 2, 176,
0, 238, 81, 137, 232, 137, 243, 177, 81, 232, 3, 3, 114, 60, 186, 135,
2, 176, 10, 238, 186, 128, 2, 236, 60, 254, 116, 10, 186, 135, 2, 236,
132, 192, 117, 38, 235, 238, 185, 0, 1, 86, 190, 0, 8, 252, 243, 165,
173, 94, 131, 197, 1, 131, 214, 0, 89, 226, 199, 186, 129, 2, 176, 1,
238, 88, 95, 90, 89, 91, 31, 233, 44, 1, 186, 129, 2, 176, 1, 238,
89, 88, 40, 200, 95, 90, 89, 91, 31, 233, 14, 1, 132, 192, 117, 3,
233, 11, 1, 80, 48, 228, 137, 198, 83, 232, 126, 1, 137, 197, 1, 240,
137, 222, 131, 211, 0, 232, 165, 1, 91, 88, 115, 3, 233, 243, 0, 30,
83, 81, 82, 87, 80, 137, 193, 48, 237, 137, 223, 140, 192, 142, 216, 140,
200, 142, 192, 186, 129, 2, 176, 0, 238, 81, 137, 232, 137, 243, 177, 88,
232, 108, 2, 114, 102, 186, 128, 2, 176, 254, 238, 185, 0, 1, 86, 137,
254, 191, 0, 8, 252, 243, 165, 137, 247, 94, 186, 135, 2, 176, 25, 238,
186, 128, 2, 236, 60, 255, 117, 10, 186, 135, 2, 236, 132, 192, 117, 59,
235, 238, 36, 31, 60, 5, 117, 51, 186, 135, 2, 176, 25, 238, 186, 128,
2, 236, 132, 192, 117, 10, 186, 135, 2, 236, 132, 192, 117, 29, 235, 238,
131, 197, 1, 131, 214, 0, 89, 226, 160, 186, 129, 2, 176, 1, 238, 140,
216, 142, 192, 88, 95, 90, 89, 91, 31, 235, 107, 186, 129, 2, 176, 1,
238, 89, 140, 216, 142, 192, 88, 40, 200, 95, 90, 89, 91, 31, 235, 74,
132, 192, 116, 74, 80, 48, 228, 137, 197, 83, 232, 189, 0, 1, 232, 131,
211, 0, 232, 232, 0, 91, 88, 114, 57, 235, 59, 182, 254, 6, 184, 64,
0, 142, 192, 38, 138, 22, 117, 0, 7, 181, 254, 177, 255, 49, 192, 248,
195, 80, 83, 232, 148, 0, 232, 196, 0, 91, 88, 114, 21, 235, 23, 235,
21, 180, 3, 232, 206, 0, 135, 209, 248, 195, 180, 170, 249, 195, 180, 1,
249, 195, 180, 4, 249, 195, 48, 228, 248, 195, 184, 195, 6, 232, 183, 1,
49, 210, 232, 75, 0, 128, 62, 0, 124, 6, 114, 20, 191, 0, 124, 185,
8, 0, 161, 0, 124, 131, 199, 2, 59, 5, 225, 249, 116, 2, 235, 36,
137, 229, 54, 139, 70, 2, 133, 192, 184, 35, 7, 116, 28, 184, 228, 6,
232, 132, 1, 186, 128, 0, 232, 23, 0, 129, 62, 254, 125, 85, 170, 184,
9, 7, 117, 5, 234, 0, 124, 0, 0, 232, 107, 1, 251, 244, 235, 253,
49, 192, 142, 216, 142, 192, 185, 0, 1, 191, 0, 124, 243, 171, 184, 1,
2, 185, 1, 0, 187, 0, 124, 205, 19, 195, 49, 192, 49, 219, 82, 81,
82, 136, 200, 36, 192, 209, 224, 209, 224, 136, 232, 185, 255, 0, 247, 225,
90, 136, 241, 48, 237, 1, 200, 177, 63, 247, 225, 89, 81, 48, 237, 128,
225, 63, 73, 1, 200, 131, 210, 0, 137, 211, 89, 90, 195, 81, 82, 232,
18, 0, 57, 211, 114, 10, 119, 4, 57, 200, 114, 4, 249, 90, 89, 195,
248, 90, 89, 195, 186, 250, 0, 185, 63, 197, 195, 80, 30, 83, 81, 82,
86, 140, 200, 142, 216, 186, 129, 2, 176, 1, 238, 185, 1, 0, 186, 160,
134, 180, 134, 205, 21, 186, 128, 2, 176, 255, 185, 10, 0, 238, 226, 253,
186, 129, 2, 176, 0, 238, 187, 10, 0, 190, 7, 5, 185, 1, 0, 180,
1, 232, 92, 0, 115, 15, 49, 201, 186, 32, 78, 180, 134, 205, 21, 75,
117, 231, 249, 235, 52, 190, 13, 5, 185, 5, 0, 180, 1, 232, 64, 0,
114, 39, 186, 135, 2, 176, 250, 238, 190, 19, 5, 185, 1, 0, 180, 1,
232, 45, 0, 190, 25, 5, 185, 1, 0, 180, 0, 232, 34, 0, 115, 9,
186, 135, 2, 236, 132, 192, 116, 224, 249, 94, 90, 89, 91, 31, 114, 8,
184, 46, 6, 232, 113, 0, 88, 195, 184, 81, 6, 232, 105, 0, 88, 195,
186, 128, 2, 176, 255, 238, 81, 185, 6, 0, 252, 172, 238, 226, 252, 185,
8, 0, 236, 60, 255, 225, 251, 89, 56, 224, 118, 3, 249, 235, 4, 248,
236, 226, 253, 176, 255, 238, 195, 64, 0, 0, 0, 0, 149, 72, 0, 0,
1, 170, 135, 119, 0, 0, 0, 0, 1, 105, 64, 0, 0, 0, 1, 186,
128, 2, 80, 176, 255, 238, 136, 200, 238, 136, 248, 238, 136, 216, 238, 88,
134, 224, 238, 134, 224, 238, 176, 1, 238, 185, 8, 0, 236, 60, 255, 225,
251, 132, 192, 116, 1, 249, 195, 156, 30, 83, 86, 137, 198, 140, 200, 142,
216, 180, 14, 49, 219, 252, 172, 8, 192, 116, 4, 205, 16, 235, 247, 94,
91, 31, 157, 195, 156, 30, 83, 81, 82, 86, 137, 194, 140, 200, 142, 216,
49, 219, 252, 137, 214, 177, 12, 211, 238, 131, 230, 15, 138, 132, 186, 5,
180, 14, 205, 16, 137, 214, 177, 8, 211, 238, 131, 230, 15, 138, 132, 186,
5, 180, 14, 205, 16, 137, 214, 177, 4, 211, 238, 131, 230, 15, 138, 132,
186, 5, 180, 14, 205, 16, 137, 214, 131, 230, 15, 138, 132, 186, 5, 180,
14, 205, 16, 94, 90, 89, 91, 31, 157, 195, 48, 49, 50, 51, 52, 53,
54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 58, 0, 32, 0, 13, 10,
0, 66, 111, 111, 116, 82, 79, 77, 32, 102, 111, 114, 32, 88, 84, 77,
97, 120, 32, 118, 49, 46, 48, 13, 10, 67, 111, 112, 121, 114, 105, 103,
104, 116, 32, 40, 99, 41, 32, 50, 48, 50, 53, 32, 77, 97, 116, 116,
104, 105, 101, 117, 32, 66, 117, 99, 99, 104, 105, 97, 110, 101, 114, 105,
13, 10, 0, 82, 79, 77, 32, 66, 97, 115, 101, 32, 65, 100, 100, 114,
101, 115, 115, 32, 32, 32, 32, 32, 32, 32, 32, 61, 32, 0, 83, 68,
32, 67, 97, 114, 100, 32, 105, 110, 105, 116, 105, 97, 108, 105, 122, 101,
100, 32, 115, 117, 99, 99, 101, 115, 115, 102, 117, 108, 108, 121, 13, 10,
0, 83, 68, 32, 67, 97, 114, 100, 32, 102, 97, 105, 108, 101, 100, 32,
116, 111, 32, 105, 110, 105, 116, 105, 97, 108, 105, 122, 101, 13, 10, 0,
70, 105, 120, 101, 100, 32, 68, 105, 115, 107, 32, 73, 68, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 61, 32, 0, 84, 111, 116, 97, 108,
32, 70, 105, 120, 101, 100, 32, 68, 105, 115, 107, 32, 68, 114, 105, 118,
101, 115, 32, 61, 32, 0, 85, 110, 115, 117, 112, 112, 111, 114, 116, 101,
100, 32, 73, 78, 84, 49, 51, 104, 32, 70, 117, 110, 99, 116, 105, 111,
110, 32, 0, 65, 116, 116, 101, 109, 112, 116, 105, 110, 103, 32, 98, 111,
111, 116, 32, 102, 114, 111, 109, 32, 102, 108, 111, 112, 112, 121, 46, 46,
46, 13, 10, 0, 65, 116, 116, 101, 109, 112, 116, 105, 110, 103, 32, 98,
111, 111, 116, 32, 102, 114, 111, 109, 32, 102, 105, 120, 101, 100, 32, 100,
105, 115, 107, 46, 46, 46, 13, 10, 0, 78, 111, 32, 98, 111, 111, 116,
97, 98, 108, 101, 32, 109, 101, 100, 105, 97, 32, 102, 111, 117, 110, 100,
13, 10, 0, 78, 111, 32, 97, 99, 116, 105, 118, 101, 32, 112, 97, 114,
116, 105, 116, 105, 111, 110, 32, 102, 111, 117, 110, 100, 13, 10, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@ -118,13 +127,4 @@ unsigned char BOOTROM[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19};
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 175};

View File

@ -26,10 +26,9 @@ cpu 8086 ; ensure we remain compatible with 8086
%define REG_TIMEOUT (XTMAX_IO_BASE+7)
;
; Whether we will try/force using our own bootstrap code instead of falling back to BASIC.
; Whether we will try to use our own bootstrap code.
;
%define USE_BOOTSTRAP
;%define FORCE_OWN_BOOTSTRAP
;
; Whether we are going to rename the BIOS's 1st disk to be the second disk.
@ -154,7 +153,6 @@ entry:
call print_hex
mov ax, newline
call print_string
%if !(%isdef(USE_BOOTSTRAP) && %isdef(FORCE_OWN_BOOTSTRAP))
.update_bda:
;
; Increment the number of fixed disks in the BIOS Data Area.
@ -167,7 +165,6 @@ entry:
call print_hex
mov ax, newline
call print_string
%endif
pop ax
;
@ -194,13 +191,17 @@ entry:
%ifdef USE_BOOTSTRAP
;
; Install our BIOS INT18h hook into the interrupt vector table.
; Install our BIOS INT18h and 19h hook into the interrupt vector table.
; Their utility depends on the BIOS, some BIOS will not invoke INT19h and only invoke INT18h in case of fallback.
;
.install_18h_vector:
mov ax, cs
mov es:[0x18*4+2], ax ; store segment
mov es:[0x19*4+2], ax ; store segment
mov ax, int18h_entry
mov es:[0x18*4], ax ; store offset
mov ax, int19h_entry
mov es:[0x19*4], ax ; store offset
%endif
.skip:
@ -925,10 +926,59 @@ succeeded:
ret
%ifdef USE_BOOTSTRAP
;
; INT 19h entry point.
; Attempt to boot from floppy (single try for expediency).
;
int19h_entry:
mov ax, boot_floppy_msg
call print_string
xor dx, dx ; 1st floppy drive
call read_sector
.test_signature: ; taken from IBM BIOS for XT 286
cmp byte [0x7c00], 0x06 ; check for first instruction invalid
jb int18h_entry
mov di, 0x7c00 ; check data pattern
mov cx, 8 ; check the next 8 words
mov ax, word [0x7c00]
.test_byte:
add di, 2 ; point to next location
cmp ax, [di] ; check data pattern for a fill pattern
loopz .test_byte
jz int18h_entry ; boot not valid print message halt
jmp jump_to_boot
;
; INT 18h entry point.
; Attempt to boot from SD Card.
;
int18h_entry:
mov bp, sp
mov ax, ss:[bp+2]
test ax, ax ; caller is boot sector, must be no active partition
mov ax, no_part_msg
je no_boot
mov ax, boot_sd_msg
call print_string
mov dx, 0x80 ; MBR can only boot from 1st fixed disk
call read_sector
.test_signature:
cmp word [0x7c00+510], 0xaa55
mov ax, no_boot_msg
jne no_boot
;
; Common code between INT18h and INT19h.
;
jump_to_boot:
jmp 0:0x7c00
no_boot:
call print_string
sti
.loop:
hlt
jmp .loop
read_sector:
xor ax, ax
mov ds, ax
mov es, ax
@ -937,42 +987,11 @@ int18h_entry:
mov di, 0x7c00
rep stosw
.read_boot_sector:
mov dx, 0x80 ; MBR can only boot from 1st fixed disk
mov ax, 0x201 ; read 1 sector
mov cx, 1 ; sector 1
mov bx, 0x7c00
int 0x13
.test_signature:
cmp word [0x7c00+510], 0xaa55
jne .no_boot
%if %isdef(USE_BOOTSTRAP) && %isdef(FORCE_OWN_BOOTSTRAP)
.update_bda:
;
; Increment the number of fixed disks in the BIOS Data Area, since we did not do it earlier.
;
mov ax, num_drives_msg
call print_string
mov ax, 0x40 ; BIOS data area
mov es, ax
inc byte es:[0x75] ; HDNUM
mov al, es:[0x75]
call print_hex
mov ax, newline
call print_string
%endif
.jump_to_boot:
mov ax, boot_msg
call print_string
xor ax, ax
mov es, ax
jmp 0:0x7c00
.no_boot:
mov ax, no_boot_msg
call print_string
sti
.loop:
hlt
jmp .loop
ret
%endif
;
@ -1311,8 +1330,10 @@ disk_id_msg db 'Fixed Disk ID = ', 0
num_drives_msg db 'Total Fixed Disk Drives = ', 0
unsupported_msg db 'Unsupported INT13h Function ', 0
%ifdef USE_BOOTSTRAP
boot_msg db 'Booting from SD Card...', 0xD, 0xA, 0
no_boot_msg db 'Not bootable', 0xD, 0xA, 0
boot_floppy_msg db 'Attempting boot from floppy...', 0xD, 0xA, 0
boot_sd_msg db 'Attempting boot from fixed disk...', 0xD, 0xA, 0
no_boot_msg db 'No bootable media found', 0xD, 0xA, 0
no_part_msg db 'No active partition found', 0xD, 0xA, 0
%endif
%ifdef DEBUG