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

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

Fixed etwhar.c.

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