1 /* id32_dboot.c: Interdata 32b 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 errors (found by Davis Johnson)
27 17-Feb-03 RMS Fixed for UNIX bootstrap, upper platter bootstrap
32 #define DBOOT_BEG 0x1000
33 #define DBOOT_START 0x100E
34 #define DBOOT_LEN (sizeof (dboot_rom) / sizeof (uint8))
36 /* Transcribed from 32b Bootstrap Loader, 03-074N81R03A13 */
38 static uint8 dboot_rom
[] = {
39 0xca, 0xf0, 0x00, 0x30,
40 0xc5, 0xf0, 0x00, 0x3a,
44 0xe6, 0xd0, 0x0f, 0x30,
45 0xd1, 0xe0, 0x00, 0x78,
46 0xd0, 0xed, 0x03, 0x40,
47 0xd3, 0xf0, 0x00, 0x7e,
48 0xc4, 0xf0, 0x00, 0x0f,
49 0x41, 0xed, 0x00, 0xd0,
50 0xd2, 0xfd, 0x03, 0x25,
51 0xd3, 0xf0, 0x00, 0x7f,
53 0x41, 0xed, 0x00, 0xd0,
54 0xd2, 0xfd, 0x03, 0x26,
55 0xd3, 0xf0, 0x00, 0x7f,
56 0xc4, 0xf0, 0x00, 0x0f,
57 0x41, 0xed, 0x00, 0xd0,
58 0xd2, 0xfd, 0x03, 0x27,
59 0xd3, 0x20, 0x00, 0x7d,
60 0xd3, 0x30, 0x00, 0x7c,
61 0xd3, 0x40, 0x00, 0x7a,
63 0xd3, 0xf0, 0x00, 0x7b,
64 0xcb, 0xf0, 0x00, 0x33,
68 0xe6, 0x7d, 0x03, 0x50,
69 0xe6, 0x8d, 0x04, 0x4f,
71 0x41, 0xed, 0x01, 0xfc,
72 0xd1, 0xed, 0x03, 0x5c,
73 0xd0, 0xed, 0x03, 0x48,
74 0x58, 0xcd, 0x03, 0x58,
75 0x43, 0x3d, 0x01, 0x9c,
76 0xe6, 0x7d, 0x03, 0x50,
77 0x41, 0xed, 0x01, 0xfc,
78 0xe6, 0xed, 0x03, 0x54,
80 0xf8, 0xf0, 0x4f, 0x53, 0x33, 0x32,
81 0xd3, 0x7e, 0x00, 0x24,
82 0xc3, 0x70, 0x00, 0x10,
84 0xc3, 0x70, 0x00, 0xe0,
86 0x55, 0xfe, 0x00, 0x00,
88 0x58, 0x6e, 0x00, 0x08,
90 0x55, 0x6d, 0x03, 0x24,
91 0x43, 0x3d, 0x01, 0xb2,
92 0xca, 0xe0, 0x00, 0x30,
94 0x42, 0x3d, 0x01, 0x66,
95 0x58, 0xcd, 0x03, 0x50,
96 0x42, 0x3d, 0x01, 0x52,
97 0x48, 0x10, 0x00, 0x7e,
98 0x42, 0x3d, 0x02, 0xf0,
99 0x58, 0xcd, 0x03, 0x48,
100 0x43, 0x3d, 0x02, 0xf0,
101 0x58, 0x8d, 0x03, 0x4c,
103 0x58, 0xce, 0x00, 0x0c,
104 0x58, 0x8e, 0x00, 0x10,
109 0xe6, 0xf0, 0x11, 0x18,
110 0x58, 0x0f, 0x00, 0x00,
111 0x50, 0x01, 0x00, 0x00,
112 0x59, 0x01, 0x00, 0x00,
113 0x42, 0x3d, 0x03, 0x08,
116 0xc5, 0xf0, 0x12, 0x78,
119 0xcb, 0xd0, 0x01, 0xe8,
123 0x41, 0xed, 0x01, 0xfc,
124 0xd1, 0xed, 0x03, 0x40,
125 0xd0, 0xe0, 0x00, 0x78,
126 0x43, 0x00, 0x00, 0x60,
127 0xde, 0x2d, 0x03, 0x28,
129 0x4d, 0x0d, 0x45, 0x00, 0x03, 0x30,
131 0x4d, 0x0d, 0x45, 0x00, 0x03, 0x38,
135 0x42, 0x2d, 0x02, 0x4a,
136 0xde, 0x3d, 0x03, 0x28,
140 0x42, 0x1d, 0x02, 0xf4,
141 0xc3, 0xf0, 0x00, 0x10,
146 0xde, 0x4d, 0x03, 0x2b,
150 0x42, 0x7d, 0x02, 0xf8,
152 0x41, 0x6d, 0x02, 0x96,
155 0xc3, 0xf0, 0x00, 0x19,
156 0x42, 0x3d, 0x02, 0xfc,
157 0xde, 0x4d, 0x03, 0x2c,
161 0xde, 0x4d, 0x03, 0x2e,
164 0xde, 0x4d, 0x03, 0x2d,
168 0xde, 0x4d, 0x03, 0x2f,
171 0xde, 0x4d, 0x03, 0x2b,
176 0xc3, 0xf0, 0x00, 0x53,
177 0x42, 0x3d, 0x03, 0x00,
181 0xe6, 0x6d, 0x02, 0x54,
197 0xde, 0x3d, 0x03, 0x2a,
198 0xde, 0x2d, 0x03, 0x29,
201 0xde, 0x2d, 0x03, 0x28,
206 0xde, 0x2d, 0x03, 0x28,
209 0x42, 0x1d, 0x03, 0x04,
210 0xc3, 0xf0, 0x00, 0x10,
214 0xc4, 0x00, 0xff, 0x00,
234 0xde, 0x0d, 0x03, 0x28,
236 0xde, 0x0d, 0x03, 0x28,
237 0xd1, 0xed, 0x03, 0x40,
238 0xd0, 0xe0, 0x00, 0x78,
242 0x00, 0x00, 0x00, 0x00,
258 /* Lower memory setup
260 78 = binary input device address
261 79 = binary device input command
262 7A = disk device number
264 7C = disk controller address
265 7D = selector channel address
266 7E:7F = operating system extension (user specified)
278 static struct dboot_id dboot_tab
[] = {
279 { "DP", 0, 2, 0x31, o_DP0
, 0 },
280 { "DP", SWMASK ('F'), 9, 0x32, o_DP0
, o_DPF
},
281 { "DP", 0, 9, 0x33, o_DP0
, 0 },
282 { "DM", 0, 64, 0x35, o_ID0
, 0 },
283 { "DM", 0, 244, 0x36, o_ID0
, 0 },
287 t_stat
id_dboot (int32 u
, DEVICE
*dptr
)
289 extern DIB ttp_dib
, sch_dib
;
291 extern int32 sim_switches
;
292 uint32 i
, typ
, ctlno
, off
, add
, cap
, sch_dev
;
295 DIB
*ddib
= (DIB
*) dptr
->ctxt
; /* get disk DIB */
296 ctlno
= ddib
->dno
; /* get ctrl devno */
297 sch_dev
= sch_dib
.dno
+ ddib
->sch
; /* sch dev # */
298 uptr
= dptr
->units
+ u
; /* get capacity */
299 cap
= uptr
->capac
>> 20;
300 for (i
= typ
= 0; dboot_tab
[i
].name
!= NULL
; i
++) {
301 if ((strcmp (dboot_tab
[i
].name
, dptr
->name
) == 0) &&
302 ((dboot_tab
[i
].sw
== 0) || (dboot_tab
[i
].sw
& sim_switches
)) &&
303 (dboot_tab
[i
].cap
== cap
)) {
304 typ
= dboot_tab
[i
].dtype
;
305 off
= dboot_tab
[i
].offset
;
306 add
= dboot_tab
[i
].adder
;
310 if (typ
== 0) return SCPE_NOFNC
;
312 IOWriteBlk (DBOOT_BEG
, DBOOT_LEN
, dboot_rom
); /* copy boot */
313 IOWriteB (AL_DEV
, ttp_dib
.dno
); /* bin input dev */
314 IOWriteB (AL_IOC
, 0xa3);
315 IOWriteB (AL_DSKU
, ctlno
+ ((u
+ 1) * off
) + add
); /* disk dev addr */
316 IOWriteB (AL_DSKT
, typ
); /* disk type */
317 IOWriteB (AL_DSKC
, ctlno
); /* disk ctl addr */
318 IOWriteB (AL_SCH
, sch_dev
);