Commit | Line | Data |
---|---|---|
196ba1fc PH |
1 | /* id16_dboot.c: Interdata 16b 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 error\r | |
27 | */\r | |
28 | \r | |
29 | #include "id_defs.h"\r | |
30 | \r | |
31 | #define DBOOT_BEG 0x1000\r | |
32 | #define DBOOT_START 0x100e\r | |
33 | #define DBOOT_LEN (sizeof (dboot_rom) / sizeof (uint8))\r | |
34 | \r | |
35 | /* Boot ROM: transcription of OS/16 MT2 ALO Direct Access Loader */\r | |
36 | \r | |
37 | static uint8 dboot_rom[] = {\r | |
38 | 0xca, 0xf0, 0x00, 0x30,\r | |
39 | 0xc5, 0xf0, 0x00, 0x3a,\r | |
40 | 0x02, 0x8e,\r | |
41 | 0x26, 0xf7,\r | |
42 | 0x03, 0x0e,\r | |
43 | 0xd1, 0xc0, 0x00, 0x78,\r | |
44 | 0xd0, 0xc0, 0x13, 0xf6,\r | |
45 | 0x07, 0xdd,\r | |
46 | 0xc8, 0x10, 0x10, 0x00,\r | |
47 | 0xd3, 0xf0, 0x00, 0x7e,\r | |
48 | 0xc4, 0xf0, 0x00, 0x0f,\r | |
49 | 0x01, 0xe1,\r | |
50 | 0xd2, 0xf0, 0x12, 0xe2,\r | |
51 | 0xd3, 0xf0, 0x00, 0x7f,\r | |
52 | 0x90, 0xf4,\r | |
53 | 0x01, 0xe1,\r | |
54 | 0xd2, 0xf0, 0x12, 0xe3,\r | |
55 | 0xd3, 0xf0, 0x00, 0x7f,\r | |
56 | 0xc4, 0xf0, 0x00, 0x0f,\r | |
57 | 0x01, 0xe1,\r | |
58 | 0xd2, 0xf0, 0x12, 0xe4,\r | |
59 | 0xd3, 0x20, 0x00, 0x7d,\r | |
60 | 0xd3, 0x30, 0x00, 0x7c,\r | |
61 | 0xd3, 0x40, 0x00, 0x7a,\r | |
62 | 0xd3, 0x50, 0x00, 0x7b,\r | |
63 | 0xc8, 0x70, 0x12, 0xf6,\r | |
64 | 0xc8, 0x80, 0x13, 0xf5,\r | |
65 | 0x07, 0xaa,\r | |
66 | 0x07, 0xcc,\r | |
67 | 0x41, 0xe0, 0x11, 0x88,\r | |
68 | 0x48, 0xa0, 0x12, 0xfe,\r | |
69 | 0x48, 0xc0, 0x13, 0x00,\r | |
70 | 0x43, 0x00, 0x10, 0x98,\r | |
71 | 0xc8, 0x70, 0x12, 0xf6,\r | |
72 | 0x41, 0xe0, 0x11, 0x88,\r | |
73 | 0xc8, 0xe0, 0x12, 0xfa,\r | |
74 | 0x24, 0x15,\r | |
75 | 0xd3, 0x0e, 0x00, 0x24,\r | |
76 | 0xc3, 0x00, 0x00, 0x10,\r | |
77 | 0x21, 0x3f,\r | |
78 | 0xca, 0xe0, 0x00, 0x30,\r | |
79 | 0x27, 0x11,\r | |
80 | 0x20, 0x38,\r | |
81 | 0x48, 0xa0, 0x12, 0xf6,\r | |
82 | 0x48, 0xc0, 0x12, 0xf8,\r | |
83 | 0x42, 0x30, 0x10, 0x70,\r | |
84 | 0x08, 0xaa,\r | |
85 | 0x20, 0x33,\r | |
86 | 0x43, 0x00, 0x12, 0xb2,\r | |
87 | 0x90, 0x05,\r | |
88 | 0x42, 0x30, 0x10, 0x88,\r | |
89 | 0xc8, 0x60, 0x4f, 0x53,\r | |
90 | 0x45, 0x63, 0x00, 0x00,\r | |
91 | 0x20, 0x36,\r | |
92 | 0xc8, 0x60, 0x31, 0x36,\r | |
93 | 0x45, 0x6e, 0x00, 0x02,\r | |
94 | 0x20, 0x3b,\r | |
95 | 0x48, 0x6e, 0x00, 0x08,\r | |
96 | 0x45, 0x60, 0x12, 0xe2,\r | |
97 | 0x20, 0x35,\r | |
98 | 0xd3, 0x6e, 0x00, 0x0a,\r | |
99 | 0xd4, 0x60, 0x12, 0xe4,\r | |
100 | 0x20, 0x3a,\r | |
101 | 0x08, 0x0e,\r | |
102 | 0x07, 0x66,\r | |
103 | 0xca, 0x60, 0x20, 0x00,\r | |
104 | 0x23, 0x36,\r | |
105 | 0x40, 0x06, 0x00, 0x00,\r | |
106 | 0x45, 0x06, 0x00, 0x00,\r | |
107 | 0x22, 0x37,\r | |
108 | 0x48, 0xae, 0x00, 0x0c,\r | |
109 | 0x48, 0xce, 0x00, 0x0e,\r | |
110 | 0x48, 0x0e, 0x00, 0x10,\r | |
111 | 0x48, 0x1e, 0x00, 0x12,\r | |
112 | 0x0b, 0x1c,\r | |
113 | 0x0f, 0x0a,\r | |
114 | 0x07, 0xff,\r | |
115 | 0x26, 0x11,\r | |
116 | 0x0e, 0x0f,\r | |
117 | 0xed, 0x00, 0x00, 0x08,\r | |
118 | 0xcb, 0x60, 0x02, 0xbe,\r | |
119 | 0x08, 0x00,\r | |
120 | 0x23, 0x34,\r | |
121 | 0x08, 0x86,\r | |
122 | 0x08, 0x16,\r | |
123 | 0x23, 0x04,\r | |
124 | 0x05, 0x16,\r | |
125 | 0x22, 0x84,\r | |
126 | 0x08, 0x81,\r | |
127 | 0x07, 0x77,\r | |
128 | 0x27, 0x81,\r | |
129 | 0xc8, 0xd1, 0xee, 0xc0,\r | |
130 | 0xc8, 0xf0, 0x11, 0x40,\r | |
131 | 0x48, 0x0f, 0x00, 0x00,\r | |
132 | 0x40, 0x01, 0x00, 0x00,\r | |
133 | 0x26, 0xf2,\r | |
134 | 0x26, 0x12,\r | |
135 | 0xc5, 0xf0, 0x13, 0xfe,\r | |
136 | 0x20, 0x88,\r | |
137 | 0x0a, 0xed,\r | |
138 | 0x40, 0xed, 0x12, 0xf4,\r | |
139 | 0x43, 0x0d, 0x11, 0x40,\r | |
140 | 0x41, 0xed, 0x11, 0x88,\r | |
141 | 0xd1, 0xed, 0x13, 0xf6,\r | |
142 | 0xd0, 0xe0, 0x00, 0x78,\r | |
143 | 0xd1, 0xed, 0x13, 0xfa,\r | |
144 | 0xd0, 0xe0, 0x00, 0x7c,\r | |
145 | 0x48, 0x10, 0x00, 0x62,\r | |
146 | 0x48, 0x6d, 0x12, 0xf4,\r | |
147 | 0xd1, 0xa6, 0x00, 0x00,\r | |
148 | 0xd0, 0xa1, 0x00, 0x30,\r | |
149 | 0xd1, 0xe6, 0x00, 0x0c,\r | |
150 | 0xd0, 0xe1, 0x00, 0x28,\r | |
151 | 0x43, 0x00, 0x00, 0x60,\r | |
152 | 0x07, 0x00,\r | |
153 | 0x07, 0xbb,\r | |
154 | 0x0b, 0xcf,\r | |
155 | 0x0f, 0xab,\r | |
156 | 0x21, 0x13,\r | |
157 | 0x26, 0x01,\r | |
158 | 0x22, 0x04,\r | |
159 | 0x0a, 0xcf,\r | |
160 | 0x0e, 0xab,\r | |
161 | 0x08, 0xac,\r | |
162 | 0x08, 0xc0,\r | |
163 | 0x03, 0x0e,\r | |
164 | 0xde, 0x2d, 0x12, 0x1e,\r | |
165 | 0xc5, 0x50, 0x00, 0x33,\r | |
166 | 0x42, 0x2d, 0x11, 0xec,\r | |
167 | 0xde, 0x3d, 0x12, 0x1e,\r | |
168 | 0x9d, 0x3f,\r | |
169 | 0x22, 0x21,\r | |
170 | 0x9d, 0x4f,\r | |
171 | 0x42, 0x1d, 0x12, 0xb8,\r | |
172 | 0xc3, 0xf0, 0x00, 0x10,\r | |
173 | 0x20, 0x35,\r | |
174 | 0xd0, 0xad, 0x13, 0xea,\r | |
175 | 0xc8, 0xf0, 0x00, 0x30,\r | |
176 | 0x41, 0xed, 0x11, 0x70,\r | |
177 | 0x08, 0x9c,\r | |
178 | 0x08, 0xba,\r | |
179 | 0x48, 0xad, 0x13, 0xea,\r | |
180 | 0x48, 0xcd, 0x13, 0xee,\r | |
181 | 0xd1, 0xed, 0x13, 0xf2,\r | |
182 | 0xc5, 0xb0, 0x00, 0x18,\r | |
183 | 0x21, 0x82,\r | |
184 | 0x26, 0xb8,\r | |
185 | 0x98, 0x49,\r | |
186 | 0xde, 0x4d, 0x12, 0xe7,\r | |
187 | 0x9d, 0x3f,\r | |
188 | 0x22, 0x21,\r | |
189 | 0x9d, 0x4f,\r | |
190 | 0x42, 0x7d, 0x12, 0xb8,\r | |
191 | 0x20, 0x83,\r | |
192 | 0x98, 0x27,\r | |
193 | 0x98, 0x28,\r | |
194 | 0x98, 0x49,\r | |
195 | 0x9a, 0x3b,\r | |
196 | 0x41, 0x6d, 0x12, 0x7a,\r | |
197 | 0x22, 0x0f,\r | |
198 | 0x9d, 0x4f,\r | |
199 | 0xc3, 0xf0, 0x00, 0x19,\r | |
200 | 0x42, 0x3d, 0x12, 0xb8,\r | |
201 | 0xd0, 0xad, 0x13, 0xea,\r | |
202 | 0xc8, 0xf5, 0xff, 0xcc,\r | |
203 | 0x0a, 0xff,\r | |
204 | 0x48, 0xff, 0x12, 0xec,\r | |
205 | 0x41, 0xed, 0x11, 0x70,\r | |
206 | 0x08, 0x9c,\r | |
207 | 0x08, 0xca,\r | |
208 | 0x07, 0xaa,\r | |
209 | 0xc8, 0xf5, 0xff, 0xcc,\r | |
210 | 0xd3, 0xff, 0x12, 0xe8,\r | |
211 | 0x41, 0xed, 0x11, 0x70,\r | |
212 | 0x40, 0xcd, 0x12, 0xf2,\r | |
213 | 0x08, 0xba,\r | |
214 | 0x48, 0xad, 0x13, 0xea,\r | |
215 | 0x48, 0xcd, 0x13, 0xee,\r | |
216 | 0xd1, 0xed, 0x13, 0xf2,\r | |
217 | 0xde, 0x4d, 0x12, 0x6e,\r | |
218 | 0x9d, 0x3f,\r | |
219 | 0x22, 0x21,\r | |
220 | 0x98, 0x49,\r | |
221 | 0xde, 0x4d, 0x12, 0xd0,\r | |
222 | 0x9d, 0x3f,\r | |
223 | 0x22, 0x21,\r | |
224 | 0xde, 0x4d, 0x12, 0xa2,\r | |
225 | 0x9d, 0x3f,\r | |
226 | 0x22, 0x21,\r | |
227 | 0xd8, 0x4d, 0x12, 0xf2,\r | |
228 | 0xde, 0x4d, 0x12, 0xd1,\r | |
229 | 0x9d, 0x3f,\r | |
230 | 0x22, 0x21,\r | |
231 | 0xde, 0x4d, 0x12, 0xe7,\r | |
232 | 0x9d, 0x3f,\r | |
233 | 0x22, 0x21,\r | |
234 | 0x9d, 0x4f,\r | |
235 | 0x20, 0x81,\r | |
236 | 0xc3, 0xf0, 0x00, 0x53,\r | |
237 | 0x42, 0x3d, 0x12, 0xb8,\r | |
238 | 0x48, 0xfd, 0x12, 0xf2,\r | |
239 | 0x91, 0xfa,\r | |
240 | 0x06, 0xf9,\r | |
241 | 0xc8, 0x6d, 0x12, 0x2c,\r | |
242 | 0x98, 0x27,\r | |
243 | 0x98, 0x28,\r | |
244 | 0x9a, 0x3b,\r | |
245 | 0x98, 0x3f,\r | |
246 | 0xde, 0x3d, 0x12, 0xe6,\r | |
247 | 0xde, 0x2d, 0x11, 0xaf,\r | |
248 | 0x9d, 0x2f,\r | |
249 | 0x20, 0x81,\r | |
250 | 0xde, 0x2d, 0x12, 0x1e,\r | |
251 | 0x99, 0x20,\r | |
252 | 0xde, 0x2d, 0x12, 0x1e,\r | |
253 | 0x9d, 0x3f,\r | |
254 | 0x22, 0x21,\r | |
255 | 0x42, 0x1d, 0x12, 0xbc,\r | |
256 | 0xc3, 0xf0, 0x00, 0x10,\r | |
257 | 0x03, 0x3e,\r | |
258 | 0x0b, 0x07,\r | |
259 | 0x26, 0x02,\r | |
260 | 0xc4, 0x00, 0xff, 0x00,\r | |
261 | 0x0a, 0x70,\r | |
262 | 0x26, 0x91,\r | |
263 | 0x07, 0xbb,\r | |
264 | 0x40, 0xbd, 0x12, 0xf2,\r | |
265 | 0x03, 0x06,\r | |
266 | 0x24, 0xf1,\r | |
267 | 0x24, 0x10,\r | |
268 | 0x23, 0x04,\r | |
269 | 0x08, 0x14,\r | |
270 | 0x23, 0x02,\r | |
271 | 0x08, 0x13,\r | |
272 | 0x24, 0x01,\r | |
273 | 0xde, 0x0d, 0x10, 0xdc,\r | |
274 | 0x9a, 0x0f,\r | |
275 | 0x9a, 0x01,\r | |
276 | 0xde, 0x0d, 0x12, 0xe5,\r | |
277 | 0xd1, 0xed, 0x13, 0xf6,\r | |
278 | 0xd0, 0xe0, 0x00, 0x78,\r | |
279 | 0xd1, 0xed, 0x13, 0xfa,\r | |
280 | 0xd0, 0xe0, 0x00, 0x7c,\r | |
281 | 0x91, 0x0f,\r | |
282 | 0x95, 0x10,\r | |
283 | 0x22, 0x01,\r | |
284 | 0x00, 0x00, 0x00,\r | |
285 | 0x80,\r | |
286 | 0xc1,\r | |
287 | 0xc2,\r | |
288 | 0x14, 0x40, 0x40, 0x00,\r | |
289 | 0x01, 0x90,\r | |
290 | 0x01, 0x40,\r | |
291 | 0x04, 0xc0,\r | |
292 | 0x00, 0x00,\r | |
293 | 0x00, 0x00\r | |
294 | };\r | |
295 | \r | |
296 | /* Lower memory setup\r | |
297 | \r | |
298 | 78 = binary input device address\r | |
299 | 79 = binary device input command\r | |
300 | 7A = disk device number\r | |
301 | 7B = device code\r | |
302 | 7C = disk controller address\r | |
303 | 7D = selector channel address\r | |
304 | 7E:7F = operating system extension (user specified)\r | |
305 | */\r | |
306 | \r | |
307 | struct dboot_id {\r | |
308 | char *name;\r | |
309 | uint32 sw;\r | |
310 | uint32 cap;\r | |
311 | uint32 dtype;\r | |
312 | uint32 offset;\r | |
313 | uint32 adder;\r | |
314 | };\r | |
315 | \r | |
316 | static struct dboot_id dboot_tab[] = {\r | |
317 | { "DP", 0, 2, 0x31, o_DP0, 0 },\r | |
318 | { "DP", SWMASK ('F'), 9, 0x32, o_DP0, o_DPF },\r | |
319 | { "DP", 0, 9, 0x33, o_DP0, 0 },\r | |
320 | { "DM", 0, 64, 0x35, o_ID0, 0 },\r | |
321 | { "DM", 0, 244, 0x36, o_ID0, 0 },\r | |
322 | { NULL }\r | |
323 | };\r | |
324 | \r | |
325 | t_stat id_dboot (int32 u, DEVICE *dptr)\r | |
326 | {\r | |
327 | extern DIB pt_dib, sch_dib;\r | |
328 | extern uint32 PC;\r | |
329 | uint32 i, typ, ctlno, off, add, cap, sch_dev;\r | |
330 | UNIT *uptr;\r | |
331 | \r | |
332 | DIB *ddib = (DIB *) dptr->ctxt; /* get disk DIB */\r | |
333 | ctlno = ddib->dno; /* get ctrl devno */\r | |
334 | sch_dev = sch_dib.dno + ddib->sch; /* sch dev # */\r | |
335 | uptr = dptr->units + u; /* get capacity */\r | |
336 | cap = uptr->capac >> 20;\r | |
337 | for (i = typ = 0; dboot_tab[i].name != NULL; i++) {\r | |
338 | if ((strcmp (dboot_tab[i].name, dptr->name) == 0) &&\r | |
339 | (dboot_tab[i].cap == cap)) {\r | |
340 | typ = dboot_tab[i].dtype;\r | |
341 | off = dboot_tab[i].offset;\r | |
342 | add = dboot_tab[i].adder;\r | |
343 | break;\r | |
344 | }\r | |
345 | }\r | |
346 | if (typ == 0) return SCPE_NOFNC;\r | |
347 | \r | |
348 | IOWriteBlk (DBOOT_BEG, DBOOT_LEN, dboot_rom); /* copy boot */\r | |
349 | IOWriteB (AL_DEV, pt_dib.dno); /* bin input dev */\r | |
350 | IOWriteB (AL_IOC, 0x99);\r | |
351 | IOWriteB (AL_DSKU, ctlno + ((u + 1) * off) + add); /* disk param */\r | |
352 | IOWriteB (AL_DSKT, typ);\r | |
353 | IOWriteB (AL_DSKC, ctlno);\r | |
354 | IOWriteB (AL_SCH, sch_dev);\r | |
355 | PC = DBOOT_START;\r | |
356 | return SCPE_OK;\r | |
357 | }\r |