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