FreeBSD/sys/dev/fb/vga.c
/* turn the BIOS video number into our video mode number */
turn the BIOS video number into our video mode number
turn the BIOS video number into our video mode number
static int
map_bios_mode_num(int type, int color, int bios_mode)
{
    static int cga_modes[7] = {
	M_B40x25, M_C40x25,		
	M_B80x25, M_C80x25,		
	M_BG320, M_CG320,
	M_BG640,
    };
    static int ega_modes[17] = {
	M_ENH_B40x25, M_ENH_C40x25,	
	M_ENH_B80x25, M_ENH_C80x25,	
	M_BG320, M_CG320,
	M_BG640,
	M_EGAMONO80x25,			
	8, 9, 10, 11, 12,
	M_CG320_D,
	M_CG640_E,
	M_ENHMONOAPA2,			
	M_ENH_CG640,			
    };
    static int vga_modes[20] = {
	M_VGA_C40x25, M_VGA_C40x25,	
	M_VGA_C80x25, M_VGA_C80x25,	
	M_BG320, M_CG320,
	M_BG640,
	M_VGA_M80x25,			
	8, 9, 10, 11, 12,
	M_CG320_D,
	M_CG640_E,
	M_ENHMONOAPA2,
	M_ENH_CG640,
	M_BG640x480, M_CG640x480, 
	M_VGA_CG320,
    };
    switch (type) {
    case KD_VGA:
	if (bios_mode < nitems(vga_modes))
	    return vga_modes[bios_mode];
	else if (color)
	    return M_VGA_C80x25;
	else
	    return M_VGA_M80x25;
	break;
    case KD_EGA:
	if (bios_mode < nitems(ega_modes))
	    return ega_modes[bios_mode];
	else if (color)
	    return M_ENH_C80x25;
	else
	    return M_EGAMONO80x25;
	break;
    case KD_CGA:
	if (bios_mode < nitems(cga_modes))
	    return cga_modes[bios_mode];
	else
	    return M_C80x25;
	break;
    case KD_MONO:
    case KD_HERCULES:
	return M_EGAMONO80x25;		
    default:
	break;
    }
    return -1;
}
static int map_bios_mode_num ( int type , int color , int bios_mode ) { static int cga_modes [ 7 ] = { M_B40x25 , M_C40x25 , M_B80x25 , M_C80x25 , M_BG320 , M_CG320 , M_BG640 , } ; static int ega_modes [ 17 ] = { M_ENH_B40x25 , M_ENH_C40x25 , M_ENH_B80x25 , M_ENH_C80x25 , M_BG320 , M_CG320 , M_BG640 , M_EGAMONO80x25 , 8 , 9 , 10 , 11 , 12 , M_CG320_D , M_CG640_E , M_ENHMONOAPA2 , M_ENH_CG640 , } ; static int vga_modes [ 20 ] = { M_VGA_C40x25 , M_VGA_C40x25 , M_VGA_C80x25 , M_VGA_C80x25 , M_BG320 , M_CG320 , M_BG640 , M_VGA_M80x25 , 8 , 9 , 10 , 11 , 12 , M_CG320_D , M_CG640_E , M_ENHMONOAPA2 , M_ENH_CG640 , M_BG640x480 , M_CG640x480 , M_VGA_CG320 , } ; switch ( type ) { case KD_VGA : if ( bios_mode < nitems ( vga_modes ) ) return vga_modes [ bios_mode ] ; else if ( color ) return M_VGA_C80x25 ; else return M_VGA_M80x25 ; break ; case KD_EGA : if ( bios_mode < nitems ( ega_modes ) ) return ega_modes [ bios_mode ] ; else if ( color ) return M_ENH_C80x25 ; else return M_EGAMONO80x25 ; break ; case KD_CGA : if ( bios_mode < nitems ( cga_modes ) ) return cga_modes [ bios_mode ] ; else return M_C80x25 ; break ; case KD_MONO : case KD_HERCULES : return M_EGAMONO80x25 ; default : break ; } return -1 ; }
turn the BIOS video number into our video mode number
turn the BIOS video number into our video mode number
/* 0, 1 */ /* 2, 3 */ /* 0, 1 */ /* 2, 3 */ /* 7 */ /* XXX: video momery > 64K */ /* XXX: video momery > 64K */ /* 0, 1 */ /* 2, 3 */ /* 7 */ /* XXX: this name is confusing */