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