First Commit of my working state
[simh.git] / VAX / vax780_syslist.c
1 /* vax_syslist.c: VAX device list
2
3 Copyright (c) 1998-2006, 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 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.
25
26 17-May-06 RMS Added CR11/CD11 support (from John Dundas)
27 01-Oct-04 RMS Cloned from vax_sys.c
28 */
29
30 #include "vax_defs.h"
31
32 char sim_name[] = "VAX780";
33
34 extern DEVICE cpu_dev;
35 extern DEVICE tlb_dev;
36 extern DEVICE sbi_dev;
37 extern DEVICE mctl_dev[MCTL_NUM];
38 extern DEVICE uba_dev;
39 extern DEVICE mba_dev[MBA_NUM];
40 extern DEVICE clk_dev;
41 extern DEVICE tmr_dev;
42 extern DEVICE tti_dev, tto_dev;
43 extern DEVICE fl_dev;
44 extern DEVICE cr_dev;
45 extern DEVICE lpt_dev;
46 extern DEVICE rq_dev, rqb_dev, rqc_dev, rqd_dev;
47 extern DEVICE rl_dev;
48 extern DEVICE hk_dev;
49 extern DEVICE rp_dev;
50 extern DEVICE ry_dev;
51 extern DEVICE ts_dev;
52 extern DEVICE tq_dev;
53 extern DEVICE tu_dev;
54 extern DEVICE dz_dev;
55 extern DEVICE xu_dev, xub_dev;
56
57 extern int32 sim_switches;
58 extern UNIT cpu_unit;
59 extern void WriteB (uint32 pa, int32 val);
60 extern void rom_wr_B (int32 pa, int32 val);
61
62 DEVICE *sim_devices[] = {
63 &cpu_dev,
64 &tlb_dev,
65 &sbi_dev,
66 &mctl_dev[0],
67 &mctl_dev[1],
68 &uba_dev,
69 &mba_dev[0],
70 &mba_dev[1],
71 &clk_dev,
72 &tmr_dev,
73 &tti_dev,
74 &tto_dev,
75 &fl_dev,
76 &dz_dev,
77 &cr_dev,
78 &lpt_dev,
79 &rp_dev,
80 &rl_dev,
81 &hk_dev,
82 &rq_dev,
83 &rqb_dev,
84 &rqc_dev,
85 &rqd_dev,
86 &ry_dev,
87 &tu_dev,
88 &ts_dev,
89 &tq_dev,
90 &xu_dev,
91 &xub_dev,
92 NULL
93 };
94
95 /* Binary loader
96
97 The binary loader handles absolute system images, that is, system
98 images linked /SYSTEM. These are simply a byte stream, with no
99 origin or relocation information.
100
101 -r load ROM0
102 -s load ROM1
103 -o for memory, specify origin
104 */
105
106 t_stat sim_load (FILE *fileref, char *cptr, char *fnam, int flag)
107 {
108 t_stat r;
109 int32 val;
110 uint32 origin, limit;
111
112 if (flag) return SCPE_ARG; /* dump? */
113 origin = 0; /* memory */
114 limit = (uint32) cpu_unit.capac;
115 if (sim_switches & SWMASK ('O')) { /* origin? */
116 origin = (int32) get_uint (cptr, 16, 0xFFFFFFFF, &r);
117 if (r != SCPE_OK) return SCPE_ARG;
118 }
119
120 while ((val = getc (fileref)) != EOF) { /* read byte stream */
121 if (sim_switches & SWMASK ('R')) { /* ROM0? */
122 if (origin >= ROMSIZE) return SCPE_NXM;
123 rom_wr_B (ROM0BASE + origin, val);
124 }
125 else if (sim_switches & SWMASK ('S')) { /* ROM1? */
126 if (origin >= ROMSIZE) return SCPE_NXM;
127 rom_wr_B (ROM1BASE + origin, val);
128 }
129 else {
130 if (origin >= limit) return SCPE_NXM; /* NXM? */
131 WriteB (origin, val); /* memory */
132 }
133 origin = origin + 1;
134 }
135 return SCPE_OK;
136 }
137
138