[f40a309] | 1 | /*
|
---|
| 2 | =============================================================================
|
---|
| 3 | etloc.c -- location field handlers
|
---|
| 4 | Version 11 -- 1988-07-13 -- 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 "graphdef.h"
|
---|
| 13 | #include "vsdd.h"
|
---|
| 14 | #include "vsddsw.h"
|
---|
| 15 | #include "score.h"
|
---|
| 16 | #include "scfns.h"
|
---|
| 17 |
|
---|
| 18 | #include "midas.h"
|
---|
| 19 | #include "scdsp.h"
|
---|
| 20 | #include "instdsp.h"
|
---|
| 21 |
|
---|
[7258c6a] | 22 | extern uint16_t setsr(uint16_t sr);
|
---|
[f40a309] | 23 |
|
---|
[7258c6a] | 24 | extern uint16_t *obj8;
|
---|
[f40a309] | 25 |
|
---|
[7258c6a] | 26 | extern uint16_t curintp;
|
---|
[f40a309] | 27 |
|
---|
[7258c6a] | 28 | extern int16_t ctrsw;
|
---|
| 29 | extern int16_t timemlt;
|
---|
| 30 | extern int16_t recsw;
|
---|
| 31 | extern int16_t stccol;
|
---|
[f40a309] | 32 |
|
---|
[7258c6a] | 33 | extern int16_t grploc[];
|
---|
| 34 | extern int16_t grpmode[];
|
---|
| 35 | extern int16_t grpstat[];
|
---|
| 36 | extern int16_t loctab[];
|
---|
| 37 | extern int16_t vce2grp[];
|
---|
[f40a309] | 38 |
|
---|
[7258c6a] | 39 | extern int16_t expbit[];
|
---|
[f40a309] | 40 |
|
---|
| 41 | extern struct gdsel *gdstbc[];
|
---|
| 42 |
|
---|
| 43 | extern struct instdef vbufs[];
|
---|
| 44 |
|
---|
| 45 | /* |
---|
| 46 |
|
---|
| 47 | */
|
---|
| 48 |
|
---|
| 49 | /*
|
---|
| 50 | =============================================================================
|
---|
| 51 | et_loc() -- load edit buffer
|
---|
| 52 | =============================================================================
|
---|
| 53 | */
|
---|
[7258c6a] | 54 |
|
---|
[f40a309] | 55 | int16_t et_loc(int16_t n)
|
---|
| 56 | {
|
---|
| 57 | ebuf[0] =grploc[n] + 1 + '0';
|
---|
| 58 | ebuf[1] = '\0';
|
---|
| 59 | ebflag = TRUE;
|
---|
| 60 | return(SUCCESS);
|
---|
| 61 | }
|
---|
| 62 |
|
---|
| 63 | /* |
---|
| 64 |
|
---|
| 65 | */
|
---|
| 66 |
|
---|
| 67 | /*
|
---|
| 68 | =============================================================================
|
---|
| 69 | setloc() -- set location
|
---|
| 70 | =============================================================================
|
---|
[7258c6a] | 71 | */
|
---|
[f40a309] | 72 |
|
---|
[7258c6a] | 73 | void setloc(int16_t grp, int16_t loc)
|
---|
| 74 | {
|
---|
| 75 | register int16_t g, i, val;
|
---|
[f40a309] | 76 | register int32_t ltmp;
|
---|
[7258c6a] | 77 | register uint16_t *fpu;
|
---|
| 78 | register struct idfnhdr *fp;
|
---|
| 79 | uint16_t fpmant, fpexp;
|
---|
[f40a309] | 80 | int16_t oldsr;
|
---|
| 81 | int16_t nop;
|
---|
| 82 |
|
---|
| 83 | grploc[grp] = loc;
|
---|
| 84 | val = (loctab[loc] << 1) ^ 0x8000;
|
---|
[7258c6a] | 85 | g = grp + 1;
|
---|
| 86 |
|
---|
[f40a309] | 87 | fpmant = (((int32_t)curintp & 0x0000FFF0L) *
|
---|
| 88 | ((int32_t)timemlt & 0x0000FFFFL)) >> 15;
|
---|
| 89 |
|
---|
| 90 | fpexp = expbit[curintp & 0x000F];
|
---|
| 91 |
|
---|
| 92 | /* |
---|
| 93 |
|
---|
| 94 | */
|
---|
| 95 | for (i = 0; i < 12; i++)
|
---|
| 96 | if (g EQ vce2grp[i]) {
|
---|
| 97 |
|
---|
| 98 | fp = &vbufs[i].idhfnc[4];
|
---|
| 99 | fpu = io_fpu + FPU_OFNC + (i << 8) + 0x0040;
|
---|
| 100 |
|
---|
| 101 | oldsr = setsr(0x2200);
|
---|
| 102 |
|
---|
| 103 | /* ++++++++++++++++++++++++++++ FPU interrupts disabled +++++++++++++++++++++ */
|
---|
[7258c6a] | 104 |
|
---|
[f40a309] | 105 | fp->idftmd ^= I_NVBITS;
|
---|
[7258c6a] | 106 |
|
---|
[f40a309] | 107 | *(fpu + (int32_t)FPU_TMNT) = fpmant;
|
---|
| 108 | ++nop; ++nop; ++nop;
|
---|
| 109 | *(fpu + (int32_t)FPU_TEXP) = fpexp;
|
---|
[7258c6a] | 110 | ++nop; ++nop; ++nop;
|
---|
[f40a309] | 111 |
|
---|
[7258c6a] | 112 | if (fp->idftmd & I_VNSUBN)
|
---|
[f40a309] | 113 | *(fpu + (int32_t)FPU_TNV1) = val;
|
---|
| 114 | else
|
---|
| 115 | *(fpu + (int32_t)FPU_TNV0) = val;
|
---|
[7258c6a] | 116 |
|
---|
[f40a309] | 117 | ++nop; ++nop; ++nop;
|
---|
| 118 |
|
---|
| 119 | *(fpu + (int32_t)FPU_TCTL) =
|
---|
| 120 | (fp->idftmd & (I_NRATIO | I_NVBITS)) | 0x0001;
|
---|
| 121 |
|
---|
| 122 | setsr(oldsr);
|
---|
| 123 |
|
---|
| 124 | /* ++++++++++++++++++++++++++++ Interrupts restored +++++++++++++++++++++++++ */
|
---|
| 125 |
|
---|
| 126 | }
|
---|
| 127 | }
|
---|
| 128 |
|
---|
| 129 | /* |
---|
| 130 |
|
---|
| 131 | */
|
---|
| 132 |
|
---|
| 133 | /*
|
---|
| 134 | =============================================================================
|
---|
[7258c6a] | 135 | ef_loc() -- parse edit buffer
|
---|
[f40a309] | 136 | =============================================================================
|
---|
[7258c6a] | 137 | */
|
---|
[f40a309] | 138 |
|
---|
| 139 | int16_t ef_loc(int16_t n)
|
---|
| 140 | {
|
---|
| 141 | register int16_t ival;
|
---|
| 142 | register struct s_entry *ep;
|
---|
| 143 |
|
---|
| 144 | ebuf[1] = '\0';
|
---|
| 145 | ival = ebuf[0] - '0';
|
---|
| 146 | ebflag = FALSE;
|
---|
| 147 |
|
---|
| 148 | if (ival EQ 0)
|
---|
| 149 | return(FAILURE);
|
---|
| 150 |
|
---|
| 151 | --ival;
|
---|
| 152 |
|
---|
| 153 | setloc(n, ival);
|
---|
| 154 |
|
---|
| 155 | if (recsw AND grpstat[n] AND (2 EQ grpmode[n])) {
|
---|
| 156 |
|
---|
| 157 | if (E_NULL NE (ep = findev(p_cur, t_cur, EV_LOCN, n, -1))) {
|
---|
| 158 |
|
---|
| 159 | ep->e_data2 = ival;
|
---|
| 160 |
|
---|
| 161 | } else if (E_NULL NE (ep = e_alc(E_SIZE2))) {
|
---|
| 162 |
|
---|
| 163 | ep->e_type = EV_LOCN;
|
---|
| 164 | ep->e_data1 = n;
|
---|
| 165 | ep->e_data2 = ival;
|
---|
| 166 | ep->e_time = t_cur;
|
---|
| 167 | p_cur = e_ins(ep, ep_adj(p_cur, 0, t_cur))->e_fwd;
|
---|
| 168 | eh_ins(ep, EH_LOCN);
|
---|
| 169 | ctrsw = TRUE;
|
---|
| 170 | se_disp(ep, D_FWD, gdstbc, 1);
|
---|
| 171 | scupd();
|
---|
| 172 | }
|
---|
| 173 | }
|
---|
| 174 |
|
---|
| 175 | return(SUCCESS);
|
---|
| 176 | }
|
---|
| 177 |
|
---|
| 178 | /* |
---|
| 179 |
|
---|
| 180 | */
|
---|
| 181 |
|
---|
| 182 | /*
|
---|
[7258c6a] | 183 | =============================================================================
|
---|
[f40a309] | 184 | rd_loc() -- (re)display the field
|
---|
| 185 | =============================================================================
|
---|
| 186 | */
|
---|
| 187 |
|
---|
| 188 | int16_t rd_loc(int16_t n)
|
---|
| 189 | {
|
---|
| 190 | if (v_regs[5] & 0x0180)
|
---|
| 191 | vbank(0);
|
---|
| 192 |
|
---|
| 193 | vputc(obj8, 4, 8+(n*5), (grploc[n] + 1 + '0'), SDW11ATR);
|
---|
| 194 |
|
---|
| 195 | return(SUCCESS);
|
---|
| 196 | }
|
---|
| 197 |
|
---|
| 198 | /*
|
---|
[0580615] | 199 | =============================================================================
|
---|
[f40a309] | 200 | ds_loc() -- display all location to group assignments
|
---|
[7258c6a] | 201 | =============================================================================
|
---|
[f40a309] | 202 | */
|
---|
| 203 |
|
---|
| 204 | void ds_loc(void)
|
---|
| 205 | {
|
---|
| 206 | register int16_t i;
|
---|
| 207 |
|
---|
| 208 | for (i = 0; i < 12; i++)
|
---|
| 209 | rd_loc(i);
|
---|
| 210 | }
|
---|
| 211 |
|
---|
| 212 | /* |
---|
| 213 |
|
---|
| 214 | */
|
---|
| 215 |
|
---|
[7258c6a] | 216 | /*
|
---|
[f40a309] | 217 | =============================================================================
|
---|
| 218 | nd_loc() -- data entry function
|
---|
| 219 | =============================================================================
|
---|
| 220 | */
|
---|
| 221 |
|
---|
| 222 | int16_t nd_loc(int16_t n, int16_t k)
|
---|
| 223 | {
|
---|
| 224 | ebuf[0] = k + '0';
|
---|
| 225 |
|
---|
| 226 | if (v_regs[5] & 0x0180)
|
---|
| 227 | vbank(0);
|
---|
| 228 |
|
---|
| 229 | vputc(obj8, 4, stccol, k + '0', SDW11DEA);
|
---|
| 230 | advscur();
|
---|
| 231 |
|
---|
| 232 | return(SUCCESS);
|
---|
| 233 | }
|
---|