xref: /netbsd-src/sys/arch/hp300/stand/common/ite_subr.c (revision 94f17fd857e2c82ad544ff0731a93918966ac997)
1*94f17fd8Stsutsui /*	$NetBSD: ite_subr.c,v 1.11 2011/02/12 05:08:41 tsutsui Exp $	*/
2a0864b3eSthorpej 
3a0864b3eSthorpej /*
49b6bd2d9Srmind  * Copyright (c) 1988 University of Utah.
5a0864b3eSthorpej  * Copyright (c) 1990, 1993
6a0864b3eSthorpej  *	The Regents of the University of California.  All rights reserved.
7a0864b3eSthorpej  *
8a0864b3eSthorpej  * This code is derived from software contributed to Berkeley by
9a0864b3eSthorpej  * the Systems Programming Group of the University of Utah Computer
10a0864b3eSthorpej  * Science Department.
11a0864b3eSthorpej  *
12a0864b3eSthorpej  * Redistribution and use in source and binary forms, with or without
13a0864b3eSthorpej  * modification, are permitted provided that the following conditions
14a0864b3eSthorpej  * are met:
15a0864b3eSthorpej  * 1. Redistributions of source code must retain the above copyright
16a0864b3eSthorpej  *    notice, this list of conditions and the following disclaimer.
17a0864b3eSthorpej  * 2. Redistributions in binary form must reproduce the above copyright
18a0864b3eSthorpej  *    notice, this list of conditions and the following disclaimer in the
19a0864b3eSthorpej  *    documentation and/or other materials provided with the distribution.
20aad01611Sagc  * 3. Neither the name of the University nor the names of its contributors
21aad01611Sagc  *    may be used to endorse or promote products derived from this software
22aad01611Sagc  *    without specific prior written permission.
23aad01611Sagc  *
24aad01611Sagc  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25aad01611Sagc  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26aad01611Sagc  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27aad01611Sagc  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28aad01611Sagc  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29aad01611Sagc  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30aad01611Sagc  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31aad01611Sagc  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32aad01611Sagc  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33aad01611Sagc  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34aad01611Sagc  * SUCH DAMAGE.
35aad01611Sagc  *
36aad01611Sagc  * from: Utah $Hdr: ite_subr.c 1.2 92/01/20$
37aad01611Sagc  *
38aad01611Sagc  *	@(#)ite_subr.c	8.1 (Berkeley) 6/10/93
39aad01611Sagc  */
40a0864b3eSthorpej 
41a0864b3eSthorpej #ifdef ITECONSOLE
42a0864b3eSthorpej 
43a0864b3eSthorpej #include <sys/param.h>
44a0864b3eSthorpej 
4513b242e4Stsutsui #include <hp300/stand/common/itereg.h>
46a0864b3eSthorpej 
47a0864b3eSthorpej #include <hp300/stand/common/samachdep.h>
48a0864b3eSthorpej #include <hp300/stand/common/itevar.h>
49a0864b3eSthorpej 
50f7bfe85dStsutsui static void ite_writeglyph(struct ite_data *, u_char *, u_char *);
51f7bfe85dStsutsui 
52212f884fStsutsui void
ite_fontinfo(struct ite_data * ip)53d3dc0553Stsutsui ite_fontinfo(struct ite_data *ip)
54a0864b3eSthorpej {
55a0864b3eSthorpej 	u_long fontaddr = getword(ip, getword(ip, FONTROM) + FONTADDR);
56a0864b3eSthorpej 
57a0864b3eSthorpej 	ip->ftheight = getbyte(ip, fontaddr + FONTHEIGHT);
58a0864b3eSthorpej 	ip->ftwidth  = getbyte(ip, fontaddr + FONTWIDTH);
59a0864b3eSthorpej 	ip->rows     = ip->dheight / ip->ftheight;
60a0864b3eSthorpej 	ip->cols     = ip->dwidth / ip->ftwidth;
61a0864b3eSthorpej 
62a0864b3eSthorpej 	if (ip->fbwidth > ip->dwidth) {
63a0864b3eSthorpej 		/*
64a0864b3eSthorpej 		 * Stuff goes to right of display.
65a0864b3eSthorpej 		 */
66a0864b3eSthorpej 		ip->fontx    = ip->dwidth;
67a0864b3eSthorpej 		ip->fonty    = 0;
68a0864b3eSthorpej 		ip->cpl      = (ip->fbwidth - ip->dwidth) / ip->ftwidth;
69a0864b3eSthorpej 		ip->cblankx  = ip->dwidth;
70a0864b3eSthorpej 		ip->cblanky  = ip->fonty + ((128 / ip->cpl) +1) * ip->ftheight;
71f6330dd7Stsutsui 	} else {
72a0864b3eSthorpej 		/*
73a0864b3eSthorpej 		 * Stuff goes below the display.
74a0864b3eSthorpej 		 */
75a0864b3eSthorpej 		ip->fontx   = 0;
76a0864b3eSthorpej 		ip->fonty   = ip->dheight;
77a0864b3eSthorpej 		ip->cpl     = ip->fbwidth / ip->ftwidth;
78a0864b3eSthorpej 		ip->cblankx = 0;
79a0864b3eSthorpej 		ip->cblanky = ip->fonty + ((128 / ip->cpl) + 1) * ip->ftheight;
80a0864b3eSthorpej 	}
81a0864b3eSthorpej }
82a0864b3eSthorpej 
83212f884fStsutsui void
ite_fontinit1bpp(struct ite_data * ip)8436ac47efStsutsui ite_fontinit1bpp(struct ite_data *ip)
8536ac47efStsutsui {
8636ac47efStsutsui 	u_char *fbmem, *dp;
8736ac47efStsutsui 	int c, l, b;
8836ac47efStsutsui 	int stride, width;
8936ac47efStsutsui 
9036ac47efStsutsui 	dp = (u_char *)(getword(ip, getword(ip, FONTROM) + FONTADDR) +
9136ac47efStsutsui 	    (char *)ip->regbase) + FONTDATA;
9236ac47efStsutsui 	stride = ip->fbwidth >> 3;
9336ac47efStsutsui 	width = (ip->ftwidth + 7) / 8;
9436ac47efStsutsui 
9536ac47efStsutsui 	for (c = 0; c < 128; c++) {
9636ac47efStsutsui 		fbmem = (u_char *)FBBASE +
97f6330dd7Stsutsui 		    (ip->fonty + (c / ip->cpl) * ip->ftheight) * stride;
9836ac47efStsutsui 		fbmem += (ip->fontx >> 3) + (c % ip->cpl) * width;
9936ac47efStsutsui 		for (l = 0; l < ip->ftheight; l++) {
10036ac47efStsutsui 			for (b = 0; b < width; b++) {
10136ac47efStsutsui 				*fbmem++ = *dp;
10236ac47efStsutsui 				dp += 2;
10336ac47efStsutsui 			}
10436ac47efStsutsui 			fbmem -= width;
10536ac47efStsutsui 			fbmem += stride;
10636ac47efStsutsui 		}
10736ac47efStsutsui 	}
10836ac47efStsutsui }
10936ac47efStsutsui 
11036ac47efStsutsui void
ite_fontinit8bpp(struct ite_data * ip)11136ac47efStsutsui ite_fontinit8bpp(struct ite_data *ip)
112a0864b3eSthorpej {
113a0864b3eSthorpej 	int bytewidth = (((ip->ftwidth - 1) / 8) + 1);
114a0864b3eSthorpej 	int glyphsize = bytewidth * ip->ftheight;
115a0864b3eSthorpej 	u_char fontbuf[500];
116a0864b3eSthorpej 	u_char *dp, *fbmem;
117a0864b3eSthorpej 	int c, i, romp;
118a0864b3eSthorpej 
119a0864b3eSthorpej 	romp = getword(ip, getword(ip, FONTROM) + FONTADDR) + FONTDATA;
120a0864b3eSthorpej 	for (c = 0; c < 128; c++) {
121f6330dd7Stsutsui 		fbmem = (u_char *)(FBBASE +
122a0864b3eSthorpej 		     (ip->fonty + (c / ip->cpl) * ip->ftheight) * ip->fbwidth +
123a0864b3eSthorpej 		     (ip->fontx + (c % ip->cpl) * ip->ftwidth));
124a0864b3eSthorpej 		dp = fontbuf;
125a0864b3eSthorpej 		for (i = 0; i < glyphsize; i++) {
126a0864b3eSthorpej 			*dp++ = getbyte(ip, romp);
127a0864b3eSthorpej 			romp += 2;
128a0864b3eSthorpej 		}
129f7bfe85dStsutsui 		ite_writeglyph(ip, fbmem, fontbuf);
130a0864b3eSthorpej 	}
131a0864b3eSthorpej }
132a0864b3eSthorpej 
133f7bfe85dStsutsui static void
ite_writeglyph(struct ite_data * ip,u_char * fbmem,u_char * glyphp)134d3dc0553Stsutsui ite_writeglyph(struct ite_data *ip, u_char *fbmem, u_char *glyphp)
135a0864b3eSthorpej {
136212f884fStsutsui 	int bn;
137212f884fStsutsui 	int l, b;
138a0864b3eSthorpej 
139a0864b3eSthorpej 	for (l = 0; l < ip->ftheight; l++) {
140a0864b3eSthorpej 		bn = 7;
141a0864b3eSthorpej 		for (b = 0; b < ip->ftwidth; b++) {
142a0864b3eSthorpej 			if ((1 << bn) & *glyphp)
143a0864b3eSthorpej 				*fbmem++ = 1;
144a0864b3eSthorpej 			else
145a0864b3eSthorpej 				*fbmem++ = 0;
146a0864b3eSthorpej 			if (--bn < 0) {
147a0864b3eSthorpej 				bn = 7;
148a0864b3eSthorpej 				glyphp++;
149a0864b3eSthorpej 			}
150a0864b3eSthorpej 		}
151a0864b3eSthorpej 		if (bn < 7)
152a0864b3eSthorpej 			glyphp++;
153a0864b3eSthorpej 		fbmem -= ip->ftwidth;
154a0864b3eSthorpej 		fbmem += ip->fbwidth;
155a0864b3eSthorpej 	}
156a0864b3eSthorpej }
157f6330dd7Stsutsui 
158f6330dd7Stsutsui /*
159f6330dd7Stsutsui  * The cursor is just an inverted space.
160f6330dd7Stsutsui  */
161f6330dd7Stsutsui #define flip_cursor(ip) \
162f6330dd7Stsutsui 	(*ip->bmv)(ip, ip->cblanky, ip->cblankx, ip->cursory * ip->ftheight, \
163f6330dd7Stsutsui 	    ip->cursorx * ip->ftwidth, ip->ftheight, ip->ftwidth, RR_XOR)
164f6330dd7Stsutsui 
165f6330dd7Stsutsui void
ite_dio_cursor(struct ite_data * ip,int flag)166f6330dd7Stsutsui ite_dio_cursor(struct ite_data *ip, int flag)
167f6330dd7Stsutsui {
168f6330dd7Stsutsui 
169f6330dd7Stsutsui 	switch (flag) {
170f6330dd7Stsutsui 	case MOVE_CURSOR:
171f6330dd7Stsutsui 		flip_cursor(ip);
172f6330dd7Stsutsui 		/* FALLTHROUGH */
173f6330dd7Stsutsui 	case DRAW_CURSOR:
174f6330dd7Stsutsui 		ip->cursorx = ip->curx;
175f6330dd7Stsutsui 		ip->cursory = ip->cury;
176f6330dd7Stsutsui 		/* FALLTHROUGH */
177f6330dd7Stsutsui 	default:
178f6330dd7Stsutsui 		flip_cursor(ip);
179f6330dd7Stsutsui 		break;
180f6330dd7Stsutsui 	}
181f6330dd7Stsutsui }
182f6330dd7Stsutsui 
183f6330dd7Stsutsui void
ite_dio_putc1bpp(struct ite_data * ip,int c,int dy,int dx)184f6330dd7Stsutsui ite_dio_putc1bpp(struct ite_data *ip, int c, int dy, int dx)
185f6330dd7Stsutsui {
186f6330dd7Stsutsui 
187f6330dd7Stsutsui 	ite_dio_windowmove1bpp(ip, charY(ip, c), charX1bpp(ip, c),
188f6330dd7Stsutsui 	    dy * ip->ftheight, dx * ip->ftwidth,
189f6330dd7Stsutsui 	    ip->ftheight, ip->ftwidth, RR_COPY);
190f6330dd7Stsutsui }
191f6330dd7Stsutsui 
192f6330dd7Stsutsui void
ite_dio_putc8bpp(struct ite_data * ip,int c,int dy,int dx)193f6330dd7Stsutsui ite_dio_putc8bpp(struct ite_data *ip, int c, int dy, int dx)
194f6330dd7Stsutsui {
195f6330dd7Stsutsui 
196f6330dd7Stsutsui 	(*ip->bmv)(ip, charY(ip, c), charX(ip, c),
197f6330dd7Stsutsui 	    dy * ip->ftheight, dx * ip->ftwidth,
198f6330dd7Stsutsui 	    ip->ftheight, ip->ftwidth, RR_COPY);
199f6330dd7Stsutsui }
200f6330dd7Stsutsui 
201f6330dd7Stsutsui void
ite_dio_clear(struct ite_data * ip,int sy,int sx,int h,int w)202f6330dd7Stsutsui ite_dio_clear(struct ite_data *ip, int sy, int sx, int h, int w)
203f6330dd7Stsutsui {
204f6330dd7Stsutsui 
205f6330dd7Stsutsui 	(*ip->bmv)(ip, sy * ip->ftheight, sx * ip->ftwidth,
206f6330dd7Stsutsui 	    sy * ip->ftheight, sx * ip->ftwidth,
207f6330dd7Stsutsui 	    h  * ip->ftheight, w  * ip->ftwidth, RR_CLEAR);
208f6330dd7Stsutsui }
209f6330dd7Stsutsui 
210f6330dd7Stsutsui void
ite_dio_scroll(struct ite_data * ip)211f6330dd7Stsutsui ite_dio_scroll(struct ite_data *ip)
212f6330dd7Stsutsui {
213f6330dd7Stsutsui 
214f6330dd7Stsutsui 	flip_cursor(ip);
215f6330dd7Stsutsui 
216f6330dd7Stsutsui 	(*ip->bmv)(ip, ip->ftheight, 0, 0, 0, (ip->rows - 1) * ip->ftheight,
217f6330dd7Stsutsui 	    ip->cols * ip->ftwidth, RR_COPY);
218f6330dd7Stsutsui }
219f6330dd7Stsutsui 
220f6330dd7Stsutsui #include <hp300/stand/common/maskbits.h>
221f6330dd7Stsutsui 
222f6330dd7Stsutsui /* NOTE:
223f6330dd7Stsutsui  * the first element in starttab could be 0xffffffff.  making it 0
224f6330dd7Stsutsui  * lets us deal with a full first word in the middle loop, rather
225f6330dd7Stsutsui  * than having to do the multiple reads and masks that we'd
226f6330dd7Stsutsui  * have to do if we thought it was partial.
227f6330dd7Stsutsui  */
228f6330dd7Stsutsui int starttab[32] = {
229f6330dd7Stsutsui 	0x00000000,
230f6330dd7Stsutsui 	0x7FFFFFFF,
231f6330dd7Stsutsui 	0x3FFFFFFF,
232f6330dd7Stsutsui 	0x1FFFFFFF,
233f6330dd7Stsutsui 	0x0FFFFFFF,
234f6330dd7Stsutsui 	0x07FFFFFF,
235f6330dd7Stsutsui 	0x03FFFFFF,
236f6330dd7Stsutsui 	0x01FFFFFF,
237f6330dd7Stsutsui 	0x00FFFFFF,
238f6330dd7Stsutsui 	0x007FFFFF,
239f6330dd7Stsutsui 	0x003FFFFF,
240f6330dd7Stsutsui 	0x001FFFFF,
241f6330dd7Stsutsui 	0x000FFFFF,
242f6330dd7Stsutsui 	0x0007FFFF,
243f6330dd7Stsutsui 	0x0003FFFF,
244f6330dd7Stsutsui 	0x0001FFFF,
245f6330dd7Stsutsui 	0x0000FFFF,
246f6330dd7Stsutsui 	0x00007FFF,
247f6330dd7Stsutsui 	0x00003FFF,
248f6330dd7Stsutsui 	0x00001FFF,
249f6330dd7Stsutsui 	0x00000FFF,
250f6330dd7Stsutsui 	0x000007FF,
251f6330dd7Stsutsui 	0x000003FF,
252f6330dd7Stsutsui 	0x000001FF,
253f6330dd7Stsutsui 	0x000000FF,
254f6330dd7Stsutsui 	0x0000007F,
255f6330dd7Stsutsui 	0x0000003F,
256f6330dd7Stsutsui 	0x0000001F,
257f6330dd7Stsutsui 	0x0000000F,
258f6330dd7Stsutsui 	0x00000007,
259f6330dd7Stsutsui 	0x00000003,
260f6330dd7Stsutsui 	0x00000001
261f6330dd7Stsutsui };
262f6330dd7Stsutsui 
263f6330dd7Stsutsui int endtab[32] = {
264f6330dd7Stsutsui 	0x00000000,
265f6330dd7Stsutsui 	0x80000000,
266f6330dd7Stsutsui 	0xC0000000,
267f6330dd7Stsutsui 	0xE0000000,
268f6330dd7Stsutsui 	0xF0000000,
269f6330dd7Stsutsui 	0xF8000000,
270f6330dd7Stsutsui 	0xFC000000,
271f6330dd7Stsutsui 	0xFE000000,
272f6330dd7Stsutsui 	0xFF000000,
273f6330dd7Stsutsui 	0xFF800000,
274f6330dd7Stsutsui 	0xFFC00000,
275f6330dd7Stsutsui 	0xFFE00000,
276f6330dd7Stsutsui 	0xFFF00000,
277f6330dd7Stsutsui 	0xFFF80000,
278f6330dd7Stsutsui 	0xFFFC0000,
279f6330dd7Stsutsui 	0xFFFE0000,
280f6330dd7Stsutsui 	0xFFFF0000,
281f6330dd7Stsutsui 	0xFFFF8000,
282f6330dd7Stsutsui 	0xFFFFC000,
283f6330dd7Stsutsui 	0xFFFFE000,
284f6330dd7Stsutsui 	0xFFFFF000,
285f6330dd7Stsutsui 	0xFFFFF800,
286f6330dd7Stsutsui 	0xFFFFFC00,
287f6330dd7Stsutsui 	0xFFFFFE00,
288f6330dd7Stsutsui 	0xFFFFFF00,
289f6330dd7Stsutsui 	0xFFFFFF80,
290f6330dd7Stsutsui 	0xFFFFFFC0,
291f6330dd7Stsutsui 	0xFFFFFFE0,
292f6330dd7Stsutsui 	0xFFFFFFF0,
293f6330dd7Stsutsui 	0xFFFFFFF8,
294f6330dd7Stsutsui 	0xFFFFFFFC,
295f6330dd7Stsutsui 	0xFFFFFFFE
296f6330dd7Stsutsui };
297f6330dd7Stsutsui 
298f6330dd7Stsutsui void
ite_dio_windowmove1bpp(struct ite_data * ip,int sy,int sx,int dy,int dx,int h,int w,int func)299f6330dd7Stsutsui ite_dio_windowmove1bpp(struct ite_data *ip, int sy, int sx, int dy, int dx,
300f6330dd7Stsutsui     int h, int w, int func)
301f6330dd7Stsutsui {
302f6330dd7Stsutsui 	int width;		/* add to get to same position in next line */
303f6330dd7Stsutsui 
304f6330dd7Stsutsui 	unsigned int *psrcLine, *pdstLine;
305f6330dd7Stsutsui 				/* pointers to line with current src and dst */
306f6330dd7Stsutsui 	unsigned int *psrc;	/* pointer to current src longword */
307f6330dd7Stsutsui 	unsigned int *pdst;	/* pointer to current dst longword */
308f6330dd7Stsutsui 
309f6330dd7Stsutsui 				/* following used for looping through a line */
310f6330dd7Stsutsui 	unsigned int startmask, endmask;  /* masks for writing ends of dst */
311f6330dd7Stsutsui 	int nlMiddle;		/* whole longwords in dst */
312f6330dd7Stsutsui 	int nl;			/* temp copy of nlMiddle */
313f6330dd7Stsutsui 	unsigned int tmpSrc;	/* place to store full source word */
314f6330dd7Stsutsui 	int xoffSrc;		/* offset (>= 0, < 32) from which to
315f6330dd7Stsutsui 				   fetch whole longwords fetched
316f6330dd7Stsutsui 				   in src */
317f6330dd7Stsutsui 	int nstart;		/* number of ragged bits at start of dst */
318f6330dd7Stsutsui 	int nend;		/* number of ragged bits at end of dst */
319f6330dd7Stsutsui 	int srcStartOver;	/* pulling nstart bits from src
320f6330dd7Stsutsui 				   overflows into the next word? */
321f6330dd7Stsutsui 
322f6330dd7Stsutsui 	if (h == 0 || w == 0)
323f6330dd7Stsutsui 		return;
324f6330dd7Stsutsui 
325f6330dd7Stsutsui 	width = ip->fbwidth >> 5;
326f6330dd7Stsutsui 	psrcLine = ((unsigned int *) ip->fbbase) + (sy * width);
327f6330dd7Stsutsui 	pdstLine = ((unsigned int *) ip->fbbase) + (dy * width);
328f6330dd7Stsutsui 
329f6330dd7Stsutsui 	/* x direction doesn't matter for < 1 longword */
330f6330dd7Stsutsui 	if (w <= 32) {
331f6330dd7Stsutsui 		int srcBit, dstBit;     /* bit offset of src and dst */
332f6330dd7Stsutsui 
333f6330dd7Stsutsui 		pdstLine += (dx >> 5);
334f6330dd7Stsutsui 		psrcLine += (sx >> 5);
335f6330dd7Stsutsui 		psrc = psrcLine;
336f6330dd7Stsutsui 		pdst = pdstLine;
337f6330dd7Stsutsui 
338f6330dd7Stsutsui 		srcBit = sx & 0x1f;
339f6330dd7Stsutsui 		dstBit = dx & 0x1f;
340f6330dd7Stsutsui 
341f6330dd7Stsutsui 		while (h--) {
342f6330dd7Stsutsui 			getandputrop(psrc, srcBit, dstBit, w, pdst, func);
343f6330dd7Stsutsui 			pdst += width;
344f6330dd7Stsutsui 			psrc += width;
345f6330dd7Stsutsui 		}
346f6330dd7Stsutsui 	} else {
347f6330dd7Stsutsui 		maskbits(dx, w, startmask, endmask, nlMiddle);
348f6330dd7Stsutsui 		if (startmask)
349f6330dd7Stsutsui 			nstart = 32 - (dx & 0x1f);
350f6330dd7Stsutsui 		else
351f6330dd7Stsutsui 			nstart = 0;
352f6330dd7Stsutsui 		if (endmask)
353f6330dd7Stsutsui 			nend = (dx + w) & 0x1f;
354f6330dd7Stsutsui 		else
355f6330dd7Stsutsui 			nend = 0;
356f6330dd7Stsutsui 
357f6330dd7Stsutsui 		xoffSrc = ((sx & 0x1f) + nstart) & 0x1f;
358f6330dd7Stsutsui 		srcStartOver = ((sx & 0x1f) + nstart) > 31;
359f6330dd7Stsutsui 
360f6330dd7Stsutsui 		pdstLine += (dx >> 5);
361f6330dd7Stsutsui 		psrcLine += (sx >> 5);
362f6330dd7Stsutsui 
363f6330dd7Stsutsui 		while (h--) {
364f6330dd7Stsutsui 			psrc = psrcLine;
365f6330dd7Stsutsui 			pdst = pdstLine;
366f6330dd7Stsutsui 
367f6330dd7Stsutsui 			if (startmask) {
368f6330dd7Stsutsui 				getandputrop(psrc, (sx & 0x1f), (dx & 0x1f),
369f6330dd7Stsutsui 				    nstart, pdst, func);
370f6330dd7Stsutsui 				pdst++;
371f6330dd7Stsutsui 				if (srcStartOver)
372f6330dd7Stsutsui 					psrc++;
373f6330dd7Stsutsui 			}
374f6330dd7Stsutsui 
375f6330dd7Stsutsui 			/* special case for aligned operations */
376f6330dd7Stsutsui 			if (xoffSrc == 0) {
377f6330dd7Stsutsui 				nl = nlMiddle;
378f6330dd7Stsutsui 				while (nl--) {
379f6330dd7Stsutsui 					DoRop(*pdst, func, *psrc++, *pdst);
380f6330dd7Stsutsui 					pdst++;
381f6330dd7Stsutsui 				}
382f6330dd7Stsutsui 			} else {
383f6330dd7Stsutsui 				nl = nlMiddle + 1;
384f6330dd7Stsutsui 				while (--nl) {
385f6330dd7Stsutsui 					getunalignedword(psrc, xoffSrc, tmpSrc);
386f6330dd7Stsutsui 					DoRop(*pdst, func, tmpSrc, *pdst);
387f6330dd7Stsutsui 					pdst++;
388f6330dd7Stsutsui 					psrc++;
389f6330dd7Stsutsui 				}
390f6330dd7Stsutsui 			}
391f6330dd7Stsutsui 
392f6330dd7Stsutsui 			if (endmask) {
393f6330dd7Stsutsui 				getandputrop0(psrc, xoffSrc, nend, pdst, func);
394f6330dd7Stsutsui 			}
395f6330dd7Stsutsui 
396f6330dd7Stsutsui 			pdstLine += width;
397f6330dd7Stsutsui 			psrcLine += width;
398f6330dd7Stsutsui 		}
399f6330dd7Stsutsui 	}
400f6330dd7Stsutsui }
401a0864b3eSthorpej #endif
402