xref: /netbsd/sys/arch/i386/stand/lib/rasops.c (revision 6550d01e)
1 /* $NetBSD: rasops.c,v 1.1 2009/02/16 22:39:30 jmcneill Exp $ */
2 
3 /*-
4  * Copyright (c) 1999 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Andrew Doran.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 #include <lib/libsa/stand.h>
33 
34 /* ANSI colormap (R,G,B). Upper 8 are high-intensity */
35 const uint8_t rasops_cmap[256*3] = {
36 	0x00, 0x00, 0x00, /* black */
37 	0x7f, 0x00, 0x00, /* red */
38 	0x00, 0x7f, 0x00, /* green */
39 	0x7f, 0x7f, 0x00, /* brown */
40 	0x00, 0x00, 0x7f, /* blue */
41 	0x7f, 0x00, 0x7f, /* magenta */
42 	0x00, 0x7f, 0x7f, /* cyan */
43 	0xc7, 0xc7, 0xc7, /* white - XXX too dim? */
44 
45 	0x7f, 0x7f, 0x7f, /* black */
46 	0xff, 0x00, 0x00, /* red */
47 	0x00, 0xff, 0x00, /* green */
48 	0xff, 0xff, 0x00, /* brown */
49 	0x00, 0x00, 0xff, /* blue */
50 	0xff, 0x00, 0xff, /* magenta */
51 	0x00, 0xff, 0xff, /* cyan */
52 	0xff, 0xff, 0xff, /* white */
53 
54 	/*
55 	 * For the cursor, we need at least the last (255th)
56 	 * color to be white. Fill up white completely for
57 	 * simplicity.
58 	 */
59 #define _CMWHITE 0xff, 0xff, 0xff,
60 #define _CMWHITE16	_CMWHITE _CMWHITE _CMWHITE _CMWHITE \
61 			_CMWHITE _CMWHITE _CMWHITE _CMWHITE \
62 			_CMWHITE _CMWHITE _CMWHITE _CMWHITE \
63 			_CMWHITE _CMWHITE _CMWHITE _CMWHITE
64 	_CMWHITE16 _CMWHITE16 _CMWHITE16 _CMWHITE16 _CMWHITE16
65 	_CMWHITE16 _CMWHITE16 _CMWHITE16 _CMWHITE16 _CMWHITE16
66 	_CMWHITE16 _CMWHITE16 _CMWHITE16 _CMWHITE16 /* but not the last one */
67 #undef _CMWHITE16
68 #undef _CMWHITE
69 
70 	/*
71 	 * For the cursor the fg/bg indices are bit inverted, so
72 	 * provide complimentary colors in the upper 16 entries.
73 	 */
74 	0x7f, 0x7f, 0x7f, /* black */
75 	0xff, 0x00, 0x00, /* red */
76 	0x00, 0xff, 0x00, /* green */
77 	0xff, 0xff, 0x00, /* brown */
78 	0x00, 0x00, 0xff, /* blue */
79 	0xff, 0x00, 0xff, /* magenta */
80 	0x00, 0xff, 0xff, /* cyan */
81 	0xff, 0xff, 0xff, /* white */
82 
83 	0x00, 0x00, 0x00, /* black */
84 	0x7f, 0x00, 0x00, /* red */
85 	0x00, 0x7f, 0x00, /* green */
86 	0x7f, 0x7f, 0x00, /* brown */
87 	0x00, 0x00, 0x7f, /* blue */
88 	0x7f, 0x00, 0x7f, /* magenta */
89 	0x00, 0x7f, 0x7f, /* cyan */
90 	0xc7, 0xc7, 0xc7, /* white - XXX too dim? */
91 };
92