1 | /*
|
---|
2 | =============================================================================
|
---|
3 | etloc.c -- location field handlers
|
---|
4 | Version 11 -- 1988-07-13 -- D.N. Lynx Crowe
|
---|
5 | =============================================================================
|
---|
6 | */
|
---|
7 |
|
---|
8 | #include "stddefs.h"
|
---|
9 | #include "fields.h"
|
---|
10 | #include "hwdefs.h"
|
---|
11 | #include "fpu.h"
|
---|
12 | #include "graphdef.h"
|
---|
13 | #include "vsdd.h"
|
---|
14 | #include "vsddsw.h"
|
---|
15 | #include "score.h"
|
---|
16 | #include "scfns.h"
|
---|
17 |
|
---|
18 | #include "midas.h"
|
---|
19 | #include "scdsp.h"
|
---|
20 | #include "instdsp.h"
|
---|
21 |
|
---|
22 | extern unsigned setsr(unsigned sr);
|
---|
23 |
|
---|
24 | extern unsigned *obj8;
|
---|
25 |
|
---|
26 | extern unsigned curintp;
|
---|
27 |
|
---|
28 | extern short ctrsw;
|
---|
29 | extern short timemlt;
|
---|
30 | extern short recsw;
|
---|
31 | extern short stccol;
|
---|
32 |
|
---|
33 | extern short grploc[];
|
---|
34 | extern short grpmode[];
|
---|
35 | extern short grpstat[];
|
---|
36 | extern short loctab[];
|
---|
37 | extern short vce2grp[];
|
---|
38 |
|
---|
39 | extern short expbit[];
|
---|
40 |
|
---|
41 | extern struct gdsel *gdstbc[];
|
---|
42 |
|
---|
43 | extern struct instdef vbufs[];
|
---|
44 |
|
---|
45 | /* |
---|
46 |
|
---|
47 | */
|
---|
48 |
|
---|
49 | /*
|
---|
50 | =============================================================================
|
---|
51 | et_loc() -- load edit buffer
|
---|
52 | =============================================================================
|
---|
53 | */
|
---|
54 |
|
---|
55 | short et_loc(short n)
|
---|
56 | {
|
---|
57 | ebuf[0] =grploc[n] + 1 + '0';
|
---|
58 | ebuf[1] = '\0';
|
---|
59 | ebflag = TRUE;
|
---|
60 | return(SUCCESS);
|
---|
61 | }
|
---|
62 |
|
---|
63 | /* |
---|
64 |
|
---|
65 | */
|
---|
66 |
|
---|
67 | /*
|
---|
68 | =============================================================================
|
---|
69 | setloc() -- set location
|
---|
70 | =============================================================================
|
---|
71 | */
|
---|
72 |
|
---|
73 | void setloc(short grp, short loc)
|
---|
74 | {
|
---|
75 | register short g, i, val;
|
---|
76 | register long ltmp;
|
---|
77 | register unsigned *fpu;
|
---|
78 | register struct idfnhdr *fp;
|
---|
79 | unsigned fpmant, fpexp;
|
---|
80 | short oldsr;
|
---|
81 | short nop;
|
---|
82 |
|
---|
83 | grploc[grp] = loc;
|
---|
84 | val = (loctab[loc] << 1) ^ 0x8000;
|
---|
85 | g = grp + 1;
|
---|
86 |
|
---|
87 | fpmant = (((long)curintp & 0x0000FFF0L) *
|
---|
88 | ((long)timemlt & 0x0000FFFFL)) >> 15;
|
---|
89 |
|
---|
90 | fpexp = expbit[curintp & 0x000F];
|
---|
91 |
|
---|
92 | /* |
---|
93 |
|
---|
94 | */
|
---|
95 | for (i = 0; i < 12; i++)
|
---|
96 | if (g EQ vce2grp[i]) {
|
---|
97 |
|
---|
98 | fp = &vbufs[i].idhfnc[4];
|
---|
99 | fpu = io_fpu + FPU_OFNC + (i << 8) + 0x0040;
|
---|
100 |
|
---|
101 | oldsr = setsr(0x2200);
|
---|
102 |
|
---|
103 | /* ++++++++++++++++++++++++++++ FPU interrupts disabled +++++++++++++++++++++ */
|
---|
104 |
|
---|
105 | fp->idftmd ^= I_NVBITS;
|
---|
106 |
|
---|
107 | *(fpu + (long)FPU_TMNT) = fpmant;
|
---|
108 | ++nop; ++nop; ++nop;
|
---|
109 | *(fpu + (long)FPU_TEXP) = fpexp;
|
---|
110 | ++nop; ++nop; ++nop;
|
---|
111 |
|
---|
112 | if (fp->idftmd & I_VNSUBN)
|
---|
113 | *(fpu + (long)FPU_TNV1) = val;
|
---|
114 | else
|
---|
115 | *(fpu + (long)FPU_TNV0) = val;
|
---|
116 |
|
---|
117 | ++nop; ++nop; ++nop;
|
---|
118 |
|
---|
119 | *(fpu + (long)FPU_TCTL) =
|
---|
120 | (fp->idftmd & (I_NRATIO | I_NVBITS)) | 0x0001;
|
---|
121 |
|
---|
122 | setsr(oldsr);
|
---|
123 |
|
---|
124 | /* ++++++++++++++++++++++++++++ Interrupts restored +++++++++++++++++++++++++ */
|
---|
125 |
|
---|
126 | }
|
---|
127 | }
|
---|
128 |
|
---|
129 | /* |
---|
130 |
|
---|
131 | */
|
---|
132 |
|
---|
133 | /*
|
---|
134 | =============================================================================
|
---|
135 | ef_loc() -- parse edit buffer
|
---|
136 | =============================================================================
|
---|
137 | */
|
---|
138 |
|
---|
139 | short ef_loc(short n)
|
---|
140 | {
|
---|
141 | register short ival;
|
---|
142 | register struct s_entry *ep;
|
---|
143 |
|
---|
144 | ebuf[1] = '\0';
|
---|
145 | ival = ebuf[0] - '0';
|
---|
146 | ebflag = FALSE;
|
---|
147 |
|
---|
148 | if (ival EQ 0)
|
---|
149 | return(FAILURE);
|
---|
150 |
|
---|
151 | --ival;
|
---|
152 |
|
---|
153 | setloc(n, ival);
|
---|
154 |
|
---|
155 | if (recsw AND grpstat[n] AND (2 EQ grpmode[n])) {
|
---|
156 |
|
---|
157 | if (E_NULL NE (ep = findev(p_cur, t_cur, EV_LOCN, n, -1))) {
|
---|
158 |
|
---|
159 | ep->e_data2 = ival;
|
---|
160 |
|
---|
161 | } else if (E_NULL NE (ep = e_alc(E_SIZE2))) {
|
---|
162 |
|
---|
163 | ep->e_type = EV_LOCN;
|
---|
164 | ep->e_data1 = n;
|
---|
165 | ep->e_data2 = ival;
|
---|
166 | ep->e_time = t_cur;
|
---|
167 | p_cur = e_ins(ep, ep_adj(p_cur, 0, t_cur))->e_fwd;
|
---|
168 | eh_ins(ep, EH_LOCN);
|
---|
169 | ctrsw = TRUE;
|
---|
170 | se_disp(ep, D_FWD, gdstbc, 1);
|
---|
171 | scupd();
|
---|
172 | }
|
---|
173 | }
|
---|
174 |
|
---|
175 | return(SUCCESS);
|
---|
176 | }
|
---|
177 |
|
---|
178 | /* |
---|
179 |
|
---|
180 | */
|
---|
181 |
|
---|
182 | /*
|
---|
183 | =============================================================================
|
---|
184 | rd_loc() -- (re)display the field
|
---|
185 | =============================================================================
|
---|
186 | */
|
---|
187 |
|
---|
188 | short rd_loc(short n)
|
---|
189 | {
|
---|
190 | if (v_regs[5] & 0x0180)
|
---|
191 | vbank(0);
|
---|
192 |
|
---|
193 | vputc(obj8, 4, 8+(n*5), (grploc[n] + 1 + '0'), SDW11ATR);
|
---|
194 |
|
---|
195 | return(SUCCESS);
|
---|
196 | }
|
---|
197 |
|
---|
198 | /*
|
---|
199 | =============================================================================
|
---|
200 | ds_loc() -- display all location to group assignments
|
---|
201 | =============================================================================
|
---|
202 | */
|
---|
203 |
|
---|
204 | void ds_loc(void)
|
---|
205 | {
|
---|
206 | register short i;
|
---|
207 |
|
---|
208 | for (i = 0; i < 12; i++)
|
---|
209 | rd_loc(i);
|
---|
210 | }
|
---|
211 |
|
---|
212 | /* |
---|
213 |
|
---|
214 | */
|
---|
215 |
|
---|
216 | /*
|
---|
217 | =============================================================================
|
---|
218 | nd_loc() -- data entry function
|
---|
219 | =============================================================================
|
---|
220 | */
|
---|
221 |
|
---|
222 | short nd_loc(short n, short k)
|
---|
223 | {
|
---|
224 | ebuf[0] = k + '0';
|
---|
225 |
|
---|
226 | if (v_regs[5] & 0x0180)
|
---|
227 | vbank(0);
|
---|
228 |
|
---|
229 | vputc(obj8, 4, stccol, k + '0', SDW11DEA);
|
---|
230 | advscur();
|
---|
231 |
|
---|
232 | return(SUCCESS);
|
---|
233 | }
|
---|