xref: /csrg-svn/sys/news3400/fb/askrom.c (revision 63257)
153893Smckusick /*
2*63257Sbostic  * Copyright (c) 1992, 1993
3*63257Sbostic  *	The Regents of the University of California.  All rights reserved.
453893Smckusick  *
553893Smckusick  * This code is derived from software contributed to Berkeley by
653893Smckusick  * Sony Corp. and Kazumasa Utashiro of Software Research Associates, Inc.
753893Smckusick  *
853893Smckusick  * %sccs.include.redist.c%
953893Smckusick  *
1053893Smckusick  * from: $Hdr: askrom.c,v 4.300 91/06/09 06:32:39 root Rel41 $ SONY
1153893Smckusick  *
12*63257Sbostic  *	@(#)askrom.c	8.1 (Berkeley) 06/10/93
1353893Smckusick  */
1453893Smckusick 
1553893Smckusick #include "nwb514.h"
1653893Smckusick #include "nwb251.h"
1753893Smckusick #include "nwb256.h"
1853893Smckusick 
1953893Smckusick #if NNWB514 > 0 || NNWB251 > 0 || NNWB256 > 0
2053893Smckusick 
2153893Smckusick #ifdef IPC_MRX
2253893Smckusick #include "../../h/param.h"
2353893Smckusick #include "../../iop/framebuf.h"
2453893Smckusick #include "../../iop/fbreg.h"
2553893Smckusick #else
2653893Smckusick #include <sys/types.h>
2757178Sutashiro #include <sys/param.h>
2857178Sutashiro #include <news3400/iop/framebuf.h>
2957178Sutashiro #include <news3400/iop/fbreg.h>
3053893Smckusick #endif
3153893Smckusick 
3257178Sutashiro #include <news3400/fb/fbdefs.h>
3353893Smckusick 
3457178Sutashiro #include <news3400/fb/qpdm.h>
3553893Smckusick 
3653893Smckusick extern short zero[];
3753893Smckusick 
3853893Smckusick extern char *ext_fnt_addr[];
3953893Smckusick extern char *ext_fnt24_addr[];
4053893Smckusick 
4153893Smckusick int krom_enable = 0;
4253893Smckusick 
4353893Smckusick caddr_t
autos_Krom_addr(fb,c,sr)4453893Smckusick autos_Krom_addr(fb, c, sr)
4553893Smckusick 	struct fbdev *fb;
4653893Smckusick 	register int c;
4753893Smckusick 	lRectangle *sr;
4853893Smckusick {
4953893Smckusick 	unsigned int cvcode24();
5053893Smckusick 
5153893Smckusick 	if ((c >= 0x20) && (c <= 0x7e)) {
5253893Smckusick 		/*
5353893Smckusick 		 * ASCII char
5453893Smckusick 		 */
5553893Smckusick 		c -= ' ';
5653893Smckusick 		c = ((c & 0x1f) | ((c & 0xe0) << 2)) << 7;
5753893Smckusick 		return ((caddr_t)(c + QP_KJROM + (sr->extent.y > 16 ? 0 : 96)));
5853893Smckusick 	} else if ((c >= 0xa1) && (c <= 0xdf)) {
5953893Smckusick 		/*
6053893Smckusick 		 * KANA char
6153893Smckusick 		 */
6253893Smckusick 		if (sr->extent.y > 16)
6353893Smckusick 			return ((caddr_t)ext_fnt24_addr[c + 64]);
6453893Smckusick 		else
6553893Smckusick 			return ((caddr_t)ext_fnt_addr[c + 64]);
6653893Smckusick 	} else if ((c >= 0x2000) && (c <= 0x7fff)) {
6753893Smckusick 		/*
6853893Smckusick 		 * KANJI char
6953893Smckusick 		 */
7053893Smckusick 		switch (c & 0x7000) {
7153893Smckusick 		case 0x2000:
7253893Smckusick 			c = ((c & 0x1f)|((c & 0x60)<<5)|((c & 0x700)>>1))<<7;
7353893Smckusick 			break;
7453893Smckusick 		case 0x3000:
7553893Smckusick 		case 0x4000:
7653893Smckusick 			c = ((c & 0x7f)|((c & 0xf00)>>1)|((c & 0x4000)>>3))<<7;
7753893Smckusick 			break;
7853893Smckusick 		case 0x5000:
7953893Smckusick 		case 0x6000:
8053893Smckusick 			c = ((c & 0x7f)|((c & 0xf00)>>1)
8153893Smckusick 					|((c & 0x2000)>>2)|0x1000) << 7;
8253893Smckusick 			break;
8353893Smckusick 		case 0x7000:
8453893Smckusick 			c = ((c & 0x1f)|((c & 0x60)<<5)
8553893Smckusick 					| ((c & 0x700)>>1)|0x1000) << 7;
8653893Smckusick 			break;
8753893Smckusick 		}
8853893Smckusick 		return ((caddr_t)(c + QP_KJROM + (sr->extent.y > 16 ? 0 : 96)));
8953893Smckusick 	} else {
9053893Smckusick 		/*
9153893Smckusick 		 * UNKNOWN char
9253893Smckusick 		 */
9353893Smckusick 		return ((caddr_t)zero);
9453893Smckusick 	}
9553893Smckusick }
9653893Smckusick #endif /* NNWB514 > 0 || NNWB251 > 0 || NNWB256 > 0 */
97