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

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

Cleanup.

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