[3ae31e9] | 1 | /*
|
---|
| 2 | =============================================================================
|
---|
| 3 | etadyn.c -- MIDAS assignment editor -- dynamics to group field handlers
|
---|
| 4 | Version 7 -- 1988-07-13 -- D.N. Lynx Crowe
|
---|
| 5 | =============================================================================
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | #include "stddefs.h"
|
---|
| 9 | #include "fields.h"
|
---|
| 10 | #include "fpu.h"
|
---|
| 11 | #include "hwdefs.h"
|
---|
| 12 | #include "vsdd.h"
|
---|
| 13 | #include "vsddsw.h"
|
---|
| 14 | #include "graphdef.h"
|
---|
| 15 |
|
---|
| 16 | #include "midas.h"
|
---|
| 17 | #include "asgdsp.h"
|
---|
| 18 | #include "instdsp.h"
|
---|
| 19 |
|
---|
| 20 | extern short setsr();
|
---|
| 21 |
|
---|
| 22 | extern unsigned *asgob;
|
---|
| 23 |
|
---|
| 24 | extern unsigned curintp;
|
---|
| 25 |
|
---|
| 26 | extern short stccol;
|
---|
| 27 | extern short stcrow;
|
---|
| 28 | extern short timemlt;
|
---|
| 29 |
|
---|
| 30 | extern char dspbuf[];
|
---|
| 31 |
|
---|
| 32 | extern short vce2grp[];
|
---|
| 33 | extern short grpdyn[];
|
---|
| 34 | extern short dyntab[];
|
---|
| 35 |
|
---|
| 36 | extern unsigned expbit[];
|
---|
| 37 |
|
---|
| 38 | extern short adbox[][8];
|
---|
| 39 |
|
---|
| 40 | extern struct instdef vbufs[];
|
---|
| 41 |
|
---|
| 42 | /* |
---|
| 43 |
|
---|
| 44 | */
|
---|
| 45 |
|
---|
| 46 | /*
|
---|
| 47 | =============================================================================
|
---|
| 48 | et_adyn() -- load the edit buffer
|
---|
| 49 | =============================================================================
|
---|
| 50 | */
|
---|
| 51 |
|
---|
| 52 | short
|
---|
| 53 | et_adyn(n)
|
---|
| 54 | short n;
|
---|
| 55 | {
|
---|
| 56 | register short grp;
|
---|
| 57 |
|
---|
| 58 | grp = 0x00FF & (n >> 8);
|
---|
| 59 |
|
---|
| 60 | ebuf[0] = grpdyn[grp] + '0';
|
---|
| 61 | ebuf[1] = '\0';
|
---|
| 62 |
|
---|
| 63 | ebflag = TRUE;
|
---|
| 64 |
|
---|
| 65 | return(SUCCESS);
|
---|
| 66 | }
|
---|
| 67 |
|
---|
| 68 | /* |
---|
| 69 |
|
---|
| 70 | */
|
---|
| 71 |
|
---|
| 72 | /*
|
---|
| 73 | =============================================================================
|
---|
| 74 | setdyn() -- set dynamics for a group
|
---|
| 75 | =============================================================================
|
---|
| 76 | */
|
---|
| 77 |
|
---|
| 78 | setdyn(grp, dyn)
|
---|
| 79 | short grp, dyn;
|
---|
| 80 | {
|
---|
| 81 | register short g, i, val;
|
---|
| 82 | register long ltmp;
|
---|
| 83 | register unsigned *fpu;
|
---|
| 84 | register struct idfnhdr *fp;
|
---|
| 85 | unsigned fpmant, fpexp;
|
---|
| 86 | short oldsr;
|
---|
| 87 | short nop;
|
---|
| 88 |
|
---|
| 89 | grpdyn[grp] = dyn;
|
---|
| 90 | val = dyntab[dyn];
|
---|
| 91 | g = grp + 1;
|
---|
| 92 |
|
---|
| 93 | fpmant = (((long)curintp & 0x0000FFF0L) *
|
---|
| 94 | ((long)timemlt & 0x0000FFFFL)) >> 15;
|
---|
| 95 |
|
---|
| 96 | fpexp = expbit[curintp & 0x000F];
|
---|
| 97 |
|
---|
| 98 | /* |
---|
| 99 |
|
---|
| 100 | */
|
---|
| 101 | for (i = 0; i < 12; i++)
|
---|
| 102 | if (g EQ vce2grp[i]) {
|
---|
| 103 |
|
---|
| 104 | fp = &vbufs[i].idhfnc[8];
|
---|
| 105 | fpu = io_fpu + FPU_OFNC + (i << 8) + 0x0080;
|
---|
| 106 |
|
---|
| 107 | oldsr = setsr(0x2200);
|
---|
| 108 |
|
---|
| 109 | /* ++++++++++++++++++++++++++++ FPU interrupts disabled +++++++++++++++++++++ */
|
---|
| 110 |
|
---|
| 111 | fp->idftmd ^= I_NVBITS;
|
---|
| 112 | *(fpu + (long)FPU_TMNT) = fpmant;
|
---|
| 113 | ++nop; ++nop; ++nop;
|
---|
| 114 | *(fpu + (long)FPU_TEXP) = fpexp;
|
---|
| 115 | ++nop; ++nop; ++nop;
|
---|
| 116 |
|
---|
| 117 | if (fp->idftmd & I_VNSUBN)
|
---|
| 118 | *(fpu + (long)FPU_TNV1) = val;
|
---|
| 119 | else
|
---|
| 120 | *(fpu + (long)FPU_TNV0) = val;
|
---|
| 121 |
|
---|
| 122 | ++nop; ++nop; ++nop;
|
---|
| 123 |
|
---|
| 124 | *(fpu + (long)FPU_TCTL) =
|
---|
| 125 | (fp->idftmd & (I_NRATIO | I_NVBITS)) | 0x0001;
|
---|
| 126 |
|
---|
| 127 | setsr(oldsr);
|
---|
| 128 |
|
---|
| 129 | /* ++++++++++++++++++++++++++++ Interrupts restored +++++++++++++++++++++++++ */
|
---|
| 130 |
|
---|
| 131 | }
|
---|
| 132 | }
|
---|
| 133 |
|
---|
| 134 | /* |
---|
| 135 |
|
---|
| 136 | */
|
---|
| 137 |
|
---|
| 138 | /*
|
---|
| 139 | =============================================================================
|
---|
| 140 | ef_adyn() -- parse (unload) the edit buffer
|
---|
| 141 | =============================================================================
|
---|
| 142 | */
|
---|
| 143 |
|
---|
| 144 | short
|
---|
| 145 | ef_adyn(n)
|
---|
| 146 | short n;
|
---|
| 147 | {
|
---|
| 148 | register short dyn, grp;
|
---|
| 149 |
|
---|
| 150 | grp = 0x00FF & (n >> 8);
|
---|
| 151 |
|
---|
| 152 | ebuf[1] = '\0'; /* terminate the string in ebuf */
|
---|
| 153 | ebflag = FALSE;
|
---|
| 154 |
|
---|
| 155 | dyn = ebuf[0] - '0';
|
---|
| 156 |
|
---|
| 157 | setdyn(grp, dyn);
|
---|
| 158 | modasg();
|
---|
| 159 | return(SUCCESS);
|
---|
| 160 | }
|
---|
| 161 |
|
---|
| 162 | /* |
---|
| 163 |
|
---|
| 164 | */
|
---|
| 165 |
|
---|
| 166 | /*
|
---|
| 167 | =============================================================================
|
---|
| 168 | rd_adyn() -- (re)display the field
|
---|
| 169 | =============================================================================
|
---|
| 170 | */
|
---|
| 171 |
|
---|
| 172 | short
|
---|
| 173 | rd_adyn(nn)
|
---|
| 174 | short nn;
|
---|
| 175 | {
|
---|
| 176 | register short n, grp;
|
---|
| 177 |
|
---|
| 178 | n = 0x00FF & nn;
|
---|
| 179 | grp = 0x00FF & (nn >> 8);
|
---|
| 180 |
|
---|
| 181 | dspbuf[0] = grpdyn[grp] + '0';
|
---|
| 182 | dspbuf[1] = '\0';
|
---|
| 183 |
|
---|
| 184 | vbank(0);
|
---|
| 185 | vcputsv(asgob, 64, adbox[n][4], adbox[n][5],
|
---|
| 186 | cfetp->frow, cfetp->flcol, dspbuf, 14);
|
---|
| 187 |
|
---|
| 188 | return(SUCCESS);
|
---|
| 189 | }
|
---|
| 190 |
|
---|
| 191 | /*
|
---|
| 192 | =============================================================================
|
---|
| 193 | nd_adyn() -- handle new data entry
|
---|
| 194 | =============================================================================
|
---|
| 195 | */
|
---|
| 196 |
|
---|
| 197 | short
|
---|
| 198 | nd_adyn(nn, k)
|
---|
| 199 | short nn;
|
---|
| 200 | register short k;
|
---|
| 201 | {
|
---|
| 202 | register short n;
|
---|
| 203 |
|
---|
| 204 | n = nn & 0xFF;
|
---|
| 205 |
|
---|
| 206 | dspbuf[0] = ebuf[0] = k + '0';
|
---|
| 207 | dspbuf[1] = ebuf[1] = '\0';
|
---|
| 208 |
|
---|
| 209 | vbank(0);
|
---|
| 210 | vcputsv(asgob, 64, AK_ENTRY, adbox[n][5], stcrow, stccol, dspbuf, 14);
|
---|
| 211 |
|
---|
| 212 | return(SUCCESS);
|
---|
| 213 | }
|
---|
| 214 |
|
---|