Commit | Line | Data |
---|---|---|
196ba1fc PH |
1 | /* id32_dboot.c: Interdata 32b simulator disk bootstrap\r |
2 | \r | |
3 | Copyright (c) 2000-2006, Robert M. Supnik\r | |
4 | \r | |
5 | Permission is hereby granted, free of charge, to any person obtaining a\r | |
6 | copy of this software and associated documentation files (the "Software"),\r | |
7 | to deal in the Software without restriction, including without limitation\r | |
8 | the rights to use, copy, modify, merge, publish, distribute, sublicense,\r | |
9 | and/or sell copies of the Software, and to permit persons to whom the\r | |
10 | Software is furnished to do so, subject to the following conditions:\r | |
11 | \r | |
12 | The above copyright notice and this permission notice shall be included in\r | |
13 | all copies or substantial portions of the Software.\r | |
14 | \r | |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r | |
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r | |
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\r | |
18 | ROBERT M SUPNIK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r | |
19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r | |
20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r | |
21 | \r | |
22 | Except as contained in this notice, the name of Robert M Supnik shall not be\r | |
23 | used in advertising or otherwise to promote the sale, use or other dealings\r | |
24 | in this Software without prior written authorization from Robert M Supnik.\r | |
25 | \r | |
26 | 17-Jul-06 RMS Fixed transcription errors (found by Davis Johnson)\r | |
27 | 17-Feb-03 RMS Fixed for UNIX bootstrap, upper platter bootstrap\r | |
28 | */\r | |
29 | \r | |
30 | #include "id_defs.h"\r | |
31 | \r | |
32 | #define DBOOT_BEG 0x1000\r | |
33 | #define DBOOT_START 0x100E\r | |
34 | #define DBOOT_LEN (sizeof (dboot_rom) / sizeof (uint8))\r | |
35 | \r | |
36 | /* Transcribed from 32b Bootstrap Loader, 03-074N81R03A13 */\r | |
37 | \r | |
38 | static uint8 dboot_rom[] = {\r | |
39 | 0xca, 0xf0, 0x00, 0x30,\r | |
40 | 0xc5, 0xf0, 0x00, 0x3a,\r | |
41 | 0x02, 0x8e,\r | |
42 | 0x26, 0xf7,\r | |
43 | 0x03, 0x0e,\r | |
44 | 0xe6, 0xd0, 0x0f, 0x30,\r | |
45 | 0xd1, 0xe0, 0x00, 0x78,\r | |
46 | 0xd0, 0xed, 0x03, 0x40,\r | |
47 | 0xd3, 0xf0, 0x00, 0x7e,\r | |
48 | 0xc4, 0xf0, 0x00, 0x0f,\r | |
49 | 0x41, 0xed, 0x00, 0xd0,\r | |
50 | 0xd2, 0xfd, 0x03, 0x25,\r | |
51 | 0xd3, 0xf0, 0x00, 0x7f,\r | |
52 | 0x10, 0xf4,\r | |
53 | 0x41, 0xed, 0x00, 0xd0,\r | |
54 | 0xd2, 0xfd, 0x03, 0x26,\r | |
55 | 0xd3, 0xf0, 0x00, 0x7f,\r | |
56 | 0xc4, 0xf0, 0x00, 0x0f,\r | |
57 | 0x41, 0xed, 0x00, 0xd0,\r | |
58 | 0xd2, 0xfd, 0x03, 0x27,\r | |
59 | 0xd3, 0x20, 0x00, 0x7d,\r | |
60 | 0xd3, 0x30, 0x00, 0x7c,\r | |
61 | 0xd3, 0x40, 0x00, 0x7a,\r | |
62 | 0x24, 0x50,\r | |
63 | 0xd3, 0xf0, 0x00, 0x7b,\r | |
64 | 0xcb, 0xf0, 0x00, 0x33,\r | |
65 | 0x23, 0x23,\r | |
66 | 0x11, 0xf1,\r | |
67 | 0x08, 0x5f,\r | |
68 | 0xe6, 0x7d, 0x03, 0x50,\r | |
69 | 0xe6, 0x8d, 0x04, 0x4f,\r | |
70 | 0x07, 0xcc,\r | |
71 | 0x41, 0xed, 0x01, 0xfc,\r | |
72 | 0xd1, 0xed, 0x03, 0x5c,\r | |
73 | 0xd0, 0xed, 0x03, 0x48,\r | |
74 | 0x58, 0xcd, 0x03, 0x58,\r | |
75 | 0x43, 0x3d, 0x01, 0x9c,\r | |
76 | 0xe6, 0x7d, 0x03, 0x50,\r | |
77 | 0x41, 0xed, 0x01, 0xfc,\r | |
78 | 0xe6, 0xed, 0x03, 0x54,\r | |
79 | 0x24, 0x15,\r | |
80 | 0xf8, 0xf0, 0x4f, 0x53, 0x33, 0x32,\r | |
81 | 0xd3, 0x7e, 0x00, 0x24,\r | |
82 | 0xc3, 0x70, 0x00, 0x10,\r | |
83 | 0x23, 0x3e,\r | |
84 | 0xc3, 0x70, 0x00, 0xe0,\r | |
85 | 0x21, 0x3b,\r | |
86 | 0x55, 0xfe, 0x00, 0x00,\r | |
87 | 0x21, 0x38,\r | |
88 | 0x58, 0x6e, 0x00, 0x08,\r | |
89 | 0x10, 0x68,\r | |
90 | 0x55, 0x6d, 0x03, 0x24,\r | |
91 | 0x43, 0x3d, 0x01, 0xb2,\r | |
92 | 0xca, 0xe0, 0x00, 0x30,\r | |
93 | 0x27, 0x11,\r | |
94 | 0x42, 0x3d, 0x01, 0x66,\r | |
95 | 0x58, 0xcd, 0x03, 0x50,\r | |
96 | 0x42, 0x3d, 0x01, 0x52,\r | |
97 | 0x48, 0x10, 0x00, 0x7e,\r | |
98 | 0x42, 0x3d, 0x02, 0xf0,\r | |
99 | 0x58, 0xcd, 0x03, 0x48,\r | |
100 | 0x43, 0x3d, 0x02, 0xf0,\r | |
101 | 0x58, 0x8d, 0x03, 0x4c,\r | |
102 | 0x23, 0x07,\r | |
103 | 0x58, 0xce, 0x00, 0x0c,\r | |
104 | 0x58, 0x8e, 0x00, 0x10,\r | |
105 | 0x0b, 0x8c,\r | |
106 | 0x26, 0xc1,\r | |
107 | 0x11, 0x88,\r | |
108 | 0x08, 0x18,\r | |
109 | 0xe6, 0xf0, 0x11, 0x18,\r | |
110 | 0x58, 0x0f, 0x00, 0x00,\r | |
111 | 0x50, 0x01, 0x00, 0x00,\r | |
112 | 0x59, 0x01, 0x00, 0x00,\r | |
113 | 0x42, 0x3d, 0x03, 0x08,\r | |
114 | 0x26, 0xf4,\r | |
115 | 0x26, 0x14,\r | |
116 | 0xc5, 0xf0, 0x12, 0x78,\r | |
117 | 0x20, 0x8c,\r | |
118 | 0x08, 0xd8,\r | |
119 | 0xcb, 0xd0, 0x01, 0xe8,\r | |
120 | 0x03, 0x08,\r | |
121 | 0x27, 0x81,\r | |
122 | 0x07, 0x77,\r | |
123 | 0x41, 0xed, 0x01, 0xfc,\r | |
124 | 0xd1, 0xed, 0x03, 0x40,\r | |
125 | 0xd0, 0xe0, 0x00, 0x78,\r | |
126 | 0x43, 0x00, 0x00, 0x60,\r | |
127 | 0xde, 0x2d, 0x03, 0x28,\r | |
128 | 0x08, 0x0c,\r | |
129 | 0x4d, 0x0d, 0x45, 0x00, 0x03, 0x30,\r | |
130 | 0x08, 0x91,\r | |
131 | 0x4d, 0x0d, 0x45, 0x00, 0x03, 0x38,\r | |
132 | 0x08, 0xa1,\r | |
133 | 0x08, 0xb0,\r | |
134 | 0x08, 0x55,\r | |
135 | 0x42, 0x2d, 0x02, 0x4a,\r | |
136 | 0xde, 0x3d, 0x03, 0x28,\r | |
137 | 0x9d, 0x3f,\r | |
138 | 0x22, 0x21,\r | |
139 | 0x9d, 0x4f,\r | |
140 | 0x42, 0x1d, 0x02, 0xf4,\r | |
141 | 0xc3, 0xf0, 0x00, 0x10,\r | |
142 | 0x20, 0x35,\r | |
143 | 0x11, 0xa5,\r | |
144 | 0x06, 0xba,\r | |
145 | 0x98, 0x49,\r | |
146 | 0xde, 0x4d, 0x03, 0x2b,\r | |
147 | 0x9d, 0x3f,\r | |
148 | 0x22, 0x21,\r | |
149 | 0x9d, 0x4f,\r | |
150 | 0x42, 0x7d, 0x02, 0xf8,\r | |
151 | 0x20, 0x83,\r | |
152 | 0x41, 0x6d, 0x02, 0x96,\r | |
153 | 0x22, 0x0b,\r | |
154 | 0x9d, 0x4f,\r | |
155 | 0xc3, 0xf0, 0x00, 0x19,\r | |
156 | 0x42, 0x3d, 0x02, 0xfc,\r | |
157 | 0xde, 0x4d, 0x03, 0x2c,\r | |
158 | 0x9d, 0x3f,\r | |
159 | 0x22, 0x21,\r | |
160 | 0x98, 0x49,\r | |
161 | 0xde, 0x4d, 0x03, 0x2e,\r | |
162 | 0x9d, 0x3f,\r | |
163 | 0x22, 0x21,\r | |
164 | 0xde, 0x4d, 0x03, 0x2d,\r | |
165 | 0x9d, 0x3f,\r | |
166 | 0x22, 0x21,\r | |
167 | 0x98, 0x4a,\r | |
168 | 0xde, 0x4d, 0x03, 0x2f,\r | |
169 | 0x9d, 0x3f,\r | |
170 | 0x22, 0x21,\r | |
171 | 0xde, 0x4d, 0x03, 0x2b,\r | |
172 | 0x9d, 0x3f,\r | |
173 | 0x22, 0x21,\r | |
174 | 0x9d, 0x4f,\r | |
175 | 0x20, 0x81,\r | |
176 | 0xc3, 0xf0, 0x00, 0x53,\r | |
177 | 0x42, 0x3d, 0x03, 0x00,\r | |
178 | 0x08, 0xfa,\r | |
179 | 0x11, 0xfa,\r | |
180 | 0x06, 0xf9,\r | |
181 | 0xe6, 0x6d, 0x02, 0x54,\r | |
182 | 0x34, 0x77,\r | |
183 | 0x9a, 0x27,\r | |
184 | 0x34, 0x77,\r | |
185 | 0x98, 0x27,\r | |
186 | 0x34, 0x88,\r | |
187 | 0x9a, 0x28,\r | |
188 | 0x34, 0x88,\r | |
189 | 0x98, 0x28,\r | |
190 | 0x08, 0x55,\r | |
191 | 0x21, 0x24,\r | |
192 | 0x98, 0x49,\r | |
193 | 0x9a, 0x3b,\r | |
194 | 0x23, 0x03,\r | |
195 | 0x9a, 0x3b,\r | |
196 | 0x98, 0x3f,\r | |
197 | 0xde, 0x3d, 0x03, 0x2a,\r | |
198 | 0xde, 0x2d, 0x03, 0x29,\r | |
199 | 0x9d, 0x2f,\r | |
200 | 0x20, 0x81,\r | |
201 | 0xde, 0x2d, 0x03, 0x28,\r | |
202 | 0x9b, 0x20,\r | |
203 | 0x99, 0x21,\r | |
204 | 0x34, 0x00,\r | |
205 | 0x06, 0x01,\r | |
206 | 0xde, 0x2d, 0x03, 0x28,\r | |
207 | 0x9d, 0x3f,\r | |
208 | 0x22, 0x21,\r | |
209 | 0x42, 0x1d, 0x03, 0x04,\r | |
210 | 0xc3, 0xf0, 0x00, 0x10,\r | |
211 | 0x03, 0x3e,\r | |
212 | 0x0b, 0x07,\r | |
213 | 0x26, 0x04,\r | |
214 | 0xc4, 0x00, 0xff, 0x00,\r | |
215 | 0x0a, 0x70,\r | |
216 | 0x26, 0x91,\r | |
217 | 0x07, 0xaa,\r | |
218 | 0x07, 0xbb,\r | |
219 | 0x03, 0x06,\r | |
220 | 0x24, 0x11,\r | |
221 | 0x23, 0x0c,\r | |
222 | 0x24, 0x12,\r | |
223 | 0x23, 0x0a,\r | |
224 | 0x24, 0x13,\r | |
225 | 0x23, 0x08,\r | |
226 | 0x24, 0x14,\r | |
227 | 0x23, 0x06,\r | |
228 | 0x24, 0x15,\r | |
229 | 0x23, 0x04,\r | |
230 | 0x24, 0x16,\r | |
231 | 0x23, 0x02,\r | |
232 | 0x24, 0x17,\r | |
233 | 0x24, 0x01,\r | |
234 | 0xde, 0x0d, 0x03, 0x28,\r | |
235 | 0x9a, 0x01,\r | |
236 | 0xde, 0x0d, 0x03, 0x28,\r | |
237 | 0xd1, 0xed, 0x03, 0x40,\r | |
238 | 0xd0, 0xe0, 0x00, 0x78,\r | |
239 | 0x11, 0x0f,\r | |
240 | 0x95, 0x10,\r | |
241 | 0x22, 0x01,\r | |
242 | 0x00, 0x00, 0x00, 0x00,\r | |
243 | 0x48, 0x30,\r | |
244 | 0xc1, 0xc2,\r | |
245 | 0xc8, 0xc4,\r | |
246 | 0xd0, 0xe0,\r | |
247 | 0x00, 0x30,\r | |
248 | 0x01, 0x90,\r | |
249 | 0x01, 0x40,\r | |
250 | 0x04, 0xc0,\r | |
251 | 0x00, 0x18,\r | |
252 | 0x00, 0x14,\r | |
253 | 0x00, 0x40,\r | |
254 | 0x00, 0x40,\r | |
255 | 0x00\r | |
256 | };\r | |
257 | \r | |
258 | /* Lower memory setup\r | |
259 | \r | |
260 | 78 = binary input device address\r | |
261 | 79 = binary device input command\r | |
262 | 7A = disk device number\r | |
263 | 7B = device code\r | |
264 | 7C = disk controller address\r | |
265 | 7D = selector channel address\r | |
266 | 7E:7F = operating system extension (user specified)\r | |
267 | */\r | |
268 | \r | |
269 | struct dboot_id {\r | |
270 | char *name;\r | |
271 | uint32 sw;\r | |
272 | uint32 cap;\r | |
273 | uint32 dtype;\r | |
274 | uint32 offset;\r | |
275 | uint32 adder;\r | |
276 | };\r | |
277 | \r | |
278 | static struct dboot_id dboot_tab[] = {\r | |
279 | { "DP", 0, 2, 0x31, o_DP0, 0 },\r | |
280 | { "DP", SWMASK ('F'), 9, 0x32, o_DP0, o_DPF },\r | |
281 | { "DP", 0, 9, 0x33, o_DP0, 0 },\r | |
282 | { "DM", 0, 64, 0x35, o_ID0, 0 },\r | |
283 | { "DM", 0, 244, 0x36, o_ID0, 0 },\r | |
284 | { NULL }\r | |
285 | };\r | |
286 | \r | |
287 | t_stat id_dboot (int32 u, DEVICE *dptr)\r | |
288 | {\r | |
289 | extern DIB ttp_dib, sch_dib;\r | |
290 | extern uint32 PC;\r | |
291 | extern int32 sim_switches;\r | |
292 | uint32 i, typ, ctlno, off, add, cap, sch_dev;\r | |
293 | UNIT *uptr;\r | |
294 | \r | |
295 | DIB *ddib = (DIB *) dptr->ctxt; /* get disk DIB */\r | |
296 | ctlno = ddib->dno; /* get ctrl devno */\r | |
297 | sch_dev = sch_dib.dno + ddib->sch; /* sch dev # */\r | |
298 | uptr = dptr->units + u; /* get capacity */\r | |
299 | cap = uptr->capac >> 20;\r | |
300 | for (i = typ = 0; dboot_tab[i].name != NULL; i++) {\r | |
301 | if ((strcmp (dboot_tab[i].name, dptr->name) == 0) &&\r | |
302 | ((dboot_tab[i].sw == 0) || (dboot_tab[i].sw & sim_switches)) &&\r | |
303 | (dboot_tab[i].cap == cap)) {\r | |
304 | typ = dboot_tab[i].dtype;\r | |
305 | off = dboot_tab[i].offset;\r | |
306 | add = dboot_tab[i].adder;\r | |
307 | break;\r | |
308 | }\r | |
309 | }\r | |
310 | if (typ == 0) return SCPE_NOFNC;\r | |
311 | \r | |
312 | IOWriteBlk (DBOOT_BEG, DBOOT_LEN, dboot_rom); /* copy boot */\r | |
313 | IOWriteB (AL_DEV, ttp_dib.dno); /* bin input dev */\r | |
314 | IOWriteB (AL_IOC, 0xa3);\r | |
315 | IOWriteB (AL_DSKU, ctlno + ((u + 1) * off) + add); /* disk dev addr */\r | |
316 | IOWriteB (AL_DSKT, typ); /* disk type */\r | |
317 | IOWriteB (AL_DSKC, ctlno); /* disk ctl addr */\r | |
318 | IOWriteB (AL_SCH, sch_dev);\r | |
319 | PC = DBOOT_START;\r | |
320 | return SCPE_OK;\r | |
321 | }\r |