| 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 "ram.h"
|
|---|
| 9 |
|
|---|
| 10 | #define CFG_OFF 10 /* display offset into configuration field */
|
|---|
| 11 |
|
|---|
| 12 | /*
|
|---|
| 13 | =============================================================================
|
|---|
| 14 | et_icnf() -- load the edit buffer
|
|---|
| 15 | =============================================================================
|
|---|
| 16 | */
|
|---|
| 17 |
|
|---|
| 18 | int16_t et_icnf(int16_t n)
|
|---|
| 19 | {
|
|---|
| 20 | sprintf(ebuf, "%02d", vbufs[curvce].idhcfg);
|
|---|
| 21 | ebflag = TRUE;
|
|---|
| 22 |
|
|---|
| 23 | return(SUCCESS);
|
|---|
| 24 | }
|
|---|
| 25 |
|
|---|
| 26 | /*
|
|---|
| 27 | =============================================================================
|
|---|
| 28 | ef_icnf() -- parse (unload) the edit buffer
|
|---|
| 29 | =============================================================================
|
|---|
| 30 | */
|
|---|
| 31 |
|
|---|
| 32 | int16_t ef_icnf(int16_t n)
|
|---|
| 33 | {
|
|---|
| 34 | register int16_t i, tmpval;
|
|---|
| 35 |
|
|---|
| 36 | ebuf[2] = '\0'; /* terminate the string in ebuf */
|
|---|
| 37 | ebflag = FALSE;
|
|---|
| 38 |
|
|---|
| 39 | tmpval = 0;
|
|---|
| 40 |
|
|---|
| 41 | for (i = 0; i < 2; i++) /* convert from ASCII to binary */
|
|---|
| 42 | tmpval = (tmpval * 10) + (ebuf[i] - '0');
|
|---|
| 43 |
|
|---|
| 44 | if (tmpval GE NUMCFG) /* check against limit */
|
|---|
| 45 | return(FAILURE);
|
|---|
| 46 |
|
|---|
| 47 | vbufs[curvce].idhcfg = tmpval;
|
|---|
| 48 | dosync(curvce);
|
|---|
| 49 | showcfg(tmpval);
|
|---|
| 50 | modinst();
|
|---|
| 51 | return(SUCCESS);
|
|---|
| 52 | }
|
|---|
| 53 |
|
|---|
| 54 | /*
|
|---|
| 55 | =============================================================================
|
|---|
| 56 | rd_icnf() -- (re)display the field
|
|---|
| 57 | =============================================================================
|
|---|
| 58 | */
|
|---|
| 59 |
|
|---|
| 60 | int16_t rd_icnf(int16_t n)
|
|---|
| 61 | {
|
|---|
| 62 | sprintf(dspbuf, "%02d", vbufs[curvce].idhcfg); /* convert */
|
|---|
| 63 |
|
|---|
| 64 | if (v_regs[5] & 0x0180)
|
|---|
| 65 | vbank(0);
|
|---|
| 66 |
|
|---|
| 67 | vcputsv(instob, 64, idbox[n][4], idbox[n][5], /* display */
|
|---|
| 68 | idbox[n][6], idbox[n][7] + CFG_OFF, dspbuf, 14);
|
|---|
| 69 |
|
|---|
| 70 | return(SUCCESS);
|
|---|
| 71 | }
|
|---|
| 72 |
|
|---|
| 73 | /*
|
|---|
| 74 | =============================================================================
|
|---|
| 75 | nd_icnf() -- handle new data entry
|
|---|
| 76 | =============================================================================
|
|---|
| 77 | */
|
|---|
| 78 |
|
|---|
| 79 | int16_t nd_icnf(int16_t n, int16_t k)
|
|---|
| 80 | {
|
|---|
| 81 | register int16_t ec, c;
|
|---|
| 82 |
|
|---|
| 83 | ec = stccol - cfetp->flcol; /* setup edit buffer column */
|
|---|
| 84 | ebuf[ec] = k + '0'; /* enter new data in buffer */
|
|---|
| 85 | ebuf[2] = '\0'; /* make sure string is terminated */
|
|---|
| 86 |
|
|---|
| 87 | dspbuf[0] = k + '0'; /* setup for display */
|
|---|
| 88 | dspbuf[1] = '\0';
|
|---|
| 89 |
|
|---|
| 90 | if (v_regs[5] & 0x0180)
|
|---|
| 91 | vbank(0);
|
|---|
| 92 |
|
|---|
| 93 | /* display the new data */
|
|---|
| 94 |
|
|---|
| 95 | vcputsv(instob, 64, ID_ENTRY, idbox[n][5],
|
|---|
| 96 | idbox[n][6], stccol, dspbuf, 14);
|
|---|
| 97 |
|
|---|
| 98 | advicur(); /* advance cursor */
|
|---|
| 99 |
|
|---|
| 100 | return(SUCCESS);
|
|---|
| 101 | }
|
|---|
| 102 |
|
|---|
| 103 |
|
|---|