source: buchla-68k/orig/RAM/ETADYN.C@ 0170798

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

Imported original source code.

  • Property mode set to 100755
File size: 4.0 KB
Line 
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
20extern short setsr();
21
22extern unsigned *asgob;
23
24extern unsigned curintp;
25
26extern short stccol;
27extern short stcrow;
28extern short timemlt;
29
30extern char dspbuf[];
31
32extern short vce2grp[];
33extern short grpdyn[];
34extern short dyntab[];
35
36extern unsigned expbit[];
37
38extern short adbox[][8];
39
40extern struct instdef vbufs[];
41
42/*
43
44*/
45
46/*
47 =============================================================================
48 et_adyn() -- load the edit buffer
49 =============================================================================
50*/
51
52short
53et_adyn(n)
54short n;
55{
56 register short 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
78setdyn(grp, dyn)
79short grp, dyn;
80{
81 register short g, i, val;
82 register long ltmp;
83 register unsigned *fpu;
84 register struct idfnhdr *fp;
85 unsigned fpmant, fpexp;
86 short oldsr;
87 short nop;
88
89 grpdyn[grp] = dyn;
90 val = dyntab[dyn];
91 g = grp + 1;
92
93 fpmant = (((long)curintp & 0x0000FFF0L) *
94 ((long)timemlt & 0x0000FFFFL)) >> 15;
95
96 fpexp = expbit[curintp & 0x000F];
97
98/*
99
100*/
101 for (i = 0; i < 12; i++)
102 if (g EQ vce2grp[i]) {
103
104 fp = &vbufs[i].idhfnc[8];
105 fpu = io_fpu + FPU_OFNC + (i << 8) + 0x0080;
106
107 oldsr = setsr(0x2200);
108
109/* ++++++++++++++++++++++++++++ FPU interrupts disabled +++++++++++++++++++++ */
110
111 fp->idftmd ^= I_NVBITS;
112 *(fpu + (long)FPU_TMNT) = fpmant;
113 ++nop; ++nop; ++nop;
114 *(fpu + (long)FPU_TEXP) = fpexp;
115 ++nop; ++nop; ++nop;
116
117 if (fp->idftmd & I_VNSUBN)
118 *(fpu + (long)FPU_TNV1) = val;
119 else
120 *(fpu + (long)FPU_TNV0) = val;
121
122 ++nop; ++nop; ++nop;
123
124 *(fpu + (long)FPU_TCTL) =
125 (fp->idftmd & (I_NRATIO | I_NVBITS)) | 0x0001;
126
127 setsr(oldsr);
128
129/* ++++++++++++++++++++++++++++ Interrupts restored +++++++++++++++++++++++++ */
130
131 }
132}
133
134/*
135
136*/
137
138/*
139 =============================================================================
140 ef_adyn() -- parse (unload) the edit buffer
141 =============================================================================
142*/
143
144short
145ef_adyn(n)
146short n;
147{
148 register short dyn, grp;
149
150 grp = 0x00FF & (n >> 8);
151
152 ebuf[1] = '\0'; /* terminate the string in ebuf */
153 ebflag = FALSE;
154
155 dyn = ebuf[0] - '0';
156
157 setdyn(grp, dyn);
158 modasg();
159 return(SUCCESS);
160}
161
162/*
163
164*/
165
166/*
167 =============================================================================
168 rd_adyn() -- (re)display the field
169 =============================================================================
170*/
171
172short
173rd_adyn(nn)
174short nn;
175{
176 register short n, grp;
177
178 n = 0x00FF & nn;
179 grp = 0x00FF & (nn >> 8);
180
181 dspbuf[0] = grpdyn[grp] + '0';
182 dspbuf[1] = '\0';
183
184 vbank(0);
185 vcputsv(asgob, 64, adbox[n][4], adbox[n][5],
186 cfetp->frow, cfetp->flcol, dspbuf, 14);
187
188 return(SUCCESS);
189}
190
191/*
192 =============================================================================
193 nd_adyn() -- handle new data entry
194 =============================================================================
195*/
196
197short
198nd_adyn(nn, k)
199short nn;
200register short k;
201{
202 register short n;
203
204 n = nn & 0xFF;
205
206 dspbuf[0] = ebuf[0] = k + '0';
207 dspbuf[1] = ebuf[1] = '\0';
208
209 vbank(0);
210 vcputsv(asgob, 64, AK_ENTRY, adbox[n][5], stcrow, stccol, dspbuf, 14);
211
212 return(SUCCESS);
213}
214
Note: See TracBrowser for help on using the repository browser.