Home | History | Annotate | Download | only in xbios
      1 /*
      2     SDL - Simple DirectMedia Layer
      3     Copyright (C) 1997-2006 Sam Lantinga
      4 
      5     This library is free software; you can redistribute it and/or
      6     modify it under the terms of the GNU Lesser General Public
      7     License as published by the Free Software Foundation; either
      8     version 2.1 of the License, or (at your option) any later version.
      9 
     10     This library is distributed in the hope that it will be useful,
     11     but WITHOUT ANY WARRANTY; without even the implied warranty of
     12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     13     Lesser General Public License for more details.
     14 
     15     You should have received a copy of the GNU Lesser General Public
     16     License along with this library; if not, write to the Free Software
     17     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
     18 
     19     Sam Lantinga
     20     slouken (at) libsdl.org
     21 */
     22 #include "SDL_config.h"
     23 
     24 #ifndef _SDL_xbios_h
     25 #define _SDL_xbios_h
     26 
     27 #include "SDL_stdinc.h"
     28 #include "../SDL_sysvideo.h"
     29 
     30 /* Hidden "this" pointer for the video functions */
     31 #define _THIS	SDL_VideoDevice *this
     32 
     33 /* TT video modes:	2
     34    Falcon RVB:		16 (could be *2 by adding PAL/NTSC modes)
     35    Falcon VGA:		6
     36    ST low:		1
     37 */
     38 #define SDL_NUMMODES 16
     39 
     40 typedef struct
     41 {
     42 	Uint16 number;		/* Video mode number */
     43 	Uint16 width;		/* Size */
     44 	Uint16 height;
     45 	Uint16 depth;		/* bits per plane */
     46 	SDL_bool doubleline;	/* Double the lines ? */
     47 } xbiosmode_t;
     48 
     49 /* Private display data */
     50 #define NUM_MODELISTS	2		/* 8 and 16 bits-per-pixel */
     51 
     52 struct SDL_PrivateVideoData {
     53 	long cookie_vdo;
     54 	int old_video_mode;				/* Old video mode before entering SDL */
     55 	void *old_video_base;			/* Old pointer to screen buffer */
     56 	void *old_palette;				/* Old palette */
     57 	Uint32 old_num_colors;			/* Nb of colors in saved palette */
     58 	int num_modes;					/* Number of xbios video modes */
     59 	xbiosmode_t	*mode_list;			/* List of xbios video modes */
     60 
     61 	void *screens[2];		/* Pointers to aligned screen buffer */
     62 	void *screensmem[2];	/* Pointers to screen buffer */
     63 	void *shadowscreen;		/* Shadow screen for c2p conversion */
     64 	int doubleline;			/* Double line mode ? */
     65 	int frame_number;		/* Number of frame for double buffer */
     66 	int pitch;				/* Destination line width for C2P */
     67 	int width, height;		/* Screen size for centered C2P */
     68 
     69 	SDL_bool centscreen;	/* Centscreen extension present ? */
     70 
     71 	SDL_Rect *SDL_modelist[NUM_MODELISTS][SDL_NUMMODES+1];
     72 	xbiosmode_t *videomodes[NUM_MODELISTS][SDL_NUMMODES+1];
     73 };
     74 
     75 /* _VDO cookie values */
     76 enum {
     77 	VDO_ST=0,
     78 	VDO_STE,
     79 	VDO_TT,
     80 	VDO_F30
     81 };
     82 
     83 /* Monitor types */
     84 enum {
     85 	MONITOR_MONO=0,
     86 	MONITOR_TV,
     87 	MONITOR_VGA,
     88 	MONITOR_RGB
     89 };
     90 
     91 /* EgetShift masks */
     92 #define ES_BANK		0x000f
     93 #define ES_MODE		0x0700
     94 #define ES_GRAY		0x1000
     95 #define ES_SMEAR	0x8000
     96 
     97 /* TT shifter modes */
     98 #define ST_LOW	0x0000
     99 #define ST_MED	0x0100
    100 #define ST_HIGH	0x0200
    101 #define TT_LOW	0x0700
    102 #define TT_MED	0x0300
    103 #define TT_HIGH	0x0600
    104 
    105 /* Hidden structure -> variables names */
    106 #define SDL_modelist		(this->hidden->SDL_modelist)
    107 #define XBIOS_mutex		    (this->hidden->mutex)
    108 #define XBIOS_cvdo		    (this->hidden->cookie_vdo)
    109 #define XBIOS_oldpalette	(this->hidden->old_palette)
    110 #define XBIOS_oldnumcol		(this->hidden->old_num_colors)
    111 #define XBIOS_oldvbase		(this->hidden->old_video_base)
    112 #define XBIOS_oldvmode		(this->hidden->old_video_mode)
    113 #define XBIOS_nummodes		(this->hidden->num_modes)
    114 #define XBIOS_modelist		(this->hidden->mode_list)
    115 #define XBIOS_screens		(this->hidden->screens)
    116 #define XBIOS_screensmem	(this->hidden->screensmem)
    117 #define XBIOS_shadowscreen	(this->hidden->shadowscreen)
    118 #define XBIOS_videomodes	(this->hidden->videomodes)
    119 #define XBIOS_doubleline	(this->hidden->doubleline)
    120 #define XBIOS_fbnum			(this->hidden->frame_number)
    121 #define XBIOS_pitch			(this->hidden->pitch)
    122 #define XBIOS_width			(this->hidden->width)
    123 #define XBIOS_height		(this->hidden->height)
    124 #define XBIOS_centscreen	(this->hidden->centscreen)
    125 
    126 /*--- Functions prototypes ---*/
    127 
    128 void SDL_XBIOS_AddMode(_THIS, Uint16 modecode, Uint16 width, Uint16 height,
    129 	Uint16 depth, SDL_bool flags);
    130 
    131 #endif /* _SDL_xbios_h */
    132