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