2 * Mesa 3-D graphics library
5 * Copyright (C) 1999 Brian Paul All Rights Reserved.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 * DOS/DJGPP device driver for Mesa
28 * Author: Daniel Borca
29 * Email : dborca@users.sourceforge.net
30 * Web : http://www.geocities.com/dborca
35 #include <sys/segments.h>
41 static vl_mode
*modes
;
43 #define null_color_precision 8
52 /* Desc: Attempts to detect NUL, check video modes and create selectors.
81 const unsigned int m_count
= sizeof(m
) / sizeof(m
[0]);
82 const unsigned int b_count
= sizeof(b
) / sizeof(b
[0]);
87 modes
= malloc(sizeof(vl_mode
) * (1 + m_count
* b_count
));
90 for (k
= 0, i
= 0; i
< m_count
; i
++) {
91 for (j
= 0; j
< b_count
; j
++, k
++) {
92 modes
[k
].xres
= m
[i
][0];
93 modes
[k
].yres
= m
[i
][1];
95 modes
[k
].mode
= 0x4000;
96 modes
[k
].scanlen
= m
[i
][0] * ((b
[j
] + 7) / 8);
104 modes
[k
].mode
= 0xffff;
105 modes
[k
].scanlen
= -1;
115 /* Desc: Frees all resources allocated by NUL init code.
132 /* Desc: Attempts to enter specified video mode.
134 * In : ptr to mode structure, refresh rate
140 null_entermode (vl_mode
*p
, int refresh
, int fbbits
)
142 NUL
.blit
= null_blit_nop
;
146 (void)(p
&& refresh
&& fbbits
); /* silence compiler warning */
150 /* Desc: Restores to the mode prior to first call to null_entermode.
163 /* Desc: set one palette entry
165 * In : color index, R, G, B
168 * Note: uses integer values
171 null_setCI_i (int index
, int red
, int green
, int blue
)
173 (void)(index
&& red
&& green
&& blue
); /* silence compiler warning */
177 /* Desc: set one palette entry
179 * In : color index, R, G, B
182 * Note: uses normalized values
185 null_setCI_f (int index
, float red
, float green
, float blue
)
187 float max
= (1 << null_color_precision
) - 1;
189 null_setCI_i(index
, (int)(red
* max
), (int)(green
* max
), (int)(blue
* max
));
193 /* Desc: state retrieval
195 * In : parameter name, ptr to storage
196 * Out : 0 if request successfully processed
201 null_get (int pname
, int *params
)
205 params
[0] = params
[0]; /* silence compiler warning */