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