~ubuntu-branches/ubuntu/utopic/simh/utopic

« back to all changes in this revision

Viewing changes to Interdata/id32_dboot.c

  • Committer: Bazaar Package Importer
  • Author(s): Vince Mulhollon
  • Date: 2004-04-20 20:01:26 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040420200126-ehsuleda8xcgi51h
Tags: 3.2.0-1
New upstream 3.2.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* id32_dboot.c: Interdata 32b simulator disk bootstrap
 
2
 
 
3
   Copyright (c) 2000-2004, Robert M. Supnik
 
4
 
 
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:
 
11
 
 
12
   The above copyright notice and this permission notice shall be included in
 
13
   all copies or substantial portions of the Software.
 
14
 
 
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.
 
21
 
 
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.
 
25
 
 
26
   17-Feb-03    RMS     Fixed for UNIX bootstrap, upper platter bootstrap
 
27
*/
 
28
 
 
29
#include "id_defs.h"
 
30
 
 
31
#define DBOOT_BEG       0x1000
 
32
#define DBOOT_START     0x100E
 
33
#define DBOOT_LEN       (sizeof (dboot_rom) / sizeof (uint8))
 
34
 
 
35
/* Transcribed from 32b Bootstrap Loader, 03-074N81R03A13 */
 
36
 
 
37
static uint8 dboot_rom[] = {
 
38
 0xca, 0xf0, 0x00, 0x30,
 
39
 0xc5, 0xf0, 0x00, 0x3a,
 
40
 0x02, 0x8e,
 
41
 0x26, 0xf7,
 
42
 0x03, 0x0e,
 
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,
 
51
 0x10, 0xf4,
 
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,
 
61
 0x24, 0x50,
 
62
 0xd3, 0xf0, 0x00, 0x7b,
 
63
 0xcb, 0xf0, 0x00, 0x33,
 
64
 0x23, 0x23,
 
65
 0x11, 0xf1,
 
66
 0x08, 0x5f,
 
67
 0xe6, 0x7d, 0x03, 0x50,
 
68
 0xe6, 0x8d, 0x04, 0x4f,
 
69
 0x07, 0xcc,
 
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,
 
78
 0x24, 0x15,
 
79
 0xf8, 0xf0, 0x4f, 0x53, 0x33, 0x32,
 
80
 0xd3, 0x7e, 0x00, 0x24,
 
81
 0xc3, 0x70, 0x00, 0x10,
 
82
 0x23, 0x3e,
 
83
 0xce, 0x70, 0x00, 0xe0,
 
84
 0x21, 0xeb,
 
85
 0x55, 0xfe, 0x00, 0x00,
 
86
 0x21, 0x38,
 
87
 0x58, 0x6e, 0x00, 0x08,
 
88
 0x10, 0x68,
 
89
 0x55, 0x6d, 0x03, 0x24,
 
90
 0x44, 0x3d, 0x01, 0xb2,
 
91
 0xca, 0xe0, 0x00, 0x30,
 
92
 0x27, 0x11,
 
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,
 
101
 0x23, 0x07,
 
102
 0x58, 0xce, 0x00, 0x0c,
 
103
 0x58, 0x8e, 0x00, 0x10,
 
104
 0x0b, 0x8c,
 
105
 0x26, 0xc1,
 
106
 0x11, 0x88,
 
107
 0x08, 0x18,
 
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,
 
113
 0x26, 0xf4,
 
114
 0x26, 0x14,
 
115
 0xc5, 0xf0, 0x12, 0x78,
 
116
 0x20, 0x8c,
 
117
 0x08, 0xd8,
 
118
 0xcb, 0xd0, 0x01, 0xe8,
 
119
 0x03, 0x08,
 
120
 0x27, 0x81,
 
121
 0x07, 0x77,
 
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,
 
127
 0x08, 0x0c,
 
128
 0x4d, 0x0d, 0x45, 0x00, 0x03, 0x30,
 
129
 0x08, 0x91,
 
130
 0x4d, 0x0d, 0x45, 0x00, 0x03, 0x38,
 
131
 0x08, 0xa1,
 
132
 0x08, 0xb0,
 
133
 0x08, 0x55,
 
134
 0x42, 0x2d, 0x02, 0x4a,
 
135
 0xde, 0x3d, 0x03, 0x28,
 
136
 0x9d, 0x3f,
 
137
 0x22, 0x21,
 
138
 0x9d, 0x4f,
 
139
 0x42, 0x1d, 0x02, 0xf4,
 
140
 0xc3, 0xf0, 0x00, 0x10,
 
141
 0x20, 0x35,
 
142
 0x11, 0xa5,
 
143
 0x06, 0xba,
 
144
 0x98, 0x49,
 
145
 0xde, 0x4d, 0x03, 0x2b,
 
146
 0x9d, 0x3f,
 
147
 0x22, 0x21,
 
148
 0x9d, 0x4f,
 
149
 0x42, 0x7d, 0x02, 0xf8,
 
150
 0x20, 0x83,
 
151
 0x41, 0x6d, 0x02, 0x96,
 
152
 0x22, 0x0b,
 
153
 0x9d, 0x4f,
 
154
 0xc3, 0xf0, 0x00, 0x19,
 
155
 0x42, 0x3d, 0x02, 0xfc,
 
156
 0xde, 0x4d, 0x03, 0x2c,
 
157
 0x9d, 0x3f,
 
158
 0x22, 0x21,
 
159
 0x98, 0x49,
 
160
 0xde, 0x4d, 0x03, 0x2e,
 
161
 0x9d, 0x3f,
 
162
 0x22, 0x21,
 
163
 0xde, 0x4d, 0x03, 0x2d,
 
164
 0x9d, 0x3f,
 
165
 0x22, 0x21,
 
166
 0x98, 0x4a,
 
167
 0xde, 0x4d, 0x03, 0x2f,
 
168
 0x0d, 0x3f,
 
169
 0x22, 0x21,
 
170
 0xde, 0x4d, 0x03, 0x2b,
 
171
 0x9d, 0x3f,
 
172
 0x22, 0x21,
 
173
 0x9d, 0x4f,
 
174
 0x20, 0x81,
 
175
 0xc3, 0xf0, 0x00, 0x53,
 
176
 0x42, 0x3d, 0x03, 0x00,
 
177
 0x08, 0xfa,
 
178
 0x11, 0xfa,
 
179
 0x06, 0xf9,
 
180
 0xe6, 0x6d, 0x02, 0x54,
 
181
 0x34, 0x77,
 
182
 0x9a, 0x27,
 
183
 0x34, 0x77,
 
184
 0x98, 0x27,
 
185
 0x34, 0x88,
 
186
 0x9a, 0x28,
 
187
 0x34, 0x88,
 
188
 0x98, 0x28,
 
189
 0x08, 0x55,
 
190
 0x21, 0x24,
 
191
 0x98, 0x49,
 
192
 0x9a, 0x3b,
 
193
 0x23, 0x03,
 
194
 0x9a, 0x3b,
 
195
 0x98, 0x3f,
 
196
 0xde, 0x3d, 0x03, 0x2a,
 
197
 0xde, 0x2d, 0x03, 0x29,
 
198
 0x9d, 0x2f,
 
199
 0x20, 0x81,
 
200
 0xde, 0x2d, 0x03, 0x28,
 
201
 0x9b, 0x20,
 
202
 0x99, 0x21,
 
203
 0x34, 0x00,
 
204
 0x06, 0x01,
 
205
 0xde, 0x2d, 0x03, 0x28,
 
206
 0x9d, 0x3f,
 
207
 0x22, 0x21,
 
208
 0x42, 0x1d, 0x03, 0x04,
 
209
 0xc3, 0xf0, 0x00, 0x10,
 
210
 0x03, 0x3e,
 
211
 0x0b, 0x07,
 
212
 0x26, 0x04,
 
213
 0xc4, 0x00, 0xff, 0x00,
 
214
 0x0a, 0x70,
 
215
 0x26, 0x91,
 
216
 0x07, 0xaa,
 
217
 0x07, 0xbb,
 
218
 0x03, 0x06,
 
219
 0x24, 0x11,
 
220
 0x23, 0x0c,
 
221
 0x24, 0x12,
 
222
 0x23, 0x0a,
 
223
 0x24, 0x13,
 
224
 0x23, 0x08,
 
225
 0x24, 0x14,
 
226
 0x23, 0x06,
 
227
 0x24, 0x15,
 
228
 0x23, 0x04,
 
229
 0x24, 0x16,
 
230
 0x23, 0x02,
 
231
 0x24, 0x17,
 
232
 0x24, 0x01,
 
233
 0xde, 0x0d, 0x03, 0x28,
 
234
 0x9a, 0x01,
 
235
 0xde, 0x0d, 0x03, 0x28,
 
236
 0xd1, 0xed, 0x03, 0x40,
 
237
 0xd0, 0xe0, 0x00, 0x78,
 
238
 0x11, 0x0f,
 
239
 0x95, 0x10,
 
240
 0x22, 0x01,
 
241
 0x00, 0x00, 0x00, 0x00,
 
242
 0x48, 0x30,
 
243
 0xc1, 0xc2,
 
244
 0xc8, 0xc4,
 
245
 0xd0, 0xe0,
 
246
 0x00, 0x30,
 
247
 0x01, 0x90,
 
248
 0x01, 0x40,
 
249
 0x04, 0xc0,
 
250
 0x00, 0x18,
 
251
 0x00, 0x14,
 
252
 0x00, 0x40,
 
253
 0x00, 0x40,
 
254
 0x00
 
255
};
 
256
 
 
257
/* Lower memory setup
 
258
 
 
259
        78      =       binary input device address
 
260
        79      =       binary device input command
 
261
        7A      =       disk device number
 
262
        7B      =       device code
 
263
        7C      =       disk controller address
 
264
        7D      =       selector channel address
 
265
        7E:7F   =       operating system extension (user specified)
 
266
*/
 
267
 
 
268
struct dboot_id {
 
269
        char    *name;
 
270
        uint32  sw;
 
271
        uint32  cap;
 
272
        uint32  dtype;
 
273
        uint32  offset;
 
274
        uint32  adder;
 
275
};
 
276
 
 
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 },
 
283
        { NULL }  };
 
284
 
 
285
t_stat id_dboot (int32 u, DEVICE *dptr)
 
286
{
 
287
extern DIB ttp_dib, sch_dib;
 
288
extern uint32 PC;
 
289
extern int32 sim_switches;
 
290
uint32 i, typ, ctlno, off, add, cap, sch_dev;
 
291
UNIT *uptr;
 
292
 
 
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;
 
305
                break;  }  }
 
306
if (typ == 0) return SCPE_NOFNC;
 
307
 
 
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);
 
315
PC = DBOOT_START;
 
316
return SCPE_OK;
 
317
}