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