source: buchla-68k/ram/etitim.c@ b28a12e

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

Zero redundant declarations.

  • Property mode set to 100644
File size: 3.6 KB
Line 
1/*
2 =============================================================================
3 etitim.c -- instrument editor - time field handlers
4 Version 14 -- 1987-12-09 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
8#define DEBUGIT 0
9
10#include "ram.h"
11
12/*
13 =============================================================================
14 et_itim() -- load the edit buffer
15 =============================================================================
16*/
17
18int16_t et_itim(int16_t n)
19{
20 register int16_t th, tl;
21 register int32_t tt, sc;
22
23 pntsel(); /* make sure edit limits are current */
24
25 sc = 1000L;
26 tt = timeto(curfunc, subj);
27 th = tt / sc;
28 tl = tt - (th * sc);
29
30 sprintf(ebuf, "%02d.%03d", th, tl);
31 ebflag = TRUE;
32#if DEBUGIT
33 printf("et_itim(): voice=%d, func=%d, pnt=%d, ebuf=[%s]\r\n",
34 curvce, curfunc, curpnt, ebuf);
35 printf("et_itim(): npts=%d, subj=%d, case=%d, min=%d, max=%d\r\n",
36 npts, subj, pecase, temin, temax);
37#endif
38 return(SUCCESS);
39}
40
41/*
42
43*/
44
45/*
46 =============================================================================
47 ef_itim() -- parse (unload) the edit buffer
48 =============================================================================
49*/
50
51int16_t ef_itim(int16_t n)
52{
53 register int16_t i, endpnt, basept;
54 register uint16_t tmpval;
55 register struct idfnhdr *fp;
56 register struct instdef *ip;
57
58 ip = &vbufs[curvce]; /* set instrument pointer */
59 fp = &ip->idhfnc[curfunc]; /* set function pointer */
60
61 ebuf[2] = '.'; /* add implied decimal point */
62 ebuf[6] = '\0'; /* terminate the string in ebuf */
63 ebflag = FALSE;
64#if DEBUGIT
65 printf("ef_itim(): voice=%d, func=%d, ebuf=[%s]\r\n",
66 curvce, curfunc, ebuf);
67#endif
68 tmpval = 0;
69
70 for (i = 0; i < 2; i++) /* convert from ASCII to binary */
71 tmpval = (tmpval * 10) + (ebuf[i] - '0');
72
73 for (i = 3; i < 6; i++)
74 tmpval = (tmpval * 10) + (ebuf[i] - '0');
75#if DEBUGIT
76 printf("ef_itim(): subj=%d, case=%d, min=%d, val=%d, max=%d\r\n",
77 subj, pecase, temin, tmpval, temax);
78#endif
79 if (tmpval > (uint16_t)temax)
80 return(FAILURE);
81
82 if (tmpval < (uint16_t)temin)
83 return(FAILURE);
84
85 setseg(subj, tmpval);
86
87 if (pecase EQ 2)
88 setseg(subj + 1, temax);
89#if DEBUGIT
90 printf("ef_itim(): SUCCESS time %d set at point %d <%d> = %d\r\n",
91 tmpval, subj, curpnt, timeto(curfunc, subj));
92#endif
93 modinst();
94 return(SUCCESS);
95}
96
97/*
98
99*/
100
101/*
102 =============================================================================
103 rd_itim() -- (re)display the field
104 =============================================================================
105*/
106
107int16_t rd_itim(int16_t n)
108{
109 register int16_t th, tl;
110 register int32_t tt, sc;
111
112 sc = 1000L;
113 tt = timeto(curfunc, subj);
114 th = tt / sc;
115 tl = tt - (th * sc);
116
117 sprintf(dspbuf, "%02d.%03d", th, tl); /* convert to ASCII */
118
119 vbank(0); /* display the value */
120
121 vcputsv(instob, 64, idbox[n][4], idbox[n][5],
122 idbox[n][6] + 1, idbox[n][7], dspbuf, 14);
123
124 edfunc(curfunc);
125 return(SUCCESS);
126}
127
128/*
129
130*/
131
132/*
133 =============================================================================
134 nd_itim() -- handle new data entry
135 =============================================================================
136*/
137
138int16_t nd_itim(int16_t n, int16_t k)
139{
140 register int16_t ec;
141
142 ec = stccol - cfetp->flcol; /* setup edit buffer column */
143
144 if (ec EQ 2)
145 return(FAILURE);
146
147 ebuf[ec] = k + '0';
148 ebuf[2] = '.';
149 ebuf[6] = '\0';
150
151 dspbuf[0] = k + '0';
152 dspbuf[1] = '\0';
153
154 vbank(0);
155
156 vcputsv(instob, 64, ID_ENTRY, idbox[n][5],
157 idbox[n][6] + 1, stccol, dspbuf, 14);
158
159 advicur();
160
161 if (stccol EQ (idbox[n][7] + 2))
162 advicur();
163
164 return(SUCCESS);
165}
166
Note: See TracBrowser for help on using the repository browser.