source: buchla-68k/ram/curset.c

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

Removed form-feed comments.

  • Property mode set to 100644
File size: 5.3 KB
Line 
1/*
2 =============================================================================
3 curset.c -- cursor control and data entry parameter setup
4 Version 14 -- 1988-12-13 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
8#define DEBUGIT 0
9
10#include "ram.h"
11
12#if DEBUGIT
13uint16_t debugcs = 1;
14
15char *C_TYPE[] = {
16
17 "CT_GRAF", /* 0 graphics */
18 "CT_TEXT", /* 1 text -- general */
19 "CT_VIRT", /* 2 virtual -- graphic */
20 "CT_SCOR", /* 3 text -- score */
21 "CT_SMTH", /* 4 text -- smooth scroll */
22 "CT_MENU" /* 5 virtual -- character */
23};
24#endif
25
26int16_t trkonly = FALSE; /* set TRUE to force use of trackball */
27
28#if DEBUGIT
29
30/*
31 =============================================================================
32 SnapCT() -- snap dump curpak variables
33 =============================================================================
34*/
35
36SnapCT()
37{
38 printf("\ncurpak variables:\n");
39 printf(" curtype = $%lX\n", curtype);
40 printf(" premove = $%lX\n", premove);
41 printf(" pstmove = $%lX\n", pstmove);
42 printf(" cx_key = $%lX\n", cx_key);
43 printf(" cy_key = $%lX\n", cy_key);
44 printf(" cx_upd = $%lX\n", cx_upd);
45 printf(" cy_upd = $%lX\n", cy_upd);
46 printf(" xy_up = $%lX\n", xy_up);
47 printf(" xy_dn = $%lX\n", xy_dn);
48 printf(" x_key = $%lX\n", x_key);
49 printf(" e_key = $%lX\n", e_key);
50 printf(" m_key = $%lX\n", m_key);
51 printf(" d_key = $%lX\n", d_key);
52 printf(" not_fld = $%lX\n", not_fld);
53 printf(" curfet = $%lX\n", curfet);
54 printf(" csbp = $%lX\n", csbp);
55 printf(" cratex = $%lX\n", cratex);
56 printf(" cratey = $%lX\n", cratey);
57 printf(" cmtype = %d\n", cmtype);
58 printf(" cxval = %d\n", cxval);
59 printf(" cyval = %d\n", cyval);
60 printf("\n");
61}
62
63#endif
64
65/*
66 =============================================================================
67 stdctp0() -- cursor type - text, virtual
68 =============================================================================
69*/
70
71int16_t stdctp0(void)
72{
73 return(submenu ? CT_VIRT : CT_TEXT);
74}
75
76/*
77 =============================================================================
78 stdctp1() -- cursor type -- graphic, text, virtual -- text if > curslim
79 =============================================================================
80*/
81
82int16_t stdctp1(void)
83{
84 if (submenu)
85 return(CT_VIRT);
86
87 return((cyval > curslim) ? CT_TEXT : CT_GRAF);
88}
89
90/*
91 =============================================================================
92 stdctp2() -- cursor type -- graphic
93 =============================================================================
94*/
95
96int16_t stdctp2(void)
97{
98 return(CT_GRAF);
99}
100
101/*
102 =============================================================================
103 stdctp3() -- cursor type -- graphic, score text, virtual
104 =============================================================================
105*/
106
107int16_t stdctp3(void)
108{
109 if (submenu)
110 return(CT_VIRT);
111
112 return(((cyval < 14) OR (cyval > 237)) ? CT_SCOR : CT_GRAF);
113}
114
115/*
116 =============================================================================
117 stdctp4() -- cursor type -- graphic, text, virtual -- text if < curslim
118 =============================================================================
119*/
120
121int16_t stdctp4(void)
122{
123 if (submenu)
124 return(CT_VIRT);
125
126 return((cyval < curslim) ? CT_TEXT : CT_GRAF);
127}
128
129/*
130 =============================================================================
131 stdctp5() -- cursor type - text, virtual - character objects
132 =============================================================================
133*/
134
135int16_t stdctp5(void)
136{
137 return(submenu ? CT_MENU : CT_SMTH);
138}
139
140/*
141 =============================================================================
142 curset() -- setup the cursor control and data entry parameters
143 =============================================================================
144*/
145
146void curset(struct curpak *s)
147{
148#if DEBUGIT
149 if (debugsw AND debugcs)
150 printf("curset($%lX): ENTRY old cmtype=%d\n", s, cmtype);
151#endif
152
153 curtype = s->curtype;
154 premove = s->premove;
155 pstmove = s->pstmove;
156
157 curmove = cmvgen;
158
159 if (trkonly) {
160
161 cx_key = txstd;
162 cy_key = tystd;
163
164 } else {
165
166 cx_key = s->cx_key;
167 cy_key = s->cy_key;
168 }
169
170 cx_upd = s->cx_upd;
171 cy_upd = s->cy_upd;
172 xy_up = s->xy_up;
173 xy_dn = s->xy_dn;
174 x_key = s->x_key;
175 e_key = s->e_key;
176 m_key = s->m_key;
177 d_key = s->d_key;
178 not_fld = s->not_fld;
179 curfet = s->curfet;
180 csbp = s->csbp;
181 cratex = s->cratex;
182 cratey = s->cratey;
183 cmtype = s->cmtype;
184 cxval = s->cxval;
185 cyval = s->cyval;
186
187#if DEBUGIT
188 if (debugsw AND debugcs)
189 printf("curset($%lX): new cmtype=%d\n", s, cmtype);
190#endif
191
192
193 if (cmtype EQ CT_GRAF) { /* graphics */
194
195 chtime = hcwval;
196 cvtime = vcwval;
197
198 } else { /* text of some sort */
199
200 chtime = thcwval;
201 cvtime = (cmtype EQ CT_SMTH) ? syrate : tvcwval;
202 }
203
204 stccol = XTOC(cxval);
205 stcrow = YTOR(cyval);
206
207 chwait = chtime;
208 cvwait = cvtime;
209
210 nchwait = curhold;
211 ncvwait = curhold;
212
213 cmfirst = TRUE;
214
215 ebflag = FALSE;
216 memset(ebuf, '\0', sizeof ebuf);
217
218 cfetp = (struct fet *)NULL;
219 infetp = (struct fet *)NULL;
220
221#if DEBUGIT
222 if (debugsw AND debugcs) {
223
224 printf("curset($%lX): EXIT cmtype=%d=%s chtime=%d cvtime=%d curhold=%d\n",
225 s, cmtype,
226 (cmtype < 6) ? C_TYPE[cmtype] : "UNKNOWN",
227 chtime, cvtime, curhold);
228
229 SnapCT();
230 }
231#endif
232
233}
234
Note: See TracBrowser for help on using the repository browser.