1
0
mirror of synced 2026-01-30 21:42:35 +00:00

Remove some of the debug features to make the code more readable.

This commit is contained in:
Matthieu Bucchianeri
2025-02-08 19:05:02 -08:00
committed by Ted Fried
parent 671b6e8153
commit 1186841266
2 changed files with 84 additions and 208 deletions

View File

@@ -1,18 +1,18 @@
#define BOOTROM_ADDR 0xCE000
unsigned char BOOTROM[] = {
85, 170, 4, 6, 80, 82, 250, 184, 21, 229, 232, 131, 4, 232, 139, 3,
85, 170, 4, 6, 80, 82, 250, 184, 19, 229, 232, 129, 4, 232, 137, 3,
115, 3, 233, 188, 0, 84, 88, 57, 224, 116, 39, 62, 161, 255, 255, 62,
199, 6, 255, 255, 170, 170, 62, 128, 62, 0, 0, 170, 62, 163, 255, 255,
116, 2, 235, 14, 80, 48, 192, 176, 64, 246, 224, 88, 116, 4, 48, 210,
235, 8, 178, 1, 184, 87, 229, 232, 70, 4, 184, 131, 2, 146, 238, 184,
124, 229, 232, 59, 4, 49, 192, 142, 192, 38, 161, 78, 0, 186, 132, 2,
239, 232, 74, 4, 184, 39, 230, 232, 38, 4, 38, 161, 76, 0, 186, 134,
2, 239, 232, 57, 4, 184, 43, 230, 232, 21, 4, 184, 145, 229, 232, 15,
4, 184, 0, 192, 38, 163, 78, 0, 232, 35, 4, 184, 39, 230, 232, 255,
3, 184, 214, 224, 38, 163, 76, 0, 232, 19, 4, 184, 43, 230, 232, 239,
3, 184, 166, 229, 232, 233, 3, 184, 0, 192, 38, 163, 6, 1, 232, 253,
3, 184, 39, 230, 232, 217, 3, 184, 138, 225, 38, 163, 4, 1, 232, 237,
3, 184, 43, 230, 232, 201, 3, 184, 64, 0, 142, 192, 38, 254, 6, 117,
235, 8, 178, 1, 184, 85, 229, 232, 68, 4, 184, 131, 2, 146, 238, 184,
122, 229, 232, 57, 4, 49, 192, 142, 192, 38, 161, 78, 0, 186, 132, 2,
239, 232, 72, 4, 184, 37, 230, 232, 36, 4, 38, 161, 76, 0, 186, 134,
2, 239, 232, 55, 4, 184, 41, 230, 232, 19, 4, 184, 143, 229, 232, 13,
4, 184, 0, 192, 38, 163, 78, 0, 232, 33, 4, 184, 37, 230, 232, 253,
3, 184, 214, 224, 38, 163, 76, 0, 232, 17, 4, 184, 41, 230, 232, 237,
3, 184, 164, 229, 232, 231, 3, 184, 0, 192, 38, 163, 6, 1, 232, 251,
3, 184, 37, 230, 232, 215, 3, 184, 138, 225, 38, 163, 4, 1, 232, 235,
3, 184, 41, 230, 232, 199, 3, 184, 64, 0, 142, 192, 38, 254, 6, 117,
0, 251, 90, 88, 7, 203, 85, 86, 128, 250, 128, 116, 26, 137, 197, 137,
214, 156, 14, 184, 49, 225, 80, 156, 186, 132, 2, 237, 80, 186, 134, 2,
237, 80, 137, 232, 137, 242, 207, 128, 252, 21, 126, 5, 232, 113, 0, 235,
@@ -20,85 +20,85 @@ unsigned char BOOTROM[] = {
190, 49, 225, 86, 137, 222, 136, 227, 48, 255, 208, 227, 135, 222, 46, 255,
164, 68, 225, 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, 202, 2, 0, 47, 227, 154, 225, 174, 225, 63, 226, 238, 226, 112, 225,
112, 225, 112, 225, 9, 227, 47, 227, 112, 225, 112, 225, 33, 227, 47, 227,
112, 225, 112, 225, 47, 227, 47, 227, 112, 225, 112, 225, 47, 227, 49, 227,
80, 184, 10, 230, 232, 25, 3, 88, 80, 136, 224, 48, 228, 232, 46, 3,
184, 43, 230, 232, 10, 3, 88, 233, 180, 1, 0, 4, 16, 0, 0, 255,
93, 202, 2, 0, 45, 227, 154, 225, 174, 225, 63, 226, 238, 226, 112, 225,
112, 225, 112, 225, 9, 227, 45, 227, 112, 225, 112, 225, 31, 227, 45, 227,
112, 225, 112, 225, 45, 227, 45, 227, 112, 225, 112, 225, 45, 227, 47, 227,
80, 184, 8, 230, 232, 23, 3, 88, 80, 136, 224, 48, 228, 232, 44, 3,
184, 41, 230, 232, 8, 3, 88, 233, 178, 1, 0, 4, 16, 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, 137, 1, 80, 48, 228, 137, 198, 83, 232, 140, 1, 137, 197,
1, 240, 137, 222, 131, 211, 0, 232, 179, 1, 91, 88, 115, 3, 233, 113,
117, 3, 233, 135, 1, 80, 48, 228, 137, 198, 83, 232, 138, 1, 137, 197,
1, 240, 137, 222, 131, 211, 0, 232, 177, 1, 91, 88, 115, 3, 233, 111,
1, 83, 81, 82, 87, 80, 137, 193, 48, 237, 137, 223, 186, 130, 2, 176,
0, 238, 81, 137, 232, 137, 243, 177, 81, 232, 115, 2, 114, 64, 186, 128,
2, 185, 80, 195, 235, 3, 232, 137, 2, 236, 60, 254, 224, 248, 117, 46,
0, 238, 81, 137, 232, 137, 243, 177, 81, 232, 113, 2, 114, 64, 186, 128,
2, 185, 80, 195, 235, 3, 232, 135, 2, 236, 60, 254, 224, 248, 117, 46,
185, 0, 1, 82, 186, 131, 2, 236, 90, 132, 192, 252, 116, 4, 243, 109,
235, 4, 237, 171, 226, 252, 237, 131, 197, 1, 131, 214, 0, 89, 226, 194,
186, 130, 2, 176, 1, 238, 88, 95, 90, 89, 91, 233, 24, 1, 186, 130,
2, 176, 1, 238, 89, 88, 40, 200, 95, 90, 89, 91, 233, 251, 0, 132,
192, 117, 3, 233, 248, 0, 80, 48, 228, 137, 198, 83, 232, 251, 0, 137,
197, 1, 240, 137, 222, 131, 211, 0, 232, 34, 1, 91, 88, 115, 3, 233,
224, 0, 30, 83, 81, 82, 87, 80, 137, 193, 48, 237, 137, 223, 140, 192,
186, 130, 2, 176, 1, 238, 88, 95, 90, 89, 91, 233, 22, 1, 186, 130,
2, 176, 1, 238, 89, 88, 40, 200, 95, 90, 89, 91, 233, 249, 0, 132,
192, 117, 3, 233, 246, 0, 80, 48, 228, 137, 198, 83, 232, 249, 0, 137,
197, 1, 240, 137, 222, 131, 211, 0, 232, 32, 1, 91, 88, 115, 3, 233,
222, 0, 30, 83, 81, 82, 87, 80, 137, 193, 48, 237, 137, 223, 140, 192,
142, 216, 186, 130, 2, 176, 0, 238, 81, 137, 232, 137, 243, 177, 88, 232,
221, 1, 114, 89, 186, 128, 2, 176, 254, 238, 185, 0, 1, 135, 247, 82,
219, 1, 114, 89, 186, 128, 2, 176, 254, 238, 185, 0, 1, 135, 247, 82,
186, 131, 2, 236, 90, 132, 192, 252, 116, 4, 243, 111, 235, 4, 173, 239,
226, 252, 135, 254, 185, 80, 195, 235, 3, 232, 214, 1, 236, 60, 255, 225,
248, 36, 31, 60, 5, 117, 38, 185, 80, 195, 235, 3, 232, 195, 1, 236,
226, 252, 135, 254, 185, 80, 195, 235, 3, 232, 212, 1, 236, 60, 255, 225,
248, 36, 31, 60, 5, 117, 38, 185, 80, 195, 235, 3, 232, 193, 1, 236,
132, 192, 225, 248, 116, 23, 131, 197, 1, 131, 214, 0, 89, 226, 169, 186,
130, 2, 176, 1, 238, 88, 95, 90, 89, 91, 31, 235, 105, 186, 130, 2,
176, 1, 238, 89, 88, 40, 200, 95, 90, 89, 91, 31, 235, 76, 132, 192,
116, 76, 80, 48, 228, 137, 197, 83, 232, 79, 0, 1, 232, 131, 211, 0,
232, 122, 0, 91, 88, 114, 59, 235, 61, 182, 15, 6, 184, 64, 0, 142,
192, 38, 138, 22, 117, 0, 7, 254, 194, 181, 254, 177, 255, 49, 192, 248,
195, 80, 83, 232, 36, 0, 232, 84, 0, 91, 88, 114, 21, 235, 23, 235,
21, 180, 3, 232, 94, 0, 135, 209, 248, 195, 180, 170, 249, 195, 180, 1,
249, 195, 180, 4, 249, 195, 48, 228, 248, 195, 49, 192, 49, 219, 82, 81,
82, 136, 200, 36, 192, 209, 224, 209, 224, 136, 232, 185, 16, 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, 15, 0, 185, 16, 188, 195, 80, 30, 83, 81, 82,
86, 184, 0, 192, 142, 216, 186, 130, 2, 176, 1, 238, 49, 201, 186, 232,
3, 180, 134, 205, 21, 186, 128, 2, 176, 255, 185, 80, 0, 238, 226, 253,
186, 130, 2, 176, 0, 238, 190, 71, 228, 185, 1, 0, 180, 1, 232, 79,
0, 114, 54, 190, 77, 228, 185, 5, 0, 180, 1, 232, 66, 0, 114, 41,
187, 100, 0, 190, 83, 228, 185, 1, 0, 180, 1, 232, 50, 0, 190, 89,
228, 185, 1, 0, 180, 0, 232, 39, 0, 115, 14, 156, 49, 201, 186, 232,
3, 180, 134, 205, 21, 157, 75, 117, 218, 94, 90, 89, 91, 31, 114, 8,
184, 200, 229, 232, 122, 0, 88, 195, 184, 235, 229, 232, 114, 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, 136, 252, 239, 88, 134, 216, 239, 134,
216, 180, 1, 239, 185, 8, 0, 236, 60, 255, 225, 251, 132, 192, 116, 1,
249, 195, 81, 82, 49, 201, 186, 1, 0, 180, 134, 205, 21, 90, 89, 195,
156, 30, 83, 86, 137, 198, 184, 0, 192, 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, 184, 0, 192, 142, 216, 49, 219, 252, 137, 214,
177, 12, 211, 238, 131, 230, 15, 138, 132, 5, 229, 180, 14, 205, 16, 137,
214, 177, 8, 211, 238, 131, 230, 15, 138, 132, 5, 229, 180, 14, 205, 16,
137, 214, 177, 4, 211, 238, 131, 230, 15, 138, 132, 5, 229, 180, 14, 205,
16, 137, 214, 131, 230, 15, 138, 132, 5, 229, 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, 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, 67, 80, 85, 32, 115, 117, 112, 112, 111,
114, 116, 115, 32, 73, 78, 83, 47, 79, 85, 84, 83, 32, 105, 110, 115,
116, 114, 117, 99, 116, 105, 111, 110, 115, 13, 10, 0, 79, 108, 100, 32,
73, 78, 84, 49, 51, 104, 32, 86, 101, 99, 116, 111, 114, 32, 61, 32,
0, 78, 101, 119, 32, 73, 78, 84, 49, 51, 104, 32, 86, 101, 99, 116,
111, 114, 32, 61, 32, 0, 78, 101, 119, 32, 70, 105, 120, 101, 100, 32,
68, 105, 115, 107, 32, 80, 97, 114, 97, 109, 101, 116, 101, 114, 32, 84,
97, 98, 108, 101, 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, 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, 58, 0, 32, 0, 13, 10, 0, 0, 0,
130, 2, 176, 1, 238, 88, 95, 90, 89, 91, 31, 235, 103, 186, 130, 2,
176, 1, 238, 89, 88, 40, 200, 95, 90, 89, 91, 31, 235, 74, 132, 192,
116, 74, 80, 48, 228, 137, 197, 83, 232, 77, 0, 1, 232, 131, 211, 0,
232, 120, 0, 91, 88, 114, 57, 235, 59, 182, 15, 6, 184, 64, 0, 142,
192, 38, 138, 22, 117, 0, 7, 181, 254, 177, 255, 49, 192, 248, 195, 80,
83, 232, 36, 0, 232, 84, 0, 91, 88, 114, 21, 235, 23, 235, 21, 180,
3, 232, 94, 0, 135, 209, 248, 195, 180, 170, 249, 195, 180, 1, 249, 195,
180, 4, 249, 195, 48, 228, 248, 195, 49, 192, 49, 219, 82, 81, 82, 136,
200, 36, 192, 209, 224, 209, 224, 136, 232, 185, 16, 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, 15, 0, 185, 16, 188, 195, 80, 30, 83, 81, 82, 86, 184,
0, 192, 142, 216, 186, 130, 2, 176, 1, 238, 49, 201, 186, 232, 3, 180,
134, 205, 21, 186, 128, 2, 176, 255, 185, 80, 0, 238, 226, 253, 186, 130,
2, 176, 0, 238, 190, 69, 228, 185, 1, 0, 180, 1, 232, 79, 0, 114,
54, 190, 75, 228, 185, 5, 0, 180, 1, 232, 66, 0, 114, 41, 187, 100,
0, 190, 81, 228, 185, 1, 0, 180, 1, 232, 50, 0, 190, 87, 228, 185,
1, 0, 180, 0, 232, 39, 0, 115, 14, 156, 49, 201, 186, 232, 3, 180,
134, 205, 21, 157, 75, 117, 218, 94, 90, 89, 91, 31, 114, 8, 184, 198,
229, 232, 122, 0, 88, 195, 184, 233, 229, 232, 114, 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, 136, 252, 239, 88, 134, 216, 239, 134, 216, 180,
1, 239, 185, 8, 0, 236, 60, 255, 225, 251, 132, 192, 116, 1, 249, 195,
81, 82, 49, 201, 186, 1, 0, 180, 134, 205, 21, 90, 89, 195, 156, 30,
83, 86, 137, 198, 184, 0, 192, 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, 184, 0, 192, 142, 216, 49, 219, 252, 137, 214, 177, 12,
211, 238, 131, 230, 15, 138, 132, 3, 229, 180, 14, 205, 16, 137, 214, 177,
8, 211, 238, 131, 230, 15, 138, 132, 3, 229, 180, 14, 205, 16, 137, 214,
177, 4, 211, 238, 131, 230, 15, 138, 132, 3, 229, 180, 14, 205, 16, 137,
214, 131, 230, 15, 138, 132, 3, 229, 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, 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, 67, 80, 85, 32, 115, 117, 112, 112, 111, 114, 116,
115, 32, 73, 78, 83, 47, 79, 85, 84, 83, 32, 105, 110, 115, 116, 114,
117, 99, 116, 105, 111, 110, 115, 13, 10, 0, 79, 108, 100, 32, 73, 78,
84, 49, 51, 104, 32, 86, 101, 99, 116, 111, 114, 32, 61, 32, 0, 78,
101, 119, 32, 73, 78, 84, 49, 51, 104, 32, 86, 101, 99, 116, 111, 114,
32, 61, 32, 0, 78, 101, 119, 32, 70, 105, 120, 101, 100, 32, 68, 105,
115, 107, 32, 80, 97, 114, 97, 109, 101, 116, 101, 114, 32, 84, 97, 98,
108, 101, 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, 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, 58, 0, 32, 0, 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, 0, 0, 0,
@@ -127,4 +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, 62};
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 148};

