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