| 1 | /*
|
|---|
| 2 | =============================================================================
|
|---|
| 3 | etagch.c -- assignment editor - group to channel number field handlers
|
|---|
| 4 | Version 6 -- 1987-12-10 -- 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 advacur(void);
|
|---|
| 13 | extern void modasg(void);
|
|---|
| 14 |
|
|---|
| 15 | extern uint16_t *asgob;
|
|---|
| 16 |
|
|---|
| 17 | extern int16_t stcrow, stccol;
|
|---|
| 18 |
|
|---|
| 19 | extern int16_t adbox[][8];
|
|---|
| 20 |
|
|---|
| 21 | extern int8_t dspbuf[];
|
|---|
| 22 |
|
|---|
| 23 | extern int16_t grp2prt[12][2]; /* group to port and channel table */
|
|---|
| 24 | /* port [0] = 0..4, channel [1] = -1, 1..16 */
|
|---|
| 25 |
|
|---|
| 26 | /* |
|---|
| 27 |
|
|---|
| 28 | */
|
|---|
| 29 |
|
|---|
| 30 | /*
|
|---|
| 31 | =============================================================================
|
|---|
| 32 | et_agch() -- load the edit buffer
|
|---|
| 33 | =============================================================================
|
|---|
| 34 | */
|
|---|
| 35 |
|
|---|
| 36 | int16_t et_agch(int16_t n)
|
|---|
| 37 | {
|
|---|
| 38 | register int16_t grp;
|
|---|
| 39 |
|
|---|
| 40 | int8_t buf[4];
|
|---|
| 41 |
|
|---|
| 42 | grp = 0x00FF & (n >> 8);
|
|---|
| 43 |
|
|---|
| 44 | numblk(ebuf, grp2prt[grp][1]);
|
|---|
| 45 | ebflag = TRUE;
|
|---|
| 46 |
|
|---|
| 47 | return(SUCCESS);
|
|---|
| 48 | }
|
|---|
| 49 |
|
|---|
| 50 | /*
|
|---|
| 51 | =============================================================================
|
|---|
| 52 | ef_agch() -- parse (unload) the edit buffer
|
|---|
| 53 | =============================================================================
|
|---|
| 54 | */
|
|---|
| 55 |
|
|---|
| 56 | int16_t ef_agch(int16_t n)
|
|---|
| 57 | {
|
|---|
| 58 | register int16_t tmpval, grp, i;
|
|---|
| 59 |
|
|---|
| 60 | grp = 0x00FF & (n >> 8);
|
|---|
| 61 |
|
|---|
| 62 | ebuf[2] = '\0'; /* terminate the string in ebuf */
|
|---|
| 63 | ebflag = FALSE;
|
|---|
| 64 | tmpval = 0;
|
|---|
| 65 |
|
|---|
| 66 | if ((ebuf[0] EQ ' ') AND (ebuf[1] EQ ' ')) {
|
|---|
| 67 |
|
|---|
| 68 | tmpval = -1;
|
|---|
| 69 |
|
|---|
| 70 | } else {
|
|---|
| 71 |
|
|---|
| 72 | for (i = 0; i < 2; i++) {
|
|---|
| 73 |
|
|---|
| 74 | if (ebuf[i] EQ ' ')
|
|---|
| 75 | ebuf[i] = '0';
|
|---|
| 76 |
|
|---|
| 77 | tmpval = (tmpval * 10) + (ebuf[i] - '0');
|
|---|
| 78 | }
|
|---|
| 79 |
|
|---|
| 80 | if ((tmpval EQ 0) OR (tmpval GT 16))
|
|---|
| 81 | return(FAILURE);
|
|---|
| 82 | }
|
|---|
| 83 |
|
|---|
| 84 | grp2prt[grp][1] = tmpval;
|
|---|
| 85 |
|
|---|
| 86 | modasg();
|
|---|
| 87 | return(SUCCESS);
|
|---|
| 88 | }
|
|---|
| 89 |
|
|---|
| 90 | /* |
|---|
| 91 |
|
|---|
| 92 | */
|
|---|
| 93 |
|
|---|
| 94 | /*
|
|---|
| 95 | =============================================================================
|
|---|
| 96 | rd_agch() -- (re)display the field
|
|---|
| 97 | =============================================================================
|
|---|
| 98 | */
|
|---|
| 99 |
|
|---|
| 100 | int16_t rd_agch(int16_t nn)
|
|---|
| 101 | {
|
|---|
| 102 | register int16_t n, grp;
|
|---|
| 103 | int8_t buf[4];
|
|---|
| 104 |
|
|---|
| 105 | n = 0x00FF & nn;
|
|---|
| 106 | grp = 0x00FF & (nn >> 8);
|
|---|
| 107 |
|
|---|
| 108 | vbank(0);
|
|---|
| 109 | vcputsv(asgob, 64, adbox[n][4], adbox[n][5],
|
|---|
| 110 | cfetp->frow, cfetp->flcol, numblk(buf, grp2prt[grp][1]), 14);
|
|---|
| 111 |
|
|---|
| 112 | return(SUCCESS);
|
|---|
| 113 | }
|
|---|
| 114 |
|
|---|
| 115 | /*
|
|---|
| 116 | =============================================================================
|
|---|
| 117 | nd_agch() -- handle new data entry
|
|---|
| 118 | =============================================================================
|
|---|
| 119 | */
|
|---|
| 120 |
|
|---|
| 121 | int16_t nd_agch(int16_t nn, int16_t k)
|
|---|
| 122 | {
|
|---|
| 123 | register int16_t n;
|
|---|
| 124 |
|
|---|
| 125 | n = nn & 0xFF;
|
|---|
| 126 | ebuf[stccol - cfetp->flcol] = k + '0';
|
|---|
| 127 | ebuf[2] = '\0';
|
|---|
| 128 |
|
|---|
| 129 | dspbuf[0] = k + '0';
|
|---|
| 130 | dspbuf[1] = '\0';
|
|---|
| 131 |
|
|---|
| 132 | vbank(0);
|
|---|
| 133 | vcputsv(asgob, 64, AK_ENTRY, adbox[n][5],
|
|---|
| 134 | stcrow, stccol, dspbuf, 14);
|
|---|
| 135 |
|
|---|
| 136 | advacur();
|
|---|
| 137 | return(SUCCESS);
|
|---|
| 138 | }
|
|---|
| 139 |
|
|---|
| 140 |
|
|---|