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

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

Point of no return.

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