1 | /*
|
---|
2 | =============================================================================
|
---|
3 | etains.c -- MIDAS assignment editor -- instrument to groups
|
---|
4 | Version 10 -- 1988-07-11 -- D.N. Lynx Crowe
|
---|
5 | =============================================================================
|
---|
6 | */
|
---|
7 |
|
---|
8 | #include "all.h"
|
---|
9 |
|
---|
10 | extern int8_t *numblk(int8_t *buf, int16_t n);
|
---|
11 |
|
---|
12 | extern void adswin(int16_t n);
|
---|
13 | extern void advacur(void);
|
---|
14 | extern void setinst(void);
|
---|
15 | extern void setv2gi(int16_t group);
|
---|
16 |
|
---|
17 | extern uint16_t *asgob;
|
---|
18 |
|
---|
19 | extern int16_t asgmod;
|
---|
20 | extern int16_t stccol;
|
---|
21 | extern int16_t stcrow;
|
---|
22 |
|
---|
23 | extern int8_t dspbuf[];
|
---|
24 |
|
---|
25 | extern int16_t ins2grp[];
|
---|
26 |
|
---|
27 | extern int16_t adbox[][8];
|
---|
28 |
|
---|
29 | /* |
---|
30 |
|
---|
31 | */
|
---|
32 |
|
---|
33 | /*
|
---|
34 | =============================================================================
|
---|
35 | modasg() -- indicate that the assignment table was modified
|
---|
36 | =============================================================================
|
---|
37 | */
|
---|
38 |
|
---|
39 | void modasg(void)
|
---|
40 | {
|
---|
41 | if (NOT asgmod) {
|
---|
42 |
|
---|
43 | asgmod = TRUE;
|
---|
44 | adswin(0);
|
---|
45 | }
|
---|
46 | }
|
---|
47 |
|
---|
48 | /*
|
---|
49 | =============================================================================
|
---|
50 | et_ains() -- load the edit buffer
|
---|
51 | =============================================================================
|
---|
52 | */
|
---|
53 |
|
---|
54 | int16_t et_ains(int16_t n)
|
---|
55 | {
|
---|
56 | register int16_t grp;
|
---|
57 |
|
---|
58 | int8_t buf[4];
|
---|
59 |
|
---|
60 | grp = 0x00FF & (n >> 8);
|
---|
61 |
|
---|
62 | sprintf(ebuf, "%02.2d", ins2grp[grp] & 0x00FF);
|
---|
63 | ebflag = TRUE;
|
---|
64 |
|
---|
65 | return(SUCCESS);
|
---|
66 | }
|
---|
67 |
|
---|
68 | /*
|
---|
69 | =============================================================================
|
---|
70 | ef_ains() -- parse (unload) the edit buffer
|
---|
71 | =============================================================================
|
---|
72 | */
|
---|
73 |
|
---|
74 | int16_t ef_ains(int16_t n)
|
---|
75 | {
|
---|
76 | register int16_t tmpval, grp, i;
|
---|
77 |
|
---|
78 | grp = 0x00FF & (n >> 8);
|
---|
79 | ebuf[2] = '\0';
|
---|
80 | ebflag = FALSE;
|
---|
81 | tmpval = 0;
|
---|
82 |
|
---|
83 | for (i = 0; i < 2; i++)
|
---|
84 | tmpval = (tmpval * 10) + (ebuf[i] - '0');
|
---|
85 |
|
---|
86 | if (tmpval GE NINST )
|
---|
87 | return(FAILURE);
|
---|
88 |
|
---|
89 | ins2grp[grp] = tmpval | (ins2grp[grp] & 0xFF00);
|
---|
90 | modasg();
|
---|
91 | setv2gi(grp);
|
---|
92 | setinst();
|
---|
93 | return(SUCCESS);
|
---|
94 | }
|
---|
95 |
|
---|
96 | /* |
---|
97 |
|
---|
98 | */
|
---|
99 |
|
---|
100 | /*
|
---|
101 | =============================================================================
|
---|
102 | rd_ains() -- (re)display the field
|
---|
103 | =============================================================================
|
---|
104 | */
|
---|
105 |
|
---|
106 | int16_t rd_ains(int16_t nn)
|
---|
107 | {
|
---|
108 | register int16_t n, grp;
|
---|
109 | int8_t buf[4];
|
---|
110 |
|
---|
111 | n = 0x00FF & nn;
|
---|
112 | grp = 0x00FF & (nn >> 8);
|
---|
113 |
|
---|
114 | sprintf(dspbuf, "%02.2d", ins2grp[grp] & 0x00FF);
|
---|
115 |
|
---|
116 | vbank(0);
|
---|
117 | vcputsv(asgob, 64, adbox[n][4], adbox[n][5],
|
---|
118 | cfetp->frow, cfetp->flcol, dspbuf, 14);
|
---|
119 |
|
---|
120 | return(SUCCESS);
|
---|
121 | }
|
---|
122 |
|
---|
123 | /*
|
---|
124 | =============================================================================
|
---|
125 | nd_ains() -- handle new data entry
|
---|
126 | =============================================================================
|
---|
127 | */
|
---|
128 |
|
---|
129 | int16_t nd_ains(int16_t nn, int16_t k)
|
---|
130 | {
|
---|
131 | register int16_t n;
|
---|
132 |
|
---|
133 | n = nn & 0xFF;
|
---|
134 | ebuf[stccol - cfetp->flcol] = k + '0';
|
---|
135 | ebuf[2] = '\0';
|
---|
136 |
|
---|
137 | dspbuf[0] = k + '0';
|
---|
138 | dspbuf[1] = '\0';
|
---|
139 |
|
---|
140 | vbank(0);
|
---|
141 | vcputsv(asgob, 64, AK_ENTRY, adbox[n][5],
|
---|
142 | stcrow, stccol, dspbuf, 14);
|
---|
143 |
|
---|
144 | advacur();
|
---|
145 | return(SUCCESS);
|
---|
146 | }
|
---|
147 |
|
---|
148 |
|
---|