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