source: buchla-68k/ram/etloc.c@ 7258c6a

Last change on this file since 7258c6a was 7258c6a, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Use standard integer types.

  • Property mode set to 100644
File size: 4.4 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 uint16_t setsr(uint16_t sr);
23
24extern uint16_t *obj8;
25
26extern uint16_t curintp;
27
28extern int16_t ctrsw;
29extern int16_t timemlt;
30extern int16_t recsw;
31extern int16_t stccol;
32
33extern int16_t grploc[];
34extern int16_t grpmode[];
35extern int16_t grpstat[];
36extern int16_t loctab[];
37extern int16_t vce2grp[];
38
39extern int16_t 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
55int16_t et_loc(int16_t 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
73void setloc(int16_t grp, int16_t loc)
74{
75 register int16_t g, i, val;
76 register int32_t ltmp;
77 register uint16_t *fpu;
78 register struct idfnhdr *fp;
79 uint16_t fpmant, fpexp;
80 int16_t oldsr;
81 int16_t nop;
82
83 grploc[grp] = loc;
84 val = (loctab[loc] << 1) ^ 0x8000;
85 g = grp + 1;
86
87 fpmant = (((int32_t)curintp & 0x0000FFF0L) *
88 ((int32_t)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 + (int32_t)FPU_TMNT) = fpmant;
108 ++nop; ++nop; ++nop;
109 *(fpu + (int32_t)FPU_TEXP) = fpexp;
110 ++nop; ++nop; ++nop;
111
112 if (fp->idftmd & I_VNSUBN)
113 *(fpu + (int32_t)FPU_TNV1) = val;
114 else
115 *(fpu + (int32_t)FPU_TNV0) = val;
116
117 ++nop; ++nop; ++nop;
118
119 *(fpu + (int32_t)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
139int16_t ef_loc(int16_t n)
140{
141 register int16_t 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
188int16_t rd_loc(int16_t 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
204void ds_loc(void)
205{
206 register int16_t 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
222int16_t nd_loc(int16_t n, int16_t 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}
Note: See TracBrowser for help on using the repository browser.