[f40a309] | 1 | /*
|
---|
| 2 | =============================================================================
|
---|
| 3 | etatab.c -- assignment editor - assignment table number field handlers
|
---|
| 4 | Version 9 -- 1988-08-22 -- D.N. Lynx Crowe
|
---|
| 5 | =============================================================================
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | #include "stddefs.h"
|
---|
| 9 | #include "fields.h"
|
---|
| 10 | #include "hwdefs.h"
|
---|
| 11 | #include "vsdd.h"
|
---|
| 12 | #include "vsddsw.h"
|
---|
| 13 | #include "graphdef.h"
|
---|
| 14 |
|
---|
| 15 | #include "midas.h"
|
---|
| 16 | #include "asgdsp.h"
|
---|
| 17 |
|
---|
[e225e77] | 18 | #include "stdio.h"
|
---|
| 19 |
|
---|
[7258c6a] | 20 | extern void adpoint(int16_t x, int16_t y, int16_t pen);
|
---|
[f40a309] | 21 |
|
---|
[e225e77] | 22 | extern uint16_t exp_c(uint16_t c);
|
---|
| 23 | extern void adswin(int16_t n);
|
---|
| 24 | extern void advacur(void);
|
---|
| 25 | extern void settc(int16_t rv, int16_t cv);
|
---|
| 26 |
|
---|
[7258c6a] | 27 | extern void (*point)(int16_t x, int16_t y, int16_t pen);
|
---|
[f40a309] | 28 |
|
---|
[7258c6a] | 29 | extern uint16_t *asgob;
|
---|
[f40a309] | 30 |
|
---|
[7258c6a] | 31 | extern int16_t asgmod;
|
---|
| 32 | extern int16_t curasg;
|
---|
| 33 | extern int16_t stccol;
|
---|
| 34 | extern int16_t stcrow;
|
---|
[f40a309] | 35 |
|
---|
[7258c6a] | 36 | extern int16_t adbox[][8];
|
---|
[f40a309] | 37 |
|
---|
[7258c6a] | 38 | extern int8_t dspbuf[];
|
---|
[f40a309] | 39 |
|
---|
| 40 | /* |
---|
| 41 |
|
---|
| 42 | */
|
---|
| 43 |
|
---|
| 44 | /*
|
---|
| 45 | =============================================================================
|
---|
| 46 | et_atab() -- load the edit buffer
|
---|
| 47 | =============================================================================
|
---|
| 48 | */
|
---|
[7258c6a] | 49 |
|
---|
[f40a309] | 50 | int16_t et_atab(int16_t n)
|
---|
| 51 | {
|
---|
| 52 | sprintf(ebuf, "%02d", curasg);
|
---|
| 53 | ebflag = TRUE;
|
---|
| 54 |
|
---|
| 55 | return(SUCCESS);
|
---|
| 56 | }
|
---|
| 57 |
|
---|
| 58 | /*
|
---|
| 59 | =============================================================================
|
---|
| 60 | ef_atab() -- parse (unload) the edit buffer
|
---|
| 61 | =============================================================================
|
---|
| 62 | */
|
---|
[7258c6a] | 63 |
|
---|
[f40a309] | 64 | int16_t ef_atab(int16_t n)
|
---|
[7258c6a] | 65 | {
|
---|
[f40a309] | 66 | register int16_t i, tmpval;
|
---|
| 67 |
|
---|
| 68 | ebuf[2] = '\0'; /* terminate the string in ebuf */
|
---|
| 69 | ebflag = FALSE;
|
---|
| 70 | tmpval = 0;
|
---|
| 71 |
|
---|
| 72 | for (i = 0; i < 2; i++) /* convert from ASCII to binary */
|
---|
| 73 | tmpval = (tmpval * 10) + (ebuf[i] - '0');
|
---|
| 74 |
|
---|
| 75 | if (tmpval GE NASGS)
|
---|
| 76 | return(FAILURE);
|
---|
| 77 |
|
---|
| 78 | curasg = tmpval;
|
---|
| 79 | asgmod = TRUE;
|
---|
| 80 | adswin(0);
|
---|
| 81 |
|
---|
| 82 | settc(2, 6);
|
---|
| 83 |
|
---|
| 84 | return(SUCCESS);
|
---|
| 85 | }
|
---|
| 86 |
|
---|
| 87 | /* |
---|
| 88 |
|
---|
| 89 | */
|
---|
| 90 |
|
---|
| 91 | /*
|
---|
| 92 | =============================================================================
|
---|
| 93 | rd_atab() -- (re)display the field
|
---|
| 94 | =============================================================================
|
---|
[7258c6a] | 95 | */
|
---|
[f40a309] | 96 |
|
---|
[7258c6a] | 97 | int16_t rd_atab(int16_t nn)
|
---|
[f40a309] | 98 | {
|
---|
| 99 | register int16_t n;
|
---|
| 100 |
|
---|
| 101 | n = nn & 0xFF;
|
---|
| 102 | sprintf(dspbuf, "%02.2d", curasg);
|
---|
| 103 |
|
---|
| 104 | point = adpoint;
|
---|
| 105 |
|
---|
| 106 | if (v_regs[5] & 0x0180)
|
---|
| 107 | vbank(0);
|
---|
| 108 |
|
---|
| 109 | vcputsv(asgob, 64, (asgmod ? exp_c(AK_MODC) : adbox[n][4]), adbox[n][5],
|
---|
| 110 | cfetp->frow, cfetp->flcol, dspbuf, 14);
|
---|
| 111 |
|
---|
| 112 | lseg(0, 0, 128, 0, AK_BORD);
|
---|
| 113 |
|
---|
| 114 | return(SUCCESS);
|
---|
| 115 | }
|
---|
| 116 |
|
---|
| 117 | /*
|
---|
| 118 | =============================================================================
|
---|
| 119 | nd_atab() -- handle new data entry
|
---|
| 120 | =============================================================================
|
---|
[7258c6a] | 121 | */
|
---|
[f40a309] | 122 |
|
---|
[7258c6a] | 123 | int16_t nd_atab(int16_t nn, int16_t k)
|
---|
[f40a309] | 124 | {
|
---|
| 125 | register int16_t ec, n;
|
---|
| 126 |
|
---|
| 127 | n = nn & 0xFF;
|
---|
| 128 | ec = stccol - cfetp->flcol; /* setup edit buffer column */
|
---|
| 129 |
|
---|
| 130 | ebuf[ec] = k + '0';
|
---|
| 131 | ebuf[2] = '\0';
|
---|
| 132 |
|
---|
| 133 | dspbuf[0] = k + '0';
|
---|
| 134 | dspbuf[1] = '\0';
|
---|
| 135 |
|
---|
| 136 | point = adpoint;
|
---|
| 137 |
|
---|
| 138 | if (v_regs[5] & 0x0180)
|
---|
| 139 | vbank(0);
|
---|
| 140 |
|
---|
| 141 | vcputsv(asgob, 64, AK_ENTRY, adbox[n][5],
|
---|
| 142 | stcrow, stccol, dspbuf, 14);
|
---|
| 143 |
|
---|
| 144 | lseg(0, 0, 128, 0, AK_BORD);
|
---|
| 145 |
|
---|
| 146 | advacur();
|
---|
| 147 | return(SUCCESS);
|
---|
| 148 | }
|
---|
| 149 |
|
---|