source: buchla-68k/vlib/vobjfns.c@ f7c91fc

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

Code compiles, doesn't link.

  • Property mode set to 100644
File size: 5.4 KB
Line 
1/*
2 =============================================================================
3 vobjfns.c -- VSDD object functions
4 Version 23 -- 1988-01-29 -- D.N. Lynx Crowe
5 (c) Copyright 1987,1988 -- D.N. Lynx Crowe
6
7 SelObj(obj)
8 int obj;
9
10 Select 'obj' as the current working object.
11
12 SetPri(obj, pri)
13 int obj, pri;
14
15 Display object 'obj' with priority 'pri'.
16
17 SetObj(obj, type, bank, base, xpix, ypix, x0, y0, flags, pri)
18 int obj, type, bank, xpix, ypix, x0, y0, flags, pri;
19 unsigned int *base;
20
21 Setup object 'obj' of type 'type' at 'base' in bank 'bank'
22 with height 'ypix' and width 'xpix' at initial location
23 'x0','y0', with flags 'flags'. Assumes HRS EQ 1.
24 If 'pri' >= 0, display the object at priority level 'pri'.
25 Define a bitmap object if 'type' EQ 0, or a character object
26 if 'type' NE 0.
27
28 CpyObj(from, to, w, h, sw)
29 unsigned int *from, *to;
30 int w, h, sw;
31
32 Copy a 'w'-word by 'h'-line object from 'from' to 'to' with
33 a destination width of 'sw' words.
34*/
35
36/*
37
38*/
39
40/*
41 VIint() is located in viint.s but is mentioned here for completeness
42
43 VIint()
44
45 Vertical Interrupt handler. Enables display of any object
46 whose bit is set in vi_ctl. Bit 0 = object 0, etc.
47
48 SetPri() uses BIOS(B_SETV, 25, VIint) to set the interrupt
49 vector and lets VIint() enable the object. If vi_dis
50 is set, SetPri() won't enable the interrupt or set the vector
51 so that several objects can be started up at once.
52 =============================================================================
53*/
54
55#include "biosdefs.h"
56#include "graphdef.h"
57#include "hwdefs.h"
58#include "stddefs.h"
59#include "vsdd.h"
60#include "vsddvars.h"
61
62extern int vbank(), objon(), VIint();
63
64short wsize; /* object width calculated by SetObj() */
65short vi_dis; /* disable use of VIint */
66
67unsigned vi_ctl; /* object unblank control bits */
68
69/*
70
71*/
72
73/*
74 =============================================================================
75 SelObj(obj) -- Select 'obj' as the current working object.
76 =============================================================================
77*/
78
79SelObj(obj)
80int obj;
81{
82 register struct octent *op;
83 register unsigned newbank;
84
85 op = &v_obtab[obj];
86
87 newbank = ((op->obank & 0x0001) << 8) | ((op->obank & 0x0002) << 6);
88
89 v_nobj = obj;
90 v_curob = op;
91 v_obpri = op->opri;
92
93 if ((v_regs[5] & 0x0180) NE newbank)
94 vbank(op->obank & 3);
95}
96
97/*
98
99*/
100
101/*
102 =============================================================================
103 SetPri(obj, pri) -- Display object 'obj' with priority 'pri'.
104
105 Blanks the object first, then sets the access table
106 and unblanks the object via VIint().
107 =============================================================================
108*/
109
110SetPri(obj, pri)
111register int obj;
112register int pri;
113{
114 register struct octent *op;
115
116 if (v_regs[5] & 0x0180) /* point at the control bank */
117 vbank(0);
118
119 op = &v_obtab[obj]; /* point at the object table */
120 op->opri = pri; /* set the priority */
121
122 v_odtab[pri][0] = op->odtw0 | V_BLA; /* start object as blanked */
123 v_odtab[pri][1] = op->odtw1;
124 v_odtab[pri][2] = ((long)op->obase >> 1) & 0xFFFF;
125
126 objon(pri, op->objy, op->ysize); /* enable access table bits */
127
128 if (vi_dis) /* don't unblank if vi_dis set */
129 return;
130
131 setipl(7); /* disable interrupts */
132
133 vi_ctl |= (1 << pri); /* set unblank bit */
134
135 if (*((long *)0x000064) NE &VIint) /* make sure VI vector is set */
136 BIOS(B_SETV, 25, VIint);
137
138 setipl(0); /* enable VI interrupt */
139}
140
141/*
142
143*/
144
145/*
146 =============================================================================
147 SetObj(obj, type, bank, base, xpix, ypix, x0, y0, flags, pri)
148 Setup an object, and optionally display it. Assumes HRS EQ 1.
149 =============================================================================
150*/
151
152SetObj(obj, type, bank, base, xpix, ypix, x0, y0, flags, pri)
153int obj, type, bank, xpix, ypix, x0, y0, flags, pri;
154unsigned int *base;
155{
156 register struct octent *op;
157
158 if (v_regs[5] & 0x0180) /* point at the control bank */
159 vbank(0);
160
161 op = &v_obtab[obj];
162
163 v_curob = op;
164 v_nobj = obj;
165 v_obpri = pri;
166
167 op->ysize = ypix;
168 op->xsize = xpix;
169 op->objx = x0;
170 op->objy = y0;
171 op->obase = base;
172 op->opri = pri;
173 op->obank = bank & 3;
174
175/*
176
177*/
178 if (type) { /* character objects */
179
180 op->odtw0 = (flags & 0xF9FF) | V_CTYPE;
181
182 switch (V_RES3 & op->odtw0) {
183
184 case V_RES0:
185
186 wsize = xpix / 128;
187 break;
188
189 case V_RES1:
190
191 wsize = xpix / 48;
192 break;
193
194 case V_RES2:
195
196 wsize = xpix / 64;
197 break;
198
199 case V_RES3:
200
201 wsize = xpix / 96;
202 break;
203 }
204
205 if (V_FAD & op->odtw0)
206 wsize = wsize + (wsize << 1);
207
208/*
209
210*/
211 } else { /* bitmap objects */
212
213 op->odtw0 = (flags & 0x0E37) | (V_BTYPE | ((bank & 3) << 6));
214
215 switch (V_RES3 & op->odtw0) {
216
217 case V_RES0:
218 case V_RES1:
219
220 wsize = 0;
221 break;
222
223 case V_RES2:
224
225 wsize = xpix / 32;
226 break;
227
228 case V_RES3:
229
230 wsize = xpix / 16;
231 break;
232 }
233 }
234
235 op->odtw1 = ((x0 >> 1) & 0x03FF) | (0xFC00 & (wsize << 10));
236
237 if (pri < 0)
238 return;
239
240 SetPri(obj, pri);
241}
242
243/*
244
245*/
246
247/*
248 =============================================================================
249 CpyObj(from, to, w, h, sw)
250
251 Copy a 'w'-word by 'h'-line object from 'from' to 'to' with
252 a destination width of 'sw' words. Assumes we're pointing at
253 the correct bank.
254 =============================================================================
255*/
256
257CpyObj(from, to, w, h, sw)
258register unsigned *from, *to;
259register unsigned w, h, sw;
260{
261 register unsigned *tp;
262 register unsigned i, j;
263
264 for (i = h; i--; ) {
265
266 tp = to;
267
268 for (j = w; j--; )
269 *tp++ = *from++;
270
271 to += sw;
272 }
273}
Note: See TracBrowser for help on using the repository browser.