10 static int driver_init(
char *title,
int w,
int h,
int depth,
int refresh_rate,
int flags);
81 #define DRV_DEPTH_COUNT (sizeof(scr_modes)/sizeof(scr_modes[0]))
85 static int driver_init(
char *title,
int w,
int h,
int depth,
int refresh_rate,
int flags)
88 unsigned char uchNewMode;
90 int iResCount, iFoundRes;
101 if( scr_modes[i].bit_depth == depth ) {
102 depth_modes = scr_modes + i;
107 if (depth_modes ==
NULL)
114 iFoundRes = iResCount;
115 for( i=0; i!=iResCount; ++i ) {
122 if( iFoundRes==iResCount )
129 _movedatab( _dos_ds, 0x449, _my_ds(), (
int) &uchNewMode, 1 );
130 if( uchNewMode!=depth_modes->
modes[ iFoundRes ] )
154 return fb_dos_init(title, w, h, depth, refresh_rate, flags);
161 outportb(0x3CE, 0x08);
162 outportb(0x3CF, 0xFF);
165 outportb(0x3CE, 0x05);
166 outportb(0x3CF, 0x00);
169 outportb(0x3CE, 0x03);
170 outportb(0x3CF, 0x00);
173 outportb(0x3C4, 0x02);
180 unsigned w =
fb_dos.
w, w8 = w >> 3, w32 = w >> 5;
182 unsigned screen_offset = 0xA0000;
183 static const unsigned char vga_bitmap[8] = {
184 128, 64, 32, 16, 8, 4, 2, 1
186 static const unsigned char bitmask[4] = {
189 unsigned uiDestOffset[4] = { 0, w8, w8*2, w8*3 };
198 unsigned x, uiDestIndex = 0;
199 unsigned char *pFrameBuffer =
buffer;
204 for( x=0; x!=w; x+=8 ) {
206 for( plane=0; plane!=planes; ++plane ) {
207 unsigned char color_mask = bitmask[plane];
208 unsigned char pattern = 0;
209 for( i=0; i!=8; ++i ) {
210 if (pFrameBuffer[i] & color_mask)
211 pattern |= vga_bitmap[i];
218 for( plane=0; plane!=planes; ++plane ) {
219 outportb(0x3C5, bitmask[plane] );
236 int y, w =
fb_dos.
w, w4 = w >> 2, w8 = w >> 3, w32 = w >> 5;
238 unsigned int screen_even = 0xB8000;
239 unsigned int screen_odd = 0xBA000;
245 unsigned int *pScreenOffset = ( ((y & 1)==0) ? &screen_even : &screen_odd );
249 unsigned char uchDst = 0;
251 unsigned value = buffer[x];
253 uchDst = (
unsigned char)
255 ((value & 0x01000000) >> 24) +
256 ((value & 0x00010000) >> 15) +
257 ((value & 0x00000100) >> 6) +
258 ((value & 0x00000001) << 3)
265 ((value & 0x01000000) >> 20) +
266 ((value & 0x00010000) >> 11) +
267 ((value & 0x00000100) >> 2) +
268 ((value & 0x00000001) << 7)
274 _dos_ds, *pScreenOffset,
278 *pScreenOffset += w8;
282 int y, w =
fb_dos.
w, w4 = w >> 2, w8 = w >> 3, w32 = w >> 5;
284 unsigned int screen_offset = 0xA0000;
287 outportb(0x3C5, 0x0F);
296 unsigned char uchDst = 0;
298 unsigned value = buffer[x];
300 uchDst = (
unsigned char)
302 ((value & 0x01000000) >> 24) +
303 ((value & 0x00010000) >> 15) +
304 ((value & 0x00000100) >> 6) +
305 ((value & 0x00000001) << 3)
312 ((value & 0x01000000) >> 20) +
313 ((value & 0x00010000) >> 11) +
314 ((value & 0x00000100) >> 2) +
315 ((value & 0x00000001) << 7)
321 _dos_ds, screen_offset,
332 int y, w =
fb_dos.
w, w4 = w >> 2, w16 = w >> 4;
334 unsigned int screen_even = 0xB8000;
335 unsigned int screen_odd = 0xBA000;
341 unsigned int *pScreenOffset = ( ((y & 1)==0) ? &screen_even : &screen_odd );
345 unsigned value = buffer[x];
348 ((value & 0x03000000) >> 24) +
349 ((value & 0x00030000) >> 14) +
350 ((value & 0x00000300) >> 4) +
351 ((value & 0x00000003) << 6)
355 _dos_ds, *pScreenOffset,
359 *pScreenOffset += w4;
382 if( scr_modes[i].bit_depth == depth ) {
383 depth_modes = scr_modes + i;
388 if (depth_modes ==
NULL)
397 while( depth_modes->
modes[ iModeCount ]!=0 )
403 return memcpy((
void*)malloc(iResCount *
sizeof(
int )),
404 depth_modes->
resolutions, iResCount *
sizeof(
int ));