[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 | */
|
---|
[0580615] | 41 |
|
---|
[f40a309] | 42 | short et_aprg(short n)
|
---|
| 43 | {
|
---|
| 44 | sprintf(ebuf, "%02d", prgchan);
|
---|
| 45 | ebflag = TRUE;
|
---|
| 46 |
|
---|
| 47 | return(SUCCESS);
|
---|
| 48 | }
|
---|
| 49 |
|
---|
| 50 | /*
|
---|
| 51 | =============================================================================
|
---|
| 52 | ef_aprg() -- parse (unload) the edit buffer
|
---|
| 53 | =============================================================================
|
---|
| 54 | */
|
---|
[0580615] | 55 |
|
---|
[f40a309] | 56 | short ef_aprg(short n)
|
---|
| 57 | {
|
---|
| 58 | register short i, tmpval;
|
---|
| 59 |
|
---|
| 60 | ebuf[2] = '\0'; /* terminate the string in ebuf */
|
---|
| 61 | ebflag = FALSE;
|
---|
| 62 | tmpval = 0;
|
---|
| 63 |
|
---|
| 64 | for (i = 0; i < 2; i++) /* convert from ASCII to binary */
|
---|
| 65 | tmpval = (tmpval * 10) + (ebuf[i] - '0');
|
---|
| 66 |
|
---|
| 67 | #if DEBUGIT
|
---|
| 68 | if (debugsw)
|
---|
| 69 | printf("ef_aprg($%04.4X): ebuf=[%s], tmpval=%d\n",
|
---|
| 70 | n, ebuf, tmpval);
|
---|
| 71 | #endif
|
---|
| 72 |
|
---|
| 73 | if ((tmpval EQ 0) OR (tmpval GT 16))
|
---|
| 74 | return(FAILURE);
|
---|
| 75 |
|
---|
| 76 | prgchan = tmpval;
|
---|
| 77 | return(SUCCESS);
|
---|
| 78 | }
|
---|
| 79 |
|
---|
| 80 | /* |
---|
| 81 |
|
---|
| 82 | */
|
---|
| 83 |
|
---|
| 84 | /*
|
---|
| 85 | =============================================================================
|
---|
| 86 | rd_aprg() -- (re)display the field
|
---|
| 87 | =============================================================================
|
---|
[0580615] | 88 | */
|
---|
[f40a309] | 89 |
|
---|
| 90 | short rd_aprg(short nn)
|
---|
| 91 | {
|
---|
| 92 | register short n;
|
---|
| 93 |
|
---|
| 94 | n = nn & 0xFF;
|
---|
| 95 | sprintf(dspbuf, "%02.2d", prgchan);
|
---|
| 96 |
|
---|
| 97 | vbank(0);
|
---|
| 98 | vcputsv(asgob, 64, adbox[n][4], adbox[n][5],
|
---|
| 99 | adbox[n][6], adbox[n][7] + 8, dspbuf, 14);
|
---|
| 100 |
|
---|
| 101 | return(SUCCESS);
|
---|
| 102 | }
|
---|
| 103 |
|
---|
| 104 | /*
|
---|
| 105 | =============================================================================
|
---|
| 106 | nd_aprg() -- handle new data entry
|
---|
| 107 | =============================================================================
|
---|
[0580615] | 108 | */
|
---|
[f40a309] | 109 |
|
---|
| 110 | short nd_aprg(short nn, short k)
|
---|
| 111 | {
|
---|
| 112 | register short ec, n;
|
---|
| 113 |
|
---|
| 114 | n = nn & 0xFF;
|
---|
| 115 |
|
---|
| 116 | ec = stccol - cfetp->flcol; /* setup edit buffer column */
|
---|
| 117 |
|
---|
| 118 | ebuf[ec] = k + '0';
|
---|
| 119 | ebuf[2] = '\0';
|
---|
| 120 |
|
---|
| 121 | dspbuf[0] = k + '0';
|
---|
| 122 | dspbuf[1] = '\0';
|
---|
| 123 |
|
---|
| 124 | vbank(0);
|
---|
| 125 | vcputsv(asgob, 64, AK_ENTRY, adbox[n][5], stcrow, stccol, dspbuf, 14);
|
---|
| 126 |
|
---|
| 127 | advacur();
|
---|
| 128 | return(SUCCESS);
|
---|
| 129 | }
|
---|
| 130 |
|
---|