source: buchla-68k/ram/etwavs.c

Last change on this file was 602f9b5, checked in by Thomas Lopatic <thomas@…>, 6 years ago

Fixed etwavs.c.

  • Property mode set to 100644
File size: 2.3 KB
Line 
1/*
2 =============================================================================
3 etwavs.c -- waveshape editor - waveshape number field handlers
4 Version 8 -- 1987-12-11 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
8#include "ram.h"
9
10/*
11 =============================================================================
12 et_wavs() -- load the edit buffer
13 =============================================================================
14*/
15
16int16_t et_wavs(int16_t n)
17{
18 (void)n;
19
20 sprintf(ebuf, "%02d", curwave + 1);
21 ebflag = TRUE;
22
23 return(SUCCESS);
24}
25
26/*
27 =============================================================================
28 ef_wavs() -- parse (unload) the edit buffer
29 =============================================================================
30*/
31
32int16_t ef_wavs(int16_t n)
33{
34 register int16_t i, tmpval;
35
36 (void)n;
37
38 ebuf[2] = '\0'; /* terminate the string in ebuf */
39 ebflag = FALSE;
40
41 tmpval = 0;
42
43 for (i = 0; i < 2; i++) /* convert from ASCII to binary */
44 tmpval = (tmpval * 10) + (ebuf[i] - '0');
45
46 if ((tmpval GT NUMWAVS) OR (tmpval EQ 0))
47 return(FAILURE);
48
49 wsnmod[curvce][curwslt] = TRUE;
50 curwave = tmpval - 1;
51 return(SUCCESS);
52}
53
54/*
55 =============================================================================
56 rd_wavs() -- (re)display the field
57 =============================================================================
58*/
59
60int16_t rd_wavs(int16_t nn)
61{
62 register int16_t n;
63 register int16_t cx;
64
65 cx = wsnmod[curvce][curwslt] ? WS_CHGC : wdbox[n][4];
66 n = nn & 0x00FF;
67
68 sprintf(dspbuf, "%02d", curwave + 1);
69
70 vbank(0);
71 vcputsv(waveob, 64, cx, wdbox[n][5],
72 wdbox[n][6], wdbox[n][7] + WAVE_OFF, dspbuf, 14);
73
74 return(SUCCESS);
75}
76
77/*
78 =============================================================================
79 nd_wavs() -- handle new data entry
80 =============================================================================
81*/
82
83int16_t nd_wavs(int16_t nn, int16_t k)
84{
85 register int16_t ec, n;
86
87 n = nn & 0xFF;
88 ec = stccol - cfetp->flcol; /* setup edit buffer column */
89 ebuf[ec] = (int8_t)(k + '0');
90 ebuf[2] = '\0';
91
92 dspbuf[0] = (int8_t)(k + '0');
93 dspbuf[1] = '\0';
94
95 vbank(0);
96 vcputsv(waveob, 64, WS_ENTRY, wdbox[n][5],
97 wdbox[n][6], stccol, dspbuf, 14);
98
99 advwcur();
100 return(SUCCESS);
101}
102
103
Note: See TracBrowser for help on using the repository browser.