source: buchla-68k/orig/RAM/ETLOC.C@ c65a0e2

Last change on this file since c65a0e2 was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 8 years ago

Imported original source code.

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