1 /* id16_dboot.c: Interdata 16b simulator disk bootstrap
3 Copyright (c) 2000-2006, Robert M. Supnik
5 Permission is hereby granted, free of charge, to any person obtaining a
6 copy of this software and associated documentation files (the "Software"),
7 to deal in the Software without restriction, including without limitation
8 the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 and/or sell copies of the Software, and to permit persons to whom the
10 Software is furnished to do so, subject to the following conditions:
12 The above copyright notice and this permission notice shall be included in
13 all copies or substantial portions of the Software.
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 ROBERT M SUPNIK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 Except as contained in this notice, the name of Robert M Supnik shall not be
23 used in advertising or otherwise to promote the sale, use or other dealings
24 in this Software without prior written authorization from Robert M Supnik.
26 17-Jul-06 RMS Fixed transcription error
31 #define DBOOT_BEG 0x1000
32 #define DBOOT_START 0x100e
33 #define DBOOT_LEN (sizeof (dboot_rom) / sizeof (uint8))
35 /* Boot ROM: transcription of OS/16 MT2 ALO Direct Access Loader */
37 static uint8 dboot_rom
[] = {
38 0xca, 0xf0, 0x00, 0x30,
39 0xc5, 0xf0, 0x00, 0x3a,
43 0xd1, 0xc0, 0x00, 0x78,
44 0xd0, 0xc0, 0x13, 0xf6,
46 0xc8, 0x10, 0x10, 0x00,
47 0xd3, 0xf0, 0x00, 0x7e,
48 0xc4, 0xf0, 0x00, 0x0f,
50 0xd2, 0xf0, 0x12, 0xe2,
51 0xd3, 0xf0, 0x00, 0x7f,
54 0xd2, 0xf0, 0x12, 0xe3,
55 0xd3, 0xf0, 0x00, 0x7f,
56 0xc4, 0xf0, 0x00, 0x0f,
58 0xd2, 0xf0, 0x12, 0xe4,
59 0xd3, 0x20, 0x00, 0x7d,
60 0xd3, 0x30, 0x00, 0x7c,
61 0xd3, 0x40, 0x00, 0x7a,
62 0xd3, 0x50, 0x00, 0x7b,
63 0xc8, 0x70, 0x12, 0xf6,
64 0xc8, 0x80, 0x13, 0xf5,
67 0x41, 0xe0, 0x11, 0x88,
68 0x48, 0xa0, 0x12, 0xfe,
69 0x48, 0xc0, 0x13, 0x00,
70 0x43, 0x00, 0x10, 0x98,
71 0xc8, 0x70, 0x12, 0xf6,
72 0x41, 0xe0, 0x11, 0x88,
73 0xc8, 0xe0, 0x12, 0xfa,
75 0xd3, 0x0e, 0x00, 0x24,
76 0xc3, 0x00, 0x00, 0x10,
78 0xca, 0xe0, 0x00, 0x30,
81 0x48, 0xa0, 0x12, 0xf6,
82 0x48, 0xc0, 0x12, 0xf8,
83 0x42, 0x30, 0x10, 0x70,
86 0x43, 0x00, 0x12, 0xb2,
88 0x42, 0x30, 0x10, 0x88,
89 0xc8, 0x60, 0x4f, 0x53,
90 0x45, 0x63, 0x00, 0x00,
92 0xc8, 0x60, 0x31, 0x36,
93 0x45, 0x6e, 0x00, 0x02,
95 0x48, 0x6e, 0x00, 0x08,
96 0x45, 0x60, 0x12, 0xe2,
98 0xd3, 0x6e, 0x00, 0x0a,
99 0xd4, 0x60, 0x12, 0xe4,
103 0xca, 0x60, 0x20, 0x00,
105 0x40, 0x06, 0x00, 0x00,
106 0x45, 0x06, 0x00, 0x00,
108 0x48, 0xae, 0x00, 0x0c,
109 0x48, 0xce, 0x00, 0x0e,
110 0x48, 0x0e, 0x00, 0x10,
111 0x48, 0x1e, 0x00, 0x12,
117 0xed, 0x00, 0x00, 0x08,
118 0xcb, 0x60, 0x02, 0xbe,
129 0xc8, 0xd1, 0xee, 0xc0,
130 0xc8, 0xf0, 0x11, 0x40,
131 0x48, 0x0f, 0x00, 0x00,
132 0x40, 0x01, 0x00, 0x00,
135 0xc5, 0xf0, 0x13, 0xfe,
138 0x40, 0xed, 0x12, 0xf4,
139 0x43, 0x0d, 0x11, 0x40,
140 0x41, 0xed, 0x11, 0x88,
141 0xd1, 0xed, 0x13, 0xf6,
142 0xd0, 0xe0, 0x00, 0x78,
143 0xd1, 0xed, 0x13, 0xfa,
144 0xd0, 0xe0, 0x00, 0x7c,
145 0x48, 0x10, 0x00, 0x62,
146 0x48, 0x6d, 0x12, 0xf4,
147 0xd1, 0xa6, 0x00, 0x00,
148 0xd0, 0xa1, 0x00, 0x30,
149 0xd1, 0xe6, 0x00, 0x0c,
150 0xd0, 0xe1, 0x00, 0x28,
151 0x43, 0x00, 0x00, 0x60,
164 0xde, 0x2d, 0x12, 0x1e,
165 0xc5, 0x50, 0x00, 0x33,
166 0x42, 0x2d, 0x11, 0xec,
167 0xde, 0x3d, 0x12, 0x1e,
171 0x42, 0x1d, 0x12, 0xb8,
172 0xc3, 0xf0, 0x00, 0x10,
174 0xd0, 0xad, 0x13, 0xea,
175 0xc8, 0xf0, 0x00, 0x30,
176 0x41, 0xed, 0x11, 0x70,
179 0x48, 0xad, 0x13, 0xea,
180 0x48, 0xcd, 0x13, 0xee,
181 0xd1, 0xed, 0x13, 0xf2,
182 0xc5, 0xb0, 0x00, 0x18,
186 0xde, 0x4d, 0x12, 0xe7,
190 0x42, 0x7d, 0x12, 0xb8,
196 0x41, 0x6d, 0x12, 0x7a,
199 0xc3, 0xf0, 0x00, 0x19,
200 0x42, 0x3d, 0x12, 0xb8,
201 0xd0, 0xad, 0x13, 0xea,
202 0xc8, 0xf5, 0xff, 0xcc,
204 0x48, 0xff, 0x12, 0xec,
205 0x41, 0xed, 0x11, 0x70,
209 0xc8, 0xf5, 0xff, 0xcc,
210 0xd3, 0xff, 0x12, 0xe8,
211 0x41, 0xed, 0x11, 0x70,
212 0x40, 0xcd, 0x12, 0xf2,
214 0x48, 0xad, 0x13, 0xea,
215 0x48, 0xcd, 0x13, 0xee,
216 0xd1, 0xed, 0x13, 0xf2,
217 0xde, 0x4d, 0x12, 0x6e,
221 0xde, 0x4d, 0x12, 0xd0,
224 0xde, 0x4d, 0x12, 0xa2,
227 0xd8, 0x4d, 0x12, 0xf2,
228 0xde, 0x4d, 0x12, 0xd1,
231 0xde, 0x4d, 0x12, 0xe7,
236 0xc3, 0xf0, 0x00, 0x53,
237 0x42, 0x3d, 0x12, 0xb8,
238 0x48, 0xfd, 0x12, 0xf2,
241 0xc8, 0x6d, 0x12, 0x2c,
246 0xde, 0x3d, 0x12, 0xe6,
247 0xde, 0x2d, 0x11, 0xaf,
250 0xde, 0x2d, 0x12, 0x1e,
252 0xde, 0x2d, 0x12, 0x1e,
255 0x42, 0x1d, 0x12, 0xbc,
256 0xc3, 0xf0, 0x00, 0x10,
260 0xc4, 0x00, 0xff, 0x00,
264 0x40, 0xbd, 0x12, 0xf2,
273 0xde, 0x0d, 0x10, 0xdc,
276 0xde, 0x0d, 0x12, 0xe5,
277 0xd1, 0xed, 0x13, 0xf6,
278 0xd0, 0xe0, 0x00, 0x78,
279 0xd1, 0xed, 0x13, 0xfa,
280 0xd0, 0xe0, 0x00, 0x7c,
288 0x14, 0x40, 0x40, 0x00,
296 /* Lower memory setup
298 78 = binary input device address
299 79 = binary device input command
300 7A = disk device number
302 7C = disk controller address
303 7D = selector channel address
304 7E:7F = operating system extension (user specified)
316 static struct dboot_id dboot_tab
[] = {
317 { "DP", 0, 2, 0x31, o_DP0
, 0 },
318 { "DP", SWMASK ('F'), 9, 0x32, o_DP0
, o_DPF
},
319 { "DP", 0, 9, 0x33, o_DP0
, 0 },
320 { "DM", 0, 64, 0x35, o_ID0
, 0 },
321 { "DM", 0, 244, 0x36, o_ID0
, 0 },
325 t_stat
id_dboot (int32 u
, DEVICE
*dptr
)
327 extern DIB pt_dib
, sch_dib
;
329 uint32 i
, typ
, ctlno
, off
, add
, cap
, sch_dev
;
332 DIB
*ddib
= (DIB
*) dptr
->ctxt
; /* get disk DIB */
333 ctlno
= ddib
->dno
; /* get ctrl devno */
334 sch_dev
= sch_dib
.dno
+ ddib
->sch
; /* sch dev # */
335 uptr
= dptr
->units
+ u
; /* get capacity */
336 cap
= uptr
->capac
>> 20;
337 for (i
= typ
= 0; dboot_tab
[i
].name
!= NULL
; i
++) {
338 if ((strcmp (dboot_tab
[i
].name
, dptr
->name
) == 0) &&
339 (dboot_tab
[i
].cap
== cap
)) {
340 typ
= dboot_tab
[i
].dtype
;
341 off
= dboot_tab
[i
].offset
;
342 add
= dboot_tab
[i
].adder
;
346 if (typ
== 0) return SCPE_NOFNC
;
348 IOWriteBlk (DBOOT_BEG
, DBOOT_LEN
, dboot_rom
); /* copy boot */
349 IOWriteB (AL_DEV
, pt_dib
.dno
); /* bin input dev */
350 IOWriteB (AL_IOC
, 0x99);
351 IOWriteB (AL_DSKU
, ctlno
+ ((u
+ 1) * off
) + add
); /* disk param */
352 IOWriteB (AL_DSKT
, typ
);
353 IOWriteB (AL_DSKC
, ctlno
);
354 IOWriteB (AL_SCH
, sch_dev
);