[f40a309] | 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 | */
|
---|
[0580615] | 39 |
|
---|
[f40a309] | 40 | short et_icnf(short n)
|
---|
| 41 | {
|
---|
| 42 | sprintf(ebuf, "%02d", vbufs[curvce].idhcfg);
|
---|
| 43 | ebflag = TRUE;
|
---|
| 44 |
|
---|
| 45 | return(SUCCESS);
|
---|
| 46 | }
|
---|
| 47 |
|
---|
| 48 | /* |
---|
| 49 |
|
---|
| 50 | */
|
---|
| 51 |
|
---|
| 52 | /*
|
---|
| 53 | =============================================================================
|
---|
| 54 | ef_icnf() -- parse (unload) the edit buffer
|
---|
| 55 | =============================================================================
|
---|
[0580615] | 56 | */
|
---|
[f40a309] | 57 |
|
---|
| 58 | short ef_icnf(short n)
|
---|
| 59 | {
|
---|
| 60 | register short i, tmpval;
|
---|
| 61 |
|
---|
| 62 | ebuf[2] = '\0'; /* terminate the string in ebuf */
|
---|
| 63 | ebflag = FALSE;
|
---|
| 64 |
|
---|
| 65 | tmpval = 0;
|
---|
| 66 |
|
---|
| 67 | for (i = 0; i < 2; i++) /* convert from ASCII to binary */
|
---|
| 68 | tmpval = (tmpval * 10) + (ebuf[i] - '0');
|
---|
| 69 |
|
---|
| 70 | if (tmpval GE NUMCFG) /* check against limit */
|
---|
| 71 | return(FAILURE);
|
---|
| 72 |
|
---|
| 73 | vbufs[curvce].idhcfg = tmpval;
|
---|
| 74 | dosync(curvce);
|
---|
| 75 | showcfg(tmpval);
|
---|
| 76 | modinst();
|
---|
| 77 | return(SUCCESS);
|
---|
| 78 | }
|
---|
| 79 |
|
---|
| 80 | /* |
---|
| 81 |
|
---|
| 82 | */
|
---|
| 83 |
|
---|
| 84 | /*
|
---|
| 85 | =============================================================================
|
---|
| 86 | rd_icnf() -- (re)display the field
|
---|
[0580615] | 87 | =============================================================================
|
---|
[f40a309] | 88 | */
|
---|
| 89 |
|
---|
| 90 | short rd_icnf(short n)
|
---|
| 91 | {
|
---|
| 92 | sprintf(dspbuf, "%02d", vbufs[curvce].idhcfg); /* convert */
|
---|
| 93 |
|
---|
| 94 | if (v_regs[5] & 0x0180)
|
---|
| 95 | vbank(0);
|
---|
| 96 |
|
---|
| 97 | vcputsv(instob, 64, idbox[n][4], idbox[n][5], /* display */
|
---|
| 98 | idbox[n][6], idbox[n][7] + CFG_OFF, dspbuf, 14);
|
---|
| 99 |
|
---|
| 100 | return(SUCCESS);
|
---|
| 101 | }
|
---|
| 102 |
|
---|
| 103 | /* |
---|
| 104 |
|
---|
| 105 | */
|
---|
| 106 |
|
---|
| 107 | /*
|
---|
| 108 | =============================================================================
|
---|
[0580615] | 109 | nd_icnf() -- handle new data entry
|
---|
[f40a309] | 110 | =============================================================================
|
---|
| 111 | */
|
---|
| 112 |
|
---|
| 113 | short nd_icnf(short n, short k)
|
---|
| 114 | {
|
---|
| 115 | register short ec, c;
|
---|
| 116 |
|
---|
| 117 | ec = stccol - cfetp->flcol; /* setup edit buffer column */
|
---|
| 118 | ebuf[ec] = k + '0'; /* enter new data in buffer */
|
---|
| 119 | ebuf[2] = '\0'; /* make sure string is terminated */
|
---|
| 120 |
|
---|
| 121 | dspbuf[0] = k + '0'; /* setup for display */
|
---|
| 122 | dspbuf[1] = '\0';
|
---|
| 123 |
|
---|
| 124 | if (v_regs[5] & 0x0180)
|
---|
| 125 | vbank(0);
|
---|
| 126 |
|
---|
| 127 | /* display the new data */
|
---|
| 128 |
|
---|
| 129 | vcputsv(instob, 64, ID_ENTRY, idbox[n][5],
|
---|
| 130 | idbox[n][6], stccol, dspbuf, 14);
|
---|
| 131 |
|
---|
| 132 | advicur(); /* advance cursor */
|
---|
| 133 |
|
---|
| 134 | return(SUCCESS);
|
---|
| 135 | }
|
---|
| 136 |
|
---|