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

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

Removed form-feed comments.

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