View File

@@ -14,40 +14,26 @@ cpu 8086 ; ensure we remain compatible with 8086
%define FIXED_DISK_0 (0)
%define FIXED_DISK_1 (1)
%define FLOPPY_DISK (-0x80)
;
; Whether we will emulate the 1st or 2nd disk.
;
%define DISK_NUMBER FIXED_DISK_0
%define EMULATE_FIXED_DISK (DISK_NUMBER >= FIXED_DISK_0)
;
; Whether we will use our own bootstrap code.
;
;%define USE_BOOTSTRAP
;
; The properties of our emulated disk.
;
%if EMULATE_FIXED_DISK
%define NUM_CYLINDERS (1024)
%define NUM_HEADS (16)
%define SECTORS_PER_TRACK (63)
; the last cylinder is reserved on fixed disks
%define NUM_SECTORS (NUM_HEADS * (NUM_CYLINDERS - 1) * SECTORS_PER_TRACK)
%else
%define NUM_HEADS (2)
%define SECTORS_PER_TRACK (18)
%define NUM_CYLINDERS (80)
%define NUM_SECTORS (NUM_HEADS * NUM_CYLINDERS * SECTORS_PER_TRACK)
%endif
; TODO: (feature) the BIOS only specifies 16 heads, however the INT13h functions could use 256.
%if NUM_HEADS > 16
%error NUM_HEADS must be 4 bits
%endif
%if EMULATE_FIXED_DISK && SECTORS_PER_TRACK > 63
%if SECTORS_PER_TRACK > 63
%error SECTORS_PER_TRACK must be 6 bits
%endif
%if NUM_CYLINDERS > 1024
@@ -162,7 +148,6 @@ entry:
mov ax, newline
call print_string
%if EMULATE_FIXED_DISK
;
; Install our fixed disk parameter table.
; For the 1st disk, it is stored in the interrupt vector table, at vector 41h.
@@ -183,34 +168,12 @@ entry:
mov ax, newline
call print_string
%ifdef USE_BOOTSTRAP
;
; Install our BIOS INT18h hook into the interrupt vector table.
;
.install_18h_vector:
mov ax, new_18h_msg
call print_string
mov ax, ROM_SEGMENT
mov es:[0x18*4+2], ax ; store segment
call print_hex
mov ax, colon
call print_string
mov ax, int18h_entry
mov es:[0x18*4], ax ; store offset
call print_hex
mov ax, newline
call print_string
%else
;
; Increment the number of fixed disks in the BIOS Data Area.
;
mov ax, 0x40 ; BIOS data area
mov es, ax
inc byte es:[0x75] ; HDNUM
%endif
%endif
.skip:
sti
@@ -259,19 +222,6 @@ int13h_entry:
; This is not an operation for the SD Card. Forward to the BIOS INT 13h handler.
;
.forward_to_bios:
%ifdef EXTRA_DEBUG
push ax
mov ax, forward_msg
call print_string
pop ax
push ax
mov al, ah
xor ah, ah
call print_hex
mov ax, newline
call print_string
pop ax
%endif
mov TEMP0, ax ; save ax
mov TEMP1, dx ; save dx
pushf ; setup for iret from INT 13h handler
@@ -306,11 +256,7 @@ int13h_entry:
; This is an operation for the SD Card. Use our own INT 13h logic.
;
.check_function:
%if EMULATE_FIXED_DISK
cmp ah, 0x15 ; is valid function?
%else
cmp ah, 0x16 ; is valid function?
%endif
jle .prepare_call
call func_unsupported
jmp .update_bda
@@ -405,9 +351,6 @@ func_table:
dw func_unsupported ; diagnostics
dw func_10_is_ready ; diagnostics
dw func_15_read_size
%if !EMULATE_FIXED_DISK
dw func_10_is_ready ; detect_change
%endif
func_unsupported:
%ifdef DEBUG
@@ -807,29 +750,9 @@ func_08_read_params:
mov es, ax
mov dl, es:[0x75] ; HDNUM
pop es
%ifndef USE_BOOTSTRAP
inc dl ; we never added ourselves
%endif
%if EMULATE_FIXED_DISK
; the last cylinder is reserved on fixed disks
mov ch, ((NUM_CYLINDERS - 2) & 0xff)
mov cl, (((NUM_CYLINDERS - 2) & 0x300) >> 2) | SECTORS_PER_TRACK
%else
mov ch, ((NUM_CYLINDERS - 1) & 0xff)
mov cl, (((NUM_CYLINDERS - 1) & 0x300) >> 2) | SECTORS_PER_TRACK
; diskette drive parameters table, it is stored in the interrupt vector table, at vector 1Eh.
xor ax, ax ; INT vector segment
mov es, ax
mov ax, es:[0x1e*4] ; offset
mov di, ax
mov ax, es:[0x1e*4+2] ; segment
mov es, ax
mov bx, 0x4 ; 1.44 MB
%endif
xor ax, ax
clc
.exit:
@@ -885,13 +808,9 @@ func_15_read_size:
%ifdef DEBUG
call debug_handler
%endif
%if EMULATE_FIXED_DISK
mov ah, 0x3 ; drive present
call get_max_lba
xchg cx, dx
%else
mov ah, 0x1 ; diskette drive present
%endif
clc
ret
@@ -918,36 +837,6 @@ succeeded:
clc
ret
%ifdef USE_BOOTSTRAP
;
; INT 18h entry point.
;
int18h_entry:
xor ax, ax
mov ds, ax
mov es, ax
mov cx, 256
mov di, 0x7c00
rep stosw
mov ax, 0x201 ; read 1 sector
mov dx, 0x80+DISK_NUMBER
mov cx, 1 ; sector 1
mov bx, 0x7c00
int 0x13
cmp word [0x7c00+510], 0xaa55
jne .no_boot
mov ax, boot_msg
call print_string
jmp 0:0x7c00
.no_boot:
mov ax, no_boot_msg
call print_string
sti
.loop:
hlt
jmp .loop
%endif
;
; Disk utilities
;
@@ -967,12 +856,10 @@ compute_lba:
push dx
push cx
push dx
%if EMULATE_FIXED_DISK
mov al, cl
and al, 0xc0
shl ax, 1
shl ax, 1
%endif
mov al, ch ; cylinder
mov cx, NUM_HEADS
mul cx ; cylinder * hpc
@@ -985,9 +872,7 @@ compute_lba:
pop cx
push cx
xor ch, ch
%if EMULATE_FIXED_DISK
and cl, 0x3f
%endif
dec cx ; sector - 1
add ax, cx ; (cylinder * hpc + head) * spt + (sector - 1)
adc dx, 0 ; carry
@@ -1270,11 +1155,6 @@ new_fdpt_msg db 'New Fixed Disk Parameter Table = ', 0
init_ok_msg db 'SD Card initialized successfully', 0xD, 0xA, 0
init_error_msg db 'SD Card failed to initialize', 0xD, 0xA, 0
unsupported_msg db 'Unsupported INT13h Function ', 0
%ifdef USE_BOOTSTRAP
new_18h_msg db 'New INT18h Vector = ', 0
boot_msg db 'Booting from SD Card...', 0xD, 0xA, 0
no_boot_msg db 'Not bootable', 0xD, 0xA, 0
%endif
colon db ':', 0
space db ' ', 0
newline db 0xD, 0xA, 0
@@ -1294,10 +1174,6 @@ sd_token_msg db 'Received token', 0xD, 0xA, 0
sd_status_msg db 'Received status ', 0
sd_idle_msg db 'Received idle', 0xD, 0xA, 0
%endif
%ifdef EXTRA_DEBUG
forward_msg db 'Forward to BIOS INT13h handler ', 0
%endif
%endif
%ifndef AS_COM_PROGRAM