source: buchla-68k/ram/etloc.c@ 8c8b4e5

Last change on this file since 8c8b4e5 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
RevLine 
[f40a309]1/*
2 =============================================================================
3 etloc.c -- location field handlers
4 Version 11 -- 1988-07-13 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
[b28a12e]8#include "ram.h"
[f40a309]9
10/*
11 =============================================================================
12 et_loc() -- load edit buffer
13 =============================================================================
14*/
15
[7258c6a]16int16_t et_loc(int16_t n)
[f40a309]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
[7258c6a]30void setloc(int16_t grp, int16_t loc)
[f40a309]31{
[8c8b4e5]32 int16_t g, i, val;
33 volatile uint16_t *fpu;
34 struct idfnhdr *fp;
[7258c6a]35 uint16_t fpmant, fpexp;
36 int16_t oldsr;
37 int16_t nop;
[f40a309]38
39 grploc[grp] = loc;
40 val = (loctab[loc] << 1) ^ 0x8000;
41 g = grp + 1;
42
[7258c6a]43 fpmant = (((int32_t)curintp & 0x0000FFF0L) *
44 ((int32_t)timemlt & 0x0000FFFFL)) >> 15;
[f40a309]45
46 fpexp = expbit[curintp & 0x000F];
47
[fa38804]48
[f40a309]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
[7258c6a]61 *(fpu + (int32_t)FPU_TMNT) = fpmant;
[f40a309]62 ++nop; ++nop; ++nop;
[7258c6a]63 *(fpu + (int32_t)FPU_TEXP) = fpexp;
[f40a309]64 ++nop; ++nop; ++nop;
65
66 if (fp->idftmd & I_VNSUBN)
[7258c6a]67 *(fpu + (int32_t)FPU_TNV1) = val;
[f40a309]68 else
[7258c6a]69 *(fpu + (int32_t)FPU_TNV0) = val;
[f40a309]70
71 ++nop; ++nop; ++nop;
72
[7258c6a]73 *(fpu + (int32_t)FPU_TCTL) =
[f40a309]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
[7258c6a]89int16_t ef_loc(int16_t n)
[f40a309]90{
[7258c6a]91 register int16_t ival;
[f40a309]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
[7258c6a]134int16_t rd_loc(int16_t n)
[f40a309]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
[0580615]150void ds_loc(void)
[f40a309]151{
[7258c6a]152 register int16_t i;
[f40a309]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
[7258c6a]164int16_t nd_loc(int16_t n, int16_t k)
[f40a309]165{
[7ecfb7b]166 (void)n;
167
[f40a309]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}
[6262b5c]178
Note: See TracBrowser for help on using the repository browser.