|
1 | | -/* Program to configure the floating address space of a PDP-11 or VAX |
2 | | -
|
3 | | - Copyright (c) 2002, 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 | | - |
27 | | -#include <ctype.h> |
28 | | -#include <errno.h> |
29 | | -#include <stdio.h> |
30 | | -#include <stddef.h> |
31 | | -#include <stdlib.h> |
32 | | -#include <string.h> |
33 | | - |
34 | | -#define RANK_LNT 34 |
35 | | - |
36 | | -int csr, i, j; |
37 | | -unsigned int rank, num; |
38 | | -char *cp, *ocp, inp[100]; |
39 | | -unsigned char numctl[RANK_LNT]; |
40 | | -unsigned char modtab[RANK_LNT] = { |
41 | | - 0X07, 0X0f, 0X07, 0X07, 0X07, 0X07, 0X07, 0X07, |
42 | | - 0X07, 0X07, 0X07, 0X0f, 0X07, 0X07, 0X0f, 0X07, |
43 | | - 0X07, 0X07, 0X07, 0X07, 0X07, 0X07, 0X07, 0X0f, |
44 | | - 0X07, 0X03, 0X1f, 0X0f, 0X0f, 0X03, 0X0F, 0x0F, |
45 | | - 0x1F, 0X1F }; |
46 | | -unsigned int fixtab[RANK_LNT] = { |
47 | | - 0, 0, 0, 0, 0, 0, 0, 0, |
48 | | - 0, 0, 0, 0, 0, 0774400, 0770460, 0, |
49 | | - 0, 0777170, 0, 0772410, 0, 0, 0, 0, |
50 | | - 0774440, 0772150, 0, 0, 0, 0774500, 0, 0, |
51 | | - 0, 0 }; |
52 | | -char *namtab[RANK_LNT] = { |
53 | | - "DJ11", "DH11", "DQ11", "DU11", "DUP11", "LK11A", "DMC11", "DZ11", |
54 | | - "KMC11", "LPP11", "VMV21", "VMV31", "DWR70", "RL11", "LPA11K", "KW11C", |
55 | | - "rsvd", "RX11", "DR11W", "DR11B", "DMP11", "DPV11", "ISB11", "DMV11", |
56 | | - "DEUNA", "UDA50", "DMF32", "KMS11", "VS100", "TK50", "KMV11", "DHV11", |
57 | | - "DMZ32", "CP132" }; |
58 | | - |
59 | | -int main (int argc, char *argv[]) |
60 | | -{ |
61 | | -(void) argc; |
62 | | -(void) argv; |
63 | | - |
64 | | -for ( ;; ) { |
65 | | - for (i = 0; i < RANK_LNT; i++) numctl[i] = 0; |
66 | | - printf ("Enter configuration data\n"); |
67 | | - for ( ;; ) { |
68 | | - printf ("Name:\t"); |
69 | | - if (fgets (inp, sizeof (inp), stdin) == NULL) return 0; |
70 | | - for (cp = inp; *cp != 0; cp++) if (*cp == '\r' || *cp == '\n') *cp = '\0'; |
71 | | - if (*inp == 0) break; |
72 | | - for (cp = inp; *cp != 0; cp++) *cp = toupper (*cp); |
73 | | - for (rank = 0; rank < RANK_LNT; rank++) { |
74 | | - if (strcmp (inp, namtab[rank]) == 0) break; } |
75 | | - if (rank >= RANK_LNT) { |
76 | | - printf ("Unknown controller, valid names are:"); |
77 | | - for (i = 0; i < RANK_LNT; i++) { |
78 | | - if ((i & 07) == 0) printf ("\n"); |
79 | | - printf (" %s", namtab[i]); } |
80 | | - printf ("\n"); |
81 | | - continue; } |
82 | | - printf ("Number:\t"); |
83 | | - fgets (inp, sizeof (inp), stdin); |
84 | | - errno = 0; |
85 | | - num = strtoul (inp, &ocp, 10); |
86 | | - if (errno || (inp == ocp)) { |
87 | | - printf ("Input error\n"); |
88 | | - continue; } |
89 | | - if (num > 8) { |
90 | | - printf ("Too many controllers\n"); |
91 | | - continue; } |
92 | | - numctl[rank] = num; |
93 | | - } |
94 | | - |
95 | | - printf ("\nRank\tName\tCtrl#\t CSR\n\n"); |
96 | | - csr = 0760010; |
97 | | - for (i = 0; i < RANK_LNT; i++) { |
98 | | - if (numctl[i] == 0) { |
99 | | - printf (" %02d\t%s\tgap\t%06o\n", i+1, namtab[i], csr); } |
100 | | - else { |
101 | | - if (fixtab[i]) |
102 | | - printf (" %02d\t%s\t 1\t%06o*\n", i+1, namtab[i], fixtab[i]); |
103 | | - else { |
104 | | - printf (" %02d\t%s\t 1\t%06o\n", i+1, namtab[i], csr); |
105 | | - csr = (csr + modtab[i] + 1) & ~modtab[i]; } |
106 | | - for (j = 1; j < numctl[i]; j++) { |
107 | | - printf ("\t\t %d\t%06o\n", j + 1, csr); |
108 | | - csr = (csr + modtab[i] + 1) & ~modtab[i]; } |
109 | | - printf (" %%\t\tgap\t%06o\n", csr); |
110 | | - } |
111 | | - if ((i + 1) < RANK_LNT) csr = (csr + modtab[i+1] + 1) & ~modtab[i+1]; |
112 | | - } |
113 | | - printf ("\n\n"); |
114 | | - } |
115 | | -return 0; |
116 | | -} |
| 1 | +/* Program to configure the floating address space of a PDP-11 or VAX |
| 2 | +
|
| 3 | + Copyright (c) 2002, 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 | + |
| 27 | +#include <ctype.h> |
| 28 | +#include <errno.h> |
| 29 | +#include <stdio.h> |
| 30 | +#include <stddef.h> |
| 31 | +#include <stdlib.h> |
| 32 | +#include <string.h> |
| 33 | + |
| 34 | +#define RANK_LNT 34 |
| 35 | + |
| 36 | +int csr, i, j; |
| 37 | +unsigned int rank, num; |
| 38 | +char *cp, *ocp, inp[100]; |
| 39 | +unsigned char numctl[RANK_LNT]; |
| 40 | +unsigned char modtab[RANK_LNT] = { |
| 41 | + 0X07, 0X0f, 0X07, 0X07, 0X07, 0X07, 0X07, 0X07, |
| 42 | + 0X07, 0X07, 0X07, 0X0f, 0X07, 0X07, 0X0f, 0X07, |
| 43 | + 0X07, 0X07, 0X07, 0X07, 0X07, 0X07, 0X07, 0X0f, |
| 44 | + 0X07, 0X03, 0X1f, 0X0f, 0X0f, 0X03, 0X0F, 0x0F, |
| 45 | + 0x1F, 0X1F }; |
| 46 | +unsigned int fixtab[RANK_LNT] = { |
| 47 | + 0, 0, 0, 0, 0, 0, 0, 0, |
| 48 | + 0, 0, 0, 0, 0, 0774400, 0770460, 0, |
| 49 | + 0, 0777170, 0, 0772410, 0, 0, 0, 0, |
| 50 | + 0774440, 0772150, 0, 0, 0, 0774500, 0, 0, |
| 51 | + 0, 0 }; |
| 52 | +char *namtab[RANK_LNT] = { |
| 53 | + "DJ11", "DH11", "DQ11", "DU11", "DUP11", "LK11A", "DMC11", "DZ11", |
| 54 | + "KMC11", "LPP11", "VMV21", "VMV31", "DWR70", "RL11", "LPA11K", "KW11C", |
| 55 | + "rsvd", "RX11", "DR11W", "DR11B", "DMP11", "DPV11", "ISB11", "DMV11", |
| 56 | + "DEUNA", "UDA50", "DMF32", "KMS11", "VS100", "TK50", "KMV11", "DHV11", |
| 57 | + "DMZ32", "CP132" }; |
| 58 | + |
| 59 | +int main (int argc, char *argv[]) |
| 60 | +{ |
| 61 | +(void) argc; |
| 62 | +(void) argv; |
| 63 | + |
| 64 | +for ( ;; ) { |
| 65 | + for (i = 0; i < RANK_LNT; i++) numctl[i] = 0; |
| 66 | + printf ("Enter configuration data\n"); |
| 67 | + for ( ;; ) { |
| 68 | + printf ("Name:\t"); |
| 69 | + if (fgets (inp, sizeof (inp), stdin) == NULL) return 0; |
| 70 | + for (cp = inp; *cp != 0; cp++) if (*cp == '\r' || *cp == '\n') *cp = '\0'; |
| 71 | + if (*inp == 0) break; |
| 72 | + for (cp = inp; *cp != 0; cp++) *cp = toupper (*cp); |
| 73 | + for (rank = 0; rank < RANK_LNT; rank++) { |
| 74 | + if (strcmp (inp, namtab[rank]) == 0) break; } |
| 75 | + if (rank >= RANK_LNT) { |
| 76 | + printf ("Unknown controller, valid names are:"); |
| 77 | + for (i = 0; i < RANK_LNT; i++) { |
| 78 | + if ((i & 07) == 0) printf ("\n"); |
| 79 | + printf (" %s", namtab[i]); } |
| 80 | + printf ("\n"); |
| 81 | + continue; } |
| 82 | + printf ("Number:\t"); |
| 83 | + fgets (inp, sizeof (inp), stdin); |
| 84 | + errno = 0; |
| 85 | + num = strtoul (inp, &ocp, 10); |
| 86 | + if (errno || (inp == ocp)) { |
| 87 | + printf ("Input error\n"); |
| 88 | + continue; } |
| 89 | + if (num > 8) { |
| 90 | + printf ("Too many controllers\n"); |
| 91 | + continue; } |
| 92 | + numctl[rank] = num; |
| 93 | + } |
| 94 | + |
| 95 | + printf ("\nRank\tName\tCtrl#\t CSR\n\n"); |
| 96 | + csr = 0760010; |
| 97 | + for (i = 0; i < RANK_LNT; i++) { |
| 98 | + if (numctl[i] == 0) { |
| 99 | + printf (" %02d\t%s\tgap\t%06o\n", i+1, namtab[i], csr); } |
| 100 | + else { |
| 101 | + if (fixtab[i]) |
| 102 | + printf (" %02d\t%s\t 1\t%06o*\n", i+1, namtab[i], fixtab[i]); |
| 103 | + else { |
| 104 | + printf (" %02d\t%s\t 1\t%06o\n", i+1, namtab[i], csr); |
| 105 | + csr = (csr + modtab[i] + 1) & ~modtab[i]; } |
| 106 | + for (j = 1; j < numctl[i]; j++) { |
| 107 | + printf ("\t\t %d\t%06o\n", j + 1, csr); |
| 108 | + csr = (csr + modtab[i] + 1) & ~modtab[i]; } |
| 109 | + printf (" %%\t\tgap\t%06o\n", csr); |
| 110 | + } |
| 111 | + if ((i + 1) < RANK_LNT) csr = (csr + modtab[i+1] + 1) & ~modtab[i+1]; |
| 112 | + } |
| 113 | + printf ("\n\n"); |
| 114 | + } |
| 115 | +return 0; |
| 116 | +} |
0 commit comments