source: buchla-68k/ram/etloc.c@ 572daa7

Last change on this file since 572daa7 was 8c8b4e5, checked in by Thomas Lopatic <thomas@…>, 7 years ago

More volatile hardware accesses.

  • Property mode set to 100644
File size: 3.7 KB
Line 
1/*
2 =============================================================================
3 etloc.c -- location field handlers
4 Version 11 -- 1988-07-13 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
8#include "ram.h"
9
10/*
11 =============================================================================
12 et_loc() -- load edit buffer
13 =============================================================================
14*/
15
16int16_t et_loc(int16_t n)
17{
18 ebuf[0] =grploc[n] + 1 + '0';
19 ebuf[1] = '\0';
20 ebflag = TRUE;
21 return(SUCCESS);
22}
23
24/*
25 =============================================================================
26 setloc() -- set location
27 =============================================================================
28*/
29
30void setloc(int16_t grp, int16_t loc)
31{
32 int16_t g, i, val;
33 volatile uint16_t *fpu;
34 struct idfnhdr *fp;
35 uint16_t fpmant, fpexp;
36 int16_t oldsr;
37 int16_t nop;
38
39 grploc[grp] = loc;
40 val = (loctab[loc] << 1) ^ 0x8000;
41 g = grp + 1;
42
43 fpmant = (((int32_t)curintp & 0x0000FFF0L) *
44 ((int32_t)timemlt & 0x0000FFFFL)) >> 15;
45
46 fpexp = expbit[curintp & 0x000F];
47
48
49 for (i = 0; i < 12; i++)
50 if (g EQ vce2grp[i]) {
51
52 fp = &vbufs[i].idhfnc[4];
53 fpu = io_fpu + FPU_OFNC + (i << 8) + 0x0040;
54
55 oldsr = setsr(0x2200);
56
57/* ++++++++++++++++++++++++++++ FPU interrupts disabled +++++++++++++++++++++ */
58
59 fp->idftmd ^= I_NVBITS;
60
61 *(fpu + (int32_t)FPU_TMNT) = fpmant;
62 ++nop; ++nop; ++nop;
63 *(fpu + (int32_t)FPU_TEXP) = fpexp;
64 ++nop; ++nop; ++nop;
65
66 if (fp->idftmd & I_VNSUBN)
67 *(fpu + (int32_t)FPU_TNV1) = val;
68 else
69 *(fpu + (int32_t)FPU_TNV0) = val;
70
71 ++nop; ++nop; ++nop;
72
73 *(fpu + (int32_t)FPU_TCTL) =
74 (fp->idftmd & (I_NRATIO | I_NVBITS)) | 0x0001;
75
76 setsr(oldsr);
77
78/* ++++++++++++++++++++++++++++ Interrupts restored +++++++++++++++++++++++++ */
79
80 }
81}
82
83/*
84 =============================================================================
85 ef_loc() -- parse edit buffer
86 =============================================================================
87*/
88
89int16_t ef_loc(int16_t n)
90{
91 register int16_t ival;
92 register struct s_entry *ep;
93
94 ebuf[1] = '\0';
95 ival = ebuf[0] - '0';
96 ebflag = FALSE;
97
98 if (ival EQ 0)
99 return(FAILURE);
100
101 --ival;
102
103 setloc(n, ival);
104
105 if (recsw AND grpstat[n] AND (2 EQ grpmode[n])) {
106
107 if (E_NULL NE (ep = findev(p_cur, t_cur, EV_LOCN, n, -1))) {
108
109 ep->e_data2 = ival;
110
111 } else if (E_NULL NE (ep = e_alc(E_SIZE2))) {
112
113 ep->e_type = EV_LOCN;
114 ep->e_data1 = n;
115 ep->e_data2 = ival;
116 ep->e_time = t_cur;
117 p_cur = e_ins(ep, ep_adj(p_cur, 0, t_cur))->e_fwd;
118 eh_ins(ep, EH_LOCN);
119 ctrsw = TRUE;
120 se_disp(ep, D_FWD, gdstbc, 1);
121 scupd();
122 }
123 }
124
125 return(SUCCESS);
126}
127
128/*
129 =============================================================================
130 rd_loc() -- (re)display the field
131 =============================================================================
132*/
133
134int16_t rd_loc(int16_t n)
135{
136 if (v_regs[5] & 0x0180)
137 vbank(0);
138
139 vputc(obj8, 4, 8+(n*5), (grploc[n] + 1 + '0'), SDW11ATR);
140
141 return(SUCCESS);
142}
143
144/*
145 =============================================================================
146 ds_loc() -- display all location to group assignments
147 =============================================================================
148*/
149
150void ds_loc(void)
151{
152 register int16_t i;
153
154 for (i = 0; i < 12; i++)
155 rd_loc(i);
156}
157
158/*
159 =============================================================================
160 nd_loc() -- data entry function
161 =============================================================================
162*/
163
164int16_t nd_loc(int16_t n, int16_t k)
165{
166 (void)n;
167
168 ebuf[0] = k + '0';
169
170 if (v_regs[5] & 0x0180)
171 vbank(0);
172
173 vputc(obj8, 4, stccol, k + '0', SDW11DEA);
174 advscur();
175
176 return(SUCCESS);
177}
178
Note: See TracBrowser for help on using the repository browser.