source: buchla-68k/ram/etivce.c@ 861ab45

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

Fixed etivce.c.

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