src/video/xbios/SDL_xbios_milan.c
branchSDL-1.2
changeset 4195 13de8ea401db
child 4196 89c7562eae9b
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/video/xbios/SDL_xbios_milan.c	Sat Sep 19 13:21:05 2009 +0000
     1.3 @@ -0,0 +1,87 @@
     1.4 +/*
     1.5 +    SDL - Simple DirectMedia Layer
     1.6 +    Copyright (C) 1997-2009 Sam Lantinga
     1.7 +
     1.8 +    This library is free software; you can redistribute it and/or
     1.9 +    modify it under the terms of the GNU Library General Public
    1.10 +    License as published by the Free Software Foundation; either
    1.11 +    version 2 of the License, or (at your option) any later version.
    1.12 +
    1.13 +    This library is distributed in the hope that it will be useful,
    1.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1.16 +    Library General Public License for more details.
    1.17 +
    1.18 +    You should have received a copy of the GNU Library General Public
    1.19 +    License along with this library; if not, write to the Free
    1.20 +    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1.21 +
    1.22 +    Sam Lantinga
    1.23 +    slouken@libsdl.org
    1.24 +*/
    1.25 +#include "SDL_config.h"
    1.26 +
    1.27 +/*
    1.28 +	Milan Xbios video functions
    1.29 +
    1.30 +	Patrice Mandin
    1.31 +*/
    1.32 +
    1.33 +#include <mint/cookie.h>
    1.34 +
    1.35 +#include "SDL_xbios.h"
    1.36 +#include "SDL_xbios_milan.h"
    1.37 +
    1.38 +#ifndef Validmode
    1.39 +#define Validmode(mode)	\
    1.40 +	(short)trap_14_ww((short)0x5f,(short)(mode))
    1.41 +#endif
    1.42 +
    1.43 +#define NUM_PREDEFINED_MODES 7
    1.44 +
    1.45 +typedef struct {
    1.46 +	Uint16 width, height;
    1.47 +} predefined_mode_t;
    1.48 +
    1.49 +static const predefined_mode_t mode_list[NUM_PREDEFINED_MODES]={
    1.50 +	{640,400},
    1.51 +	{640,480},
    1.52 +	{800,608},
    1.53 +	{1024,768},
    1.54 +	{1152,864},
    1.55 +	{1280,1024},
    1.56 +	{1600,1200}	
    1.57 +};
    1.58 +
    1.59 +static const Uint8 mode_bpp[4]={
    1.60 +	8, 15, 16, 32
    1.61 +};
    1.62 +
    1.63 +void SDL_XBIOS_ListMilanModes(_THIS, int actually_add)
    1.64 +{
    1.65 +	int i;
    1.66 +
    1.67 +	/* Read infos about current mode */ 
    1.68 +
    1.69 +	/* Read validated predefined modes */
    1.70 +	for (i=0; i<NUM_PREDEFINED_MODES; i++) {
    1.71 +		int j;
    1.72 +		Uint16 deviceid = 0x1000 + (i<<4);
    1.73 +
    1.74 +		for (j=1; j<4; j++) {
    1.75 +			if (Validmode(deviceid + j)) {
    1.76 +				xbiosmode_t modeinfo;
    1.77 +				
    1.78 +				modeinfo.number = deviceid + j;
    1.79 +				modeinfo.width = mode_list[i].width;
    1.80 +				modeinfo.height = mode_list[i].height;
    1.81 +				modeinfo.depth = mode_bpp[j-1];
    1.82 +				modeinfo.doubleline = SDL_FALSE;
    1.83 +
    1.84 +				SDL_XBIOS_AddMode(this, actually_add, &modeinfo);
    1.85 +			}
    1.86 +		}
    1.87 +	}
    1.88 +
    1.89 +	/* Read custom created modes */
    1.90 +}