Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
authorPatrice Mandin <patmandin@gmail.com>
Tue, 22 Feb 2005 17:57:40 +0000
changeset 1040c6ed27c7d47d
parent 1039 68f2b997758e
child 1041 af92ee34b3e2
Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
src/video/xbios/Makefile.am
src/video/xbios/SDL_xbios.c
src/video/xbios/SDL_xbios_blowup.c
src/video/xbios/SDL_xbios_blowup.h
src/video/xbios/SDL_xbios_sb3.c
src/video/xbios/SDL_xbios_sb3.h
     1.1 --- a/src/video/xbios/Makefile.am	Tue Feb 15 11:50:33 2005 +0000
     1.2 +++ b/src/video/xbios/Makefile.am	Tue Feb 22 17:57:40 2005 +0000
     1.3 @@ -7,4 +7,8 @@
     1.4  # The SDL XBIOS video driver sources
     1.5  XBIOS_SRCS = 	\
     1.6  	SDL_xbios.c	\
     1.7 -	SDL_xbios.h
     1.8 +	SDL_xbios.h	\
     1.9 +	SDL_xbios_blowup.c	\
    1.10 +	SDL_xbios_blowup.h	\
    1.11 +	SDL_xbios_sb3.c	\
    1.12 +	SDL_xbios_sb3.h
     2.1 --- a/src/video/xbios/SDL_xbios.c	Tue Feb 15 11:50:33 2005 +0000
     2.2 +++ b/src/video/xbios/SDL_xbios.c	Tue Feb 22 17:57:40 2005 +0000
     2.3 @@ -55,6 +55,8 @@
     2.4  #include "SDL_atarimxalloc_c.h"
     2.5  #include "SDL_atarigl_c.h"
     2.6  #include "SDL_xbios.h"
     2.7 +#include "SDL_xbios_blowup.h"
     2.8 +#include "SDL_xbios_sb3.h"
     2.9  
    2.10  #define XBIOS_VID_DRIVER_NAME "xbios"
    2.11  
    2.12 @@ -138,7 +140,7 @@
    2.13  
    2.14  static int XBIOS_Available(void)
    2.15  {
    2.16 -	unsigned long cookie_vdo, cookie_mil, cookie_hade;
    2.17 +	unsigned long cookie_vdo, cookie_mil, cookie_hade, cookie_scpn;
    2.18  
    2.19  	/* Milan/Hades Atari clones do not have an Atari video chip */
    2.20  	if ( (Getcookie(C__MIL, &cookie_mil) == C_FOUND) ||
    2.21 @@ -165,6 +167,11 @@
    2.22  		case VDO_F30:
    2.23  			if ( Montype() == MONITOR_MONO)
    2.24  				return 0;
    2.25 +			if (Getcookie(C_SCPN, &cookie_scpn) == C_FOUND) {
    2.26 +				if (!SDL_XBIOS_SB3Usable((scpn_cookie_t *)cookie_scpn)) {
    2.27 +					return 0;
    2.28 +				}
    2.29 +			}
    2.30  			break;
    2.31  		default:
    2.32  			return 0;
    2.33 @@ -242,6 +249,7 @@
    2.34  {
    2.35  	int i,j8,j16;
    2.36  	xbiosmode_t *current_mode;
    2.37 +	unsigned long cookie_blow, cookie_scpn;
    2.38  
    2.39  	/* Initialize all variables that we clean on shutdown */
    2.40  	memset (SDL_modelist, 0, sizeof(SDL_modelist));
    2.41 @@ -369,6 +377,13 @@
    2.42  				current_mode++;
    2.43  			}
    2.44  
    2.45 +			/* Initialize BlowUp or SB3 stuff if present */
    2.46 +			if (Getcookie(C_BLOW, &cookie_blow) == C_FOUND) {
    2.47 +				SDL_XBIOS_BlowupInit(this, (blow_cookie_t *)cookie_blow);
    2.48 +			} else if (Getcookie(C_SCPN, &cookie_scpn) == C_FOUND) {
    2.49 +				SDL_XBIOS_SB3Init(this, (scpn_cookie_t *)cookie_scpn);
    2.50 +			}
    2.51 +
    2.52  			break;
    2.53  	}
    2.54  	
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/src/video/xbios/SDL_xbios_blowup.c	Tue Feb 22 17:57:40 2005 +0000
     3.3 @@ -0,0 +1,93 @@
     3.4 +/*
     3.5 +    SDL - Simple DirectMedia Layer
     3.6 +    Copyright (C) 1997-2004 Sam Lantinga
     3.7 +
     3.8 +    This library is free software; you can redistribute it and/or
     3.9 +    modify it under the terms of the GNU Library General Public
    3.10 +    License as published by the Free Software Foundation; either
    3.11 +    version 2 of the License, or (at your option) any later version.
    3.12 +
    3.13 +    This library is distributed in the hope that it will be useful,
    3.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    3.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    3.16 +    Library General Public License for more details.
    3.17 +
    3.18 +    You should have received a copy of the GNU Library General Public
    3.19 +    License along with this library; if not, write to the Free
    3.20 +    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    3.21 +
    3.22 +    Sam Lantinga
    3.23 +    slouken@libsdl.org
    3.24 +*/
    3.25 +
    3.26 +/*
    3.27 +	Blowup extension definitions
    3.28 +
    3.29 +	Patrice Mandin
    3.30 +*/
    3.31 +
    3.32 +#include "SDL_xbios.h"
    3.33 +#include "SDL_xbios_blowup.h"
    3.34 +
    3.35 +void SDL_XBIOS_BlowupInit(_THIS, blow_cookie_t *cookie_blow)
    3.36 +{
    3.37 +	int i, num_mode, bank, keep_old;
    3.38 +	xbiosmode_t *current_mode;
    3.39 +	blow_mode_t *blow_mode;
    3.40 +
    3.41 +	current_mode = XBIOS_modelist;
    3.42 +	for (i=0;i<XBIOS_nummodes;i++) {
    3.43 +		keep_old=1;	/* use default mode */
    3.44 +		blow_mode = NULL;
    3.45 +		switch (current_mode->depth) {
    3.46 +			case 1:
    3.47 +				num_mode=0;
    3.48 +				break;
    3.49 +			case 2:
    3.50 +				num_mode=1;
    3.51 +				break;
    3.52 +			case 4:
    3.53 +				num_mode=2;
    3.54 +				break;
    3.55 +			case 8:
    3.56 +				num_mode=3;
    3.57 +				break;
    3.58 +			case 16:
    3.59 +				num_mode=4;
    3.60 +				break;
    3.61 +			default:
    3.62 +				num_mode=-1;
    3.63 +				break;
    3.64 +		}
    3.65 +
    3.66 +		/* Check which bank of modes to use */
    3.67 +		if (num_mode>=0) {
    3.68 +			bank = cookie_blow->num_mode[num_mode];
    3.69 +			blow_mode = &(cookie_blow->blowup_modes[num_mode+(bank*5)]);
    3.70 +	
    3.71 +			/* Check extended mode enabled */
    3.72 +			if (blow_mode->enabled == 0) {
    3.73 +				/* Check monitor needed for this mode */
    3.74 +				if ((blow_mode->monitor == cookie_blow->montype)
    3.75 +					|| ((blow_mode->monitor == MONITOR_TV)
    3.76 +						&& (cookie_blow->montype == MONITOR_RGB))
    3.77 +					|| ((blow_mode->monitor == MONITOR_RGB)
    3.78 +						&& (cookie_blow->montype == MONITOR_TV)))
    3.79 +				{
    3.80 +					keep_old = 0; /* we can use this extended mode */
    3.81 +				}
    3.82 +			}
    3.83 +		}
    3.84 +
    3.85 +		if (keep_old) {
    3.86 +			/* disable blowup for this mode */
    3.87 +			current_mode->number |= (1<<15);	
    3.88 +		} else {
    3.89 +			/* Update mode size */
    3.90 +			current_mode->width = blow_mode->width +1;
    3.91 +			current_mode->height = blow_mode->height +1;
    3.92 +		}
    3.93 +
    3.94 +		current_mode++;
    3.95 +	}
    3.96 +}
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/src/video/xbios/SDL_xbios_blowup.h	Tue Feb 22 17:57:40 2005 +0000
     4.3 @@ -0,0 +1,85 @@
     4.4 +/*
     4.5 +    SDL - Simple DirectMedia Layer
     4.6 +    Copyright (C) 1997-2004 Sam Lantinga
     4.7 +
     4.8 +    This library is free software; you can redistribute it and/or
     4.9 +    modify it under the terms of the GNU Library General Public
    4.10 +    License as published by the Free Software Foundation; either
    4.11 +    version 2 of the License, or (at your option) any later version.
    4.12 +
    4.13 +    This library is distributed in the hope that it will be useful,
    4.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    4.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    4.16 +    Library General Public License for more details.
    4.17 +
    4.18 +    You should have received a copy of the GNU Library General Public
    4.19 +    License along with this library; if not, write to the Free
    4.20 +    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    4.21 +
    4.22 +    Sam Lantinga
    4.23 +    slouken@libsdl.org
    4.24 +*/
    4.25 +
    4.26 +/*
    4.27 +	Blowup extension definitions
    4.28 +
    4.29 +	Patrice Mandin
    4.30 +*/
    4.31 +
    4.32 +#ifndef _SDL_xbios_blowup_h
    4.33 +#define _SDL_xbios_blowup_h
    4.34 +
    4.35 +#include "SDL_xbios.h"
    4.36 +
    4.37 +/*--- Types ---*/
    4.38 +
    4.39 +typedef struct {
    4.40 +	/* 64 bytes */
    4.41 +	unsigned short	enabled;		/* Extended mode enabled ? 0=yes, <>0=no */
    4.42 +	unsigned short	dummy10[6];
    4.43 +	unsigned short	registers_0E;	/* value for register 0xffff820e */
    4.44 +	unsigned short	registers_10;	/* value for register 0xffff8210 */
    4.45 +	unsigned short	dummy11[23];
    4.46 +
    4.47 +	/* 64 bytes */
    4.48 +	unsigned short	width;			/* width-1 */
    4.49 +	unsigned short	height;			/* height-1 */
    4.50 +	unsigned short	dummy20;
    4.51 +	unsigned long	screensize;		/* screensize in bytes */
    4.52 +	unsigned short	dummy21[8];
    4.53 +	unsigned short	virtual;		/* Virtual screen ? */
    4.54 +	unsigned short	virwidth;		/* Virtual screen width */
    4.55 +	unsigned short	virheight;		/* Virtual screen height */
    4.56 +
    4.57 +	unsigned short dummy22;
    4.58 +	unsigned short monitor;			/* Monitor defined for this mode */
    4.59 +	unsigned short extension;		/* Extended mode defined ? 0=yes, 1=no */
    4.60 +	unsigned short dummy23[13];
    4.61 +
    4.62 +	/* 64 bytes */
    4.63 +	unsigned short	dummy30;
    4.64 +	unsigned short	registers_82[6];	/* values for registers 0xffff8282-8c */
    4.65 +	unsigned short	dummy31[9];
    4.66 +
    4.67 +	unsigned short	dummy32;
    4.68 +	unsigned short	registers_A2[6];	/* values for registers 0xffff82a2-ac */
    4.69 +	unsigned short	dummy33[9];
    4.70 +
    4.71 +	/* 64 bytes */
    4.72 +	unsigned short	registers_C0;	/* value for register 0xffff82c0 */
    4.73 +	unsigned short	registers_C2;	/* value for register 0xffff82c2 */
    4.74 +	unsigned short	dummy40[30];
    4.75 +} __attribute__((packed)) blow_mode_t;
    4.76 +
    4.77 +typedef struct {
    4.78 +	blow_mode_t	blowup_modes[10];
    4.79 +	unsigned char	num_mode[6];
    4.80 +	unsigned long	dummy;
    4.81 +	unsigned short	montype;
    4.82 +} __attribute__((packed)) blow_cookie_t;
    4.83 +
    4.84 +/*--- Functions prototypes ---*/
    4.85 +
    4.86 +void SDL_XBIOS_BlowupInit(_THIS, blow_cookie_t *cookie_blow);
    4.87 +
    4.88 +#endif /* _SDL_xbios_blowup_h */
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/src/video/xbios/SDL_xbios_sb3.c	Tue Feb 22 17:57:40 2005 +0000
     5.3 @@ -0,0 +1,80 @@
     5.4 +/*
     5.5 +    SDL - Simple DirectMedia Layer
     5.6 +    Copyright (C) 1997-2004 Sam Lantinga
     5.7 +
     5.8 +    This library is free software; you can redistribute it and/or
     5.9 +    modify it under the terms of the GNU Library General Public
    5.10 +    License as published by the Free Software Foundation; either
    5.11 +    version 2 of the License, or (at your option) any later version.
    5.12 +
    5.13 +    This library is distributed in the hope that it will be useful,
    5.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    5.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    5.16 +    Library General Public License for more details.
    5.17 +
    5.18 +    You should have received a copy of the GNU Library General Public
    5.19 +    License along with this library; if not, write to the Free
    5.20 +    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    5.21 +
    5.22 +    Sam Lantinga
    5.23 +    slouken@libsdl.org
    5.24 +*/
    5.25 +
    5.26 +/*
    5.27 +	ScreenBlaster 3 functions
    5.28 +
    5.29 +	Patrice Mandin
    5.30 +*/
    5.31 +
    5.32 +/*--- Includes ---*/
    5.33 +
    5.34 +#include "SDL_xbios.h"
    5.35 +#include "SDL_xbios_sb3.h"
    5.36 +
    5.37 +/*--- Defines ---*/
    5.38 +
    5.39 +const int SDL_XBIOS_scpn_planes_device[]={
    5.40 +	SCPN_DEV_1BPP,
    5.41 +	SCPN_DEV_4BPP,
    5.42 +	SCPN_DEV_8BPP,
    5.43 +	SCPN_DEV_16BPP,
    5.44 +	SCPN_DEV_2BPP,
    5.45 +	SCPN_DEV_4BPP,
    5.46 +	SCPN_DEV_1BPP
    5.47 +};
    5.48 +
    5.49 +/*--- Functions ---*/
    5.50 +
    5.51 +int SDL_XBIOS_SB3Usable(scpn_cookie_t *cookie_scpn)
    5.52 +{
    5.53 +	scpn_screeninfo_t *scrinfo;
    5.54 +	int bpp;
    5.55 +
    5.56 +	/* Check if current SB3 mode is usable, i.e. 8 or 16bpp */
    5.57 +	scrinfo = cookie_scpn->screen_info;
    5.58 +	bpp = 1<<(SDL_XBIOS_scpn_planes_device[scrinfo->device]);
    5.59 +
    5.60 +	if ((bpp==8) || (bpp==16)) {
    5.61 +		return 1;
    5.62 +	}
    5.63 +
    5.64 +	return 0;
    5.65 +}
    5.66 +
    5.67 +void SDL_XBIOS_SB3Init(_THIS, scpn_cookie_t *cookie_scpn)
    5.68 +{
    5.69 +	xbiosmode_t *current_mode;
    5.70 +	scpn_screeninfo_t *scrinfo;
    5.71 +
    5.72 +	/* SB3 prevent changing video modes, we can only use current one */
    5.73 +
    5.74 +	XBIOS_nummodes = 1;
    5.75 +	current_mode = XBIOS_modelist;	
    5.76 +	current_mode->number = -1;
    5.77 +
    5.78 +	scrinfo = cookie_scpn->screen_info;
    5.79 +	current_mode->width = scrinfo->virtual_width;
    5.80 +	current_mode->height = scrinfo->virtual_height;
    5.81 +	current_mode->depth = 1<<(SDL_XBIOS_scpn_planes_device[scrinfo->device]);
    5.82 +	scrinfo->h_pos = scrinfo->v_pos = 0;
    5.83 +}
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/src/video/xbios/SDL_xbios_sb3.h	Tue Feb 22 17:57:40 2005 +0000
     6.3 @@ -0,0 +1,81 @@
     6.4 +/*
     6.5 +    SDL - Simple DirectMedia Layer
     6.6 +    Copyright (C) 1997-2004 Sam Lantinga
     6.7 +
     6.8 +    This library is free software; you can redistribute it and/or
     6.9 +    modify it under the terms of the GNU Library General Public
    6.10 +    License as published by the Free Software Foundation; either
    6.11 +    version 2 of the License, or (at your option) any later version.
    6.12 +
    6.13 +    This library is distributed in the hope that it will be useful,
    6.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    6.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    6.16 +    Library General Public License for more details.
    6.17 +
    6.18 +    You should have received a copy of the GNU Library General Public
    6.19 +    License along with this library; if not, write to the Free
    6.20 +    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    6.21 +
    6.22 +    Sam Lantinga
    6.23 +    slouken@libsdl.org
    6.24 +*/
    6.25 +
    6.26 +/*
    6.27 +	ScreenBlaster 3 definitions
    6.28 +
    6.29 +	Patrice Mandin
    6.30 +*/
    6.31 +
    6.32 +#ifndef _SDL_xbios_sb3_h_
    6.33 +#define _SDL_xbios_sb3_h_
    6.34 +
    6.35 +/*--- Defines ---*/
    6.36 +
    6.37 +#ifndef C_SCPN
    6.38 +#define C_SCPN 0x5343504EL
    6.39 +#endif
    6.40 +
    6.41 +#define SCPN_DEV_1BPP	0
    6.42 +#define SCPN_DEV_2BPP	1
    6.43 +#define SCPN_DEV_4BPP	2
    6.44 +#define SCPN_DEV_8BPP	3
    6.45 +#define SCPN_DEV_16BPP	4
    6.46 +
    6.47 +extern const int SDL_XBIOS_scpn_planes_device[];
    6.48 +
    6.49 +/*--- Types ---*/
    6.50 +
    6.51 +typedef struct {
    6.52 +	unsigned short	virtual_width;	/* Virtual screen width */
    6.53 +	unsigned short	virtual_height;	/* Virtual screen height */
    6.54 +	unsigned short	visible_width;	/* Visible width */
    6.55 +	unsigned short	visible_height;	/* Visible height */
    6.56 +	unsigned short	h_pos;	/* Horizontal position in virtual screen */
    6.57 +	unsigned short	v_pos;	/* Vertical position in virtual screen */
    6.58 +	unsigned short	dummy;
    6.59 +	unsigned long	size;	/* Size of screen in bytes */
    6.60 +	unsigned short	device;	/* Device number to find planes = getRez() */
    6.61 +							/* = Index in scpn_planes_device[] */
    6.62 +} __attribute__((packed)) scpn_screeninfo_t;
    6.63 +
    6.64 +typedef struct {
    6.65 +	unsigned long	magic;	/* just a BRA assembler jump */
    6.66 +	unsigned short	version;
    6.67 +	void			*dummy1;
    6.68 +	unsigned short	ptsout0_1;
    6.69 +	unsigned short	ptsout0_2;
    6.70 +	unsigned short	dummy3;
    6.71 +	unsigned char	date[8];	/* Date of program build */
    6.72 +	unsigned char	asm_string[30];	/* 10 times the 'ASM' string */
    6.73 +	unsigned short	dummy4;
    6.74 +	scpn_screeninfo_t	*screen_info;
    6.75 +	unsigned short	dummy6;
    6.76 +} __attribute__((packed)) scpn_cookie_t;
    6.77 +
    6.78 +/*--- Function prototypes ---*/
    6.79 +
    6.80 +int SDL_XBIOS_SB3Usable(scpn_cookie_t *cookie_scpn);
    6.81 +
    6.82 +void SDL_XBIOS_SB3Init(_THIS, scpn_cookie_t *cookie_scpn);
    6.83 +
    6.84 +#endif /* _SDL_xbios_sb3_h_ */