[f40a309] | 1 | /*
|
---|
| 2 | =============================================================================
|
---|
| 3 | ettval.c -- MIDAS tuning editor -- value field handlers
|
---|
| 4 | Version 2 -- 1987-12-09 -- D.N. Lynx Crowe
|
---|
| 5 | =============================================================================
|
---|
| 6 | */
|
---|
| 7 |
|
---|
[b28a12e] | 8 | #include "ram.h"
|
---|
[f40a309] | 9 |
|
---|
| 10 | /*
|
---|
| 11 | =============================================================================
|
---|
| 12 | modtun() -- indicate that the tuning table was modified
|
---|
| 13 | =============================================================================
|
---|
| 14 | */
|
---|
| 15 |
|
---|
[0580615] | 16 | void modtun(void)
|
---|
[f40a309] | 17 | {
|
---|
| 18 | if (NOT tunmod) {
|
---|
| 19 |
|
---|
| 20 | tunmod = TRUE;
|
---|
| 21 | tdswin(6);
|
---|
| 22 | }
|
---|
| 23 | }
|
---|
| 24 |
|
---|
| 25 | /* |
---|
| 26 |
|
---|
| 27 | */
|
---|
| 28 |
|
---|
| 29 | /*
|
---|
| 30 | =============================================================================
|
---|
| 31 | et_tval() -- load the edit buffer
|
---|
| 32 | =============================================================================
|
---|
| 33 | */
|
---|
[7258c6a] | 34 |
|
---|
[f40a309] | 35 | int16_t et_tval(int16_t n)
|
---|
[7258c6a] | 36 | {
|
---|
| 37 | register int16_t tv;
|
---|
[f40a309] | 38 | register int8_t ts;
|
---|
| 39 |
|
---|
| 40 | tv = (tunval < 0 ? -tunval : tunval) >> 1;
|
---|
| 41 | ts = tunval < 0 ? '-' : '+';
|
---|
| 42 |
|
---|
| 43 | sprintf(ebuf, "%c%04d", ts, tv);
|
---|
| 44 | ebflag = TRUE;
|
---|
| 45 |
|
---|
| 46 | return(SUCCESS);
|
---|
| 47 | }
|
---|
| 48 |
|
---|
| 49 | /* |
---|
| 50 |
|
---|
| 51 | */
|
---|
| 52 |
|
---|
| 53 | /*
|
---|
| 54 | =============================================================================
|
---|
| 55 | ef_tval() -- parse (unload) the edit buffer
|
---|
| 56 | =============================================================================
|
---|
[7258c6a] | 57 | */
|
---|
[f40a309] | 58 |
|
---|
[7258c6a] | 59 | int16_t ef_tval(int16_t n)
|
---|
| 60 | {
|
---|
| 61 | register int16_t *ov;
|
---|
[f40a309] | 62 | register int16_t i, tmpval, tv;
|
---|
| 63 | register int8_t ts;
|
---|
| 64 |
|
---|
| 65 | ebuf[5] = '\0'; /* terminate the string in ebuf */
|
---|
| 66 | ebflag = FALSE;
|
---|
| 67 |
|
---|
| 68 | tmpval = 0;
|
---|
| 69 |
|
---|
| 70 | for (i = 1; i < 5; i++) /* convert from ASCII to binary */
|
---|
| 71 | tmpval = (tmpval * 10) + (ebuf[i] - '0');
|
---|
| 72 |
|
---|
| 73 | if (ebuf[0] EQ '-')
|
---|
| 74 | tunval = -tmpval << 1;
|
---|
| 75 | else
|
---|
| 76 | tunval = tmpval << 1;
|
---|
| 77 |
|
---|
| 78 | tv = (tunval < 0 ? -tunval : tunval) >> 1;
|
---|
| 79 | ts = tunval < 0 ? '-' : '+';
|
---|
| 80 | sprintf(dspbuf, "Val %c%04d", ts, tv);
|
---|
| 81 |
|
---|
| 82 | vbank(0);
|
---|
| 83 | vcputsv(tunob, 64, tdbox[n][4], tdbox[n][5], 18, 54, dspbuf, 14);
|
---|
| 84 |
|
---|
| 85 | modtun();
|
---|
| 86 | return(SUCCESS);
|
---|
| 87 | }
|
---|
| 88 |
|
---|
| 89 | /* |
---|
| 90 |
|
---|
| 91 | */
|
---|
| 92 |
|
---|
| 93 | /*
|
---|
| 94 | =============================================================================
|
---|
| 95 | rd_tval() -- (re)display the field
|
---|
[7258c6a] | 96 | =============================================================================
|
---|
[f40a309] | 97 | */
|
---|
[7258c6a] | 98 |
|
---|
| 99 | int16_t rd_tval(int16_t nn)
|
---|
[f40a309] | 100 | {
|
---|
| 101 | register int16_t tv, n;
|
---|
| 102 | register int8_t ts;
|
---|
| 103 |
|
---|
| 104 | n = nn & 0xFF;
|
---|
| 105 |
|
---|
| 106 | tv = (tunval < 0 ? -tunval : tunval) >> 1;
|
---|
| 107 | ts = tunval < 0 ? '-' : '+';
|
---|
| 108 |
|
---|
| 109 | sprintf(dspbuf, "Val %c%04d", ts, tv);
|
---|
| 110 |
|
---|
| 111 | vbank(0);
|
---|
| 112 | vcputsv(tunob, 64, tdbox[n][4], tdbox[n][5], 18, 54, dspbuf, 14);
|
---|
| 113 | return(SUCCESS);
|
---|
| 114 | }
|
---|
| 115 |
|
---|
| 116 | /* |
---|
| 117 |
|
---|
| 118 | */
|
---|
| 119 |
|
---|
| 120 | /*
|
---|
| 121 | =============================================================================
|
---|
[7258c6a] | 122 | nd_tval() -- handle new data entry
|
---|
[f40a309] | 123 | =============================================================================
|
---|
[7258c6a] | 124 | */
|
---|
[f40a309] | 125 |
|
---|
| 126 | int16_t nd_tval(int16_t nn, int16_t k)
|
---|
| 127 | {
|
---|
| 128 | register int16_t ec, n;
|
---|
| 129 |
|
---|
| 130 | n = nn & 0xFF;
|
---|
| 131 | ec = stccol - cfetp->flcol; /* setup edit buffer column */
|
---|
| 132 |
|
---|
| 133 | if (ec EQ 0) {
|
---|
| 134 |
|
---|
| 135 | if (k EQ 8) {
|
---|
| 136 |
|
---|
| 137 | ebuf[0] = '-';
|
---|
| 138 | ebuf[5] = '\0';
|
---|
| 139 |
|
---|
| 140 | dspbuf[0] = '-';
|
---|
| 141 | dspbuf[1] = '\0';
|
---|
| 142 |
|
---|
| 143 | } else if (k EQ 9) {
|
---|
| 144 |
|
---|
| 145 | ebuf[0] = '+';
|
---|
| 146 | ebuf[5] = '\0';
|
---|
| 147 |
|
---|
| 148 | dspbuf[0] = '+';
|
---|
| 149 | dspbuf[1] = '\0';
|
---|
| 150 |
|
---|
| 151 | } else {
|
---|
| 152 |
|
---|
| 153 | return(FAILURE);
|
---|
| 154 | }
|
---|
| 155 | /* |
---|
| 156 |
|
---|
| 157 | */
|
---|
| 158 | } else {
|
---|
| 159 |
|
---|
| 160 | ebuf[ec] = k + '0';
|
---|
| 161 | ebuf[5] = '\0';
|
---|
| 162 |
|
---|
| 163 | dspbuf[0] = k + '0';
|
---|
| 164 | dspbuf[1] = '\0';
|
---|
| 165 | }
|
---|
| 166 |
|
---|
| 167 | vbank(0);
|
---|
| 168 | vcputsv(tunob, 64, TDENTRY, tdbox[n][5], stcrow, stccol, dspbuf, 14);
|
---|
[6262b5c] | 169 |
|
---|
| 170 | advtcur();
|
---|
| 171 | return(SUCCESS);
|
---|
| 172 | }
|
---|
| 173 |
|
---|
| 174 |
|
---|