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

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

More volatile hardware accesses.

  • Property mode set to 100644
File size: 3.3 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
[b28a12e]8#include "ram.h"
[f40a309]9
10/*
11 =============================================================================
12 et_adyn() -- load the edit buffer
13 =============================================================================
14*/
15
[7258c6a]16int16_t et_adyn(int16_t n)
[f40a309]17{
[7258c6a]18 register int16_t grp;
[f40a309]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
[7258c6a]36void setdyn(int16_t grp, int16_t dyn)
[f40a309]37{
[8c8b4e5]38 int16_t g, i, val;
39 volatile uint16_t *fpu;
40 struct idfnhdr *fp;
[7258c6a]41 uint16_t fpmant, fpexp;
42 int16_t oldsr;
43 int16_t nop;
[f40a309]44
45 grpdyn[grp] = dyn;
46 val = dyntab[dyn];
47 g = grp + 1;
48
[7258c6a]49 fpmant = (((int32_t)curintp & 0x0000FFF0L) *
50 ((int32_t)timemlt & 0x0000FFFFL)) >> 15;
[f40a309]51
52 fpexp = expbit[curintp & 0x000F];
53
[fa38804]54
[f40a309]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;
[7258c6a]66 *(fpu + (int32_t)FPU_TMNT) = fpmant;
[f40a309]67 ++nop; ++nop; ++nop;
[7258c6a]68 *(fpu + (int32_t)FPU_TEXP) = fpexp;
[f40a309]69 ++nop; ++nop; ++nop;
70
71 if (fp->idftmd & I_VNSUBN)
[7258c6a]72 *(fpu + (int32_t)FPU_TNV1) = val;
[f40a309]73 else
[7258c6a]74 *(fpu + (int32_t)FPU_TNV0) = val;
[f40a309]75
76 ++nop; ++nop; ++nop;
77
[7258c6a]78 *(fpu + (int32_t)FPU_TCTL) =
[f40a309]79 (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
[7258c6a]94int16_t ef_adyn(int16_t n)
[f40a309]95{
[7258c6a]96 register int16_t dyn, grp;
[f40a309]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
[7258c6a]116int16_t rd_adyn(int16_t nn)
[f40a309]117{
[7258c6a]118 register int16_t n, grp;
[f40a309]119
120 n = 0x00FF & nn;
121 grp = 0x00FF & (nn >> 8);
122
123 dspbuf[0] = 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
[7258c6a]139int16_t nd_adyn(int16_t nn, int16_t k)
[f40a309]140{
[7258c6a]141 register int16_t n;
[f40a309]142
143 n = nn & 0xFF;
144
145 dspbuf[0] = ebuf[0] = 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
[6262b5c]154
Note: See TracBrowser for help on using the repository browser.