1 | /*
|
---|
2 | =============================================================================
|
---|
3 | etadyn.c -- MIDAS assignment editor -- dynamics to group field handlers
|
---|
4 | Version 7 -- 1988-07-13 -- D.N. Lynx Crowe
|
---|
5 | =============================================================================
|
---|
6 | */
|
---|
7 |
|
---|
8 | #include "stddefs.h"
|
---|
9 | #include "fields.h"
|
---|
10 | #include "fpu.h"
|
---|
11 | #include "hwdefs.h"
|
---|
12 | #include "vsdd.h"
|
---|
13 | #include "vsddsw.h"
|
---|
14 | #include "graphdef.h"
|
---|
15 |
|
---|
16 | #include "midas.h"
|
---|
17 | #include "asgdsp.h"
|
---|
18 | #include "instdsp.h"
|
---|
19 |
|
---|
20 | extern uint16_t setsr(uint16_t sr);
|
---|
21 |
|
---|
22 | extern void modasg(void);
|
---|
23 |
|
---|
24 | extern uint16_t *asgob;
|
---|
25 |
|
---|
26 | extern uint16_t curintp;
|
---|
27 |
|
---|
28 | extern int16_t stccol;
|
---|
29 | extern int16_t stcrow;
|
---|
30 | extern int16_t timemlt;
|
---|
31 |
|
---|
32 | extern int8_t dspbuf[];
|
---|
33 |
|
---|
34 | extern int16_t vce2grp[];
|
---|
35 | extern int16_t grpdyn[];
|
---|
36 | extern int16_t dyntab[];
|
---|
37 |
|
---|
38 | extern int16_t expbit[];
|
---|
39 |
|
---|
40 | extern int16_t adbox[][8];
|
---|
41 |
|
---|
42 | extern struct instdef vbufs[];
|
---|
43 |
|
---|
44 | /* |
---|
45 |
|
---|
46 | */
|
---|
47 |
|
---|
48 | /*
|
---|
49 | =============================================================================
|
---|
50 | et_adyn() -- load the edit buffer
|
---|
51 | =============================================================================
|
---|
52 | */
|
---|
53 |
|
---|
54 | int16_t et_adyn(int16_t n)
|
---|
55 | {
|
---|
56 | register int16_t grp;
|
---|
57 |
|
---|
58 | grp = 0x00FF & (n >> 8);
|
---|
59 |
|
---|
60 | ebuf[0] = grpdyn[grp] + '0';
|
---|
61 | ebuf[1] = '\0';
|
---|
62 |
|
---|
63 | ebflag = TRUE;
|
---|
64 |
|
---|
65 | return(SUCCESS);
|
---|
66 | }
|
---|
67 |
|
---|
68 | /* |
---|
69 |
|
---|
70 | */
|
---|
71 |
|
---|
72 | /*
|
---|
73 | =============================================================================
|
---|
74 | setdyn() -- set dynamics for a group
|
---|
75 | =============================================================================
|
---|
76 | */
|
---|
77 |
|
---|
78 | void setdyn(int16_t grp, int16_t dyn)
|
---|
79 | {
|
---|
80 | register int16_t g, i, val;
|
---|
81 | register int32_t ltmp;
|
---|
82 | register uint16_t *fpu;
|
---|
83 | register struct idfnhdr *fp;
|
---|
84 | uint16_t fpmant, fpexp;
|
---|
85 | int16_t oldsr;
|
---|
86 | int16_t nop;
|
---|
87 |
|
---|
88 | grpdyn[grp] = dyn;
|
---|
89 | val = dyntab[dyn];
|
---|
90 | g = grp + 1;
|
---|
91 |
|
---|
92 | fpmant = (((int32_t)curintp & 0x0000FFF0L) *
|
---|
93 | ((int32_t)timemlt & 0x0000FFFFL)) >> 15;
|
---|
94 |
|
---|
95 | fpexp = expbit[curintp & 0x000F];
|
---|
96 |
|
---|
97 | /* |
---|
98 |
|
---|
99 | */
|
---|
100 | for (i = 0; i < 12; i++)
|
---|
101 | if (g EQ vce2grp[i]) {
|
---|
102 |
|
---|
103 | fp = &vbufs[i].idhfnc[8];
|
---|
104 | fpu = io_fpu + FPU_OFNC + (i << 8) + 0x0080;
|
---|
105 |
|
---|
106 | oldsr = setsr(0x2200);
|
---|
107 |
|
---|
108 | /* ++++++++++++++++++++++++++++ FPU interrupts disabled +++++++++++++++++++++ */
|
---|
109 |
|
---|
110 | fp->idftmd ^= I_NVBITS;
|
---|
111 | *(fpu + (int32_t)FPU_TMNT) = fpmant;
|
---|
112 | ++nop; ++nop; ++nop;
|
---|
113 | *(fpu + (int32_t)FPU_TEXP) = fpexp;
|
---|
114 | ++nop; ++nop; ++nop;
|
---|
115 |
|
---|
116 | if (fp->idftmd & I_VNSUBN)
|
---|
117 | *(fpu + (int32_t)FPU_TNV1) = val;
|
---|
118 | else
|
---|
119 | *(fpu + (int32_t)FPU_TNV0) = val;
|
---|
120 |
|
---|
121 | ++nop; ++nop; ++nop;
|
---|
122 |
|
---|
123 | *(fpu + (int32_t)FPU_TCTL) =
|
---|
124 | (fp->idftmd & (I_NRATIO | I_NVBITS)) | 0x0001;
|
---|
125 |
|
---|
126 | setsr(oldsr);
|
---|
127 |
|
---|
128 | /* ++++++++++++++++++++++++++++ Interrupts restored +++++++++++++++++++++++++ */
|
---|
129 |
|
---|
130 | }
|
---|
131 | }
|
---|
132 |
|
---|
133 | /* |
---|
134 |
|
---|
135 | */
|
---|
136 |
|
---|
137 | /*
|
---|
138 | =============================================================================
|
---|
139 | ef_adyn() -- parse (unload) the edit buffer
|
---|
140 | =============================================================================
|
---|
141 | */
|
---|
142 |
|
---|
143 | int16_t ef_adyn(int16_t n)
|
---|
144 | {
|
---|
145 | register int16_t dyn, grp;
|
---|
146 |
|
---|
147 | grp = 0x00FF & (n >> 8);
|
---|
148 |
|
---|
149 | ebuf[1] = '\0'; /* terminate the string in ebuf */
|
---|
150 | ebflag = FALSE;
|
---|
151 |
|
---|
152 | dyn = ebuf[0] - '0';
|
---|
153 |
|
---|
154 | setdyn(grp, dyn);
|
---|
155 | modasg();
|
---|
156 | return(SUCCESS);
|
---|
157 | }
|
---|
158 |
|
---|
159 | /* |
---|
160 |
|
---|
161 | */
|
---|
162 |
|
---|
163 | /*
|
---|
164 | =============================================================================
|
---|
165 | rd_adyn() -- (re)display the field
|
---|
166 | =============================================================================
|
---|
167 | */
|
---|
168 |
|
---|
169 | int16_t rd_adyn(int16_t nn)
|
---|
170 | {
|
---|
171 | register int16_t n, grp;
|
---|
172 |
|
---|
173 | n = 0x00FF & nn;
|
---|
174 | grp = 0x00FF & (nn >> 8);
|
---|
175 |
|
---|
176 | dspbuf[0] = grpdyn[grp] + '0';
|
---|
177 | dspbuf[1] = '\0';
|
---|
178 |
|
---|
179 | vbank(0);
|
---|
180 | vcputsv(asgob, 64, adbox[n][4], adbox[n][5],
|
---|
181 | cfetp->frow, cfetp->flcol, dspbuf, 14);
|
---|
182 |
|
---|
183 | return(SUCCESS);
|
---|
184 | }
|
---|
185 |
|
---|
186 | /*
|
---|
187 | =============================================================================
|
---|
188 | nd_adyn() -- handle new data entry
|
---|
189 | =============================================================================
|
---|
190 | */
|
---|
191 |
|
---|
192 | int16_t nd_adyn(int16_t nn, int16_t k)
|
---|
193 | {
|
---|
194 | register int16_t n;
|
---|
195 |
|
---|
196 | n = nn & 0xFF;
|
---|
197 |
|
---|
198 | dspbuf[0] = ebuf[0] = k + '0';
|
---|
199 | dspbuf[1] = ebuf[1] = '\0';
|
---|
200 |
|
---|
201 | vbank(0);
|
---|
202 | vcputsv(asgob, 64, AK_ENTRY, adbox[n][5], stcrow, stccol, dspbuf, 14);
|
---|
203 |
|
---|
204 | return(SUCCESS);
|
---|
205 | }
|
---|
206 |
|
---|