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

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

Removed form-feed comments.

  • Property mode set to 100644
File size: 3.5 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 ef_itim() -- parse (unload) the edit buffer
44 =============================================================================
45*/
46
47int16_t ef_itim(int16_t n)
48{
49 register int16_t i, endpnt, basept;
50 register uint16_t tmpval;
51 register struct idfnhdr *fp;
52 register struct instdef *ip;
53
54 ip = &vbufs[curvce]; /* set instrument pointer */
55 fp = &ip->idhfnc[curfunc]; /* set function pointer */
56
57 ebuf[2] = '.'; /* add implied decimal point */
58 ebuf[6] = '\0'; /* terminate the string in ebuf */
59 ebflag = FALSE;
60#if DEBUGIT
61 printf("ef_itim(): voice=%d, func=%d, ebuf=[%s]\r\n",
62 curvce, curfunc, ebuf);
63#endif
64 tmpval = 0;
65
66 for (i = 0; i < 2; i++) /* convert from ASCII to binary */
67 tmpval = (tmpval * 10) + (ebuf[i] - '0');
68
69 for (i = 3; i < 6; i++)
70 tmpval = (tmpval * 10) + (ebuf[i] - '0');
71#if DEBUGIT
72 printf("ef_itim(): subj=%d, case=%d, min=%d, val=%d, max=%d\r\n",
73 subj, pecase, temin, tmpval, temax);
74#endif
75 if (tmpval > (uint16_t)temax)
76 return(FAILURE);
77
78 if (tmpval < (uint16_t)temin)
79 return(FAILURE);
80
81 setseg(subj, tmpval);
82
83 if (pecase EQ 2)
84 setseg(subj + 1, temax);
85#if DEBUGIT
86 printf("ef_itim(): SUCCESS time %d set at point %d <%d> = %d\r\n",
87 tmpval, subj, curpnt, timeto(curfunc, subj));
88#endif
89 modinst();
90 return(SUCCESS);
91}
92
93/*
94 =============================================================================
95 rd_itim() -- (re)display the field
96 =============================================================================
97*/
98
99int16_t rd_itim(int16_t n)
100{
101 register int16_t th, tl;
102 register int32_t tt, sc;
103
104 sc = 1000L;
105 tt = timeto(curfunc, subj);
106 th = tt / sc;
107 tl = tt - (th * sc);
108
109 sprintf(dspbuf, "%02d.%03d", th, tl); /* convert to ASCII */
110
111 vbank(0); /* display the value */
112
113 vcputsv(instob, 64, idbox[n][4], idbox[n][5],
114 idbox[n][6] + 1, idbox[n][7], dspbuf, 14);
115
116 edfunc(curfunc);
117 return(SUCCESS);
118}
119
120/*
121 =============================================================================
122 nd_itim() -- handle new data entry
123 =============================================================================
124*/
125
126int16_t nd_itim(int16_t n, int16_t k)
127{
128 register int16_t ec;
129
130 ec = stccol - cfetp->flcol; /* setup edit buffer column */
131
132 if (ec EQ 2)
133 return(FAILURE);
134
135 ebuf[ec] = k + '0';
136 ebuf[2] = '.';
137 ebuf[6] = '\0';
138
139 dspbuf[0] = k + '0';
140 dspbuf[1] = '\0';
141
142 vbank(0);
143
144 vcputsv(instob, 64, ID_ENTRY, idbox[n][5],
145 idbox[n][6] + 1, stccol, dspbuf, 14);
146
147 advicur();
148
149 if (stccol EQ (idbox[n][7] + 2))
150 advicur();
151
152 return(SUCCESS);
153}
154
Note: See TracBrowser for help on using the repository browser.