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

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

Added include files for global functions and variables.

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