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
RevLine 
[f40a309]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
[6262b5c]8#include "all.h"
[f40a309]9
[7258c6a]10extern uint16_t setsr(uint16_t sr);
[f40a309]11
[e225e77]12extern void modasg(void);
13
[7258c6a]14extern uint16_t *asgob;
[f40a309]15
[7258c6a]16extern uint16_t curintp;
[f40a309]17
[7258c6a]18extern int16_t stccol;
19extern int16_t stcrow;
20extern int16_t timemlt;
[f40a309]21
[7258c6a]22extern int8_t dspbuf[];
[f40a309]23
[7258c6a]24extern int16_t vce2grp[];
25extern int16_t grpdyn[];
26extern int16_t dyntab[];
[f40a309]27
[7258c6a]28extern int16_t expbit[];
[f40a309]29
[7258c6a]30extern int16_t adbox[][8];
[f40a309]31
32extern struct instdef vbufs[];
33
34/*
35
36*/
37
38/*
39 =============================================================================
40 et_adyn() -- load the edit buffer
41 =============================================================================
42*/
[7258c6a]43
[f40a309]44int16_t et_adyn(int16_t n)
[7258c6a]45{
[f40a309]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 =============================================================================
[7258c6a]66*/
[f40a309]67
[7258c6a]68void setdyn(int16_t grp, int16_t dyn)
69{
70 register int16_t g, i, val;
[f40a309]71 register int32_t ltmp;
[7258c6a]72 register uint16_t *fpu;
73 register struct idfnhdr *fp;
74 uint16_t fpmant, fpexp;
[f40a309]75 int16_t oldsr;
76 int16_t nop;
77
78 grpdyn[grp] = dyn;
79 val = dyntab[dyn];
[7258c6a]80 g = grp + 1;
81
[f40a309]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
[7258c6a]98/* ++++++++++++++++++++++++++++ FPU interrupts disabled +++++++++++++++++++++ */
[f40a309]99
[7258c6a]100 fp->idftmd ^= I_NVBITS;
[f40a309]101 *(fpu + (int32_t)FPU_TMNT) = fpmant;
102 ++nop; ++nop; ++nop;
103 *(fpu + (int32_t)FPU_TEXP) = fpexp;
[7258c6a]104 ++nop; ++nop; ++nop;
[f40a309]105
[7258c6a]106 if (fp->idftmd & I_VNSUBN)
[f40a309]107 *(fpu + (int32_t)FPU_TNV1) = val;
108 else
109 *(fpu + (int32_t)FPU_TNV0) = val;
[7258c6a]110
[f40a309]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 =============================================================================
[7258c6a]129 ef_adyn() -- parse (unload) the edit buffer
[f40a309]130 =============================================================================
[7258c6a]131*/
[f40a309]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/*
[7258c6a]154 =============================================================================
[f40a309]155 rd_adyn() -- (re)display the field
[7258c6a]156 =============================================================================
[f40a309]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/*
[7258c6a]177 =============================================================================
[f40a309]178 nd_adyn() -- handle new data entry
[7258c6a]179 =============================================================================
[f40a309]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);
[6262b5c]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.