1
/* id32_dboot.c: Interdata 32b simulator disk bootstrap
3
Copyright (c) 2000-2004, 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
23
be 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-Feb-03 RMS Fixed for UNIX bootstrap, upper platter bootstrap
31
#define DBOOT_BEG 0x1000
32
#define DBOOT_START 0x100E
33
#define DBOOT_LEN (sizeof (dboot_rom) / sizeof (uint8))
35
/* Transcribed from 32b Bootstrap Loader, 03-074N81R03A13 */
37
static uint8 dboot_rom[] = {
38
0xca, 0xf0, 0x00, 0x30,
39
0xc5, 0xf0, 0x00, 0x3a,
43
0xe6, 0xd0, 0x0f, 0x30,
44
0xd1, 0xe0, 0x00, 0x78,
45
0xd0, 0xed, 0x03, 0x40,
46
0xd3, 0xf0, 0x00, 0x7e,
47
0xc4, 0xf0, 0x00, 0x0f,
48
0x41, 0xed, 0x00, 0xd0,
49
0xd2, 0xfd, 0x03, 0x25,
50
0xd3, 0xf0, 0x00, 0x7f,
52
0x41, 0xed, 0x00, 0xd0,
53
0xd2, 0xfd, 0x03, 0x26,
54
0xd3, 0xf0, 0x00, 0x7f,
55
0xc4, 0xf0, 0x00, 0x0f,
56
0x41, 0xed, 0x00, 0xd0,
57
0xd2, 0xfd, 0x03, 0x27,
58
0xd3, 0x20, 0x00, 0x7d,
59
0xd3, 0x30, 0x00, 0x7c,
60
0xd3, 0x40, 0x00, 0x7a,
62
0xd3, 0xf0, 0x00, 0x7b,
63
0xcb, 0xf0, 0x00, 0x33,
67
0xe6, 0x7d, 0x03, 0x50,
68
0xe6, 0x8d, 0x04, 0x4f,
70
0x41, 0xed, 0x01, 0xfc,
71
0xd1, 0xed, 0x03, 0x5c,
72
0xd0, 0xed, 0x03, 0x48,
73
0x58, 0xcd, 0x03, 0x58,
74
0x43, 0x3d, 0x01, 0x9c,
75
0xe6, 0x7d, 0x03, 0x50,
76
0x41, 0xed, 0x01, 0xfc,
77
0xe6, 0xed, 0x03, 0x54,
79
0xf8, 0xf0, 0x4f, 0x53, 0x33, 0x32,
80
0xd3, 0x7e, 0x00, 0x24,
81
0xc3, 0x70, 0x00, 0x10,
83
0xce, 0x70, 0x00, 0xe0,
85
0x55, 0xfe, 0x00, 0x00,
87
0x58, 0x6e, 0x00, 0x08,
89
0x55, 0x6d, 0x03, 0x24,
90
0x44, 0x3d, 0x01, 0xb2,
91
0xca, 0xe0, 0x00, 0x30,
93
0x42, 0x3d, 0x01, 0x66,
94
0x58, 0xcd, 0x03, 0x50,
95
0x42, 0x3d, 0x01, 0x52,
96
0x48, 0x10, 0x00, 0x7e,
97
0x42, 0x3d, 0x02, 0xf0,
98
0x58, 0xcd, 0x03, 0x48,
99
0x43, 0x3d, 0x02, 0xf0,
100
0x58, 0x8d, 0x03, 0x4c,
102
0x58, 0xce, 0x00, 0x0c,
103
0x58, 0x8e, 0x00, 0x10,
108
0xe6, 0xf0, 0x11, 0x18,
109
0x58, 0x0f, 0x00, 0x00,
110
0x50, 0x01, 0x00, 0x00,
111
0x59, 0x01, 0x00, 0x00,
112
0x42, 0x3d, 0x03, 0x08,
115
0xc5, 0xf0, 0x12, 0x78,
118
0xcb, 0xd0, 0x01, 0xe8,
122
0x41, 0xed, 0x01, 0xfc,
123
0xd1, 0xed, 0x03, 0x40,
124
0xd0, 0xe0, 0x00, 0x78,
125
0x43, 0x00, 0x00, 0x60,
126
0xde, 0x2d, 0x03, 0x28,
128
0x4d, 0x0d, 0x45, 0x00, 0x03, 0x30,
130
0x4d, 0x0d, 0x45, 0x00, 0x03, 0x38,
134
0x42, 0x2d, 0x02, 0x4a,
135
0xde, 0x3d, 0x03, 0x28,
139
0x42, 0x1d, 0x02, 0xf4,
140
0xc3, 0xf0, 0x00, 0x10,
145
0xde, 0x4d, 0x03, 0x2b,
149
0x42, 0x7d, 0x02, 0xf8,
151
0x41, 0x6d, 0x02, 0x96,
154
0xc3, 0xf0, 0x00, 0x19,
155
0x42, 0x3d, 0x02, 0xfc,
156
0xde, 0x4d, 0x03, 0x2c,
160
0xde, 0x4d, 0x03, 0x2e,
163
0xde, 0x4d, 0x03, 0x2d,
167
0xde, 0x4d, 0x03, 0x2f,
170
0xde, 0x4d, 0x03, 0x2b,
175
0xc3, 0xf0, 0x00, 0x53,
176
0x42, 0x3d, 0x03, 0x00,
180
0xe6, 0x6d, 0x02, 0x54,
196
0xde, 0x3d, 0x03, 0x2a,
197
0xde, 0x2d, 0x03, 0x29,
200
0xde, 0x2d, 0x03, 0x28,
205
0xde, 0x2d, 0x03, 0x28,
208
0x42, 0x1d, 0x03, 0x04,
209
0xc3, 0xf0, 0x00, 0x10,
213
0xc4, 0x00, 0xff, 0x00,
233
0xde, 0x0d, 0x03, 0x28,
235
0xde, 0x0d, 0x03, 0x28,
236
0xd1, 0xed, 0x03, 0x40,
237
0xd0, 0xe0, 0x00, 0x78,
241
0x00, 0x00, 0x00, 0x00,
257
/* Lower memory setup
259
78 = binary input device address
260
79 = binary device input command
261
7A = disk device number
263
7C = disk controller address
264
7D = selector channel address
265
7E:7F = operating system extension (user specified)
277
static struct dboot_id dboot_tab[] = {
278
{ "DP", 0, 2, 0x31, o_DP0, 0 },
279
{ "DP", SWMASK ('F'), 9, 0x32, o_DP0, o_DPF },
280
{ "DP", 0, 9, 0x33, o_DP0, 0 },
281
{ "DM", 0, 64, 0x35, o_ID0, 0 },
282
{ "DM", 0, 244, 0x36, o_ID0, 0 },
285
t_stat id_dboot (int32 u, DEVICE *dptr)
287
extern DIB ttp_dib, sch_dib;
289
extern int32 sim_switches;
290
uint32 i, typ, ctlno, off, add, cap, sch_dev;
293
DIB *ddib = (DIB *) dptr->ctxt; /* get disk DIB */
294
ctlno = ddib->dno; /* get ctrl devno */
295
sch_dev = sch_dib.dno + ddib->sch; /* sch dev # */
296
uptr = dptr->units + u; /* get capacity */
297
cap = uptr->capac >> 20;
298
for (i = typ = 0; dboot_tab[i].name != NULL; i++) {
299
if ((strcmp (dboot_tab[i].name, dptr->name) == 0) &&
300
((dboot_tab[i].sw == 0) || (dboot_tab[i].sw & sim_switches)) &&
301
(dboot_tab[i].cap == cap)) {
302
typ = dboot_tab[i].dtype;
303
off = dboot_tab[i].offset;
304
add = dboot_tab[i].adder;
306
if (typ == 0) return SCPE_NOFNC;
308
IOWriteBlk (DBOOT_BEG, DBOOT_LEN, dboot_rom); /* copy boot */
309
IOWriteB (AL_DEV, ttp_dib.dno); /* bin input dev */
310
IOWriteB (AL_IOC, 0xa3);
311
IOWriteB (AL_DSKU, ctlno + ((u + 1) * off) + add); /* disk dev addr */
312
IOWriteB (AL_DSKT, typ); /* disk type */
313
IOWriteB (AL_DSKC, ctlno); /* disk ctl addr */
314
IOWriteB (AL_SCH, sch_dev);