From d4def64a805a567fe2180e18d48921fb452e1a34 Mon Sep 17 00:00:00 2001 From: briggs Date: Tue, 8 Apr 1997 04:41:26 +0000 Subject: [PATCH] Changes from Michael R. Zucca for 16-bit and 32-bit console support. --- sys/arch/mac68k/dev/ite.c | 97 +++++++++++++++++++++++++++++++++--- sys/arch/mac68k/dev/itevar.h | 3 +- 2 files changed, 92 insertions(+), 8 deletions(-) diff --git a/sys/arch/mac68k/dev/ite.c b/sys/arch/mac68k/dev/ite.c index d39e177c292..0cf676afd65 100644 --- a/sys/arch/mac68k/dev/ite.c +++ b/sys/arch/mac68k/dev/ite.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ite.c,v 1.12 1997/04/03 03:53:27 briggs Exp $ */ +/* $OpenBSD: ite.c,v 1.13 1997/04/08 04:41:26 briggs Exp $ */ /* $NetBSD: ite.c,v 1.32 1997/02/20 00:23:25 scottr Exp $ */ /* @@ -95,6 +95,8 @@ static __inline void putpixel1 __P((int, int, int *, int)); static void putpixel2 __P((int, int, int *, int)); static void putpixel4 __P((int, int, int *, int)); static void putpixel8 __P((int, int, int *, int)); +static void putpixel16 __P((int, int, int *, int)); +static void putpixel32 __P((int, int, int *, int)); static void reversepixel1 __P((int, int, int)); static void writechar __P((char, int, int, int)); static void drawcursor __P((void)); @@ -260,12 +262,58 @@ putpixel8(xx, yy, c, num) } } +static void +putpixel16(xx, yy, c, num) + int xx, yy; + int *c; + int num; +{ + unsigned short *sc; + int videorowshorts; + unsigned char uc; + + sc = (unsigned short *)videoaddr; + + videorowshorts = videorowbytes >> 1; + sc += yy * videorowshorts + xx; + while (num--) { + uc = (*c++ & 0xff); + *sc = (uc << 8) | uc; + sc += videorowshorts; + } +} + +static void +putpixel32(xx, yy, c, num) + int xx, yy; + int *c; + int num; +{ + unsigned long *sc; + int videorowlongs; + unsigned char uc; + + sc = (unsigned long *)videoaddr; + + videorowlongs = videorowbytes >> 2; + sc += yy * videorowlongs + xx; + while (num--) { + uc = (*c++ & 0xff); + *sc = (uc << 24) | (uc << 16) | (uc << 8) | uc; + sc += videorowlongs; +} +} + static void reversepixel1(xx, yy, num) int xx, yy, num; { unsigned int mask; unsigned char *sc; + unsigned long *sl; + unsigned short *ss; + int videorowshorts; + int videorowlongs; sc = (unsigned char *) videoaddr; mask = 0; /* Get rid of warning from compiler */ @@ -287,6 +335,24 @@ reversepixel1(xx, yy, num) mask = 255; sc += yy * videorowbytes + xx; break; + case 16: + videorowshorts = videorowbytes >> 1; + ss = (unsigned short *) videoaddr; + ss += yy * videorowshorts + xx; + while (num--) { + *ss ^= 0xffff; + ss += videorowshorts; + } + return; + case 32: + videorowlongs = videorowbytes >> 2; + sl = (unsigned long *) videoaddr; + sl += yy * videorowlongs + xx; + while (num--) { + *sl ^= 0xffffffff; + sl += videorowlongs; + } + return; default: panic("reversepixel(): unsupported bit depth"); } @@ -330,6 +396,8 @@ writechar(ch, x, y, attr) case 2: case 4: case 8: + case 16: + case 32: for (j = 0; j < CHARWIDTH; j++) { mask = 1 << (CHARWIDTH - 1 - j); for (i = 0; i < CHARHEIGHT; i++) @@ -1166,13 +1234,9 @@ itecninit(struct consdev * cp) return ite_init(); } -int -ite_init() +void +itereset() { - if (ite_initted) - return 0; - - ite_initted = 1; width = videosize & 0xffff; height = (videosize >> 16) & 0xffff; scrrows = height / CHARHEIGHT; @@ -1200,10 +1264,29 @@ ite_init() reversepixel = reversepixel1; screenrowbytes = width; break; + case 16: + putpixel = putpixel16; + reversepixel = reversepixel1; + screenrowbytes = width*2; + break; + case 32: + putpixel = putpixel32; + reversepixel = reversepixel1; + screenrowbytes = width*4; + break; } vt100_reset(); +} +int +ite_init() +{ + if (ite_initted) + return 0; + + ite_initted = 1; + itereset(); return iteon((dev_t) 0, 0); } diff --git a/sys/arch/mac68k/dev/itevar.h b/sys/arch/mac68k/dev/itevar.h index b6faa91b098..febebc44731 100644 --- a/sys/arch/mac68k/dev/itevar.h +++ b/sys/arch/mac68k/dev/itevar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: itevar.h,v 1.1 1996/05/26 19:02:07 briggs Exp $ */ +/* $OpenBSD: itevar.h,v 1.2 1997/04/08 04:41:27 briggs Exp $ */ /* $NetBSD: itevar.h,v 1.1 1996/05/05 06:16:49 briggs Exp $ */ /* @@ -35,6 +35,7 @@ int ite_intr __P((adb_event_t *event)); int iteon __P((dev_t dev, int flags)); int iteoff __P((dev_t dev, int flags)); +void itereset __P((void)); #ifndef CN_DEAD #include -- 2.20.1