source: buchla-68k/ram/etavgr.c@ 7258c6a

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

Use standard integer types.

  • Property mode set to 100644
File size: 3.1 KB
Line 
1/*
2 =============================================================================
3 etavgr.c -- assignment editor - voice to group field handlers
4 Version 9 -- 1988-03-18 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
8#define DEBUGIT 0
9
10#include "stddefs.h"
11#include "fields.h"
12#include "vsdd.h"
13#include "vsddsw.h"
14#include "graphdef.h"
15
16#include "midas.h"
17#include "asgdsp.h"
18
19#if DEBUGIT
20extern short debugsw;
21#endif
22
23extern int8_t *numblk(int8_t *buf, int16_t n);
24
25extern uint16_t *asgob;
26
27extern int16_t stcrow, stccol;
28
29extern int16_t adbox[][8];
30
31extern int8_t dspbuf[];
32
33extern int16_t vce2grp[12]; /* voice to group table */
34extern int16_t ins2grp[12];
35
36/*
37
38*/
39
40/*
41 =============================================================================
42 et_avgr() -- load the edit buffer
43 =============================================================================
44*/
45
46int16_t et_avgr(int16_t nn)
47{
48 register int16_t grp;
49 int8_t buf[4];
50
51 grp = 0x00FF & (nn >> 8);
52
53 sprintf(ebuf, "%s", numblk(buf, vce2grp[grp]));
54 ebflag = TRUE;
55
56#if DEBUGIT
57 if (debugsw)
58 printf("et_avgr($%04.4X): ebuf=[%s]\n", nn, ebuf);
59#endif
60
61 return(SUCCESS);
62}
63
64/*
65
66*/
67
68/*
69 =============================================================================
70 ef_avgr() -- parse (unload) the edit buffer
71 =============================================================================
72*/
73
74int16_t ef_avgr(int16_t nn)
75{
76 register int16_t tmpval, vce, i;
77
78 vce = 0x00FF & (nn >> 8);
79
80 ebuf[2] = '\0'; /* terminate the string in ebuf */
81 ebflag = FALSE;
82 tmpval = 0;
83
84#if DEBUGIT
85 if (debugsw)
86 printf("ef_avgr($%04.4X): ebuf=[%s]\n", nn, ebuf);
87#endif
88
89 if ((ebuf[0] EQ ' ') AND (ebuf[1] EQ ' ')) {
90
91 tmpval = -1;
92
93 } else {
94
95 for (i = 0; i < 2; i++) {
96
97 if (ebuf[i] EQ ' ')
98 ebuf[i] = '0';
99
100 tmpval = (tmpval * 10) + (ebuf[i] - '0');
101 }
102
103 if ((tmpval EQ 0) OR (tmpval GT 12))
104 return(FAILURE);
105 }
106
107 vce2grp[vce] = tmpval;
108
109 if (tmpval > 0)
110 execins(vce, (ins2grp[tmpval - 1] & 0x00FF), 1);
111
112 modasg();
113 return(SUCCESS);
114}
115
116/*
117
118*/
119
120/*
121 =============================================================================
122 rd_avgr() -- (re)display the field
123 =============================================================================
124*/
125
126int16_t rd_avgr(int16_t nn)
127{
128 register int16_t n, grp;
129 int8_t buf[4];
130
131 n = 0x00FF & nn;
132 grp = 0x00FF & (nn >> 8);
133
134 vbank(0);
135 vcputsv(asgob, 64, adbox[n][4], adbox[n][5],
136 cfetp->frow, cfetp->flcol, numblk(buf, vce2grp[grp]), 14);
137
138 return(SUCCESS);
139}
140
141/*
142
143*/
144
145/*
146 =============================================================================
147 nd_avgr() -- handle new data entry
148 =============================================================================
149*/
150
151int16_t nd_avgr(int16_t nn, int16_t k)
152{
153 register int16_t n, col;
154
155 n = nn & 0xFF;
156 col = stccol - cfetp->flcol;
157
158 ebuf[col] = k + '0';
159 ebuf[2] = '\0';
160
161#if DEBUGIT
162 if (debugsw)
163 printf("nd_avgr($%04.4X, %d): cfetp=$%08.8lX, col=%d, ebuf=[%s]\n",
164 nn, k, cfetp, col, ebuf);
165#endif
166
167 dspbuf[0] = k + '0';
168 dspbuf[1] = '\0';
169
170 vbank(0);
171 vcputsv(asgob, 64, AK_ENTRY, adbox[n][5], stcrow, stccol, dspbuf, 14);
172
173 advacur();
174 return(SUCCESS);
175}
176
Note: See TracBrowser for help on using the repository browser.