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

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

Removed form-feed comments.

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