src/video/xbios/SDL_xbios_milan.c
author Patrice Mandin <patmandin@gmail.com>
Sat, 19 Sep 2009 13:21:05 +0000
branchSDL-1.2
changeset 4195 13de8ea401db
child 4196 89c7562eae9b
permissions -rw-r--r--
Start Milan video support
patmandin@4195
     1
/*
patmandin@4195
     2
    SDL - Simple DirectMedia Layer
patmandin@4195
     3
    Copyright (C) 1997-2009 Sam Lantinga
patmandin@4195
     4
patmandin@4195
     5
    This library is free software; you can redistribute it and/or
patmandin@4195
     6
    modify it under the terms of the GNU Library General Public
patmandin@4195
     7
    License as published by the Free Software Foundation; either
patmandin@4195
     8
    version 2 of the License, or (at your option) any later version.
patmandin@4195
     9
patmandin@4195
    10
    This library is distributed in the hope that it will be useful,
patmandin@4195
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
patmandin@4195
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
patmandin@4195
    13
    Library General Public License for more details.
patmandin@4195
    14
patmandin@4195
    15
    You should have received a copy of the GNU Library General Public
patmandin@4195
    16
    License along with this library; if not, write to the Free
patmandin@4195
    17
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
patmandin@4195
    18
patmandin@4195
    19
    Sam Lantinga
patmandin@4195
    20
    slouken@libsdl.org
patmandin@4195
    21
*/
patmandin@4195
    22
#include "SDL_config.h"
patmandin@4195
    23
patmandin@4195
    24
/*
patmandin@4195
    25
	Milan Xbios video functions
patmandin@4195
    26
patmandin@4195
    27
	Patrice Mandin
patmandin@4195
    28
*/
patmandin@4195
    29
patmandin@4195
    30
#include <mint/cookie.h>
patmandin@4195
    31
patmandin@4195
    32
#include "SDL_xbios.h"
patmandin@4195
    33
#include "SDL_xbios_milan.h"
patmandin@4195
    34
patmandin@4195
    35
#ifndef Validmode
patmandin@4195
    36
#define Validmode(mode)	\
patmandin@4195
    37
	(short)trap_14_ww((short)0x5f,(short)(mode))
patmandin@4195
    38
#endif
patmandin@4195
    39
patmandin@4195
    40
#define NUM_PREDEFINED_MODES 7
patmandin@4195
    41
patmandin@4195
    42
typedef struct {
patmandin@4195
    43
	Uint16 width, height;
patmandin@4195
    44
} predefined_mode_t;
patmandin@4195
    45
patmandin@4195
    46
static const predefined_mode_t mode_list[NUM_PREDEFINED_MODES]={
patmandin@4195
    47
	{640,400},
patmandin@4195
    48
	{640,480},
patmandin@4195
    49
	{800,608},
patmandin@4195
    50
	{1024,768},
patmandin@4195
    51
	{1152,864},
patmandin@4195
    52
	{1280,1024},
patmandin@4195
    53
	{1600,1200}	
patmandin@4195
    54
};
patmandin@4195
    55
patmandin@4195
    56
static const Uint8 mode_bpp[4]={
patmandin@4195
    57
	8, 15, 16, 32
patmandin@4195
    58
};
patmandin@4195
    59
patmandin@4195
    60
void SDL_XBIOS_ListMilanModes(_THIS, int actually_add)
patmandin@4195
    61
{
patmandin@4195
    62
	int i;
patmandin@4195
    63
patmandin@4195
    64
	/* Read infos about current mode */ 
patmandin@4195
    65
patmandin@4195
    66
	/* Read validated predefined modes */
patmandin@4195
    67
	for (i=0; i<NUM_PREDEFINED_MODES; i++) {
patmandin@4195
    68
		int j;
patmandin@4195
    69
		Uint16 deviceid = 0x1000 + (i<<4);
patmandin@4195
    70
patmandin@4195
    71
		for (j=1; j<4; j++) {
patmandin@4195
    72
			if (Validmode(deviceid + j)) {
patmandin@4195
    73
				xbiosmode_t modeinfo;
patmandin@4195
    74
				
patmandin@4195
    75
				modeinfo.number = deviceid + j;
patmandin@4195
    76
				modeinfo.width = mode_list[i].width;
patmandin@4195
    77
				modeinfo.height = mode_list[i].height;
patmandin@4195
    78
				modeinfo.depth = mode_bpp[j-1];
patmandin@4195
    79
				modeinfo.doubleline = SDL_FALSE;
patmandin@4195
    80
patmandin@4195
    81
				SDL_XBIOS_AddMode(this, actually_add, &modeinfo);
patmandin@4195
    82
			}
patmandin@4195
    83
		}
patmandin@4195
    84
	}
patmandin@4195
    85
patmandin@4195
    86
	/* Read custom created modes */
patmandin@4195
    87
}