1 | /*
|
---|
2 | =============================================================================
|
---|
3 | etatab.c -- assignment editor - assignment table number field handlers
|
---|
4 | Version 9 -- 1988-08-22 -- D.N. Lynx Crowe
|
---|
5 | =============================================================================
|
---|
6 | */
|
---|
7 |
|
---|
8 | #include "stddefs.h"
|
---|
9 | #include "fields.h"
|
---|
10 | #include "hwdefs.h"
|
---|
11 | #include "vsdd.h"
|
---|
12 | #include "vsddsw.h"
|
---|
13 | #include "graphdef.h"
|
---|
14 |
|
---|
15 | #include "midas.h"
|
---|
16 | #include "asgdsp.h"
|
---|
17 |
|
---|
18 | #include "stdio.h"
|
---|
19 |
|
---|
20 | extern void adpoint(int16_t x, int16_t y, int16_t pen);
|
---|
21 |
|
---|
22 | extern uint16_t exp_c(uint16_t c);
|
---|
23 | extern void adswin(int16_t n);
|
---|
24 | extern void advacur(void);
|
---|
25 | extern void settc(int16_t rv, int16_t cv);
|
---|
26 |
|
---|
27 | extern void (*point)(int16_t x, int16_t y, int16_t pen);
|
---|
28 |
|
---|
29 | extern uint16_t *asgob;
|
---|
30 |
|
---|
31 | extern int16_t asgmod;
|
---|
32 | extern int16_t curasg;
|
---|
33 | extern int16_t stccol;
|
---|
34 | extern int16_t stcrow;
|
---|
35 |
|
---|
36 | extern int16_t adbox[][8];
|
---|
37 |
|
---|
38 | extern int8_t dspbuf[];
|
---|
39 |
|
---|
40 | /* |
---|
41 |
|
---|
42 | */
|
---|
43 |
|
---|
44 | /*
|
---|
45 | =============================================================================
|
---|
46 | et_atab() -- load the edit buffer
|
---|
47 | =============================================================================
|
---|
48 | */
|
---|
49 |
|
---|
50 | int16_t et_atab(int16_t n)
|
---|
51 | {
|
---|
52 | sprintf(ebuf, "%02d", curasg);
|
---|
53 | ebflag = TRUE;
|
---|
54 |
|
---|
55 | return(SUCCESS);
|
---|
56 | }
|
---|
57 |
|
---|
58 | /*
|
---|
59 | =============================================================================
|
---|
60 | ef_atab() -- parse (unload) the edit buffer
|
---|
61 | =============================================================================
|
---|
62 | */
|
---|
63 |
|
---|
64 | int16_t ef_atab(int16_t n)
|
---|
65 | {
|
---|
66 | register int16_t i, tmpval;
|
---|
67 |
|
---|
68 | ebuf[2] = '\0'; /* terminate the string in ebuf */
|
---|
69 | ebflag = FALSE;
|
---|
70 | tmpval = 0;
|
---|
71 |
|
---|
72 | for (i = 0; i < 2; i++) /* convert from ASCII to binary */
|
---|
73 | tmpval = (tmpval * 10) + (ebuf[i] - '0');
|
---|
74 |
|
---|
75 | if (tmpval GE NASGS)
|
---|
76 | return(FAILURE);
|
---|
77 |
|
---|
78 | curasg = tmpval;
|
---|
79 | asgmod = TRUE;
|
---|
80 | adswin(0);
|
---|
81 |
|
---|
82 | settc(2, 6);
|
---|
83 |
|
---|
84 | return(SUCCESS);
|
---|
85 | }
|
---|
86 |
|
---|
87 | /* |
---|
88 |
|
---|
89 | */
|
---|
90 |
|
---|
91 | /*
|
---|
92 | =============================================================================
|
---|
93 | rd_atab() -- (re)display the field
|
---|
94 | =============================================================================
|
---|
95 | */
|
---|
96 |
|
---|
97 | int16_t rd_atab(int16_t nn)
|
---|
98 | {
|
---|
99 | register int16_t n;
|
---|
100 |
|
---|
101 | n = nn & 0xFF;
|
---|
102 | sprintf(dspbuf, "%02.2d", curasg);
|
---|
103 |
|
---|
104 | point = adpoint;
|
---|
105 |
|
---|
106 | if (v_regs[5] & 0x0180)
|
---|
107 | vbank(0);
|
---|
108 |
|
---|
109 | vcputsv(asgob, 64, (asgmod ? exp_c(AK_MODC) : adbox[n][4]), adbox[n][5],
|
---|
110 | cfetp->frow, cfetp->flcol, dspbuf, 14);
|
---|
111 |
|
---|
112 | lseg(0, 0, 128, 0, AK_BORD);
|
---|
113 |
|
---|
114 | return(SUCCESS);
|
---|
115 | }
|
---|
116 |
|
---|
117 | /*
|
---|
118 | =============================================================================
|
---|
119 | nd_atab() -- handle new data entry
|
---|
120 | =============================================================================
|
---|
121 | */
|
---|
122 |
|
---|
123 | int16_t nd_atab(int16_t nn, int16_t k)
|
---|
124 | {
|
---|
125 | register int16_t ec, n;
|
---|
126 |
|
---|
127 | n = nn & 0xFF;
|
---|
128 | ec = stccol - cfetp->flcol; /* setup edit buffer column */
|
---|
129 |
|
---|
130 | ebuf[ec] = k + '0';
|
---|
131 | ebuf[2] = '\0';
|
---|
132 |
|
---|
133 | dspbuf[0] = k + '0';
|
---|
134 | dspbuf[1] = '\0';
|
---|
135 |
|
---|
136 | point = adpoint;
|
---|
137 |
|
---|
138 | if (v_regs[5] & 0x0180)
|
---|
139 | vbank(0);
|
---|
140 |
|
---|
141 | vcputsv(asgob, 64, AK_ENTRY, adbox[n][5],
|
---|
142 | stcrow, stccol, dspbuf, 14);
|
---|
143 |
|
---|
144 | lseg(0, 0, 128, 0, AK_BORD);
|
---|
145 |
|
---|
146 | advacur();
|
---|
147 | return(SUCCESS);
|
---|
148 | }
|
---|
149 |
|
---|