source: buchla-68k/ram/etiwsn.c@ b28a12e

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

Zero redundant declarations.

  • Property mode set to 100644
File size: 3.2 KB
Line 
1/*
2 =============================================================================
3 etiwsn.c -- MIDAS instrument editor - waveshape number handlers
4 Version 6 -- 1988-04-19 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
8#include "ram.h"
9
10/*
11 =============================================================================
12 et_iwsn() -- load the edit buffer
13 =============================================================================
14*/
15
16int16_t et_iwsn(int16_t nn)
17{
18 register int16_t m;
19
20 m = nn >> 8;
21
22 sprintf(ebuf, "%02d", m ? vbufs[curvce].idhwsb + 1
23 : vbufs[curvce].idhwsa + 1);
24 ebflag = TRUE;
25
26 return(SUCCESS);
27}
28
29/*
30
31*/
32
33/*
34 =============================================================================
35 ef_iwsn() -- parse (unload) the edit buffer
36 =============================================================================
37*/
38
39int16_t ef_iwsn(int16_t nn)
40{
41 register int16_t i, tmpval, m;
42 register int16_t *fpuws;
43
44 m = nn >> 8;
45 ebuf[2] = '\0'; /* terminate the string in ebuf */
46 ebflag = FALSE;
47
48 tmpval = 0;
49
50 for (i = 0; i < 2; i++) /* convert from ASCII to binary */
51 tmpval = (tmpval * 10) + (ebuf[i] - '0');
52
53 if ((tmpval EQ 0) OR (tmpval GT NUMWAVS))
54 return(FAILURE);
55
56 if (m) {
57
58 /* slot B */
59 vbufs[curvce].idhwsb = tmpval - 1;
60
61 memcpyw(vbufs[curvce].idhwvbf, &wslib[tmpval - 1],
62 NUMHARM + (2 * NUMWPNT));
63
64 fpuws = io_fpu + FPU_OWST + (curvce << 9) + 1;
65
66 memcpyw(fpuws, vbufs[curvce].idhwvbf, NUMWPNT);
67
68 *(fpuws - 1) = vbufs[curvce].idhwvbf[0];
69 *(fpuws + NUMWPNT) = vbufs[curvce].idhwvbf[NUMWPNT - 1];
70
71 } else {
72
73 /* slot A */
74
75 vbufs[curvce].idhwsa = tmpval - 1;
76
77 memcpyw(vbufs[curvce].idhwvaf, &wslib[tmpval - 1],
78 NUMHARM + (2 * NUMWPNT));
79
80 fpuws = io_fpu + FPU_OWST + (curvce << 9) + 0x100 + 1;
81
82 memcpyw(fpuws, vbufs[curvce].idhwvaf, NUMWPNT);
83
84 *(fpuws - 1) = vbufs[curvce].idhwvaf[0];
85 *(fpuws + NUMWPNT) = vbufs[curvce].idhwvaf[NUMWPNT - 1];
86 }
87
88 dswin(21);
89 modinst();
90 return(SUCCESS);
91}
92
93/*
94
95*/
96
97/*
98 =============================================================================
99 rd_iwsn() -- (re)display the field
100 =============================================================================
101*/
102
103int16_t rd_iwsn(int16_t nn)
104{
105 register int16_t m, n;
106
107 m = (nn >> 8) & 0x00FF;
108 n = nn & 0x00FF;
109
110 sprintf(dspbuf, "%02d", m ? vbufs[curvce].idhwsb + 1
111 : vbufs[curvce].idhwsa + 1);
112
113 vbank(0);
114
115 vcputsv(instob, 64, (m ? WSBFC : WSAFC), idbox[n][5],
116 cfetp->frow, cfetp->flcol, dspbuf, 14);
117
118 return(SUCCESS);
119}
120
121/*
122
123*/
124
125/*
126 =============================================================================
127 nd_iwsn() -- handle new data entry
128 =============================================================================
129*/
130
131int16_t nd_iwsn(int16_t nn, int16_t k)
132{
133 register int16_t ec, c, n;
134
135 n = nn & 0x00FF;
136
137 ec = stccol - cfetp->flcol; /* setup edit buffer column */
138 ebuf[ec] = k + '0'; /* enter new data in buffer */
139 ebuf[2] = '\0'; /* make sure string is terminated */
140
141 dspbuf[0] = k + '0'; /* setup for display */
142 dspbuf[1] = '\0';
143
144 vbank(0); /* display the new data */
145 vcputsv(instob, 64, ID_ENTRY, idbox[n][5], stcrow, stccol, dspbuf, 14);
146
147 advicur(); /* advance cursor */
148
149 return(SUCCESS);
150}
151
152
Note: See TracBrowser for help on using the repository browser.