source: buchla-68k/ram/etadyn.c@ 6262b5c

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

Added include files for global functions and variables.

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