source: buchla-68k/ram/etwpnt.c@ ea9a162

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

Fixed etwpnt.c.

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