[3ae31e9] | 1 | /*
|
---|
| 2 | =============================================================================
|
---|
| 3 | eticnf.c -- instrument editor - configuration number field handlers
|
---|
| 4 | Version 16 -- 1988-08-23 -- D.N. Lynx Crowe
|
---|
| 5 | =============================================================================
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | #include "stddefs.h"
|
---|
| 9 | #include "fields.h"
|
---|
| 10 | #include "hwdefs.h"
|
---|
| 11 | #include "fpu.h"
|
---|
| 12 | #include "vsdd.h"
|
---|
| 13 | #include "vsddsw.h"
|
---|
| 14 | #include "graphdef.h"
|
---|
| 15 |
|
---|
| 16 | #include "midas.h"
|
---|
| 17 | #include "instdsp.h"
|
---|
| 18 |
|
---|
| 19 | #define CFG_OFF 10 /* display offset into configuration field */
|
---|
| 20 |
|
---|
| 21 | extern unsigned *instob;
|
---|
| 22 |
|
---|
| 23 | extern short stccol, curvce;
|
---|
| 24 | extern short idbox[][8];
|
---|
| 25 |
|
---|
| 26 | extern char dspbuf[];
|
---|
| 27 |
|
---|
| 28 | extern struct instdef vbufs[];
|
---|
| 29 |
|
---|
| 30 | /* |
---|
| 31 |
|
---|
| 32 | */
|
---|
| 33 |
|
---|
| 34 | /*
|
---|
| 35 | =============================================================================
|
---|
| 36 | et_icnf() -- load the edit buffer
|
---|
| 37 | =============================================================================
|
---|
| 38 | */
|
---|
| 39 |
|
---|
| 40 | short
|
---|
| 41 | et_icnf(n)
|
---|
| 42 | short n;
|
---|
| 43 | {
|
---|
| 44 | sprintf(ebuf, "%02d", vbufs[curvce].idhcfg);
|
---|
| 45 | ebflag = TRUE;
|
---|
| 46 |
|
---|
| 47 | return(SUCCESS);
|
---|
| 48 | }
|
---|
| 49 |
|
---|
| 50 | /* |
---|
| 51 |
|
---|
| 52 | */
|
---|
| 53 |
|
---|
| 54 | /*
|
---|
| 55 | =============================================================================
|
---|
| 56 | ef_icnf() -- parse (unload) the edit buffer
|
---|
| 57 | =============================================================================
|
---|
| 58 | */
|
---|
| 59 |
|
---|
| 60 | short
|
---|
| 61 | ef_icnf(n)
|
---|
| 62 | short n;
|
---|
| 63 | {
|
---|
| 64 | register short i, tmpval;
|
---|
| 65 |
|
---|
| 66 | ebuf[2] = '\0'; /* terminate the string in ebuf */
|
---|
| 67 | ebflag = FALSE;
|
---|
| 68 |
|
---|
| 69 | tmpval = 0;
|
---|
| 70 |
|
---|
| 71 | for (i = 0; i < 2; i++) /* convert from ASCII to binary */
|
---|
| 72 | tmpval = (tmpval * 10) + (ebuf[i] - '0');
|
---|
| 73 |
|
---|
| 74 | if (tmpval GE NUMCFG) /* check against limit */
|
---|
| 75 | return(FAILURE);
|
---|
| 76 |
|
---|
| 77 | vbufs[curvce].idhcfg = tmpval;
|
---|
| 78 | dosync(curvce);
|
---|
| 79 | showcfg(tmpval);
|
---|
| 80 | modinst();
|
---|
| 81 | return(SUCCESS);
|
---|
| 82 | }
|
---|
| 83 |
|
---|
| 84 | /* |
---|
| 85 |
|
---|
| 86 | */
|
---|
| 87 |
|
---|
| 88 | /*
|
---|
| 89 | =============================================================================
|
---|
| 90 | rd_icnf() -- (re)display the field
|
---|
| 91 | =============================================================================
|
---|
| 92 | */
|
---|
| 93 |
|
---|
| 94 | short
|
---|
| 95 | rd_icnf(n)
|
---|
| 96 | short n;
|
---|
| 97 | {
|
---|
| 98 | sprintf(dspbuf, "%02d", vbufs[curvce].idhcfg); /* convert */
|
---|
| 99 |
|
---|
| 100 | if (v_regs[5] & 0x0180)
|
---|
| 101 | vbank(0);
|
---|
| 102 |
|
---|
| 103 | vcputsv(instob, 64, idbox[n][4], idbox[n][5], /* display */
|
---|
| 104 | idbox[n][6], idbox[n][7] + CFG_OFF, dspbuf, 14);
|
---|
| 105 |
|
---|
| 106 | return(SUCCESS);
|
---|
| 107 | }
|
---|
| 108 |
|
---|
| 109 | /* |
---|
| 110 |
|
---|
| 111 | */
|
---|
| 112 |
|
---|
| 113 | /*
|
---|
| 114 | =============================================================================
|
---|
| 115 | nd_icnf() -- handle new data entry
|
---|
| 116 | =============================================================================
|
---|
| 117 | */
|
---|
| 118 |
|
---|
| 119 | short
|
---|
| 120 | nd_icnf(n, k)
|
---|
| 121 | short n;
|
---|
| 122 | register short k;
|
---|
| 123 | {
|
---|
| 124 | register short ec, c;
|
---|
| 125 |
|
---|
| 126 | ec = stccol - cfetp->flcol; /* setup edit buffer column */
|
---|
| 127 | ebuf[ec] = k + '0'; /* enter new data in buffer */
|
---|
| 128 | ebuf[2] = '\0'; /* make sure string is terminated */
|
---|
| 129 |
|
---|
| 130 | dspbuf[0] = k + '0'; /* setup for display */
|
---|
| 131 | dspbuf[1] = '\0';
|
---|
| 132 |
|
---|
| 133 | if (v_regs[5] & 0x0180)
|
---|
| 134 | vbank(0);
|
---|
| 135 |
|
---|
| 136 | /* display the new data */
|
---|
| 137 |
|
---|
| 138 | vcputsv(instob, 64, ID_ENTRY, idbox[n][5],
|
---|
| 139 | idbox[n][6], stccol, dspbuf, 14);
|
---|
| 140 |
|
---|
| 141 | advicur(); /* advance cursor */
|
---|
| 142 |
|
---|
| 143 | return(SUCCESS);
|
---|
| 144 | }
|
---|
| 145 |
|
---|