[f40a309] | 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 | #if DEBUGIT
|
---|
| 20 | extern short debugsw;
|
---|
| 21 | #endif
|
---|
| 22 |
|
---|
| 23 | extern unsigned *asgob;
|
---|
| 24 |
|
---|
| 25 | extern short stcrow, stccol;
|
---|
| 26 | extern short prgchan;
|
---|
| 27 |
|
---|
| 28 | extern short adbox[][8];
|
---|
| 29 |
|
---|
| 30 | extern char dspbuf[];
|
---|
| 31 |
|
---|
| 32 | /* |
---|
| 33 |
|
---|
| 34 | */
|
---|
| 35 |
|
---|
| 36 | /*
|
---|
| 37 | =============================================================================
|
---|
| 38 | et_aprg() -- load the edit buffer
|
---|
| 39 | =============================================================================
|
---|
| 40 | */
|
---|
| 41 |
|
---|
| 42 | short
|
---|
| 43 | et_aprg(n)
|
---|
| 44 | short n;
|
---|
| 45 | {
|
---|
| 46 | sprintf(ebuf, "%02d", prgchan);
|
---|
| 47 | ebflag = TRUE;
|
---|
| 48 |
|
---|
| 49 | return(SUCCESS);
|
---|
| 50 | }
|
---|
| 51 |
|
---|
| 52 | /*
|
---|
| 53 | =============================================================================
|
---|
| 54 | ef_aprg() -- parse (unload) the edit buffer
|
---|
| 55 | =============================================================================
|
---|
| 56 | */
|
---|
| 57 |
|
---|
| 58 | short
|
---|
| 59 | ef_aprg(n)
|
---|
| 60 | short n;
|
---|
| 61 | {
|
---|
| 62 | register short 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 | short
|
---|
| 95 | rd_aprg(nn)
|
---|
| 96 | short nn;
|
---|
| 97 | {
|
---|
| 98 | register short n;
|
---|
| 99 |
|
---|
| 100 | n = nn & 0xFF;
|
---|
| 101 | sprintf(dspbuf, "%02.2d", prgchan);
|
---|
| 102 |
|
---|
| 103 | vbank(0);
|
---|
| 104 | vcputsv(asgob, 64, adbox[n][4], adbox[n][5],
|
---|
| 105 | adbox[n][6], adbox[n][7] + 8, dspbuf, 14);
|
---|
| 106 |
|
---|
| 107 | return(SUCCESS);
|
---|
| 108 | }
|
---|
| 109 |
|
---|
| 110 | /*
|
---|
| 111 | =============================================================================
|
---|
| 112 | nd_aprg() -- handle new data entry
|
---|
| 113 | =============================================================================
|
---|
| 114 | */
|
---|
| 115 |
|
---|
| 116 | short
|
---|
| 117 | nd_aprg(nn, k)
|
---|
| 118 | short nn;
|
---|
| 119 | register short k;
|
---|
| 120 | {
|
---|
| 121 | register short ec, n;
|
---|
| 122 |
|
---|
| 123 | n = nn & 0xFF;
|
---|
| 124 |
|
---|
| 125 | ec = stccol - cfetp->flcol; /* setup edit buffer column */
|
---|
| 126 |
|
---|
| 127 | ebuf[ec] = k + '0';
|
---|
| 128 | ebuf[2] = '\0';
|
---|
| 129 |
|
---|
| 130 | dspbuf[0] = k + '0';
|
---|
| 131 | dspbuf[1] = '\0';
|
---|
| 132 |
|
---|
| 133 | vbank(0);
|
---|
| 134 | vcputsv(asgob, 64, AK_ENTRY, adbox[n][5], stcrow, stccol, dspbuf, 14);
|
---|
| 135 |
|
---|
| 136 | advacur();
|
---|
| 137 | return(SUCCESS);
|
---|
| 138 | }
|
---|
| 139 |
|
---|