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