1 | /*
|
---|
2 | =============================================================================
|
---|
3 | etaprg.c -- MIDAS assignment editor - program change channel field
|
---|
4 | Version 3 -- 1987-12-21 -- 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 | #include "stdio.h"
|
---|
20 |
|
---|
21 | extern void advacur(void);
|
---|
22 |
|
---|
23 | #if DEBUGIT
|
---|
24 | extern short debugsw;
|
---|
25 | #endif
|
---|
26 |
|
---|
27 | extern uint16_t *asgob;
|
---|
28 |
|
---|
29 | extern int16_t stcrow, stccol;
|
---|
30 | extern int16_t prgchan;
|
---|
31 |
|
---|
32 | extern int16_t adbox[][8];
|
---|
33 |
|
---|
34 | extern int8_t dspbuf[];
|
---|
35 |
|
---|
36 | /* |
---|
37 |
|
---|
38 | */
|
---|
39 |
|
---|
40 | /*
|
---|
41 | =============================================================================
|
---|
42 | et_aprg() -- load the edit buffer
|
---|
43 | =============================================================================
|
---|
44 | */
|
---|
45 |
|
---|
46 | int16_t et_aprg(int16_t n)
|
---|
47 | {
|
---|
48 | sprintf(ebuf, "%02d", prgchan);
|
---|
49 | ebflag = TRUE;
|
---|
50 |
|
---|
51 | return(SUCCESS);
|
---|
52 | }
|
---|
53 |
|
---|
54 | /*
|
---|
55 | =============================================================================
|
---|
56 | ef_aprg() -- parse (unload) the edit buffer
|
---|
57 | =============================================================================
|
---|
58 | */
|
---|
59 |
|
---|
60 | int16_t ef_aprg(int16_t n)
|
---|
61 | {
|
---|
62 | register int16_t i, tmpval;
|
---|
63 |
|
---|
64 | ebuf[2] = '\0'; /* terminate the string in ebuf */
|
---|
65 | ebflag = FALSE;
|
---|
66 | tmpval = 0;
|
---|
67 |
|
---|
68 | for (i = 0; i < 2; i++) /* convert from ASCII to binary */
|
---|
69 | tmpval = (tmpval * 10) + (ebuf[i] - '0');
|
---|
70 |
|
---|
71 | #if DEBUGIT
|
---|
72 | if (debugsw)
|
---|
73 | printf("ef_aprg($%04.4X): ebuf=[%s], tmpval=%d\n",
|
---|
74 | n, ebuf, tmpval);
|
---|
75 | #endif
|
---|
76 |
|
---|
77 | if ((tmpval EQ 0) OR (tmpval GT 16))
|
---|
78 | return(FAILURE);
|
---|
79 |
|
---|
80 | prgchan = tmpval;
|
---|
81 | return(SUCCESS);
|
---|
82 | }
|
---|
83 |
|
---|
84 | /* |
---|
85 |
|
---|
86 | */
|
---|
87 |
|
---|
88 | /*
|
---|
89 | =============================================================================
|
---|
90 | rd_aprg() -- (re)display the field
|
---|
91 | =============================================================================
|
---|
92 | */
|
---|
93 |
|
---|
94 | int16_t rd_aprg(int16_t nn)
|
---|
95 | {
|
---|
96 | register int16_t n;
|
---|
97 |
|
---|
98 | n = nn & 0xFF;
|
---|
99 | sprintf(dspbuf, "%02.2d", prgchan);
|
---|
100 |
|
---|
101 | vbank(0);
|
---|
102 | vcputsv(asgob, 64, adbox[n][4], adbox[n][5],
|
---|
103 | adbox[n][6], adbox[n][7] + 8, dspbuf, 14);
|
---|
104 |
|
---|
105 | return(SUCCESS);
|
---|
106 | }
|
---|
107 |
|
---|
108 | /*
|
---|
109 | =============================================================================
|
---|
110 | nd_aprg() -- handle new data entry
|
---|
111 | =============================================================================
|
---|
112 | */
|
---|
113 |
|
---|
114 | int16_t nd_aprg(int16_t nn, int16_t k)
|
---|
115 | {
|
---|
116 | register int16_t ec, n;
|
---|
117 |
|
---|
118 | n = nn & 0xFF;
|
---|
119 |
|
---|
120 | ec = stccol - cfetp->flcol; /* setup edit buffer column */
|
---|
121 |
|
---|
122 | ebuf[ec] = k + '0';
|
---|
123 | ebuf[2] = '\0';
|
---|
124 |
|
---|
125 | dspbuf[0] = k + '0';
|
---|
126 | dspbuf[1] = '\0';
|
---|
127 |
|
---|
128 | vbank(0);
|
---|
129 | vcputsv(asgob, 64, AK_ENTRY, adbox[n][5], stcrow, stccol, dspbuf, 14);
|
---|
130 |
|
---|
131 | advacur();
|
---|
132 | return(SUCCESS);
|
---|
133 | }
|
---|
134 |
|
---|