Removed outdated Atari support
authorSam Lantinga <slouken@libsdl.org>
Sun, 20 Sep 2009 04:15:19 +0000
changeset 32831ed5d432e468
parent 3282 10a12f77f597
child 3284 2b95b2c0b6d4
Removed outdated Atari support
CREDITS
README
README.MiNT
configure.in
include/SDL.h
include/SDL_config.h.in
src/audio/SDL_audio.c
src/audio/mint/SDL_mintaudio.c
src/audio/mint/SDL_mintaudio.h
src/audio/mint/SDL_mintaudio_dma8.c
src/audio/mint/SDL_mintaudio_dma8.h
src/audio/mint/SDL_mintaudio_gsxb.c
src/audio/mint/SDL_mintaudio_gsxb.h
src/audio/mint/SDL_mintaudio_it.S
src/audio/mint/SDL_mintaudio_mcsn.c
src/audio/mint/SDL_mintaudio_mcsn.h
src/audio/mint/SDL_mintaudio_stfa.c
src/audio/mint/SDL_mintaudio_stfa.h
src/audio/mint/SDL_mintaudio_xbios.c
src/joystick/mint/SDL_sysjoystick.c
src/loadso/mint/SDL_sysloadso.c
src/timer/mint/SDL_systimer.c
src/timer/mint/SDL_vbltimer.S
src/timer/mint/SDL_vbltimer_s.h
src/video/SDL_renderer_gl.c
src/video/SDL_sysvideo.h
src/video/SDL_video.c
src/video/ataricommon/SDL_ataric2p.S
src/video/ataricommon/SDL_ataric2p_s.h
src/video/ataricommon/SDL_ataridevmouse.c
src/video/ataricommon/SDL_ataridevmouse_c.h
src/video/ataricommon/SDL_atarieddi.S
src/video/ataricommon/SDL_atarieddi_s.h
src/video/ataricommon/SDL_atarievents.c
src/video/ataricommon/SDL_atarievents_c.h
src/video/ataricommon/SDL_atarigl.c
src/video/ataricommon/SDL_atarigl_c.h
src/video/ataricommon/SDL_atarikeys.h
src/video/ataricommon/SDL_atarimxalloc.c
src/video/ataricommon/SDL_atarimxalloc_c.h
src/video/ataricommon/SDL_biosevents.c
src/video/ataricommon/SDL_biosevents_c.h
src/video/ataricommon/SDL_gemdosevents.c
src/video/ataricommon/SDL_gemdosevents_c.h
src/video/ataricommon/SDL_ikbdevents.c
src/video/ataricommon/SDL_ikbdevents_c.h
src/video/ataricommon/SDL_ikbdinterrupt.S
src/video/ataricommon/SDL_ikbdinterrupt_s.h
src/video/ataricommon/SDL_xbiosevents.c
src/video/ataricommon/SDL_xbiosevents_c.h
src/video/ataricommon/SDL_xbiosinterrupt.S
src/video/ataricommon/SDL_xbiosinterrupt_s.h
src/video/gem/SDL_gemevents.c
src/video/gem/SDL_gemevents.h
src/video/gem/SDL_gemkeyboard.c
src/video/gem/SDL_gemkeyboard.h
src/video/gem/SDL_gemmodes.c
src/video/gem/SDL_gemmodes.h
src/video/gem/SDL_gemmouse.c
src/video/gem/SDL_gemmouse.h
src/video/gem/SDL_gemvideo.c
src/video/gem/SDL_gemvideo.h
src/video/gem/SDL_gemwindow.c
src/video/gem/SDL_gemwindow.h
src/video/xbios/SDL_xbios.c
src/video/xbios/SDL_xbios.h
src/video/xbios/SDL_xbios_blowup.c
src/video/xbios/SDL_xbios_blowup.h
src/video/xbios/SDL_xbios_centscreen.c
src/video/xbios/SDL_xbios_centscreen.h
src/video/xbios/SDL_xbios_sb3.c
src/video/xbios/SDL_xbios_sb3.h
src/video/xbios/SDL_xbiosmodes.c
src/video/xbios/SDL_xbiosmodes.h
     1.1 --- a/CREDITS	Sun Sep 20 04:13:23 2009 +0000
     1.2 +++ b/CREDITS	Sun Sep 20 04:15:19 2009 +0000
     1.3 @@ -46,8 +46,6 @@
     1.4  
     1.5  * David Carré, for the Pandora port
     1.6  
     1.7 -* Patrice Mandin, for the Atari port
     1.8 -
     1.9  * Couriersud for the DirectFB driver
    1.10  
    1.11  * Jon Atkins for SDL_image, SDL_mixer and SDL_net documentation
     2.1 --- a/README	Sun Sep 20 04:13:23 2009 +0000
     2.2 +++ b/README	Sun Sep 20 04:15:19 2009 +0000
     2.3 @@ -14,8 +14,8 @@
     2.4  
     2.5  The current version supports Linux, Windows, Windows CE, BeOS, MacOS,
     2.6  Mac OS X, FreeBSD, NetBSD, OpenBSD, BSD/OS, Solaris, IRIX, and QNX.
     2.7 -The code contains support for Atari, AIX, OSF/Tru64, RISC OS, and
     2.8 -SymbianOS, but these are not officially supported.
     2.9 +The code contains support for AIX, OSF/Tru64, RISC OS, and SymbianOS,
    2.10 +but these are not officially supported.
    2.11  
    2.12  SDL is written in C, but works with C++ natively, and has bindings to
    2.13  several other languages, including Ada, C#, Eiffel, Erlang, Euphoria,
     3.1 --- a/README.MiNT	Sun Sep 20 04:13:23 2009 +0000
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,248 +0,0 @@
     3.4 -==============================================================================
     3.5 -Using the Simple DirectMedia Layer on Atari
     3.6 -==============================================================================
     3.7 -
     3.8 -
     3.9 -    If you want to build SDL from sources to create SDL programs on Atari:
    3.10 -        see sections I - II.
    3.11 -	
    3.12 -    If you want to create SDL programs on Atari using SDL binary build,
    3.13 -        download it from my web site (URL at end of this file).
    3.14 -
    3.15 -    If you want to configure a program using SDL on Atari,
    3.16 -	    see sections IV - VI.
    3.17 -
    3.18 -
    3.19 -==============================================================================
    3.20 -I.  Building the Simple DirectMedia Layer libraries:
    3.21 -    (This step isn't necessary if you have the SDL binary distribution)
    3.22 -
    3.23 -  Do the classic configure, with --disable-shared --enable-static and:
    3.24 -
    3.25 -    Tos version (should run everywhere):
    3.26 -      --disable-threads
    3.27 -    Tos does not support threads.
    3.28 -
    3.29 -    MiNT version (maybe Magic, only for multitasking OS):
    3.30 -      --disable-pthreads --enable-pth
    3.31 -    Mint and Magic may supports threads, so audio can be used with current
    3.32 -    devices, like Sun audio, or disk-writing support. Like Tos, interrupt
    3.33 -    audio without threads is more suited for Atari machines.
    3.34 -
    3.35 -  Then you can make ; make install it.
    3.36 -
    3.37 -==============================================================================
    3.38 -II. Building the Simple DirectMedia Layer test programs:
    3.39 -
    3.40 -  Do the classic configure, then make.
    3.41 -
    3.42 -  Run them !
    3.43 -
    3.44 -==============================================================================
    3.45 -III.  Enjoy! :)
    3.46 -
    3.47 -  If you have a project you'd like me to know about, or want to ask questions,
    3.48 -  go ahead and join the SDL developer's mailing list by sending e-mail to:
    3.49 -
    3.50 -	sdl-request@libsdl.org
    3.51 -
    3.52 -  and put "subscribe" into the subject of the message. Or alternatively you
    3.53 -  can use the web interface:
    3.54 -
    3.55 -	http://www.libsdl.org/mailman/listinfo/sdl
    3.56 -  
    3.57 -==============================================================================
    3.58 -IV.  What is supported:
    3.59 -
    3.60 -Keyboard (GEMDOS, BIOS, GEM, Ikbd)
    3.61 -Mouse (XBIOS, GEM, Ikbd, /dev/mouse (non working atm, disabled))
    3.62 -Video (XBIOS (Fullscreen), GEM (Windowed and Fullscreen))
    3.63 -Timer (VBL vector, GNU pth library)
    3.64 -Joysticks and joypads (Ikbd, Hardware)
    3.65 -Audio (Hardware, XBIOS, GSXB, MCSN, STFA, /dev/audio if threads enabled)
    3.66 -Threads (Multitasking OS only via GNU pth library)
    3.67 -Shared object loader (using LDG library from http://ldg.atari.org/)
    3.68 -Audio CD (MetaDOS)
    3.69 -OpenGL (using Mesa offscreen rendering driver)
    3.70 -
    3.71 -- Dependent driver combinations:
    3.72 -Video   Kbd     Mouse   Timer   Joysticks
    3.73 -xbios   ikbd    ikbd    vbl(2)  ikbd
    3.74 -xbios   gemdos  xbios   vbl(2)  xbios
    3.75 -xbios   bios    xbios   vbl(2)  xbios
    3.76 -gem     gem     gem(1)  vbl(2)  xbios
    3.77 -
    3.78 -Audio   O/S     Misc
    3.79 -dma8    All     Uses MFP Timer A interrupt
    3.80 -xbios	TOS     Uses MFP Timer A interrupt
    3.81 -xbios   MiNT    Uses MFP Timer A interrupt
    3.82 -xbios   Magic   Disabled
    3.83 -stfa    All     Uses MFP interrupt
    3.84 -mcsn	TOS     Uses MFP Timer A interrupt
    3.85 -mcsn    MiNT    Uses MiNT thread
    3.86 -mcsn    Magic   Disabled
    3.87 -gsxb    All     Uses GSXB callback
    3.88 -
    3.89 -Joypad driver always uses hardware access.
    3.90 -OpenGL driver always uses OSMesa.
    3.91 -
    3.92 -(1) GEM does not report relative mouse motion, so xbios mouse driver is used
    3.93 -to report this type event.
    3.94 -A preliminary driver for /dev/mouse device driver is present, but is disabled
    3.95 -till it can be used with other applications simultaneously.
    3.96 -
    3.97 -(2) If you build SDL with threads using the GNU pth library, timers are
    3.98 -supported via the pth library.
    3.99 -
   3.100 -==============================================================================
   3.101 -V.  Environment variables:
   3.102 -
   3.103 -SDL_VIDEODRIVER:
   3.104 -	Set to 'xbios' to force xbios video driver
   3.105 -	Set to 'gem' to force gem video driver
   3.106 -
   3.107 -SDL_VIDEO_GL_DRIVER:
   3.108 -	Set to filename to load as OpenGL library, if you use SDL_GL_LoadLibrary()
   3.109 -
   3.110 -SDL_AUDIODRIVER:
   3.111 -	Set to 'mint_gsxb' to force Atari GSXB audio driver
   3.112 -	Set to 'mint_mcsn' to force Atari MCSN audio driver
   3.113 -	Set to 'mint_stfa' to force Atari STFA audio driver
   3.114 -	Set to 'mint_xbios' to force Atari Xbios audio driver
   3.115 -	Set to 'mint_dma8' to force Atari 8 bits DMA audio driver
   3.116 -	Set to 'audio' to force Sun /dev/audio audio driver
   3.117 -	Set to 'disk' to force disk-writing audio driver
   3.118 -
   3.119 -SDL_ATARI_EVENTSDRIVER
   3.120 -	Set to 'ikbd' to force IKBD 6301 keyboard driver
   3.121 -	Set to 'gemdos' to force gemdos keyboard driver
   3.122 -	Set to 'bios' to force bios keyboard driver
   3.123 -
   3.124 -SDL_JOYSTICK_ATARI:
   3.125 -	Use any of these strings in the environment variable to enable or
   3.126 -	disable a joystick:
   3.127 -
   3.128 -	'ikbd-joy1-[on|off]' for IKBD joystick on port 1 (hardware access)
   3.129 -	'xbios-joy1-[on|off]' for IKBD joystick on port 1 (xbios access)
   3.130 -	'porta-pad-[on|off]' for joypad and/or teamtap on port A
   3.131 -	'porta-joy0-[on|off]' for joystick 0 on port A
   3.132 -	'porta-joy1-[on|off]' for joystick 1 on port A
   3.133 -	'porta-lp-[on|off]' for lightpen on port A
   3.134 -	'porta-anpad-[on|off]' for analog paddle on port A
   3.135 -	'portb-pad-[on|off]' for joypad and/or teamtap on port B
   3.136 -	'portb-joy0-[on|off]' for joystick 0 on port B
   3.137 -	'portb-joy1-[on|off]' for joystick 1 on port B
   3.138 -	'portb-anpad-[on|off]' for analog paddle on port B
   3.139 -
   3.140 -	Default configuration is:
   3.141 -		'ikbd-joy1-on' (if IKBD events driver enabled)
   3.142 -		'xbios-joy1-on' (if gemdos/bios/gem events driver enabled)
   3.143 -		'porta-pad-on portb-pad-on' (if available on the machine)
   3.144 -
   3.145 -	port[a|b]-[pad|joy?|lp|anpad]-* strings are mutually exclusives.
   3.146 -	On such a port, you can only use a joypad OR 1 or 2 joysticks OR
   3.147 -	a lightpen OR an analog paddle. You must disable joypad before
   3.148 -	setting another controller.
   3.149 -
   3.150 -	The second joystick port on IKBD is used by the mouse, so not usable.
   3.151 -	Another problem with the IKBD: mouse buttons and joystick fire buttons
   3.152 -	are wired together at the hardware level, it means:
   3.153 -		port 0                port 0           port 1
   3.154 -		mouse left button  = joystick fire 0 = joystick fire 1
   3.155 -		mouse right button = joystick fire 1 = joystick fire 0
   3.156 -
   3.157 -	Descriptions of joysticks/joypads:
   3.158 -	- Joypads: 1 hat, 17 buttons (Atari Jaguar console-like).
   3.159 -	- Joysticks: 1 hat, 1 button.
   3.160 -	- Lightpen, analog paddles: 2 axis, 2 buttons. The 2 buttons are those
   3.161 -	  affected to 1 button joysticks on the same port.
   3.162 -
   3.163 -==============================================================================
   3.164 -VI.  More informations about drivers:
   3.165 -
   3.166 -OpenGL:
   3.167 -	The default is to use the Mesa offscreen driver (osmesa.ldg). If you want
   3.168 -	to use an older OpenGL implementation, like mesa_gl.ldg or tiny_gl.ldg,
   3.169 -	your program must use SDL_GL_LoadLibrary() to do so, and retrieve the
   3.170 -	needed function pointers with SDL_LoadFunction(). In all cases, the OpenGL
   3.171 -	context is taken care of by SDL itself, you just have to use gl* functions.
   3.172 -
   3.173 -	However, there is one OpenGL call that has a different prototype in the old
   3.174 -	implementations: glOrtho(). In the old implementations, it has 6 float as
   3.175 -	parameters, in the standard one, it has 6 double parameters. If you want
   3.176 -	to compile testdyngl, or any other SDL program that loads its OpenGL
   3.177 -	library, you must change the glOrtho() prototype used in this program. In
   3.178 -	osmesa.ldg, you can retrieve a glOrtho() with double parameters, by
   3.179 -	searching for the function "glOrtho6d".
   3.180 -
   3.181 -Xbios video:
   3.182 -	Video chip is detected using the _VDO cookie.
   3.183 -	Screen enhancers are not supported, but could be if you know how to
   3.184 -	use them.
   3.185 -
   3.186 -	ST, STE, Mega ST, Mega STE:
   3.187 -		320x200x4 bits, shades of grey, available only for the purpose
   3.188 -		of testing SDL.
   3.189 -	TT:
   3.190 -		320x480x8 and 320x240x8 (software double-lined mode).
   3.191 -	Falcon:
   3.192 -		All modes supported by the current monitor (RVB or VGA).
   3.193 -		BlowUp and Centscreen extended modes, ScreenBlaster 3 current mode.
   3.194 -	Clones and any machine with monochrome monitor:
   3.195 -		Not supported.
   3.196 -
   3.197 -Gem video:
   3.198 -	Automatically used if xbios not available.
   3.199 -
   3.200 -	All machines:
   3.201 -		Only the current resolution, if 8 bits or higher depth.
   3.202 -
   3.203 -IKBD keyboard, mouse and joystick driver:
   3.204 -	Available if _MCH cookie is ST, Mega ST, STE, Mega STE, TT or Falcon.
   3.205 -
   3.206 -	Hades has an IKBD, but xbios is not available for video, so IKBD
   3.207 -	driver is disabled.
   3.208 -
   3.209 -Gemdos and bios keyboard driver:
   3.210 -	Available on all machines.
   3.211 -
   3.212 -Mouse and joystick xbios driver:
   3.213 -	Available on all machines (I think).
   3.214 -
   3.215 -Joypad driver:
   3.216 -	Available if _MCH cookie is STE or Falcon.
   3.217 -
   3.218 -PTH timer driver:
   3.219 -	Available with multitasking OS.
   3.220 -
   3.221 -VBL timer driver:
   3.222 -	Available on all machines (I think).
   3.223 -
   3.224 -Audio drivers:
   3.225 -	Cookies _SND, MCSN, STFA and GSXB used to detect supported audio
   3.226 -	capabilities.
   3.227 -
   3.228 -	STE, Mega STE, TT:
   3.229 -		8 bits DMA (hardware access)
   3.230 -		STFA, MCSN or GSXB driver if installed
   3.231 -	Falcon:
   3.232 -		8 bits DMA (hardware access)
   3.233 -		Xbios functions
   3.234 -		STFA, MCSN or GSXB driver if installed
   3.235 -	Other machines:
   3.236 -		STFA, MCSN or GSXB driver if installed
   3.237 -
   3.238 -	STFA driver:
   3.239 -		http://removers.free.fr/softs/stfa.html
   3.240 -	GSXB driver:
   3.241 -		http://assemsoft.atari.org/gsxb/
   3.242 -	MacSound driver:
   3.243 -		http://jf.omnis.ch/software/tos/
   3.244 -	MagicSound driver (MCSN,GSXB compatible):
   3.245 -		http://perso.wanadoo.fr/didierm/
   3.246 -	X-Sound driver (GSXB compatible):
   3.247 -		http://www.uni-ulm.de/~s_thuth/atari/xsound_e.html
   3.248 -
   3.249 --- 
   3.250 -Patrice Mandin <pmandin@caramail.com>
   3.251 -http://pmandin.atari.org/
     4.1 --- a/configure.in	Sun Sep 20 04:13:23 2009 +0000
     4.2 +++ b/configure.in	Sun Sep 20 04:15:19 2009 +0000
     4.3 @@ -897,25 +897,6 @@
     4.4      fi
     4.5  }
     4.6  
     4.7 -dnl Set up the Atari Audio driver
     4.8 -CheckAtariAudio()
     4.9 -{
    4.10 -    AC_ARG_ENABLE(mintaudio,
    4.11 -AC_HELP_STRING([--enable-mintaudio], [support Atari audio driver [[default=yes]]]),
    4.12 -                  , enable_mintaudio=yes)
    4.13 -    if test x$enable_audio = xyes -a x$enable_mintaudio = xyes; then
    4.14 -        mintaudio=no
    4.15 -        AC_CHECK_HEADER(mint/falcon.h, have_mint_falcon_hdr=yes)
    4.16 -        if test x$have_mint_falcon_hdr = xyes; then
    4.17 -            mintaudio=yes
    4.18 -            AC_DEFINE(SDL_AUDIO_DRIVER_MINT)
    4.19 -            SOURCES="$SOURCES $srcdir/src/audio/mint/*.c"
    4.20 -            SOURCES="$SOURCES $srcdir/src/audio/mint/*.S"
    4.21 -            have_audio=yes
    4.22 -        fi
    4.23 -    fi
    4.24 -}
    4.25 -
    4.26  dnl See if GCC's -fvisibility=hidden is supported (gcc4 and later, usually).
    4.27  dnl  Details of this flag are here: http://gcc.gnu.org/wiki/Visibility
    4.28  CheckVisibilityHidden()
    4.29 @@ -1529,48 +1510,6 @@
    4.30      fi
    4.31  }
    4.32  
    4.33 -dnl Set up the Atari Bios keyboard driver
    4.34 -CheckAtariBiosEvent()
    4.35 -{
    4.36 -    SOURCES="$SOURCES $srcdir/src/video/ataricommon/*.c"
    4.37 -    SOURCES="$SOURCES $srcdir/src/video/ataricommon/*.S"
    4.38 -}
    4.39 -
    4.40 -dnl Set up the Atari Xbios driver
    4.41 -CheckAtariXbiosVideo()
    4.42 -{
    4.43 -    AC_ARG_ENABLE(video-xbios,
    4.44 -AC_HELP_STRING([--enable-video-xbios], [use Atari Xbios video driver [[default=yes]]]),
    4.45 -                  , enable_video_xbios=yes)
    4.46 -    video_xbios=no
    4.47 -    if test x$enable_video = xyes -a x$enable_video_xbios = xyes; then
    4.48 -        video_xbios=yes
    4.49 -        AC_DEFINE(SDL_VIDEO_DRIVER_XBIOS)
    4.50 -        SOURCES="$SOURCES $srcdir/src/video/xbios/*.c"
    4.51 -        have_video=yes
    4.52 -    fi
    4.53 -}
    4.54 -
    4.55 -dnl Set up the Atari Gem driver
    4.56 -CheckAtariGemVideo()
    4.57 -{
    4.58 -    AC_ARG_ENABLE(video-gem,
    4.59 -AC_HELP_STRING([--enable-video-gem], [use Atari Gem video driver [[default=yes]]]),
    4.60 -                  , enable_video_gem=yes)
    4.61 -    if test x$enable_video = xyes -a x$enable_video_gem = xyes; then
    4.62 -        video_gem=no
    4.63 -        AC_CHECK_HEADER(gem.h, have_gem_hdr=yes)
    4.64 -        AC_CHECK_LIB(gem, appl_init, have_gem_lib=yes)
    4.65 -        if test x$have_gem_hdr = xyes -a x$have_gem_lib = xyes; then
    4.66 -            video_gem=yes
    4.67 -            AC_DEFINE(SDL_VIDEO_DRIVER_GEM)
    4.68 -            SOURCES="$SOURCES $srcdir/src/video/gem/*.c"
    4.69 -            SDL_LIBS="$SDL_LIBS -lgem"
    4.70 -            have_video=yes
    4.71 -        fi
    4.72 -    fi
    4.73 -}
    4.74 -
    4.75  dnl rcg04172001 Set up the Null video driver.
    4.76  CheckDummyVideo()
    4.77  {
    4.78 @@ -1708,43 +1647,6 @@
    4.79      fi
    4.80  }
    4.81  
    4.82 -dnl Check for Mesa offscreen rendering
    4.83 -CheckAtariOSMesa()
    4.84 -{
    4.85 -    if test "x$enable_video" = "xyes" -a "x$enable_video_opengl" = "xyes"; then
    4.86 -        AC_CHECK_HEADER(GL/osmesa.h, have_osmesa_hdr=yes)
    4.87 -        AC_CHECK_LIB(OSMesa, OSMesaCreateContext, have_osmesa_lib=yes, have_osmesa_lib=no, -lm)
    4.88 -
    4.89 -        # Static linking to -lOSMesa
    4.90 -        AC_PATH_PROG(OSMESA_CONFIG, osmesa-config, no)
    4.91 -        if test "x$OSMESA_CONFIG" = "xno" -o "x$enable_atari_ldg" = "xno"; then
    4.92 -            # -lOSMesa is really the static library
    4.93 -            if test "x$have_osmesa_hdr" = "xyes" -a "x$have_osmesa_lib" = "xyes"; then
    4.94 -                OSMESA_LIBS="-lOSMesa"
    4.95 -            fi
    4.96 -        else
    4.97 -            # -lOSMesa is a loader for OSMesa.ldg
    4.98 -            OSMESA_CFLAGS=`$OSMESA_CONFIG --cflags`
    4.99 -            OSMESA_LIBS=`$OSMESA_CONFIG --libs`
   4.100 -        fi
   4.101 -        AC_DEFINE(SDL_VIDEO_OPENGL)
   4.102 -        AC_DEFINE(SDL_VIDEO_OPENGL_OSMESA)
   4.103 -        AC_DEFINE(SDL_VIDEO_RENDER_OGL)
   4.104 -        SDL_CFLAGS="$SDL_CFLAGS $OSMESA_CFLAGS"
   4.105 -        SDL_LIBS="$SDL_LIBS $OSMESA_LIBS"
   4.106 -
   4.107 -        AC_ARG_ENABLE(osmesa-shared,
   4.108 -AC_HELP_STRING([--enable-osmesa-shared], [dynamically load OSMesa OpenGL support [[default=yes]]]),
   4.109 -                              , enable_osmesa_shared=yes)
   4.110 -        if test "x$enable_osmesa_shared" = "xyes" -a "x$enable_atari_ldg" = "xyes"; then
   4.111 -            # Dynamic linking
   4.112 -            if test "x$have_osmesa_hdr" = "xyes"; then
   4.113 -                AC_DEFINE(SDL_VIDEO_OPENGL_OSMESA_DYNAMIC)
   4.114 -            fi
   4.115 -        fi
   4.116 -    fi
   4.117 -}
   4.118 -
   4.119  dnl See if we can use the new unified event interface in Linux 2.4
   4.120  CheckInputEvents()
   4.121  {
   4.122 @@ -2086,24 +1988,6 @@
   4.123      fi
   4.124  }
   4.125  
   4.126 -dnl Set up the Atari LDG (shared object loader)
   4.127 -CheckAtariLdg()
   4.128 -{
   4.129 -    AC_ARG_ENABLE(atari-ldg,
   4.130 -AC_HELP_STRING([--enable-atari-ldg], [use Atari LDG for shared object loading [[default=yes]]]),
   4.131 -                  , enable_atari_ldg=yes)
   4.132 -    if test x$video_gem = xyes -a x$enable_atari_ldg = xyes; then
   4.133 -        AC_CHECK_HEADER(ldg.h, have_ldg_hdr=yes)
   4.134 -        AC_CHECK_LIB(ldg, ldg_open, have_ldg_lib=yes, have_ldg_lib=no, -lgem)
   4.135 -        if test x$have_ldg_hdr = xyes -a x$have_ldg_lib = xyes; then
   4.136 -            AC_DEFINE(SDL_LOADSO_LDG)
   4.137 -            SOURCES="$SOURCES $srcdir/src/loadso/mint/*.c"
   4.138 -            SDL_LIBS="$SDL_LIBS -lldg -lgem"
   4.139 -            have_loadso=yes
   4.140 -        fi
   4.141 -    fi
   4.142 -}
   4.143 -
   4.144  dnl Check for the usbhid(3) library on *BSD
   4.145  CheckUSBHID()
   4.146  {
   4.147 @@ -2795,45 +2679,6 @@
   4.148              EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit"
   4.149          fi
   4.150          ;;
   4.151 -    *-*-mint*)
   4.152 -        ARCH=mint
   4.153 -        CheckDummyVideo
   4.154 -        CheckDiskAudio
   4.155 -        CheckDummyAudio
   4.156 -        CheckAtariBiosEvent
   4.157 -        CheckAtariXbiosVideo
   4.158 -        CheckAtariGemVideo
   4.159 -        CheckAtariAudio
   4.160 -        CheckAtariLdg
   4.161 -        CheckAtariOSMesa
   4.162 -        CheckPTH
   4.163 -        # Set up files for the audio library
   4.164 -        if test x$enable_threads = xyes -a x$enable_pth = xyes; then
   4.165 -            if test x$enable_audio = xyes; then
   4.166 -                AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO)
   4.167 -                SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
   4.168 -                have_audio=yes
   4.169 -            fi
   4.170 -        fi
   4.171 -        # Set up files for the joystick library
   4.172 -        if test x$enable_joystick = xyes; then
   4.173 -            AC_DEFINE(SDL_JOYSTICK_MINT)
   4.174 -            SOURCES="$SOURCES $srcdir/src/joystick/mint/*.c"
   4.175 -            have_joystick=yes
   4.176 -        fi
   4.177 -        # Set up files for the timer library
   4.178 -        if test x$enable_timers = xyes; then
   4.179 -            if test x$enable_threads = xyes -a x$enable_pth = xyes; then
   4.180 -                AC_DEFINE(SDL_TIMER_UNIX)
   4.181 -                SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
   4.182 -            else
   4.183 -                AC_DEFINE(SDL_TIMER_MINT)
   4.184 -                SOURCES="$SOURCES $srcdir/src/timer/mint/*.c"
   4.185 -                SOURCES="$SOURCES $srcdir/src/timer/mint/*.S"
   4.186 -            fi
   4.187 -            have_timers=yes
   4.188 -        fi
   4.189 -        ;;
   4.190      *-riscos)
   4.191          ARCH=riscos
   4.192          CheckOSS
     5.1 --- a/include/SDL.h	Sun Sep 20 04:13:23 2009 +0000
     5.2 +++ b/include/SDL.h	Sun Sep 20 04:15:19 2009 +0000
     5.3 @@ -38,8 +38,8 @@
     5.4  
     5.5  The current version supports Linux, Windows, Windows CE, BeOS, MacOS,
     5.6  Mac OS X, FreeBSD, NetBSD, OpenBSD, BSD/OS, Solaris, IRIX, and QNX.
     5.7 -The code contains support for Atari, AIX, OSF/Tru64, RISC OS, and
     5.8 -SymbianOS, but these are not officially supported.
     5.9 +The code contains support for AIX, OSF/Tru64, RISC OS, and SymbianOS,
    5.10 +but these are not officially supported.
    5.11  
    5.12  SDL is written in C, but works with C++ natively, and has bindings to
    5.13  several other languages, including Ada, C#, Eiffel, Erlang, Euphoria,
     6.1 --- a/include/SDL_config.h.in	Sun Sep 20 04:13:23 2009 +0000
     6.2 +++ b/include/SDL_config.h.in	Sun Sep 20 04:15:19 2009 +0000
     6.3 @@ -187,7 +187,6 @@
     6.4  #undef SDL_AUDIO_DRIVER_DSOUND
     6.5  #undef SDL_AUDIO_DRIVER_ESD
     6.6  #undef SDL_AUDIO_DRIVER_ESD_DYNAMIC
     6.7 -#undef SDL_AUDIO_DRIVER_MINT
     6.8  #undef SDL_AUDIO_DRIVER_MMEAUDIO
     6.9  #undef SDL_AUDIO_DRIVER_NAS
    6.10  #undef SDL_AUDIO_DRIVER_NAS_DYNAMIC
    6.11 @@ -209,7 +208,6 @@
    6.12  #undef SDL_JOYSTICK_DUMMY
    6.13  #undef SDL_JOYSTICK_IOKIT
    6.14  #undef SDL_JOYSTICK_LINUX
    6.15 -#undef SDL_JOYSTICK_MINT
    6.16  #undef SDL_JOYSTICK_NDS
    6.17  #undef SDL_JOYSTICK_RISCOS
    6.18  #undef SDL_JOYSTICK_WINMM
    6.19 @@ -241,7 +239,6 @@
    6.20  /* Enable various timer systems */
    6.21  #undef SDL_TIMER_BEOS
    6.22  #undef SDL_TIMER_DUMMY
    6.23 -#undef SDL_TIMER_MINT
    6.24  #undef SDL_TIMER_NDS
    6.25  #undef SDL_TIMER_RISCOS
    6.26  #undef SDL_TIMER_UNIX
    6.27 @@ -255,7 +252,6 @@
    6.28  #undef SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC
    6.29  #undef SDL_VIDEO_DRIVER_DUMMY
    6.30  #undef SDL_VIDEO_DRIVER_FBCON
    6.31 -#undef SDL_VIDEO_DRIVER_GEM
    6.32  #undef SDL_VIDEO_DRIVER_NDS
    6.33  #undef SDL_VIDEO_DRIVER_PHOTON
    6.34  #undef SDL_VIDEO_DRIVER_QNXGF
    6.35 @@ -277,7 +273,6 @@
    6.36  #undef SDL_VIDEO_DRIVER_X11_XINPUT
    6.37  #undef SDL_VIDEO_DRIVER_X11_SCRNSAVER
    6.38  #undef SDL_VIDEO_DRIVER_X11_XV
    6.39 -#undef SDL_VIDEO_DRIVER_XBIOS
    6.40  
    6.41  #undef SDL_VIDEO_RENDER_D3D
    6.42  #undef SDL_VIDEO_RENDER_GDI
     7.1 --- a/src/audio/SDL_audio.c	Sun Sep 20 04:13:23 2009 +0000
     7.2 +++ b/src/audio/SDL_audio.c	Sun Sep 20 04:15:19 2009 +0000
     7.3 @@ -62,11 +62,6 @@
     7.4  extern AudioBootStrap COREAUDIO_bootstrap;
     7.5  extern AudioBootStrap COREAUDIOIPHONE_bootstrap;
     7.6  extern AudioBootStrap SNDMGR_bootstrap;
     7.7 -extern AudioBootStrap MINTAUDIO_GSXB_bootstrap;
     7.8 -extern AudioBootStrap MINTAUDIO_MCSN_bootstrap;
     7.9 -extern AudioBootStrap MINTAUDIO_STFA_bootstrap;
    7.10 -extern AudioBootStrap MINTAUDIO_XBIOS_bootstrap;
    7.11 -extern AudioBootStrap MINTAUDIO_DMA8_bootstrap;
    7.12  extern AudioBootStrap DISKAUD_bootstrap;
    7.13  extern AudioBootStrap DUMMYAUD_bootstrap;
    7.14  extern AudioBootStrap DCAUD_bootstrap;
    7.15 @@ -127,13 +122,6 @@
    7.16  #if SDL_AUDIO_DRIVER_COREAUDIOIPHONE
    7.17      &COREAUDIOIPHONE_bootstrap,
    7.18  #endif
    7.19 -#if SDL_AUDIO_DRIVER_MINT
    7.20 -    &MINTAUDIO_GSXB_bootstrap,
    7.21 -    &MINTAUDIO_MCSN_bootstrap,
    7.22 -    &MINTAUDIO_STFA_bootstrap,
    7.23 -    &MINTAUDIO_XBIOS_bootstrap,
    7.24 -    &MINTAUDIO_DMA8_bootstrap,
    7.25 -#endif
    7.26  #if SDL_AUDIO_DRIVER_DISK
    7.27      &DISKAUD_bootstrap,
    7.28  #endif
     8.1 --- a/src/audio/mint/SDL_mintaudio.c	Sun Sep 20 04:13:23 2009 +0000
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,230 +0,0 @@
     8.4 -/*
     8.5 -    SDL - Simple DirectMedia Layer
     8.6 -    Copyright (C) 1997-2009 Sam Lantinga
     8.7 -
     8.8 -    This library is free software; you can redistribute it and/or
     8.9 -    modify it under the terms of the GNU Library General Public
    8.10 -    License as published by the Free Software Foundation; either
    8.11 -    version 2 of the License, or (at your option) any later version.
    8.12 -
    8.13 -    This library is distributed in the hope that it will be useful,
    8.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
    8.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    8.16 -    Library General Public License for more details.
    8.17 -
    8.18 -    You should have received a copy of the GNU Library General Public
    8.19 -    License along with this library; if not, write to the Free
    8.20 -    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    8.21 -
    8.22 -    Sam Lantinga
    8.23 -    slouken@libsdl.org
    8.24 -*/
    8.25 -#include "SDL_config.h"
    8.26 -
    8.27 -/*
    8.28 -	Audio interrupt variables and callback function
    8.29 -
    8.30 -	Patrice Mandin
    8.31 -*/
    8.32 -
    8.33 -#include <unistd.h>
    8.34 -
    8.35 -#include <mint/osbind.h>
    8.36 -#include <mint/falcon.h>
    8.37 -#include <mint/mintbind.h>
    8.38 -#include <mint/cookie.h>
    8.39 -
    8.40 -#include "SDL_audio.h"
    8.41 -#include "SDL_mintaudio.h"
    8.42 -#include "SDL_mintaudio_stfa.h"
    8.43 -
    8.44 -/* The audio device */
    8.45 -
    8.46 -SDL_AudioDevice *SDL_MintAudio_device;
    8.47 -Uint8 *SDL_MintAudio_audiobuf[2];       /* Pointers to buffers */
    8.48 -unsigned long SDL_MintAudio_audiosize;  /* Length of audio buffer=spec->size */
    8.49 -volatile unsigned short SDL_MintAudio_numbuf;   /* Buffer to play */
    8.50 -volatile unsigned short SDL_MintAudio_mutex;
    8.51 -volatile unsigned long SDL_MintAudio_clocktics;
    8.52 -cookie_stfa_t *SDL_MintAudio_stfa;
    8.53 -
    8.54 -/* MiNT thread variables */
    8.55 -SDL_bool SDL_MintAudio_mint_present;
    8.56 -SDL_bool SDL_MintAudio_quit_thread;
    8.57 -SDL_bool SDL_MintAudio_thread_finished;
    8.58 -long SDL_MintAudio_thread_pid;
    8.59 -
    8.60 -/* The callback function, called by each driver whenever needed */
    8.61 -
    8.62 -void
    8.63 -SDL_MintAudio_Callback(void)
    8.64 -{
    8.65 -    Uint8 *buffer;
    8.66 -    SDL_AudioDevice *audio = SDL_MintAudio_device;
    8.67 -
    8.68 -    buffer = SDL_MintAudio_audiobuf[SDL_MintAudio_numbuf];
    8.69 -    SDL_memset(buffer, audio->spec.silence, audio->spec.size);
    8.70 -
    8.71 -    if (audio->paused)
    8.72 -        return;
    8.73 -
    8.74 -    if (audio->convert.needed) {
    8.75 -        int silence;
    8.76 -
    8.77 -        if (audio->convert.src_format == AUDIO_U8) {
    8.78 -            silence = 0x80;
    8.79 -        } else {
    8.80 -            silence = 0;
    8.81 -        }
    8.82 -        SDL_memset(audio->convert.buf, silence, audio->convert.len);
    8.83 -        audio->spec.callback(audio->spec.userdata,
    8.84 -                             (Uint8 *) audio->convert.buf,
    8.85 -                             audio->convert.len);
    8.86 -        SDL_ConvertAudio(&audio->convert);
    8.87 -        SDL_memcpy(buffer, audio->convert.buf, audio->convert.len_cvt);
    8.88 -    } else {
    8.89 -        audio->spec.callback(audio->spec.userdata, buffer, audio->spec.size);
    8.90 -    }
    8.91 -}
    8.92 -
    8.93 -/* Add a new frequency/clock/predivisor to the current list */
    8.94 -void
    8.95 -SDL_MintAudio_AddFrequency(_THIS, Uint32 frequency, Uint32 clock,
    8.96 -                           Uint32 prediv, int gpio_bits)
    8.97 -{
    8.98 -    int i, p;
    8.99 -
   8.100 -    if (MINTAUDIO_freqcount == MINTAUDIO_maxfreqs) {
   8.101 -        return;
   8.102 -    }
   8.103 -
   8.104 -    /* Search where to insert the frequency (highest first) */
   8.105 -    for (p = 0; p < MINTAUDIO_freqcount; p++) {
   8.106 -        if (frequency > MINTAUDIO_frequencies[p].frequency) {
   8.107 -            break;
   8.108 -        }
   8.109 -    }
   8.110 -
   8.111 -    /* Put all following ones farer */
   8.112 -    if (MINTAUDIO_freqcount > 0) {
   8.113 -        for (i = MINTAUDIO_freqcount; i > p; i--) {
   8.114 -            SDL_memcpy(&MINTAUDIO_frequencies[i],
   8.115 -                       &MINTAUDIO_frequencies[i - 1],
   8.116 -                       sizeof(mint_frequency_t));
   8.117 -        }
   8.118 -    }
   8.119 -
   8.120 -    /* And insert new one */
   8.121 -    MINTAUDIO_frequencies[p].frequency = frequency;
   8.122 -    MINTAUDIO_frequencies[p].masterclock = clock;
   8.123 -    MINTAUDIO_frequencies[p].predivisor = prediv;
   8.124 -    MINTAUDIO_frequencies[p].gpio_bits = gpio_bits;
   8.125 -
   8.126 -    MINTAUDIO_freqcount++;
   8.127 -}
   8.128 -
   8.129 -/* Search for the nearest frequency */
   8.130 -int
   8.131 -SDL_MintAudio_SearchFrequency(_THIS, int desired_freq)
   8.132 -{
   8.133 -    int i;
   8.134 -
   8.135 -    /* Only 1 freq ? */
   8.136 -    if (MINTAUDIO_freqcount == 1) {
   8.137 -        return 0;
   8.138 -    }
   8.139 -
   8.140 -    /* Check the array */
   8.141 -    for (i = 0; i < MINTAUDIO_freqcount; i++) {
   8.142 -        if (desired_freq >= ((MINTAUDIO_frequencies[i].frequency +
   8.143 -                              MINTAUDIO_frequencies[i + 1].frequency) >> 1)) {
   8.144 -            return i;
   8.145 -        }
   8.146 -    }
   8.147 -
   8.148 -    /* Not in the array, give the latest */
   8.149 -    return MINTAUDIO_freqcount - 1;
   8.150 -}
   8.151 -
   8.152 -/* Check if FPU is present */
   8.153 -void
   8.154 -SDL_MintAudio_CheckFpu(void)
   8.155 -{
   8.156 -    unsigned long cookie_fpu;
   8.157 -
   8.158 -    SDL_MintAudio_hasfpu = 0;
   8.159 -    if (Getcookie(C__FPU, &cookie_fpu) != C_FOUND) {
   8.160 -        return;
   8.161 -    }
   8.162 -    switch ((cookie_fpu >> 16) & 0xfffe) {
   8.163 -    case 2:
   8.164 -    case 4:
   8.165 -    case 6:
   8.166 -    case 8:
   8.167 -    case 16:
   8.168 -        SDL_MintAudio_hasfpu = 1;
   8.169 -        break;
   8.170 -    }
   8.171 -}
   8.172 -
   8.173 -/* The thread function, used under MiNT with xbios */
   8.174 -int
   8.175 -SDL_MintAudio_Thread(long param)
   8.176 -{
   8.177 -    SndBufPtr pointers;
   8.178 -    SDL_bool buffers_filled[2] = { SDL_FALSE, SDL_FALSE };
   8.179 -
   8.180 -    SDL_MintAudio_thread_finished = SDL_FALSE;
   8.181 -    while (!SDL_MintAudio_quit_thread) {
   8.182 -        if (Buffptr(&pointers) != 0)
   8.183 -            continue;
   8.184 -
   8.185 -        if (((unsigned long) pointers.play >=
   8.186 -             (unsigned long) SDL_MintAudio_audiobuf[0])
   8.187 -            && ((unsigned long) pointers.play <=
   8.188 -                (unsigned long) SDL_MintAudio_audiobuf[1])) {
   8.189 -            /* DMA is reading buffer #0, setup buffer #1 if not already done */
   8.190 -            if (!buffers_filled[1]) {
   8.191 -                SDL_MintAudio_numbuf = 1;
   8.192 -                SDL_MintAudio_Callback();
   8.193 -                Setbuffer(0, SDL_MintAudio_audiobuf[1],
   8.194 -                          SDL_MintAudio_audiobuf[1] +
   8.195 -                          SDL_MintAudio_audiosize);
   8.196 -                buffers_filled[1] = SDL_TRUE;
   8.197 -                buffers_filled[0] = SDL_FALSE;
   8.198 -            }
   8.199 -        } else {
   8.200 -            /* DMA is reading buffer #1, setup buffer #0 if not already done */
   8.201 -            if (!buffers_filled[0]) {
   8.202 -                SDL_MintAudio_numbuf = 0;
   8.203 -                SDL_MintAudio_Callback();
   8.204 -                Setbuffer(0, SDL_MintAudio_audiobuf[0],
   8.205 -                          SDL_MintAudio_audiobuf[0] +
   8.206 -                          SDL_MintAudio_audiosize);
   8.207 -                buffers_filled[0] = SDL_TRUE;
   8.208 -                buffers_filled[1] = SDL_FALSE;
   8.209 -            }
   8.210 -        }
   8.211 -
   8.212 -        usleep(100);
   8.213 -    }
   8.214 -    SDL_MintAudio_thread_finished = SDL_TRUE;
   8.215 -    return 0;
   8.216 -}
   8.217 -
   8.218 -void
   8.219 -SDL_MintAudio_WaitThread(void)
   8.220 -{
   8.221 -    if (!SDL_MintAudio_mint_present)
   8.222 -        return;
   8.223 -
   8.224 -    if (SDL_MintAudio_thread_finished)
   8.225 -        return;
   8.226 -
   8.227 -    SDL_MintAudio_quit_thread = SDL_TRUE;
   8.228 -    while (!SDL_MintAudio_thread_finished) {
   8.229 -        Syield();
   8.230 -    }
   8.231 -}
   8.232 -
   8.233 -/* vi: set ts=4 sw=4 expandtab: */
     9.1 --- a/src/audio/mint/SDL_mintaudio.h	Sun Sep 20 04:13:23 2009 +0000
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,159 +0,0 @@
     9.4 -/*
     9.5 -    SDL - Simple DirectMedia Layer
     9.6 -    Copyright (C) 1997-2009 Sam Lantinga
     9.7 -
     9.8 -    This library is free software; you can redistribute it and/or
     9.9 -    modify it under the terms of the GNU Library General Public
    9.10 -    License as published by the Free Software Foundation; either
    9.11 -    version 2 of the License, or (at your option) any later version.
    9.12 -
    9.13 -    This library is distributed in the hope that it will be useful,
    9.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
    9.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    9.16 -    Library General Public License for more details.
    9.17 -
    9.18 -    You should have received a copy of the GNU Library General Public
    9.19 -    License along with this library; if not, write to the Free
    9.20 -    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    9.21 -
    9.22 -    Sam Lantinga
    9.23 -    slouken@libsdl.org
    9.24 -*/
    9.25 -#include "SDL_config.h"
    9.26 -
    9.27 -/*
    9.28 -	MiNT audio driver
    9.29 -
    9.30 -	Patrice Mandin
    9.31 -*/
    9.32 -
    9.33 -#ifndef _SDL_mintaudio_h
    9.34 -#define _SDL_mintaudio_h
    9.35 -
    9.36 -#include "../SDL_sysaudio.h"
    9.37 -#include "SDL_mintaudio_stfa.h"
    9.38 -
    9.39 -/* Hidden "this" pointer for the audio functions */
    9.40 -#define _THIS	SDL_AudioDevice *this
    9.41 -
    9.42 -/* 16 predivisors with 3 clocks max. */
    9.43 -#define MINTAUDIO_maxfreqs		(16*3)
    9.44 -
    9.45 -typedef struct
    9.46 -{
    9.47 -    Uint32 frequency;
    9.48 -    Uint32 masterclock;
    9.49 -    Uint32 predivisor;
    9.50 -    int gpio_bits;              /* in case of external clock */
    9.51 -} mint_frequency_t;
    9.52 -
    9.53 -struct SDL_PrivateAudioData
    9.54 -{
    9.55 -    mint_frequency_t frequencies[MINTAUDIO_maxfreqs];
    9.56 -    int freq_count;             /* Number of frequencies in the array */
    9.57 -    int numfreq;                /* Number of selected frequency */
    9.58 -};
    9.59 -
    9.60 -/* Old variable names */
    9.61 -
    9.62 -#define MINTAUDIO_frequencies	(this->hidden->frequencies)
    9.63 -#define MINTAUDIO_freqcount		(this->hidden->freq_count)
    9.64 -#define MINTAUDIO_numfreq		(this->hidden->numfreq)
    9.65 -
    9.66 -/* _MCH cookie (values>>16) */
    9.67 -enum
    9.68 -{
    9.69 -    MCH_ST = 0,
    9.70 -    MCH_STE,
    9.71 -    MCH_TT,
    9.72 -    MCH_F30,
    9.73 -    MCH_CLONE,
    9.74 -    MCH_ARANYM
    9.75 -};
    9.76 -
    9.77 -/* Master clocks for replay frequencies */
    9.78 -#define MASTERCLOCK_STE		8010666 /* Not sure of this one */
    9.79 -#define MASTERCLOCK_TT		16107953        /* Not sure of this one */
    9.80 -#define MASTERCLOCK_FALCON1	25175000
    9.81 -#define MASTERCLOCK_FALCON2	32000000        /* Only usable for DSP56K */
    9.82 -#define MASTERCLOCK_FALCONEXT	-1      /* Clock on DSP56K port, unknown */
    9.83 -#define MASTERCLOCK_44K		22579200        /* Standard clock for 44.1 Khz */
    9.84 -#define MASTERCLOCK_48K		24576000        /* Standard clock for 48 Khz */
    9.85 -
    9.86 -/* Master clock predivisors */
    9.87 -#define MASTERPREDIV_STE	160
    9.88 -#define MASTERPREDIV_TT		320
    9.89 -#define MASTERPREDIV_FALCON	256
    9.90 -#define MASTERPREDIV_MILAN	256
    9.91 -
    9.92 -/* MFP 68901 interrupt sources */
    9.93 -enum
    9.94 -{
    9.95 -    MFP_PARALLEL = 0,
    9.96 -    MFP_DCD,
    9.97 -    MFP_CTS,
    9.98 -    MFP_BITBLT,
    9.99 -    MFP_TIMERD,
   9.100 -    MFP_BAUDRATE = MFP_TIMERD,
   9.101 -    MFP_TIMERC,
   9.102 -    MFP_200HZ = MFP_TIMERC,
   9.103 -    MFP_ACIA,
   9.104 -    MFP_DISK,
   9.105 -    MFP_TIMERB,
   9.106 -    MFP_HBLANK = MFP_TIMERB,
   9.107 -    MFP_TERR,
   9.108 -    MFP_TBE,
   9.109 -    MFP_RERR,
   9.110 -    MFP_RBF,
   9.111 -    MFP_TIMERA,
   9.112 -    MFP_DMASOUND = MFP_TIMERA,
   9.113 -    MFP_RING,
   9.114 -    MFP_MONODETECT
   9.115 -};
   9.116 -
   9.117 -/* Xbtimer() timers */
   9.118 -enum
   9.119 -{
   9.120 -    XB_TIMERA = 0,
   9.121 -    XB_TIMERB,
   9.122 -    XB_TIMERC,
   9.123 -    XB_TIMERD
   9.124 -};
   9.125 -
   9.126 -/* Variables */
   9.127 -extern SDL_AudioDevice *SDL_MintAudio_device;
   9.128 -extern Uint8 *SDL_MintAudio_audiobuf[2];        /* Pointers to buffers */
   9.129 -extern unsigned long SDL_MintAudio_audiosize;   /* Length of audio buffer=spec->size */
   9.130 -extern volatile unsigned short SDL_MintAudio_numbuf;    /* Buffer to play */
   9.131 -extern volatile unsigned short SDL_MintAudio_mutex;
   9.132 -extern cookie_stfa_t *SDL_MintAudio_stfa;
   9.133 -extern volatile unsigned long SDL_MintAudio_clocktics;
   9.134 -extern unsigned short SDL_MintAudio_hasfpu;     /* To preserve fpu registers if needed */
   9.135 -
   9.136 -/* MiNT thread variables */
   9.137 -extern SDL_bool SDL_MintAudio_mint_present;
   9.138 -extern SDL_bool SDL_MintAudio_quit_thread;
   9.139 -extern SDL_bool SDL_MintAudio_thread_finished;
   9.140 -extern long SDL_MintAudio_thread_pid;
   9.141 -
   9.142 -/* Functions */
   9.143 -void SDL_MintAudio_Callback(void);
   9.144 -void SDL_MintAudio_AddFrequency(_THIS, Uint32 frequency, Uint32 clock,
   9.145 -                                Uint32 prediv, int gpio_bits);
   9.146 -int SDL_MintAudio_SearchFrequency(_THIS, int desired_freq);
   9.147 -void SDL_MintAudio_CheckFpu(void);
   9.148 -
   9.149 -/* MiNT thread functions */
   9.150 -int SDL_MintAudio_Thread(long param);
   9.151 -void SDL_MintAudio_WaitThread(void);
   9.152 -
   9.153 -/* ASM interrupt functions */
   9.154 -void SDL_MintAudio_GsxbInterrupt(void);
   9.155 -void SDL_MintAudio_EmptyGsxbInterrupt(void);
   9.156 -void SDL_MintAudio_XbiosInterruptMeasureClock(void);
   9.157 -void SDL_MintAudio_XbiosInterrupt(void);
   9.158 -void SDL_MintAudio_Dma8Interrupt(void);
   9.159 -void SDL_MintAudio_StfaInterrupt(void);
   9.160 -
   9.161 -#endif /* _SDL_mintaudio_h */
   9.162 -/* vi: set ts=4 sw=4 expandtab: */
    10.1 --- a/src/audio/mint/SDL_mintaudio_dma8.c	Sun Sep 20 04:13:23 2009 +0000
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,348 +0,0 @@
    10.4 -/*
    10.5 -    SDL - Simple DirectMedia Layer
    10.6 -    Copyright (C) 1997-2009 Sam Lantinga
    10.7 -
    10.8 -    This library is free software; you can redistribute it and/or
    10.9 -    modify it under the terms of the GNU Library General Public
   10.10 -    License as published by the Free Software Foundation; either
   10.11 -    version 2 of the License, or (at your option) any later version.
   10.12 -
   10.13 -    This library is distributed in the hope that it will be useful,
   10.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   10.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   10.16 -    Library General Public License for more details.
   10.17 -
   10.18 -    You should have received a copy of the GNU Library General Public
   10.19 -    License along with this library; if not, write to the Free
   10.20 -    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   10.21 -
   10.22 -    Sam Lantinga
   10.23 -    slouken@libsdl.org
   10.24 -*/
   10.25 -#include "SDL_config.h"
   10.26 -
   10.27 -/*
   10.28 -	MiNT audio driver
   10.29 -	using DMA 8bits (hardware access)
   10.30 -
   10.31 -	Patrice Mandin
   10.32 -*/
   10.33 -
   10.34 -/* Mint includes */
   10.35 -#include <mint/osbind.h>
   10.36 -#include <mint/falcon.h>
   10.37 -#include <mint/cookie.h>
   10.38 -
   10.39 -#include "SDL_audio.h"
   10.40 -#include "../SDL_audio_c.h"
   10.41 -#include "../SDL_sysaudio.h"
   10.42 -
   10.43 -#include "../../video/ataricommon/SDL_atarimxalloc_c.h"
   10.44 -
   10.45 -#include "SDL_mintaudio.h"
   10.46 -#include "SDL_mintaudio_dma8.h"
   10.47 -
   10.48 -/*--- Defines ---*/
   10.49 -
   10.50 -#define MINT_AUDIO_DRIVER_NAME "mint_dma8"
   10.51 -
   10.52 -/* Debug print info */
   10.53 -#define DEBUG_NAME "audio:dma8: "
   10.54 -#if 0
   10.55 -#define DEBUG_PRINT(what) \
   10.56 -	{ \
   10.57 -		printf what; \
   10.58 -	}
   10.59 -#else
   10.60 -#define DEBUG_PRINT(what)
   10.61 -#endif
   10.62 -
   10.63 -/*--- Static variables ---*/
   10.64 -
   10.65 -static unsigned long cookie_snd, cookie_mch;
   10.66 -
   10.67 -static void
   10.68 -MINTDMA8_LockDevice(_THIS)
   10.69 -{
   10.70 -    void *oldpile;
   10.71 -
   10.72 -    /* Stop replay */
   10.73 -    oldpile = (void *) Super(0);
   10.74 -    DMAAUDIO_IO.control = 0;
   10.75 -    Super(oldpile);
   10.76 -}
   10.77 -
   10.78 -static void
   10.79 -MINTDMA8_UnlockDevice(_THIS)
   10.80 -{
   10.81 -    void *oldpile;
   10.82 -
   10.83 -    /* Restart replay */
   10.84 -    oldpile = (void *) Super(0);
   10.85 -    DMAAUDIO_IO.control = 3;
   10.86 -    Super(oldpile);
   10.87 -}
   10.88 -
   10.89 -static void
   10.90 -MINTDMA8_CloseDevice(_THIS)
   10.91 -{
   10.92 -    if (this->hidden != NULL) {
   10.93 -        /* Stop replay */
   10.94 -        void *oldpile = (void *) Super(0);
   10.95 -
   10.96 -        DMAAUDIO_IO.control = 0;
   10.97 -        Super(oldpile);
   10.98 -
   10.99 -        DEBUG_PRINT((DEBUG_NAME "closeaudio: replay stopped\n"));
  10.100 -
  10.101 -        /* Disable interrupt */
  10.102 -        Jdisint(MFP_DMASOUND);
  10.103 -
  10.104 -        DEBUG_PRINT((DEBUG_NAME "closeaudio: interrupt disabled\n"));
  10.105 -
  10.106 -        /* Wait if currently playing sound */
  10.107 -        while (SDL_MintAudio_mutex != 0) {
  10.108 -        }
  10.109 -
  10.110 -        DEBUG_PRINT((DEBUG_NAME "closeaudio: no more interrupt running\n"));
  10.111 -
  10.112 -        /* Clear buffers */
  10.113 -        if (SDL_MintAudio_audiobuf[0]) {
  10.114 -            Mfree(SDL_MintAudio_audiobuf[0]);
  10.115 -            SDL_MintAudio_audiobuf[0] = SDL_MintAudio_audiobuf[1] = NULL;
  10.116 -        }
  10.117 -
  10.118 -        DEBUG_PRINT((DEBUG_NAME "closeaudio: buffers freed\n"));
  10.119 -        SDL_free(this->hidden);
  10.120 -        this->hidden = NULL;
  10.121 -    }
  10.122 -}
  10.123 -
  10.124 -static int
  10.125 -MINTDMA8_CheckAudio(_THIS)
  10.126 -{
  10.127 -    int i, masterprediv, sfreq;
  10.128 -    unsigned long masterclock;
  10.129 -
  10.130 -    DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ",
  10.131 -                 SDL_AUDIO_BITSIZE(this->spec.format)));
  10.132 -    DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(this->spec.format)));
  10.133 -    DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(this->spec.format)));
  10.134 -    DEBUG_PRINT(("big endian=%d, ",
  10.135 -                 SDL_AUDIO_ISBIGENDIAN(this->spec.format)));
  10.136 -    DEBUG_PRINT(("channels=%d, ", this->spec.channels));
  10.137 -    DEBUG_PRINT(("freq=%d\n", this->spec.freq));
  10.138 -
  10.139 -    if (this->spec.channels > 2) {
  10.140 -        this->spec.channels = 2;        /* no more than stereo! */
  10.141 -    }
  10.142 -
  10.143 -    /* Check formats available */
  10.144 -    this->spec.format = AUDIO_S8;
  10.145 -
  10.146 -    /* Calculate and select the closest frequency */
  10.147 -    sfreq = 0;
  10.148 -    masterclock = MASTERCLOCK_STE;
  10.149 -    masterprediv = MASTERPREDIV_STE;
  10.150 -    switch (cookie_mch >> 16) {
  10.151 -/*
  10.152 -		case MCH_STE:
  10.153 -			masterclock=MASTERCLOCK_STE;
  10.154 -			masterprediv=MASTERPREDIV_STE;
  10.155 -			break;
  10.156 -*/
  10.157 -    case MCH_TT:
  10.158 -        masterclock = MASTERCLOCK_TT;
  10.159 -        masterprediv = MASTERPREDIV_TT;
  10.160 -        break;
  10.161 -    case MCH_F30:
  10.162 -    case MCH_ARANYM:
  10.163 -        masterclock = MASTERCLOCK_FALCON1;
  10.164 -        masterprediv = MASTERPREDIV_FALCON;
  10.165 -        sfreq = 1;
  10.166 -        break;
  10.167 -    }
  10.168 -
  10.169 -    MINTAUDIO_freqcount = 0;
  10.170 -    for (i = sfreq; i < 4; i++) {
  10.171 -        SDL_MintAudio_AddFrequency(this,
  10.172 -                                   masterclock / (masterprediv * (1 << i)),
  10.173 -                                   masterclock, i - sfreq, -1);
  10.174 -    }
  10.175 -
  10.176 -#if 1
  10.177 -    for (i = 0; i < MINTAUDIO_freqcount; i++) {
  10.178 -        DEBUG_PRINT((DEBUG_NAME "freq %d: %lu Hz, clock %lu, prediv %d\n",
  10.179 -                     i, MINTAUDIO_frequencies[i].frequency,
  10.180 -                     MINTAUDIO_frequencies[i].masterclock,
  10.181 -                     MINTAUDIO_frequencies[i].predivisor));
  10.182 -    }
  10.183 -#endif
  10.184 -
  10.185 -    MINTAUDIO_numfreq = SDL_MintAudio_SearchFrequency(this, this->spec.freq);
  10.186 -    this->spec.freq = MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency;
  10.187 -
  10.188 -    DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ",
  10.189 -                 SDL_AUDIO_BITSIZE(this->spec.format)));
  10.190 -    DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(this->spec.format)));
  10.191 -    DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(this->spec.format)));
  10.192 -    DEBUG_PRINT(("big endian=%d, ",
  10.193 -                 SDL_AUDIO_ISBIGENDIAN(this->spec.format)));
  10.194 -    DEBUG_PRINT(("channels=%d, ", this->spec.channels));
  10.195 -    DEBUG_PRINT(("freq=%d\n", this->spec.freq));
  10.196 -
  10.197 -    return 0;
  10.198 -}
  10.199 -
  10.200 -static void
  10.201 -MINTDMA8_InitAudio(_THIS)
  10.202 -{
  10.203 -    void *oldpile;
  10.204 -    unsigned long buffer;
  10.205 -    unsigned char mode;
  10.206 -
  10.207 -    /* Set replay tracks */
  10.208 -    if (cookie_snd & SND_16BIT) {
  10.209 -        Settracks(0, 0);
  10.210 -        Setmontracks(0);
  10.211 -    }
  10.212 -
  10.213 -    oldpile = (void *) Super(0);
  10.214 -
  10.215 -    /* Stop currently playing sound */
  10.216 -    DMAAUDIO_IO.control = 0;
  10.217 -
  10.218 -    /* Set buffer */
  10.219 -    buffer = (unsigned long) SDL_MintAudio_audiobuf[SDL_MintAudio_numbuf];
  10.220 -    DMAAUDIO_IO.start_high = (buffer >> 16) & 255;
  10.221 -    DMAAUDIO_IO.start_mid = (buffer >> 8) & 255;
  10.222 -    DMAAUDIO_IO.start_low = buffer & 255;
  10.223 -
  10.224 -    buffer += SDL_MintAudio_audiosize;
  10.225 -    DMAAUDIO_IO.end_high = (buffer >> 16) & 255;
  10.226 -    DMAAUDIO_IO.end_mid = (buffer >> 8) & 255;
  10.227 -    DMAAUDIO_IO.end_low = buffer & 255;
  10.228 -
  10.229 -    mode = 3 - MINTAUDIO_frequencies[MINTAUDIO_numfreq].predivisor;
  10.230 -    if (this->spec.channels == 1) {
  10.231 -        mode |= 1 << 7;
  10.232 -    }
  10.233 -    DMAAUDIO_IO.sound_ctrl = mode;
  10.234 -
  10.235 -    /* Set interrupt */
  10.236 -    Jdisint(MFP_DMASOUND);
  10.237 -    Xbtimer(XB_TIMERA, 8, 1, SDL_MintAudio_Dma8Interrupt);
  10.238 -    Jenabint(MFP_DMASOUND);
  10.239 -
  10.240 -    if (cookie_snd & SND_16BIT) {
  10.241 -        if (Setinterrupt(SI_TIMERA, SI_PLAY) < 0) {
  10.242 -            DEBUG_PRINT((DEBUG_NAME "Setinterrupt() failed\n"));
  10.243 -        }
  10.244 -    }
  10.245 -
  10.246 -    /* Go */
  10.247 -    DMAAUDIO_IO.control = 3;    /* playback + repeat */
  10.248 -
  10.249 -    Super(oldpile);
  10.250 -}
  10.251 -
  10.252 -static int
  10.253 -MINTDMA8_OpenDevice(_THIS, const char *devname, int iscapture)
  10.254 -{
  10.255 -    SDL_MintAudio_device = this;
  10.256 -
  10.257 -    /* Check audio capabilities */
  10.258 -    if (MINTDMA8_CheckAudio(this) == -1) {
  10.259 -        return 0;
  10.260 -    }
  10.261 -
  10.262 -    /* Initialize all variables that we clean on shutdown */
  10.263 -    this->hidden = (struct SDL_PrivateAudioData *)
  10.264 -        SDL_malloc((sizeof *this->hidden));
  10.265 -    if (this->hidden == NULL) {
  10.266 -        SDL_OutOfMemory();
  10.267 -        return 0;
  10.268 -    }
  10.269 -    SDL_memset(this->hidden, 0, (sizeof *this->hidden));
  10.270 -
  10.271 -    SDL_CalculateAudioSpec(&this->spec);
  10.272 -
  10.273 -    /* Allocate memory for audio buffers in DMA-able RAM */
  10.274 -    DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", this->spec.size));
  10.275 -
  10.276 -    SDL_MintAudio_audiobuf[0] =
  10.277 -        Atari_SysMalloc(this->spec.size * 2, MX_STRAM);
  10.278 -    if (SDL_MintAudio_audiobuf[0] == NULL) {
  10.279 -        SDL_free(this->hidden);
  10.280 -        this->hidden = NULL;
  10.281 -        SDL_OutOfMemory();
  10.282 -        return 0;
  10.283 -    }
  10.284 -    SDL_MintAudio_audiobuf[1] = SDL_MintAudio_audiobuf[0] + this->spec.size;
  10.285 -    SDL_MintAudio_numbuf = 0;
  10.286 -    SDL_memset(SDL_MintAudio_audiobuf[0], this->spec.silence,
  10.287 -               this->spec.size * 2);
  10.288 -    SDL_MintAudio_audiosize = this->spec.size;
  10.289 -    SDL_MintAudio_mutex = 0;
  10.290 -
  10.291 -    DEBUG_PRINT((DEBUG_NAME "buffer 0 at 0x%08x\n",
  10.292 -                 SDL_MintAudio_audiobuf[0]));
  10.293 -    DEBUG_PRINT((DEBUG_NAME "buffer 1 at 0x%08x\n",
  10.294 -                 SDL_MintAudio_audiobuf[1]));
  10.295 -
  10.296 -    SDL_MintAudio_CheckFpu();
  10.297 -
  10.298 -    /* Setup audio hardware */
  10.299 -    MINTDMA8_InitAudio(this);
  10.300 -
  10.301 -    return 1;                   /* good to go. */
  10.302 -}
  10.303 -
  10.304 -static int
  10.305 -MINTDMA8_Init(SDL_AudioDriverImpl * impl)
  10.306 -{
  10.307 -    /* Cookie _MCH present ? if not, assume ST machine */
  10.308 -    if (Getcookie(C__MCH, &cookie_mch) == C_NOTFOUND) {
  10.309 -        cookie_mch = MCH_ST;
  10.310 -    }
  10.311 -
  10.312 -    /* Cookie _SND present ? if not, assume ST machine */
  10.313 -    if (Getcookie(C__SND, &cookie_snd) == C_NOTFOUND) {
  10.314 -        cookie_snd = SND_PSG;
  10.315 -    }
  10.316 -
  10.317 -    /* Check if we have 8 bits audio */
  10.318 -    if ((cookie_snd & SND_8BIT) == 0) {
  10.319 -        SDL_SetError(DEBUG_NAME "no 8 bits sound");
  10.320 -        return 0;
  10.321 -    }
  10.322 -
  10.323 -    /* Check if audio is lockable */
  10.324 -    if (cookie_snd & SND_16BIT) {
  10.325 -        if (Locksnd() != 1) {
  10.326 -            SDL_SetError(DEBUG_NAME "audio locked by other application");
  10.327 -            return 0;
  10.328 -        }
  10.329 -
  10.330 -        Unlocksnd();
  10.331 -    }
  10.332 -
  10.333 -    DEBUG_PRINT((DEBUG_NAME "8 bits audio available!\n"));
  10.334 -
  10.335 -    /* Set the function pointers */
  10.336 -    impl->OpenDevice = MINTDMA8_OpenDevice;
  10.337 -    impl->CloseDevice = MINTDMA8_CloseDevice;
  10.338 -    impl->LockDevice = MINTDMA8_LockDevice;
  10.339 -    impl->UnlockDevice = MINTDMA8_UnlockDevice;
  10.340 -    impl->OnlyHasDefaultOutputDevice = 1;
  10.341 -    impl->ProvidesOwnCallbackThread = 1;
  10.342 -    impl->SkipMixerLock = 1;
  10.343 -
  10.344 -    return 2;                   /* 2 == definitely has an audio device. */
  10.345 -}
  10.346 -
  10.347 -AudioBootStrap MINTAUDIO_DMA8_bootstrap = {
  10.348 -    MINT_AUDIO_DRIVER_NAME, "MiNT DMA 8 bits audio driver", MINTDMA8_Init, 0
  10.349 -};
  10.350 -
  10.351 -/* vi: set ts=4 sw=4 expandtab: */
    11.1 --- a/src/audio/mint/SDL_mintaudio_dma8.h	Sun Sep 20 04:13:23 2009 +0000
    11.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.3 @@ -1,87 +0,0 @@
    11.4 -/*
    11.5 -    SDL - Simple DirectMedia Layer
    11.6 -    Copyright (C) 1997-2009 Sam Lantinga
    11.7 -
    11.8 -    This library is free software; you can redistribute it and/or
    11.9 -    modify it under the terms of the GNU Library General Public
   11.10 -    License as published by the Free Software Foundation; either
   11.11 -    version 2 of the License, or (at your option) any later version.
   11.12 -
   11.13 -    This library is distributed in the hope that it will be useful,
   11.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   11.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   11.16 -    Library General Public License for more details.
   11.17 -
   11.18 -    You should have received a copy of the GNU Library General Public
   11.19 -    License along with this library; if not, write to the Free
   11.20 -    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   11.21 -
   11.22 -    Sam Lantinga
   11.23 -    slouken@libsdl.org
   11.24 -*/
   11.25 -#include "SDL_config.h"
   11.26 -
   11.27 -/*
   11.28 -	DMA 8bits and Falcon Codec audio definitions
   11.29 -
   11.30 -	Patrice Mandin, Didier Méquignon
   11.31 -*/
   11.32 -
   11.33 -#ifndef _SDL_mintaudio_dma8_h
   11.34 -#define _SDL_mintaudio_dma8_h
   11.35 -
   11.36 -#define DMAAUDIO_IO_BASE (0xffff8900)
   11.37 -struct DMAAUDIO_IO_S
   11.38 -{
   11.39 -    unsigned char int_ctrl;
   11.40 -    unsigned char control;
   11.41 -
   11.42 -    unsigned char dummy1;
   11.43 -    unsigned char start_high;
   11.44 -    unsigned char dummy2;
   11.45 -    unsigned char start_mid;
   11.46 -    unsigned char dummy3;
   11.47 -    unsigned char start_low;
   11.48 -
   11.49 -    unsigned char dummy4;
   11.50 -    unsigned char cur_high;
   11.51 -    unsigned char dummy5;
   11.52 -    unsigned char cur_mid;
   11.53 -    unsigned char dummy6;
   11.54 -    unsigned char cur_low;
   11.55 -
   11.56 -    unsigned char dummy7;
   11.57 -    unsigned char end_high;
   11.58 -    unsigned char dummy8;
   11.59 -    unsigned char end_mid;
   11.60 -    unsigned char dummy9;
   11.61 -    unsigned char end_low;
   11.62 -
   11.63 -    unsigned char dummy10[12];
   11.64 -
   11.65 -    unsigned char track_ctrl;   /* CODEC only */
   11.66 -    unsigned char sound_ctrl;
   11.67 -    unsigned short sound_data;
   11.68 -    unsigned short sound_mask;
   11.69 -
   11.70 -    unsigned char dummy11[10];
   11.71 -
   11.72 -    unsigned short dev_ctrl;
   11.73 -    unsigned short dest_ctrl;
   11.74 -    unsigned short sync_div;
   11.75 -    unsigned char track_rec;
   11.76 -    unsigned char adderin_input;
   11.77 -    unsigned char channel_input;
   11.78 -    unsigned char channel_amplification;
   11.79 -    unsigned char channel_reduction;
   11.80 -
   11.81 -    unsigned char dummy12[6];
   11.82 -
   11.83 -    unsigned char data_direction;
   11.84 -    unsigned char dummy13;
   11.85 -    unsigned char dev_data;
   11.86 -};
   11.87 -#define DMAAUDIO_IO ((*(volatile struct DMAAUDIO_IO_S *)DMAAUDIO_IO_BASE))
   11.88 -
   11.89 -#endif /* _SDL_mintaudio_dma8_h */
   11.90 -/* vi: set ts=4 sw=4 expandtab: */
    12.1 --- a/src/audio/mint/SDL_mintaudio_gsxb.c	Sun Sep 20 04:13:23 2009 +0000
    12.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.3 @@ -1,443 +0,0 @@
    12.4 -/*
    12.5 -    SDL - Simple DirectMedia Layer
    12.6 -    Copyright (C) 1997-2009 Sam Lantinga
    12.7 -
    12.8 -    This library is free software; you can redistribute it and/or
    12.9 -    modify it under the terms of the GNU Library General Public
   12.10 -    License as published by the Free Software Foundation; either
   12.11 -    version 2 of the License, or (at your option) any later version.
   12.12 -
   12.13 -    This library is distributed in the hope that it will be useful,
   12.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   12.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   12.16 -    Library General Public License for more details.
   12.17 -
   12.18 -    You should have received a copy of the GNU Library General Public
   12.19 -    License along with this library; if not, write to the Free
   12.20 -    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   12.21 -
   12.22 -    Sam Lantinga
   12.23 -    slouken@libsdl.org
   12.24 -*/
   12.25 -#include "SDL_config.h"
   12.26 -
   12.27 -/*
   12.28 -	MiNT audio driver
   12.29 -	using XBIOS functions (GSXB compatible driver)
   12.30 -
   12.31 -	Patrice Mandin
   12.32 -*/
   12.33 -
   12.34 -/* Mint includes */
   12.35 -#include <mint/osbind.h>
   12.36 -#include <mint/falcon.h>
   12.37 -#include <mint/cookie.h>
   12.38 -
   12.39 -#include "SDL_audio.h"
   12.40 -#include "../SDL_audio_c.h"
   12.41 -#include "../SDL_sysaudio.h"
   12.42 -
   12.43 -#include "../../video/ataricommon/SDL_atarimxalloc_c.h"
   12.44 -
   12.45 -#include "SDL_mintaudio.h"
   12.46 -#include "SDL_mintaudio_gsxb.h"
   12.47 -
   12.48 -/*--- Defines ---*/
   12.49 -
   12.50 -#define MINT_AUDIO_DRIVER_NAME "mint_gsxb"
   12.51 -
   12.52 -/* Debug print info */
   12.53 -#define DEBUG_NAME "audio:gsxb: "
   12.54 -#if 0
   12.55 -#define DEBUG_PRINT(what) \
   12.56 -	{ \
   12.57 -		printf what; \
   12.58 -	}
   12.59 -#else
   12.60 -#define DEBUG_PRINT(what)
   12.61 -#endif
   12.62 -
   12.63 -/*--- Static variables ---*/
   12.64 -
   12.65 -static unsigned long cookie_snd, cookie_gsxb;
   12.66 -
   12.67 -/*--- Audio driver functions ---*/
   12.68 -
   12.69 -/* GSXB callbacks */
   12.70 -static void MINTGSXB_GsxbInterrupt(void);
   12.71 -static void MINTGSXB_GsxbNullInterrupt(void);
   12.72 -
   12.73 -static void
   12.74 -MINTGSXB_LockDevice(_THIS)
   12.75 -{
   12.76 -    /* Stop replay */
   12.77 -    Buffoper(0);
   12.78 -}
   12.79 -
   12.80 -static void
   12.81 -MINTGSXB_UnlockDevice(_THIS)
   12.82 -{
   12.83 -    /* Restart replay */
   12.84 -    Buffoper(SB_PLA_ENA | SB_PLA_RPT);
   12.85 -}
   12.86 -
   12.87 -static void
   12.88 -MINTGSXB_CloseDevice(_THIS)
   12.89 -{
   12.90 -    if (this->hidden != NULL) {
   12.91 -        /* Stop replay */
   12.92 -        Buffoper(0);
   12.93 -
   12.94 -        /* Uninstall interrupt */
   12.95 -        if (NSetinterrupt(2, SI_NONE, MINTGSXB_GsxbNullInterrupt) < 0) {
   12.96 -            DEBUG_PRINT((DEBUG_NAME "NSetinterrupt() failed in close\n"));
   12.97 -        }
   12.98 -
   12.99 -        /* Wait if currently playing sound */
  12.100 -        while (SDL_MintAudio_mutex != 0) {
  12.101 -        }
  12.102 -
  12.103 -        /* Clear buffers */
  12.104 -        if (SDL_MintAudio_audiobuf[0]) {
  12.105 -            Mfree(SDL_MintAudio_audiobuf[0]);
  12.106 -            SDL_MintAudio_audiobuf[0] = SDL_MintAudio_audiobuf[1] = NULL;
  12.107 -        }
  12.108 -
  12.109 -        /* Unlock sound system */
  12.110 -        Unlocksnd();
  12.111 -
  12.112 -        SDL_free(this->hidden);
  12.113 -        this->hidden = NULL;
  12.114 -    }
  12.115 -}
  12.116 -
  12.117 -static int
  12.118 -MINTGSXB_CheckAudio(_THIS)
  12.119 -{
  12.120 -    long snd_format;
  12.121 -    int i, resolution, format_signed, format_bigendian;
  12.122 -    SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format);
  12.123 -    int valid_datatype = 0;
  12.124 -
  12.125 -    resolution = SDL_AUDIO_BITSIZE(this->spec.format);
  12.126 -    format_signed = SDL_AUDIO_ISSIGNED(this->spec.format);
  12.127 -    format_bigendian = SDL_AUDIO_ISBIGENDIAN(this->spec.format);
  12.128 -
  12.129 -    DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ", resolution));
  12.130 -    DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(this->spec.format)));
  12.131 -    DEBUG_PRINT(("signed=%d, ", format_signed));
  12.132 -    DEBUG_PRINT(("big endian=%d, ", format_bigendian));
  12.133 -    DEBUG_PRINT(("channels=%d, ", this->spec.channels));
  12.134 -    DEBUG_PRINT(("freq=%d\n", this->spec.freq));
  12.135 -
  12.136 -    if (this->spec.channels > 2) {
  12.137 -        this->spec.channels = 2;        /* no more than stereo! */
  12.138 -    }
  12.139 -
  12.140 -    while ((!valid_datatype) && (test_format)) {
  12.141 -        /* Check formats available */
  12.142 -        snd_format = Sndstatus(SND_QUERYFORMATS);
  12.143 -        this->spec.format = test_format;
  12.144 -        resolution = SDL_AUDIO_BITSIZE(this->spec.format);
  12.145 -        format_signed = SDL_AUDIO_ISSIGNED(this->spec.format);
  12.146 -        format_bigendian = SDL_AUDIO_ISBIGENDIAN(this->spec.format);
  12.147 -        switch (test_format) {
  12.148 -        case AUDIO_U8:
  12.149 -        case AUDIO_S8:
  12.150 -            if (snd_format & SND_FORMAT8) {
  12.151 -                valid_datatype = 1;
  12.152 -                snd_format = Sndstatus(SND_QUERY8BIT);
  12.153 -            }
  12.154 -            break;
  12.155 -
  12.156 -        case AUDIO_U16LSB:
  12.157 -        case AUDIO_S16LSB:
  12.158 -        case AUDIO_U16MSB:
  12.159 -        case AUDIO_S16MSB:
  12.160 -            if (snd_format & SND_FORMAT16) {
  12.161 -                valid_datatype = 1;
  12.162 -                snd_format = Sndstatus(SND_QUERY16BIT);
  12.163 -            }
  12.164 -            break;
  12.165 -
  12.166 -        case AUDIO_S32LSB:
  12.167 -        case AUDIO_S32MSB:
  12.168 -            if (snd_format & SND_FORMAT32) {
  12.169 -                valid_datatype = 1;
  12.170 -                snd_format = Sndstatus(SND_QUERY32BIT);
  12.171 -            }
  12.172 -            break;
  12.173 -
  12.174 -            /* no float support... */
  12.175 -
  12.176 -        default:
  12.177 -            test_format = SDL_NextAudioFormat();
  12.178 -            break;
  12.179 -        }
  12.180 -    }
  12.181 -
  12.182 -    if (!valid_datatype) {
  12.183 -        SDL_SetError("Unsupported audio format");
  12.184 -        return (-1);
  12.185 -    }
  12.186 -
  12.187 -    /* Check signed/unsigned format */
  12.188 -    if (format_signed) {
  12.189 -        if (snd_format & SND_FORMATSIGNED) {
  12.190 -            /* Ok */
  12.191 -        } else if (snd_format & SND_FORMATUNSIGNED) {
  12.192 -            /* Give unsigned format */
  12.193 -            this->spec.format = this->spec.format & (~SDL_AUDIO_MASK_SIGNED);
  12.194 -        }
  12.195 -    } else {
  12.196 -        if (snd_format & SND_FORMATUNSIGNED) {
  12.197 -            /* Ok */
  12.198 -        } else if (snd_format & SND_FORMATSIGNED) {
  12.199 -            /* Give signed format */
  12.200 -            this->spec.format |= SDL_AUDIO_MASK_SIGNED;
  12.201 -        }
  12.202 -    }
  12.203 -
  12.204 -    if (format_bigendian) {
  12.205 -        if (snd_format & SND_FORMATBIGENDIAN) {
  12.206 -            /* Ok */
  12.207 -        } else if (snd_format & SND_FORMATLITTLEENDIAN) {
  12.208 -            /* Give little endian format */
  12.209 -            this->spec.format = this->spec.format & (~SDL_AUDIO_MASK_ENDIAN);
  12.210 -        }
  12.211 -    } else {
  12.212 -        if (snd_format & SND_FORMATLITTLEENDIAN) {
  12.213 -            /* Ok */
  12.214 -        } else if (snd_format & SND_FORMATBIGENDIAN) {
  12.215 -            /* Give big endian format */
  12.216 -            this->spec.format |= SDL_AUDIO_MASK_ENDIAN;
  12.217 -        }
  12.218 -    }
  12.219 -
  12.220 -    /* Calculate and select the closest frequency */
  12.221 -    MINTAUDIO_freqcount = 0;
  12.222 -    for (i = 1; i < 4; i++) {
  12.223 -        SDL_MintAudio_AddFrequency(this,
  12.224 -                                   MASTERCLOCK_44K / (MASTERPREDIV_MILAN *
  12.225 -                                                      (1 << i)),
  12.226 -                                   MASTERCLOCK_44K, (1 << i) - 1, -1);
  12.227 -    }
  12.228 -
  12.229 -#if 1
  12.230 -    for (i = 0; i < MINTAUDIO_freqcount; i++) {
  12.231 -        DEBUG_PRINT((DEBUG_NAME "freq %d: %lu Hz, clock %lu, prediv %d\n",
  12.232 -                     i, MINTAUDIO_frequencies[i].frequency,
  12.233 -                     MINTAUDIO_frequencies[i].masterclock,
  12.234 -                     MINTAUDIO_frequencies[i].predivisor));
  12.235 -    }
  12.236 -#endif
  12.237 -
  12.238 -    MINTAUDIO_numfreq = SDL_MintAudio_SearchFrequency(this, this->spec.freq);
  12.239 -    this->spec.freq = MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency;
  12.240 -
  12.241 -    DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ",
  12.242 -                 SDL_AUDIO_BITSIZE(this->spec.format)));
  12.243 -    DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(this->spec.format)));
  12.244 -    DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(this->spec.format)));
  12.245 -    DEBUG_PRINT(("big endian=%d, ",
  12.246 -                 SDL_AUDIO_ISBIGENDIAN(this->spec.format)));
  12.247 -    DEBUG_PRINT(("channels=%d, ", this->spec.channels));
  12.248 -    DEBUG_PRINT(("freq=%d\n", this->spec.freq));
  12.249 -
  12.250 -    return 0;
  12.251 -}
  12.252 -
  12.253 -static void
  12.254 -MINTGSXB_InitAudio(_THIS)
  12.255 -{
  12.256 -    int channels_mode, prediv;
  12.257 -    void *buffer;
  12.258 -
  12.259 -    /* Stop currently playing sound */
  12.260 -    Buffoper(0);
  12.261 -
  12.262 -    /* Set replay tracks */
  12.263 -    Settracks(0, 0);
  12.264 -    Setmontracks(0);
  12.265 -
  12.266 -    /* Select replay format */
  12.267 -    switch (SDL_AUDIO_BITSIZE(this->spec.format)) {
  12.268 -    case 8:
  12.269 -        if (this->spec.channels == 2) {
  12.270 -            channels_mode = STEREO8;
  12.271 -        } else {
  12.272 -            channels_mode = MONO8;
  12.273 -        }
  12.274 -        break;
  12.275 -    case 16:
  12.276 -        if (this->spec.channels == 2) {
  12.277 -            channels_mode = STEREO16;
  12.278 -        } else {
  12.279 -            channels_mode = MONO16;
  12.280 -        }
  12.281 -        break;
  12.282 -    case 32:
  12.283 -        if (this->spec.channels == 2) {
  12.284 -            channels_mode = STEREO32;
  12.285 -        } else {
  12.286 -            channels_mode = MONO32;
  12.287 -        }
  12.288 -        break;
  12.289 -    default:
  12.290 -        channels_mode = STEREO16;
  12.291 -        break;
  12.292 -    }
  12.293 -    if (Setmode(channels_mode) < 0) {
  12.294 -        DEBUG_PRINT((DEBUG_NAME "Setmode() failed\n"));
  12.295 -    }
  12.296 -
  12.297 -    prediv = MINTAUDIO_frequencies[MINTAUDIO_numfreq].predivisor;
  12.298 -    Devconnect(DMAPLAY, DAC, CLKEXT, prediv, 1);
  12.299 -
  12.300 -    /* Set buffer */
  12.301 -    buffer = SDL_MintAudio_audiobuf[SDL_MintAudio_numbuf];
  12.302 -    if (Setbuffer(0, buffer, buffer + this->spec.size) < 0) {
  12.303 -        DEBUG_PRINT((DEBUG_NAME "Setbuffer() failed\n"));
  12.304 -    }
  12.305 -
  12.306 -    /* Install interrupt */
  12.307 -    if (NSetinterrupt(2, SI_PLAY, MINTGSXB_GsxbInterrupt) < 0) {
  12.308 -        DEBUG_PRINT((DEBUG_NAME "NSetinterrupt() failed\n"));
  12.309 -    }
  12.310 -
  12.311 -    /* Go */
  12.312 -    Buffoper(SB_PLA_ENA | SB_PLA_RPT);
  12.313 -    DEBUG_PRINT((DEBUG_NAME "hardware initialized\n"));
  12.314 -}
  12.315 -
  12.316 -static int
  12.317 -MINTGSXB_OpenDevice(_THIS, const char *devname, int iscapture)
  12.318 -{
  12.319 -    /* Lock sound system */
  12.320 -    if (Locksnd() != 1) {
  12.321 -        SDL_SetError("MINTGSXB_OpenDevice: Audio system already in use");
  12.322 -        return 0;
  12.323 -    }
  12.324 -
  12.325 -    SDL_MintAudio_device = this;
  12.326 -
  12.327 -    /* Check audio capabilities */
  12.328 -    if (MINTGSXB_CheckAudio(this) == -1) {
  12.329 -        return 0;
  12.330 -    }
  12.331 -
  12.332 -    /* Initialize all variables that we clean on shutdown */
  12.333 -    this->hidden = (struct SDL_PrivateAudioData *)
  12.334 -        SDL_malloc((sizeof *this->hidden));
  12.335 -    if (this->hidden == NULL) {
  12.336 -        SDL_OutOfMemory();
  12.337 -        return 0;
  12.338 -    }
  12.339 -    SDL_memset(this->hidden, 0, (sizeof *this->hidden));
  12.340 -
  12.341 -    SDL_CalculateAudioSpec(&this->spec);
  12.342 -
  12.343 -    /* Allocate memory for audio buffers in DMA-able RAM */
  12.344 -    DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", this->spec.size));
  12.345 -
  12.346 -    SDL_MintAudio_audiobuf[0] =
  12.347 -        Atari_SysMalloc(this->spec.size * 2, MX_STRAM);
  12.348 -    if (SDL_MintAudio_audiobuf[0] == NULL) {
  12.349 -        SDL_free(this->hidden);
  12.350 -        this->hidden = NULL;
  12.351 -        SDL_OutOfMemory();
  12.352 -        return 0;
  12.353 -    }
  12.354 -    SDL_MintAudio_audiobuf[1] = SDL_MintAudio_audiobuf[0] + this->spec.size;
  12.355 -    SDL_MintAudio_numbuf = 0;
  12.356 -    SDL_memset(SDL_MintAudio_audiobuf[0], this->spec.silence,
  12.357 -               this->spec.size * 2);
  12.358 -    SDL_MintAudio_audiosize = this->spec.size;
  12.359 -    SDL_MintAudio_mutex = 0;
  12.360 -
  12.361 -    DEBUG_PRINT((DEBUG_NAME "buffer 0 at 0x%08x\n",
  12.362 -                 SDL_MintAudio_audiobuf[0]));
  12.363 -    DEBUG_PRINT((DEBUG_NAME "buffer 1 at 0x%08x\n",
  12.364 -                 SDL_MintAudio_audiobuf[1]));
  12.365 -
  12.366 -    SDL_MintAudio_CheckFpu();
  12.367 -
  12.368 -    /* Setup audio hardware */
  12.369 -    MINTGSXB_InitAudio(this);
  12.370 -
  12.371 -    return 1;                   /* good to go. */
  12.372 -}
  12.373 -
  12.374 -static void
  12.375 -MINTGSXB_GsxbInterrupt(void)
  12.376 -{
  12.377 -    Uint8 *newbuf;
  12.378 -
  12.379 -    if (SDL_MintAudio_mutex)
  12.380 -        return;
  12.381 -
  12.382 -    SDL_MintAudio_mutex = 1;
  12.383 -
  12.384 -    SDL_MintAudio_numbuf ^= 1;
  12.385 -    SDL_MintAudio_Callback();
  12.386 -    newbuf = SDL_MintAudio_audiobuf[SDL_MintAudio_numbuf];
  12.387 -    Setbuffer(0, newbuf, newbuf + SDL_MintAudio_audiosize);
  12.388 -
  12.389 -    SDL_MintAudio_mutex = 0;
  12.390 -}
  12.391 -
  12.392 -static void
  12.393 -MINTGSXB_GsxbNullInterrupt(void)
  12.394 -{
  12.395 -}
  12.396 -
  12.397 -static int
  12.398 -MINTGSXB_Init(SDL_AudioDriverImpl * impl)
  12.399 -{
  12.400 -    /* Cookie _SND present ? if not, assume ST machine */
  12.401 -    if (Getcookie(C__SND, &cookie_snd) == C_NOTFOUND) {
  12.402 -        cookie_snd = SND_PSG;
  12.403 -    }
  12.404 -
  12.405 -    /* Check if we have 16 bits audio */
  12.406 -    if ((cookie_snd & SND_16BIT) == 0) {
  12.407 -        SDL_SetError(DEBUG_NAME "no 16-bit sound");
  12.408 -        return 0;
  12.409 -    }
  12.410 -
  12.411 -    /* Cookie GSXB present ? */
  12.412 -    cookie_gsxb = (Getcookie(C_GSXB, &cookie_gsxb) == C_FOUND);
  12.413 -
  12.414 -    /* Is it GSXB ? */
  12.415 -    if (((cookie_snd & SND_GSXB) == 0) || (cookie_gsxb == 0)) {
  12.416 -        SDL_SetError(DEBUG_NAME "no GSXB audio");
  12.417 -        return 0;
  12.418 -    }
  12.419 -
  12.420 -    /* Check if audio is lockable */
  12.421 -    if (Locksnd() != 1) {
  12.422 -        SDL_SetError(DEBUG_NAME "audio locked by other application");
  12.423 -        return 0;
  12.424 -    }
  12.425 -
  12.426 -    Unlocksnd();
  12.427 -
  12.428 -    DEBUG_PRINT((DEBUG_NAME "GSXB audio available!\n"));
  12.429 -
  12.430 -    /* Set the function pointers */
  12.431 -    impl->OpenDevice = MINTGSXB_OpenDevice;
  12.432 -    impl->CloseDevice = MINTGSXB_CloseDevice;
  12.433 -    impl->LockDevice = MINTGSXB_LockDevice;
  12.434 -    impl->UnlockDevice = MINTGSXB_UnlockDevice;
  12.435 -    impl->OnlyHasDefaultOutputDevice = 1;
  12.436 -    impl->ProvidesOwnCallbackThread = 1;
  12.437 -    impl->SkipMixerLock = 1;
  12.438 -
  12.439 -    return 2;                   /* 2 == definitely has an audio device. */
  12.440 -}
  12.441 -
  12.442 -AudioBootStrap MINTAUDIO_GSXB_bootstrap = {
  12.443 -    MINT_AUDIO_DRIVER_NAME, "MiNT GSXB audio driver", MINTGSXB_Init, 0
  12.444 -};
  12.445 -
  12.446 -/* vi: set ts=4 sw=4 expandtab: */
    13.1 --- a/src/audio/mint/SDL_mintaudio_gsxb.h	Sun Sep 20 04:13:23 2009 +0000
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,109 +0,0 @@
    13.4 -/*
    13.5 -    SDL - Simple DirectMedia Layer
    13.6 -    Copyright (C) 1997-2009 Sam Lantinga
    13.7 -
    13.8 -    This library is free software; you can redistribute it and/or
    13.9 -    modify it under the terms of the GNU Lesser General Public
   13.10 -    License as published by the Free Software Foundation; either
   13.11 -    version 2.1 of the License, or (at your option) any later version.
   13.12 -
   13.13 -    This library is distributed in the hope that it will be useful,
   13.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   13.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   13.16 -    Lesser General Public License for more details.
   13.17 -
   13.18 -    You should have received a copy of the GNU Lesser General Public
   13.19 -    License along with this library; if not, write to the Free Software
   13.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   13.21 -
   13.22 -    Sam Lantinga
   13.23 -    slouken@libsdl.org
   13.24 -*/
   13.25 -#include "SDL_config.h"
   13.26 -
   13.27 -/*
   13.28 - * GSXB audio definitions
   13.29 - * 
   13.30 - * Patrice Mandin
   13.31 - */
   13.32 -
   13.33 -#ifndef _SDL_mintaudio_gsxb_h
   13.34 -#define _SDL_mintaudio_gsxb_h
   13.35 -
   13.36 -#include <mint/falcon.h>        /* for trap_14_xxx macros */
   13.37 -
   13.38 -/* GSXB Cookie */
   13.39 -
   13.40 -#define C_GSXB		0x47535842L
   13.41 -
   13.42 -/* Bit 5 in cookie _SND */
   13.43 -
   13.44 -#define SND_GSXB	(1<<5)
   13.45 -
   13.46 -/* NSoundcmd modes */
   13.47 -
   13.48 -#define SETRATE			7       /* Set sample rate */
   13.49 -#define SET8BITFORMAT	8       /* 8 bits format */
   13.50 -#define SET16BITFORMAT	9       /* 16 bits format */
   13.51 -#define SET24BITFORMAT	10      /* 24 bits format */
   13.52 -#define SET32BITFORMAT	11      /* 32 bits format */
   13.53 -#define LTATTEN_MASTER	12      /* Attenuation */
   13.54 -#define RTATTEN_MASTER	13
   13.55 -#define LTATTEN_MICIN	14
   13.56 -#define RTATTEN_MICIN	15
   13.57 -#define LTATTEN_FMGEN	16
   13.58 -#define RTATTEN_FMGEN	17
   13.59 -#define LTATTEN_LINEIN	18
   13.60 -#define RTATTEN_LINEIN	19
   13.61 -#define LTATTEN_CDIN	20
   13.62 -#define RTATTEN_CDIN	21
   13.63 -#define LTATTEN_VIDIN	22
   13.64 -#define RTATTEN_VIDIN	23
   13.65 -#define LTATTEN_AUXIN	24
   13.66 -#define RTATTEN_AUXIN	25
   13.67 -
   13.68 -/* Setmode modes */
   13.69 -
   13.70 -#define MONO16		3
   13.71 -#define STEREO24	4
   13.72 -#define STEREO32	5
   13.73 -#define MONO24		6
   13.74 -#define MONO32		7
   13.75 -
   13.76 -/* Sndstatus modes */
   13.77 -
   13.78 -#define SND_QUERYFORMATS	2
   13.79 -#define SND_QUERYMIXERS		3
   13.80 -#define SND_QUERYSOURCES	4
   13.81 -#define SND_QUERYDUPLEX		5
   13.82 -#define SND_QUERY8BIT		8
   13.83 -#define SND_QUERY16BIT		9
   13.84 -#define SND_QUERY24BIT		10
   13.85 -#define SND_QUERY32BIT		11
   13.86 -
   13.87 -#define SND_FORMAT8		(1<<0)
   13.88 -#define SND_FORMAT16	(1<<1)
   13.89 -#define SND_FORMAT24	(1<<2)
   13.90 -#define SND_FORMAT32	(1<<3)
   13.91 -
   13.92 -#define SND_FORMATSIGNED		(1<<0)
   13.93 -#define SND_FORMATUNSIGNED		(1<<1)
   13.94 -#define SND_FORMATBIGENDIAN		(1<<2)
   13.95 -#define SND_FORMATLITTLEENDIAN	(1<<3)
   13.96 -
   13.97 -/* Devconnect prescalers */
   13.98 -
   13.99 -#define CLK_44K		1
  13.100 -#define CLK_22K		3
  13.101 -#define CLK_11K		7
  13.102 -
  13.103 -/* Extra xbios functions */
  13.104 -
  13.105 -#define NSoundcmd(mode,data,data2)	\
  13.106 -	(long)trap_14_wwl((short)130,(short)(mode),(short)(data),(long)(data2))
  13.107 -#define NSetinterrupt(src_inter,cause,inth_addr)	\
  13.108 -	(long)trap_14_wwwl((short)135,(short)(src_inter),(short)(cause),	\
  13.109 -		(long)(inth_addr))
  13.110 -
  13.111 -#endif /* _SDL_mintaudio_gsxb_h */
  13.112 -/* vi: set ts=4 sw=4 expandtab: */
    14.1 --- a/src/audio/mint/SDL_mintaudio_it.S	Sun Sep 20 04:13:23 2009 +0000
    14.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.3 @@ -1,281 +0,0 @@
    14.4 -/*
    14.5 -    SDL - Simple DirectMedia Layer
    14.6 -    Copyright (C) 1997-2009 Sam Lantinga
    14.7 -
    14.8 -    This library is free software; you can redistribute it and/or
    14.9 -    modify it under the terms of the GNU Library General Public
   14.10 -    License as published by the Free Software Foundation; either
   14.11 -    version 2 of the License, or (at your option) any later version.
   14.12 -
   14.13 -    This library is distributed in the hope that it will be useful,
   14.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   14.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   14.16 -    Library General Public License for more details.
   14.17 -
   14.18 -    You should have received a copy of the GNU Library General Public
   14.19 -    License along with this library; if not, write to the Free
   14.20 -    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   14.21 -
   14.22 -    Sam Lantinga
   14.23 -    slouken@libsdl.org
   14.24 -*/
   14.25 -
   14.26 -/*
   14.27 -	Audio interrupts
   14.28 -
   14.29 -	Patrice Mandin, Didier Méquignon
   14.30 - */
   14.31 -
   14.32 -	.text
   14.33 -
   14.34 -	.globl	_SDL_MintAudio_Callback
   14.35 -
   14.36 -	.globl	_SDL_MintAudio_XbiosInterrupt
   14.37 -	.globl	_SDL_MintAudio_XbiosInterruptMeasureClock
   14.38 -	.globl	_SDL_MintAudio_Dma8Interrupt
   14.39 -	.globl	_SDL_MintAudio_StfaInterrupt
   14.40 -
   14.41 -	.globl	_SDL_MintAudio_mutex
   14.42 -	.globl	_SDL_MintAudio_audiobuf
   14.43 -	.globl	_SDL_MintAudio_numbuf
   14.44 -	.globl	_SDL_MintAudio_audiosize
   14.45 -	.globl	_SDL_MintAudio_clocktics
   14.46 -	.globl	_SDL_MintAudio_hasfpu
   14.47 -
   14.48 -	.globl	_SDL_MintAudio_stfa
   14.49 -
   14.50 -/*
   14.51 -	How it works:
   14.52 -	- Audio is playing buffer #0 (resp. #1)
   14.53 -	- We must calculate a sample in buffer #1 (resp. #0)
   14.54 -	  so we first call the callback to do it
   14.55 -	- Then we swap the buffers
   14.56 -*/
   14.57 -
   14.58 -#define	savptr	0x4a2
   14.59 -#define	savamt	0x46
   14.60 -
   14.61 -/*--- Xbios interrupt vector to measure Falcon external clock ---*/
   14.62 -
   14.63 -_SDL_MintAudio_XbiosInterruptMeasureClock:          /* 1 mS */
   14.64 -
   14.65 -	btst	#0,0xFFFF8901:w	/* state DMA sound */
   14.66 -	beqs	SDL_MintAudio_EndIntMeasure
   14.67 -	addql	#1,_SDL_MintAudio_clocktics
   14.68 -SDL_MintAudio_EndIntMeasure:
   14.69 -	bclr	#5,0xFFFFFA0F:w	/* Clear service bit */
   14.70 -	rte
   14.71 -
   14.72 -/*--- Xbios interrupt vector ---*/
   14.73 -
   14.74 -_SDL_MintAudio_XbiosInterrupt:
   14.75 -
   14.76 -	/* Reenable interrupts, so other interrupts can work */
   14.77 -	movew	#0x2300,sr
   14.78 -
   14.79 -	/* Clear service bit, so other MFP interrupts can work */
   14.80 -	bclr	#5,0xfffffa0f:w
   14.81 -
   14.82 -	/* Check if we are not already running */
   14.83 -	tstw	_SDL_MintAudio_mutex
   14.84 -	bne	SDL_MintAudio_XbiosEnd
   14.85 -	notw	_SDL_MintAudio_mutex
   14.86 -	
   14.87 -	/* Swap buffers */
   14.88 -	eorw	#1,_SDL_MintAudio_numbuf
   14.89 -
   14.90 -	moveml	d0-d7/a0-a6,sp@-
   14.91 -
   14.92 -	/* Save FPU if needed */
   14.93 -	tstw	_SDL_MintAudio_hasfpu
   14.94 -	beqs	SDL_MintAudio_Xbios_nofpu1
   14.95 -	.chip	68060
   14.96 -	fsave	sp@-
   14.97 -	fmoveml fpcr/fpsr/fpiar,sp@-
   14.98 -	fmovemx	fp0-fp7,sp@-
   14.99 -	.chip	68000
  14.100 -SDL_MintAudio_Xbios_nofpu1:
  14.101 -
  14.102 -	/* Callback */
  14.103 -	jsr	_SDL_MintAudio_Callback
  14.104 -
  14.105 -	/* Restore FPU if needed */
  14.106 -	tstw	_SDL_MintAudio_hasfpu
  14.107 -	beqs	SDL_MintAudio_Xbios_nofpu2
  14.108 -	.chip	68060
  14.109 -	fmovemx	sp@+,fp0-fp7
  14.110 -	fmoveml	sp@+,fpcr/fpsr/fpiar
  14.111 -	frestore	sp@+
  14.112 -	.chip	68000
  14.113 -SDL_MintAudio_Xbios_nofpu2:
  14.114 -
  14.115 -	/* Reserve space for registers */
  14.116 -	subl	#savamt,savptr
  14.117 -
  14.118 -	/* Set new buffer */
  14.119 -
  14.120 -	moveq	#0,d0
  14.121 -	movel	_SDL_MintAudio_audiosize,d1
  14.122 -
  14.123 -	movew	_SDL_MintAudio_numbuf,d0
  14.124 -	lsll	#2,d0
  14.125 -	lea	_SDL_MintAudio_audiobuf,a0
  14.126 -	movel	a0@(d0:l),a1
  14.127 -
  14.128 -	lea	a1@(d1:l),a2
  14.129 -
  14.130 -	movel	a2,sp@-
  14.131 -	movel	a1,sp@-
  14.132 -	clrw	sp@-
  14.133 -	movew	#131,sp@-
  14.134 -	trap	#14
  14.135 -	lea	sp@(12),sp
  14.136 -
  14.137 -	/* Restore registers space */
  14.138 -	addl	#savamt,savptr
  14.139 -
  14.140 -	moveml	sp@+,d0-d7/a0-a6
  14.141 -
  14.142 -	clrw	_SDL_MintAudio_mutex
  14.143 -SDL_MintAudio_XbiosEnd:
  14.144 -	rte
  14.145 -
  14.146 -/*--- DMA 8 bits interrupt vector ---*/
  14.147 -
  14.148 -_SDL_MintAudio_Dma8Interrupt:
  14.149 -
  14.150 -	/* Reenable interrupts, so other interrupts can work */
  14.151 -	movew	#0x2300,sr
  14.152 -
  14.153 -	/* Clear service bit, so other MFP interrupts can work */
  14.154 -	bclr	#5,0xfffffa0f:w
  14.155 -
  14.156 -	/* Check if we are not already running */
  14.157 -	tstw	_SDL_MintAudio_mutex
  14.158 -	bne	SDL_MintAudio_Dma8End
  14.159 -	notw	_SDL_MintAudio_mutex
  14.160 -	
  14.161 -	/* Swap buffers */
  14.162 -	eorw	#1,_SDL_MintAudio_numbuf
  14.163 -
  14.164 -	moveml	d0-d1/a0-a1,sp@-
  14.165 -
  14.166 -	/* Save FPU if needed */
  14.167 -	tstw	_SDL_MintAudio_hasfpu
  14.168 -	beqs	SDL_MintAudio_Dma8_nofpu1
  14.169 -	.chip	68060
  14.170 -	fsave	sp@-
  14.171 -	fmoveml fpcr/fpsr/fpiar,sp@-
  14.172 -	fmovemx	fp0-fp7,sp@-
  14.173 -	.chip	68000
  14.174 -SDL_MintAudio_Dma8_nofpu1:
  14.175 -
  14.176 -	/* Callback */
  14.177 -	jsr	_SDL_MintAudio_Callback
  14.178 -
  14.179 -	/* Restore FPU if needed */
  14.180 -	tstw	_SDL_MintAudio_hasfpu
  14.181 -	beqs	SDL_MintAudio_Dma8_nofpu2
  14.182 -	.chip	68060
  14.183 -	fmovemx	sp@+,fp0-fp7
  14.184 -	fmoveml	sp@+,fpcr/fpsr/fpiar
  14.185 -	frestore	sp@+
  14.186 -	.chip	68000
  14.187 -SDL_MintAudio_Dma8_nofpu2:
  14.188 -
  14.189 -	/* Set new buffer */
  14.190 -
  14.191 -	moveq	#0,d0
  14.192 -
  14.193 -	movew	_SDL_MintAudio_numbuf,d0
  14.194 -	lslw	#2,d0
  14.195 -	lea	_SDL_MintAudio_audiobuf,a0
  14.196 -	movel	a0@(d0:w),d1
  14.197 -
  14.198 -	/* Modify DMA addresses */
  14.199 -	lea	0xffff8900:w,a0
  14.200 -
  14.201 -	moveb	d1,a0@(0x07)	/* Start address */
  14.202 -	rorl	#8,d1
  14.203 -	moveb	d1,a0@(0x05)
  14.204 -	rorl	#8,d1
  14.205 -	moveb	d1,a0@(0x03)
  14.206 -	swap	d1
  14.207 -
  14.208 -	addl	_SDL_MintAudio_audiosize,d1
  14.209 -
  14.210 -	moveb	d1,a0@(0x13)	/* End address */
  14.211 -	rorl	#8,d1
  14.212 -	moveb	d1,a0@(0x11)
  14.213 -	rorl	#8,d1
  14.214 -	moveb	d1,a0@(0x0f)
  14.215 -
  14.216 -	moveml	sp@+,d0-d1/a0-a1
  14.217 -
  14.218 -	clrw	_SDL_MintAudio_mutex
  14.219 -SDL_MintAudio_Dma8End:
  14.220 -	rte
  14.221 -
  14.222 -/*--- STFA interrupt vector ---*/
  14.223 -
  14.224 -STFA_SOUND_START	=	6
  14.225 -STFA_SOUND_END		=	STFA_SOUND_START+8
  14.226 -
  14.227 -_SDL_MintAudio_StfaInterrupt:
  14.228 -
  14.229 -	/* Reenable interrupts, so other interrupts can work */
  14.230 -	movew	#0x2300,sr
  14.231 -
  14.232 -	/* Check if we are not already running */
  14.233 -	tstw	_SDL_MintAudio_mutex
  14.234 -	bnes	SDL_MintAudio_StfaEnd
  14.235 -	notw	_SDL_MintAudio_mutex
  14.236 -	
  14.237 -	/* Swap buffers */
  14.238 -	eorw	#1,_SDL_MintAudio_numbuf
  14.239 -
  14.240 -	moveml	d0-d7/a0-a6,sp@-
  14.241 -
  14.242 -	/* Save FPU if needed */
  14.243 -	tstw	_SDL_MintAudio_hasfpu
  14.244 -	beqs	SDL_MintAudio_Stfa_nofpu1
  14.245 -	.chip	68060
  14.246 -	fsave	sp@-
  14.247 -	fmoveml fpcr/fpsr/fpiar,sp@-
  14.248 -	fmovemx	fp0-fp7,sp@-
  14.249 -	.chip	68000
  14.250 -SDL_MintAudio_Stfa_nofpu1:
  14.251 -
  14.252 -	/* Callback */
  14.253 -	jsr	_SDL_MintAudio_Callback
  14.254 -
  14.255 -	/* Restore FPU if needed */
  14.256 -	tstw	_SDL_MintAudio_hasfpu
  14.257 -	beqs	SDL_MintAudio_Stfa_nofpu2
  14.258 -	.chip	68060
  14.259 -	fmovemx	sp@+,fp0-fp7
  14.260 -	fmoveml	sp@+,fpcr/fpsr/fpiar
  14.261 -	frestore	sp@+
  14.262 -	.chip	68000
  14.263 -SDL_MintAudio_Stfa_nofpu2:
  14.264 -
  14.265 -	/* Set new buffer */
  14.266 -
  14.267 -	moveq	#0,d0
  14.268 -	movel	_SDL_MintAudio_stfa,a1
  14.269 -
  14.270 -	movew	_SDL_MintAudio_numbuf,d0
  14.271 -	lslw	#2,d0
  14.272 -	lea	_SDL_MintAudio_audiobuf,a0
  14.273 -	movel	a0@(d0:w),d1
  14.274 -
  14.275 -	/* Modify STFA replay buffers */
  14.276 -	movel	d1,a1@(STFA_SOUND_START)
  14.277 -	addl	_SDL_MintAudio_audiosize,d1
  14.278 -	movel	d1,a1@(STFA_SOUND_END)
  14.279 -
  14.280 -	moveml	sp@+,d0-d7/a0-a6
  14.281 -
  14.282 -	clrw	_SDL_MintAudio_mutex
  14.283 -SDL_MintAudio_StfaEnd:
  14.284 -	rte
    15.1 --- a/src/audio/mint/SDL_mintaudio_mcsn.c	Sun Sep 20 04:13:23 2009 +0000
    15.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.3 @@ -1,400 +0,0 @@
    15.4 -/*
    15.5 -    SDL - Simple DirectMedia Layer
    15.6 -    Copyright (C) 1997-2009 Sam Lantinga
    15.7 -
    15.8 -    This library is free software; you can redistribute it and/or
    15.9 -    modify it under the terms of the GNU Library General Public
   15.10 -    License as published by the Free Software Foundation; either
   15.11 -    version 2 of the License, or (at your option) any later version.
   15.12 -
   15.13 -    This library is distributed in the hope that it will be useful,
   15.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   15.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   15.16 -    Library General Public License for more details.
   15.17 -
   15.18 -    You should have received a copy of the GNU Library General Public
   15.19 -    License along with this library; if not, write to the Free
   15.20 -    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   15.21 -
   15.22 -    Sam Lantinga
   15.23 -    slouken@libsdl.org
   15.24 -*/
   15.25 -#include "SDL_config.h"
   15.26 -
   15.27 -/*
   15.28 -	MiNT audio driver
   15.29 -	using XBIOS functions (MacSound compatible driver)
   15.30 -
   15.31 -	Patrice Mandin
   15.32 -*/
   15.33 -
   15.34 -#include <support.h>
   15.35 -
   15.36 -/* Mint includes */
   15.37 -#include <mint/osbind.h>
   15.38 -#include <mint/falcon.h>
   15.39 -#include <mint/cookie.h>
   15.40 -
   15.41 -#include "SDL_audio.h"
   15.42 -#include "../SDL_audio_c.h"
   15.43 -#include "../SDL_sysaudio.h"
   15.44 -
   15.45 -#include "../../video/ataricommon/SDL_atarimxalloc_c.h"
   15.46 -
   15.47 -#include "SDL_mintaudio.h"
   15.48 -#include "SDL_mintaudio_mcsn.h"
   15.49 -
   15.50 -/*--- Defines ---*/
   15.51 -
   15.52 -#define MINT_AUDIO_DRIVER_NAME "mint_mcsn"
   15.53 -
   15.54 -/* Debug print info */
   15.55 -#define DEBUG_NAME "audio:mcsn: "
   15.56 -#if 0
   15.57 -#define DEBUG_PRINT(what) \
   15.58 -	{ \
   15.59 -		printf what; \
   15.60 -	}
   15.61 -#else
   15.62 -#define DEBUG_PRINT(what)
   15.63 -#endif
   15.64 -
   15.65 -/*--- Static variables ---*/
   15.66 -
   15.67 -static unsigned long cookie_snd = 0;
   15.68 -static unsigned long cookie_mch = 0;
   15.69 -static cookie_mcsn_t *cookie_mcsn = NULL;
   15.70 -
   15.71 -static void
   15.72 -MINTMCSN_LockDevice(_THIS)
   15.73 -{
   15.74 -    /* Stop replay */
   15.75 -    Buffoper(0);
   15.76 -}
   15.77 -
   15.78 -static void
   15.79 -MINTMCSN_UnlockDevice(_THIS)
   15.80 -{
   15.81 -    /* Restart replay */
   15.82 -    Buffoper(SB_PLA_ENA | SB_PLA_RPT);
   15.83 -}
   15.84 -
   15.85 -static void
   15.86 -MINTMCSN_CloseDevice(_THIS)
   15.87 -{
   15.88 -    if (this->hidden != NULL) {
   15.89 -        /* Stop replay */
   15.90 -        SDL_MintAudio_WaitThread();
   15.91 -        Buffoper(0);
   15.92 -
   15.93 -        if (!SDL_MintAudio_mint_present) {
   15.94 -            /* Uninstall interrupt */
   15.95 -            Jdisint(MFP_DMASOUND);
   15.96 -        }
   15.97 -
   15.98 -        /* Wait if currently playing sound */
   15.99 -        while (SDL_MintAudio_mutex != 0) {
  15.100 -        }
  15.101 -
  15.102 -        /* Clear buffers */
  15.103 -        if (SDL_MintAudio_audiobuf[0]) {
  15.104 -            Mfree(SDL_MintAudio_audiobuf[0]);
  15.105 -            SDL_MintAudio_audiobuf[0] = SDL_MintAudio_audiobuf[1] = NULL;
  15.106 -        }
  15.107 -
  15.108 -        /* Unlock sound system */
  15.109 -        Unlocksnd();
  15.110 -
  15.111 -        SDL_free(this->hidden);
  15.112 -        this->hidden = NULL;
  15.113 -    }
  15.114 -}
  15.115 -
  15.116 -static int
  15.117 -MINTMCSN_CheckAudio(_THIS)
  15.118 -{
  15.119 -    int i;
  15.120 -    unsigned long masterclock, masterprediv;
  15.121 -
  15.122 -    DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ",
  15.123 -                 SDL_AUDIO_BITSIZE(this->spec.format)));
  15.124 -    DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(this->spec.format)));
  15.125 -    DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(this->spec.format)));
  15.126 -    DEBUG_PRINT(("big endian=%d, ",
  15.127 -                 SDL_AUDIO_ISBIGENDIAN(this->spec.format)));
  15.128 -    DEBUG_PRINT(("channels=%d, ", this->spec.channels));
  15.129 -    DEBUG_PRINT(("freq=%d\n", this->spec.freq));
  15.130 -
  15.131 -    if (this->spec.channels > 2) {
  15.132 -        this->spec.channels = 2;        /* no more than stereo! */
  15.133 -    }
  15.134 -
  15.135 -    /* Check formats available */
  15.136 -    MINTAUDIO_freqcount = 0;
  15.137 -    switch (cookie_mcsn->play) {
  15.138 -    case MCSN_ST:
  15.139 -        this->spec.channels = 1;
  15.140 -        this->spec.format = AUDIO_S8;   /* FIXME: is it signed or unsigned ? */
  15.141 -        SDL_MintAudio_AddFrequency(this, 12500, 0, 0, -1);
  15.142 -        break;
  15.143 -    case MCSN_TT:              /* Also STE, Mega STE */
  15.144 -        this->spec.format = AUDIO_S8;
  15.145 -        masterclock = MASTERCLOCK_STE;
  15.146 -        masterprediv = MASTERPREDIV_STE;
  15.147 -        if ((cookie_mch >> 16) == MCH_TT) {
  15.148 -            masterclock = MASTERCLOCK_TT;
  15.149 -            masterprediv = MASTERPREDIV_TT;
  15.150 -        }
  15.151 -        for (i = 0; i < 4; i++) {
  15.152 -            SDL_MintAudio_AddFrequency(this,
  15.153 -                                       masterclock / (masterprediv *
  15.154 -                                                      (1 << i)),
  15.155 -                                       masterclock, 3 - i, -1);
  15.156 -        }
  15.157 -        break;
  15.158 -    case MCSN_FALCON:          /* Also Mac */
  15.159 -        for (i = 1; i < 12; i++) {
  15.160 -            /* Remove unusable Falcon codec predivisors */
  15.161 -            if ((i == 6) || (i == 8) || (i == 10)) {
  15.162 -                continue;
  15.163 -            }
  15.164 -            SDL_MintAudio_AddFrequency(this,
  15.165 -                                       MASTERCLOCK_FALCON1 /
  15.166 -                                       (MASTERPREDIV_FALCON * (i + 1)),
  15.167 -                                       CLK25M, i + 1, -1);
  15.168 -        }
  15.169 -        if (cookie_mcsn->res1 != 0) {
  15.170 -            for (i = 1; i < 4; i++) {
  15.171 -                SDL_MintAudio_AddFrequency(this,
  15.172 -                                           (cookie_mcsn->res1) /
  15.173 -                                           (MASTERPREDIV_FALCON *
  15.174 -                                            (1 << i)), CLKEXT,
  15.175 -                                           (1 << i) - 1, -1);
  15.176 -            }
  15.177 -        }
  15.178 -        this->spec.format |= SDL_AUDIO_MASK_SIGNED;     /* Audio is always signed */
  15.179 -        if ((SDL_AUDIO_BITSIZE(this->spec.format)) == 16) {
  15.180 -            this->spec.format |= SDL_AUDIO_MASK_ENDIAN; /* Audio is always big endian */
  15.181 -            this->spec.channels = 2;    /* 16 bits always stereo */
  15.182 -        }
  15.183 -        break;
  15.184 -    }
  15.185 -
  15.186 -#if 1
  15.187 -    for (i = 0; i < MINTAUDIO_freqcount; i++) {
  15.188 -        DEBUG_PRINT((DEBUG_NAME "freq %d: %lu Hz, clock %lu, prediv %d\n",
  15.189 -                     i, MINTAUDIO_frequencies[i].frequency,
  15.190 -                     MINTAUDIO_frequencies[i].masterclock,
  15.191 -                     MINTAUDIO_frequencies[i].predivisor));
  15.192 -    }
  15.193 -#endif
  15.194 -
  15.195 -    MINTAUDIO_numfreq = SDL_MintAudio_SearchFrequency(this, this->spec.freq);
  15.196 -    this->spec.freq = MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency;
  15.197 -
  15.198 -    DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ",
  15.199 -                 SDL_AUDIO_BITSIZE(this->spec.format)));
  15.200 -    DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(this->spec.format)));
  15.201 -    DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(this->spec.format)));
  15.202 -    DEBUG_PRINT(("big endian=%d, ",
  15.203 -                 SDL_AUDIO_ISBIGENDIAN(this->spec.format)));
  15.204 -    DEBUG_PRINT(("channels=%d, ", this->spec.channels));
  15.205 -    DEBUG_PRINT(("freq=%d\n", this->spec.freq));
  15.206 -
  15.207 -    return 0;
  15.208 -}
  15.209 -
  15.210 -static void
  15.211 -MINTMCSN_InitAudio(_THIS)
  15.212 -{
  15.213 -    int channels_mode, prediv, dmaclock;
  15.214 -    void *buffer;
  15.215 -
  15.216 -    /* Stop currently playing sound */
  15.217 -    SDL_MintAudio_quit_thread = SDL_FALSE;
  15.218 -    SDL_MintAudio_thread_finished = SDL_TRUE;
  15.219 -    SDL_MintAudio_WaitThread();
  15.220 -    Buffoper(0);
  15.221 -
  15.222 -    /* Set replay tracks */
  15.223 -    Settracks(0, 0);
  15.224 -    Setmontracks(0);
  15.225 -
  15.226 -    /* Select replay format */
  15.227 -    channels_mode = STEREO16;
  15.228 -    switch (SDL_AUDIO_BITSIZE(this->spec.format)) {
  15.229 -    case 8:
  15.230 -        if (this->spec.channels == 2) {
  15.231 -            channels_mode = STEREO8;
  15.232 -        } else {
  15.233 -            channels_mode = MONO8;
  15.234 -        }
  15.235 -        break;
  15.236 -    }
  15.237 -    if (Setmode(channels_mode) < 0) {
  15.238 -        DEBUG_PRINT((DEBUG_NAME "Setmode() failed\n"));
  15.239 -    }
  15.240 -
  15.241 -    dmaclock = MINTAUDIO_frequencies[MINTAUDIO_numfreq].masterclock;
  15.242 -    prediv = MINTAUDIO_frequencies[MINTAUDIO_numfreq].predivisor;
  15.243 -    switch (cookie_mcsn->play) {
  15.244 -    case MCSN_TT:
  15.245 -        Devconnect(DMAPLAY, DAC, CLK25M, CLKOLD, 1);
  15.246 -        Soundcmd(SETPRESCALE, prediv);
  15.247 -        DEBUG_PRINT((DEBUG_NAME "STE/TT prescaler selected\n"));
  15.248 -        break;
  15.249 -    case MCSN_FALCON:
  15.250 -        Devconnect(DMAPLAY, DAC, dmaclock, prediv, 1);
  15.251 -        DEBUG_PRINT((DEBUG_NAME "Falcon prescaler selected\n"));
  15.252 -        break;
  15.253 -    }
  15.254 -
  15.255 -    /* Set buffer */
  15.256 -    buffer = SDL_MintAudio_audiobuf[SDL_MintAudio_numbuf];
  15.257 -    if (Setbuffer(0, buffer, buffer + this->spec.size) < 0) {
  15.258 -        DEBUG_PRINT((DEBUG_NAME "Setbuffer() failed\n"));
  15.259 -    }
  15.260 -
  15.261 -    if (SDL_MintAudio_mint_present) {
  15.262 -        SDL_MintAudio_thread_pid = tfork(SDL_MintAudio_Thread, 0);
  15.263 -    } else {
  15.264 -        /* Install interrupt */
  15.265 -        Jdisint(MFP_DMASOUND);
  15.266 -        Xbtimer(XB_TIMERA, 8, 1, SDL_MintAudio_XbiosInterrupt);
  15.267 -        Jenabint(MFP_DMASOUND);
  15.268 -
  15.269 -        if (Setinterrupt(SI_TIMERA, SI_PLAY) < 0) {
  15.270 -            DEBUG_PRINT((DEBUG_NAME "Setinterrupt() failed\n"));
  15.271 -        }
  15.272 -    }
  15.273 -
  15.274 -    /* Go */
  15.275 -    Buffoper(SB_PLA_ENA | SB_PLA_RPT);
  15.276 -    DEBUG_PRINT((DEBUG_NAME "hardware initialized\n"));
  15.277 -}
  15.278 -
  15.279 -static int
  15.280 -MINTMCSN_OpenDevice(_THIS, const char *devname, int iscapture)
  15.281 -{
  15.282 -    /* Lock sound system */
  15.283 -    if (Locksnd() != 1) {
  15.284 -        SDL_SetError("MINTMCSN_OpenDevice: Audio system already in use");
  15.285 -        return 0;
  15.286 -    }
  15.287 -
  15.288 -    SDL_MintAudio_device = this;
  15.289 -
  15.290 -    /* Check audio capabilities */
  15.291 -    if (MINTMCSN_CheckAudio(this) == -1) {
  15.292 -        return 0;
  15.293 -    }
  15.294 -
  15.295 -    /* Initialize all variables that we clean on shutdown */
  15.296 -    this->hidden = (struct SDL_PrivateAudioData *)
  15.297 -        SDL_malloc((sizeof *this->hidden));
  15.298 -    if (this->hidden == NULL) {
  15.299 -        SDL_OutOfMemory();
  15.300 -        return 0;
  15.301 -    }
  15.302 -    SDL_memset(this->hidden, 0, (sizeof *this->hidden));
  15.303 -
  15.304 -    SDL_CalculateAudioSpec(&this->spec);
  15.305 -
  15.306 -    /* Allocate memory for audio buffers in DMA-able RAM */
  15.307 -    DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", this->spec.size));
  15.308 -
  15.309 -    SDL_MintAudio_audiobuf[0] =
  15.310 -        Atari_SysMalloc(this->spec.size * 2, MX_STRAM);
  15.311 -    if (SDL_MintAudio_audiobuf[0] == NULL) {
  15.312 -        SDL_free(this->hidden);
  15.313 -        this->hidden = NULL;
  15.314 -        SDL_OutOfMemory();
  15.315 -        return 0;
  15.316 -    }
  15.317 -    SDL_MintAudio_audiobuf[1] = SDL_MintAudio_audiobuf[0] + this->spec.size;
  15.318 -    SDL_MintAudio_numbuf = 0;
  15.319 -    SDL_memset(SDL_MintAudio_audiobuf[0], this->spec.silence,
  15.320 -               this->spec.size * 2);
  15.321 -    SDL_MintAudio_audiosize = this->spec.size;
  15.322 -    SDL_MintAudio_mutex = 0;
  15.323 -
  15.324 -    DEBUG_PRINT((DEBUG_NAME "buffer 0 at 0x%08x\n",
  15.325 -                 SDL_MintAudio_audiobuf[0]));
  15.326 -    DEBUG_PRINT((DEBUG_NAME "buffer 1 at 0x%08x\n",
  15.327 -                 SDL_MintAudio_audiobuf[1]));
  15.328 -
  15.329 -    SDL_MintAudio_CheckFpu();
  15.330 -
  15.331 -    /* Setup audio hardware */
  15.332 -    MINTMCSN_InitAudio(this);
  15.333 -
  15.334 -    return 1;                   /* good to go. */
  15.335 -}
  15.336 -
  15.337 -static int
  15.338 -MINTMCSN_Init(SDL_AudioDriverImpl * impl)
  15.339 -{
  15.340 -    unsigned long dummy = 0;
  15.341 -
  15.342 -    SDL_MintAudio_mint_present = (Getcookie(C_MiNT, &dummy) == C_FOUND);
  15.343 -
  15.344 -    /* We can't use XBIOS in interrupt with Magic, don't know about thread */
  15.345 -    if (Getcookie(C_MagX, &dummy) == C_FOUND) {
  15.346 -        return 0;
  15.347 -    }
  15.348 -
  15.349 -    /* Cookie _MCH present ? if not, assume ST machine */
  15.350 -    if (Getcookie(C__MCH, &cookie_mch) == C_NOTFOUND) {
  15.351 -        cookie_mch = MCH_ST;
  15.352 -    }
  15.353 -
  15.354 -    /* Cookie _SND present ? if not, assume ST machine */
  15.355 -    if (Getcookie(C__SND, &cookie_snd) == C_NOTFOUND) {
  15.356 -        cookie_snd = SND_PSG;
  15.357 -    }
  15.358 -
  15.359 -    /* Check if we have 16 bits audio */
  15.360 -    if ((cookie_snd & SND_16BIT) == 0) {
  15.361 -        SDL_SetError(DEBUG_NAME "no 16-bit sound");
  15.362 -        return 0;
  15.363 -    }
  15.364 -
  15.365 -    /* Cookie MCSN present ? */
  15.366 -    if (Getcookie(C_McSn, (long *) &cookie_mcsn) != C_FOUND) {
  15.367 -        SDL_SetError(DEBUG_NAME "no MCSN audio");
  15.368 -        return 0;
  15.369 -    }
  15.370 -
  15.371 -    /* Check if interrupt at end of replay */
  15.372 -    if (cookie_mcsn->pint == 0) {
  15.373 -        SDL_SetError(DEBUG_NAME "no interrupt at end of replay");
  15.374 -        return 0;
  15.375 -    }
  15.376 -
  15.377 -    /* Check if audio is lockable */
  15.378 -    if (Locksnd() != 1) {
  15.379 -        SDL_SetError(DEBUG_NAME "audio locked by other application");
  15.380 -        return 0;
  15.381 -    }
  15.382 -
  15.383 -    Unlocksnd();
  15.384 -
  15.385 -    DEBUG_PRINT((DEBUG_NAME "MCSN audio available!\n"));
  15.386 -
  15.387 -    /* Set the function pointers */
  15.388 -    impl->OpenDevice = MINTMCSN_OpenDevice;
  15.389 -    impl->CloseDevice = MINTMCSN_CloseDevice;
  15.390 -    impl->LockDevice = MINTMCSN_LockDevice;
  15.391 -    impl->UnlockDevice = MINTMCSN_UnlockDevice;
  15.392 -    impl->OnlyHasDefaultOutputDevice = 1;
  15.393 -    impl->ProvidesOwnCallbackThread = 1;
  15.394 -    impl->SkipMixerLock = 1;
  15.395 -
  15.396 -    return 2;                   /* 2 == definitely has an audio device. */
  15.397 -}
  15.398 -
  15.399 -AudioBootStrap MINTAUDIO_MCSN_bootstrap = {
  15.400 -    MINT_AUDIO_DRIVER_NAME, "MiNT MCSN audio driver", MINTMCSN_Init, 0
  15.401 -};
  15.402 -
  15.403 -/* vi: set ts=4 sw=4 expandtab: */
    16.1 --- a/src/audio/mint/SDL_mintaudio_mcsn.h	Sun Sep 20 04:13:23 2009 +0000
    16.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.3 @@ -1,62 +0,0 @@
    16.4 -/*
    16.5 -    SDL - Simple DirectMedia Layer
    16.6 -    Copyright (C) 1997-2009 Sam Lantinga
    16.7 -
    16.8 -    This library is free software; you can redistribute it and/or
    16.9 -    modify it under the terms of the GNU Library General Public
   16.10 -    License as published by the Free Software Foundation; either
   16.11 -    version 2 of the License, or (at your option) any later version.
   16.12 -
   16.13 -    This library is distributed in the hope that it will be useful,
   16.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   16.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   16.16 -    Library General Public License for more details.
   16.17 -
   16.18 -    You should have received a copy of the GNU Library General Public
   16.19 -    License along with this library; if not, write to the Free
   16.20 -    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   16.21 -
   16.22 -    Sam Lantinga
   16.23 -    slouken@libsdl.org
   16.24 -*/
   16.25 -#include "SDL_config.h"
   16.26 -
   16.27 -/*
   16.28 -	MCSN control structure
   16.29 -
   16.30 -	Patrice Mandin
   16.31 -*/
   16.32 -
   16.33 -#ifndef _SDL_mintaudio_mcsh_h
   16.34 -#define _SDL_mintaudio_mcsh_h
   16.35 -
   16.36 -typedef struct
   16.37 -{
   16.38 -    unsigned short version;     /* Version */
   16.39 -    unsigned short size;        /* Size of structure */
   16.40 -
   16.41 -    unsigned short play;        /* Replay capability */
   16.42 -    unsigned short record;      /* Record capability */
   16.43 -    unsigned short dsp;         /* DSP56K present */
   16.44 -    unsigned short pint;        /* Interrupt at end of replay */
   16.45 -    unsigned short rint;        /* Interrupt at end of record */
   16.46 -
   16.47 -    unsigned long res1;         /* Frequency of external clock */
   16.48 -    unsigned long res2;
   16.49 -    unsigned long res3;
   16.50 -    unsigned long res4;
   16.51 -} cookie_mcsn_t __attribute__ ((packed));
   16.52 -
   16.53 -enum
   16.54 -{
   16.55 -    MCSN_ST = 0,
   16.56 -    MCSN_TT,
   16.57 -    MCSN_STE = MCSN_TT,
   16.58 -    MCSN_FALCON,
   16.59 -    MCSN_MAC = MCSN_FALCON
   16.60 -};
   16.61 -
   16.62 -#define SETSMPFREQ	7       /* Set sample frequency */
   16.63 -
   16.64 -#endif /* _SDL_mintaudio_mcsh_h */
   16.65 -/* vi: set ts=4 sw=4 expandtab: */
    17.1 --- a/src/audio/mint/SDL_mintaudio_stfa.c	Sun Sep 20 04:13:23 2009 +0000
    17.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.3 @@ -1,307 +0,0 @@
    17.4 -/*
    17.5 -    SDL - Simple DirectMedia Layer
    17.6 -    Copyright (C) 1997-2009 Sam Lantinga
    17.7 -
    17.8 -    This library is free software; you can redistribute it and/or
    17.9 -    modify it under the terms of the GNU Library General Public
   17.10 -    License as published by the Free Software Foundation; either
   17.11 -    version 2 of the License, or (at your option) any later version.
   17.12 -
   17.13 -    This library is distributed in the hope that it will be useful,
   17.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   17.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   17.16 -    Library General Public License for more details.
   17.17 -
   17.18 -    You should have received a copy of the GNU Library General Public
   17.19 -    License along with this library; if not, write to the Free
   17.20 -    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   17.21 -
   17.22 -    Sam Lantinga
   17.23 -    slouken@libsdl.org
   17.24 -*/
   17.25 -#include "SDL_config.h"
   17.26 -
   17.27 -/*
   17.28 -	MiNT audio driver
   17.29 -	using XBIOS functions (STFA driver)
   17.30 -
   17.31 -	Patrice Mandin
   17.32 -*/
   17.33 -
   17.34 -/* Mint includes */
   17.35 -#include <mint/osbind.h>
   17.36 -#include <mint/falcon.h>
   17.37 -#include <mint/cookie.h>
   17.38 -
   17.39 -#include "SDL_audio.h"
   17.40 -#include "../SDL_audio_c.h"
   17.41 -#include "../SDL_sysaudio.h"
   17.42 -
   17.43 -#include "../../video/ataricommon/SDL_atarimxalloc_c.h"
   17.44 -
   17.45 -#include "SDL_mintaudio.h"
   17.46 -#include "SDL_mintaudio_stfa.h"
   17.47 -
   17.48 -/*--- Defines ---*/
   17.49 -
   17.50 -#define MINT_AUDIO_DRIVER_NAME "mint_stfa"
   17.51 -
   17.52 -/* Debug print info */
   17.53 -#define DEBUG_NAME "audio:stfa: "
   17.54 -#if 0
   17.55 -#define DEBUG_PRINT(what) \
   17.56 -	{ \
   17.57 -		printf what; \
   17.58 -	}
   17.59 -#else
   17.60 -#define DEBUG_PRINT(what)
   17.61 -#endif
   17.62 -
   17.63 -/*--- Static variables ---*/
   17.64 -
   17.65 -static unsigned long cookie_snd = 0;
   17.66 -static unsigned long cookie_mch = 0;
   17.67 -static cookie_stfa_t *cookie_stfa = NULL;
   17.68 -
   17.69 -static const int freqs[16] = {
   17.70 -    4995, 6269, 7493, 8192,
   17.71 -    9830, 10971, 12538, 14985,
   17.72 -    16384, 19819, 21943, 24576,
   17.73 -    30720, 32336, 43885, 49152
   17.74 -};
   17.75 -
   17.76 -static void
   17.77 -MINTSTFA_LockDevice(_THIS)
   17.78 -{
   17.79 -    /* Stop replay */
   17.80 -    void *oldpile = (void *) Super(0);
   17.81 -    cookie_stfa->sound_enable = STFA_PLAY_DISABLE;
   17.82 -    Super(oldpile);
   17.83 -}
   17.84 -
   17.85 -static void
   17.86 -MINTSTFA_UnlockDevice(_THIS)
   17.87 -{
   17.88 -    /* Restart replay */
   17.89 -    void *oldpile = (void *) Super(0);
   17.90 -    cookie_stfa->sound_enable = STFA_PLAY_ENABLE | STFA_PLAY_REPEAT;
   17.91 -    Super(oldpile);
   17.92 -}
   17.93 -
   17.94 -static void
   17.95 -MINTSTFA_CloseDevice(_THIS)
   17.96 -{
   17.97 -    if (this->hidden != NULL) {
   17.98 -        /* Stop replay */
   17.99 -        void *oldpile = (void *) Super(0);
  17.100 -        cookie_stfa->sound_enable = STFA_PLAY_DISABLE;
  17.101 -        Super(oldpile);
  17.102 -
  17.103 -        /* Wait if currently playing sound */
  17.104 -        while (SDL_MintAudio_mutex != 0) {
  17.105 -        }
  17.106 -
  17.107 -        /* Clear buffers */
  17.108 -        if (SDL_MintAudio_audiobuf[0]) {
  17.109 -            Mfree(SDL_MintAudio_audiobuf[0]);
  17.110 -            SDL_MintAudio_audiobuf[0] = SDL_MintAudio_audiobuf[1] = NULL;
  17.111 -        }
  17.112 -
  17.113 -        SDL_free(this->hidden);
  17.114 -        this->hidden = NULL;
  17.115 -    }
  17.116 -}
  17.117 -
  17.118 -static int
  17.119 -MINTSTFA_CheckAudio(_THIS)
  17.120 -{
  17.121 -    int i;
  17.122 -
  17.123 -    DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ",
  17.124 -                 SDL_AUDIO_BITSIZE(this->spec.format)));
  17.125 -    DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(this->spec.format)));
  17.126 -    DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(this->spec.format)));
  17.127 -    DEBUG_PRINT(("big endian=%d, ",
  17.128 -                 SDL_AUDIO_ISBIGENDIAN(this->spec.format)));
  17.129 -    DEBUG_PRINT(("channels=%d, ", this->spec.channels));
  17.130 -    DEBUG_PRINT(("freq=%d\n", this->spec.freq));
  17.131 -
  17.132 -    if (SDL_AUDIO_BITSIZE(this->spec.format) > 16) {
  17.133 -        this->spec.format = AUDIO_S16SYS;       /* clamp out int32/float32 ... */
  17.134 -    }
  17.135 -
  17.136 -    if (this->spec.channels > 2) {
  17.137 -        this->spec.channels = 2;        /* no more than stereo! */
  17.138 -    }
  17.139 -
  17.140 -    /* Check formats available */
  17.141 -    MINTAUDIO_freqcount = 0;
  17.142 -    for (i = 0; i < 16; i++) {
  17.143 -        SDL_MintAudio_AddFrequency(this, freqs[i], 0, i, -1);
  17.144 -    }
  17.145 -
  17.146 -#if 1
  17.147 -    for (i = 0; i < MINTAUDIO_freqcount; i++) {
  17.148 -        DEBUG_PRINT((DEBUG_NAME "freq %d: %lu Hz, clock %lu, prediv %d\n",
  17.149 -                     i, MINTAUDIO_frequencies[i].frequency,
  17.150 -                     MINTAUDIO_frequencies[i].masterclock,
  17.151 -                     MINTAUDIO_frequencies[i].predivisor));
  17.152 -    }
  17.153 -#endif
  17.154 -
  17.155 -    MINTAUDIO_numfreq = SDL_MintAudio_SearchFrequency(this, this->spec.freq);
  17.156 -    this->spec.freq = MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency;
  17.157 -
  17.158 -    DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ",
  17.159 -                 SDL_AUDIO_BITSIZE(this->spec.format)));
  17.160 -    DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(this->spec.format)));
  17.161 -    DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(this->spec.format)));
  17.162 -    DEBUG_PRINT(("big endian=%d, ",
  17.163 -                 SDL_AUDIO_ISBIGENDIAN(this->spec.format)));
  17.164 -    DEBUG_PRINT(("channels=%d, ", this->spec.channels));
  17.165 -    DEBUG_PRINT(("freq=%d\n", this->spec.freq));
  17.166 -
  17.167 -    return 0;
  17.168 -}
  17.169 -
  17.170 -static void
  17.171 -MINTSTFA_InitAudio(_THIS)
  17.172 -{
  17.173 -    void *buffer = SDL_MintAudio_audiobuf[SDL_MintAudio_numbuf];
  17.174 -    void *oldpile = (void *) Super(0);
  17.175 -
  17.176 -    /* Stop replay */
  17.177 -    cookie_stfa->sound_enable = STFA_PLAY_DISABLE;
  17.178 -
  17.179 -    /* Select replay format */
  17.180 -    cookie_stfa->sound_control =
  17.181 -        MINTAUDIO_frequencies[MINTAUDIO_numfreq].predivisor;
  17.182 -    if (SDL_AUDIO_BITSIZE(this->spec.format) == 8) {
  17.183 -        cookie_stfa->sound_control |= STFA_FORMAT_8BIT;
  17.184 -    } else {
  17.185 -        cookie_stfa->sound_control |= STFA_FORMAT_16BIT;
  17.186 -    }
  17.187 -    if (this->spec.channels == 2) {
  17.188 -        cookie_stfa->sound_control |= STFA_FORMAT_STEREO;
  17.189 -    } else {
  17.190 -        cookie_stfa->sound_control |= STFA_FORMAT_MONO;
  17.191 -    }
  17.192 -    if (SDL_AUDIO_ISSIGNED(this->spec.format) != 0) {
  17.193 -        cookie_stfa->sound_control |= STFA_FORMAT_SIGNED;
  17.194 -    } else {
  17.195 -        cookie_stfa->sound_control |= STFA_FORMAT_UNSIGNED;
  17.196 -    }
  17.197 -    if (SDL_AUDIO_ISBIGENDIAN(this->spec.format) != 0) {
  17.198 -        cookie_stfa->sound_control |= STFA_FORMAT_BIGENDIAN;
  17.199 -    } else {
  17.200 -        cookie_stfa->sound_control |= STFA_FORMAT_LITENDIAN;
  17.201 -    }
  17.202 -
  17.203 -    /* Set buffer */
  17.204 -    cookie_stfa->sound_start = (unsigned long) buffer;
  17.205 -    cookie_stfa->sound_end = (unsigned long) (buffer + this->spec.size);
  17.206 -
  17.207 -    /* Set interrupt */
  17.208 -    cookie_stfa->stfa_it = SDL_MintAudio_StfaInterrupt;
  17.209 -
  17.210 -    /* Restart replay */
  17.211 -    cookie_stfa->sound_enable = STFA_PLAY_ENABLE | STFA_PLAY_REPEAT;
  17.212 -
  17.213 -    Super(oldpile);
  17.214 -
  17.215 -    DEBUG_PRINT((DEBUG_NAME "hardware initialized\n"));
  17.216 -}
  17.217 -
  17.218 -static int
  17.219 -MINTSTFA_OpenDevice(_THIS, const char *devname, int iscapture)
  17.220 -{
  17.221 -    SDL_MintAudio_device = this;
  17.222 -
  17.223 -    /* Check audio capabilities */
  17.224 -    if (MINTSTFA_CheckAudio(this) == -1) {
  17.225 -        return 0;
  17.226 -    }
  17.227 -
  17.228 -    /* Initialize all variables that we clean on shutdown */
  17.229 -    this->hidden = (struct SDL_PrivateAudioData *)
  17.230 -        SDL_malloc((sizeof *this->hidden));
  17.231 -    if (this->hidden == NULL) {
  17.232 -        SDL_OutOfMemory();
  17.233 -        return 0;
  17.234 -    }
  17.235 -    SDL_memset(this->hidden, 0, (sizeof *this->hidden));
  17.236 -
  17.237 -    SDL_CalculateAudioSpec(&this->spec);
  17.238 -
  17.239 -    /* Allocate memory for audio buffers in DMA-able RAM */
  17.240 -    DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", this->spec.size));
  17.241 -
  17.242 -    SDL_MintAudio_audiobuf[0] =
  17.243 -        Atari_SysMalloc(this->spec.size * 2, MX_STRAM);
  17.244 -    if (SDL_MintAudio_audiobuf[0] == NULL) {
  17.245 -        SDL_OutOfMemory();
  17.246 -        SDL_free(this->hidden);
  17.247 -        this->hidden = NULL;
  17.248 -        return 0;
  17.249 -    }
  17.250 -    SDL_MintAudio_audiobuf[1] = SDL_MintAudio_audiobuf[0] + this->spec.size;
  17.251 -    SDL_MintAudio_numbuf = 0;
  17.252 -    SDL_memset(SDL_MintAudio_audiobuf[0], this->spec.silence,
  17.253 -               this->spec.size * 2);
  17.254 -    SDL_MintAudio_audiosize = this->spec.size;
  17.255 -    SDL_MintAudio_mutex = 0;
  17.256 -
  17.257 -    DEBUG_PRINT((DEBUG_NAME "buffer 0 at 0x%08x\n",
  17.258 -                 SDL_MintAudio_audiobuf[0]));
  17.259 -    DEBUG_PRINT((DEBUG_NAME "buffer 1 at 0x%08x\n",
  17.260 -                 SDL_MintAudio_audiobuf[1]));
  17.261 -
  17.262 -    SDL_MintAudio_CheckFpu();
  17.263 -
  17.264 -    /* Setup audio hardware */
  17.265 -    MINTSTFA_InitAudio(this);
  17.266 -
  17.267 -    return 1;                   /* good to go. */
  17.268 -}
  17.269 -
  17.270 -
  17.271 -static int
  17.272 -MINTSTFA_Init(SDL_AudioDriverImpl * impl)
  17.273 -{
  17.274 -    /* Cookie _MCH present ? if not, assume ST machine */
  17.275 -    if (Getcookie(C__MCH, &cookie_mch) == C_NOTFOUND) {
  17.276 -        cookie_mch = MCH_ST;
  17.277 -    }
  17.278 -
  17.279 -    /* Cookie _SND present ? if not, assume ST machine */
  17.280 -    if (Getcookie(C__SND, &cookie_snd) == C_NOTFOUND) {
  17.281 -        cookie_snd = SND_PSG;
  17.282 -    }
  17.283 -
  17.284 -    /* Cookie STFA present ? */
  17.285 -    if (Getcookie(C_STFA, (long *) &cookie_stfa) != C_FOUND) {
  17.286 -        SDL_SetError(DEBUG_NAME "no STFA audio");
  17.287 -        return (0);
  17.288 -    }
  17.289 -
  17.290 -    SDL_MintAudio_stfa = cookie_stfa;
  17.291 -
  17.292 -    DEBUG_PRINT((DEBUG_NAME "STFA audio available!\n"));
  17.293 -
  17.294 -    /* Set the function pointers */
  17.295 -    impl->OpenDevice = MINTSTFA_OpenDevice;
  17.296 -    impl->CloseDevice = MINTSTFA_CloseDevice;
  17.297 -    impl->LockDevice = MINTSTFA_LockDevice;
  17.298 -    impl->UnlockDevice = MINTSTFA_UnlockDevice;
  17.299 -    impl->OnlyHasDefaultOutputDevice = 1;
  17.300 -    impl->ProvidesOwnCallbackThread = 1;
  17.301 -    impl->SkipMixerLock = 1;
  17.302 -
  17.303 -    return 2;                   /* 2 == definitely has an audio device. */
  17.304 -}
  17.305 -
  17.306 -AudioBootStrap MINTAUDIO_STFA_bootstrap = {
  17.307 -    MINT_AUDIO_DRIVER_NAME, "MiNT STFA audio driver", MINTSTFA_Init, 0
  17.308 -};
  17.309 -
  17.310 -/* vi: set ts=4 sw=4 expandtab: */
    18.1 --- a/src/audio/mint/SDL_mintaudio_stfa.h	Sun Sep 20 04:13:23 2009 +0000
    18.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.3 @@ -1,103 +0,0 @@
    18.4 -/*
    18.5 -    SDL - Simple DirectMedia Layer
    18.6 -    Copyright (C) 1997-2009 Sam Lantinga
    18.7 -
    18.8 -    This library is free software; you can redistribute it and/or
    18.9 -    modify it under the terms of the GNU Library General Public
   18.10 -    License as published by the Free Software Foundation; either
   18.11 -    version 2 of the License, or (at your option) any later version.
   18.12 -
   18.13 -    This library is distributed in the hope that it will be useful,
   18.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   18.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   18.16 -    Library General Public License for more details.
   18.17 -
   18.18 -    You should have received a copy of the GNU Library General Public
   18.19 -    License along with this library; if not, write to the Free
   18.20 -    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   18.21 -
   18.22 -    Sam Lantinga
   18.23 -    slouken@libsdl.org
   18.24 -*/
   18.25 -#include "SDL_config.h"
   18.26 -
   18.27 -/*
   18.28 -	STFA control structure
   18.29 -
   18.30 -	Patrice Mandin
   18.31 -*/
   18.32 -
   18.33 -#ifndef _SDL_mintaudio_stfa_h
   18.34 -#define _SDL_mintaudio_stfa_h
   18.35 -
   18.36 -/*--- Defines ---*/
   18.37 -
   18.38 -#define C_STFA	0x53544641L     /* Sound treiber für atari (seb/The removers) */
   18.39 -
   18.40 -#define STFA_PLAY_ENABLE	(1<<0)
   18.41 -#define STFA_PLAY_DISABLE	(0<<0)
   18.42 -#define STFA_PLAY_REPEAT	(1<<1)
   18.43 -#define STFA_PLAY_SINGLE	(0<<1)
   18.44 -
   18.45 -#define STFA_FORMAT_SIGNED		(1<<15)
   18.46 -#define STFA_FORMAT_UNSIGNED	(0<<15)
   18.47 -#define STFA_FORMAT_STEREO		(1<<14)
   18.48 -#define STFA_FORMAT_MONO		(0<<14)
   18.49 -#define STFA_FORMAT_16BIT		(1<<13)
   18.50 -#define STFA_FORMAT_8BIT		(0<<13)
   18.51 -#define STFA_FORMAT_LITENDIAN	(1<<9)
   18.52 -#define STFA_FORMAT_BIGENDIAN	(0<<9)
   18.53 -#define STFA_FORMAT_FREQ_MASK	0x0f
   18.54 -enum
   18.55 -{
   18.56 -    STFA_FORMAT_F4995 = 0,
   18.57 -    STFA_FORMAT_F6269,
   18.58 -    STFA_FORMAT_F7493,
   18.59 -    STFA_FORMAT_F8192,
   18.60 -
   18.61 -    STFA_FORMAT_F9830,
   18.62 -    STFA_FORMAT_F10971,
   18.63 -    STFA_FORMAT_F12538,
   18.64 -    STFA_FORMAT_F14985,
   18.65 -
   18.66 -    STFA_FORMAT_F16384,
   18.67 -    STFA_FORMAT_F19819,
   18.68 -    STFA_FORMAT_F21943,
   18.69 -    STFA_FORMAT_F24576,
   18.70 -
   18.71 -    STFA_FORMAT_F30720,
   18.72 -    STFA_FORMAT_F32336,
   18.73 -    STFA_FORMAT_F43885,
   18.74 -    STFA_FORMAT_F49152
   18.75 -};
   18.76 -
   18.77 -/*--- Types ---*/
   18.78 -
   18.79 -typedef struct
   18.80 -{
   18.81 -    unsigned short sound_enable;
   18.82 -    unsigned short sound_control;
   18.83 -    unsigned short sound_output;
   18.84 -    unsigned long sound_start;
   18.85 -    unsigned long sound_current;
   18.86 -    unsigned long sound_end;
   18.87 -    unsigned short version;
   18.88 -    void *old_vbl;
   18.89 -    void *old_timera;
   18.90 -    unsigned long old_mfp_status;
   18.91 -    void *new_vbl;
   18.92 -    void *drivers_list;
   18.93 -    void *play_stop;
   18.94 -    unsigned short frequency;
   18.95 -    void *set_frequency;
   18.96 -
   18.97 -    unsigned short frequency_threshold;
   18.98 -    unsigned short *custom_freq_table;
   18.99 -    unsigned short stfa_on_off;
  18.100 -    void *new_drivers_list;
  18.101 -    unsigned long old_bit_2_of_cookie_snd;
  18.102 -    void (*stfa_it) (void);
  18.103 -} cookie_stfa_t __attribute__ ((packed));
  18.104 -
  18.105 -#endif /* _SDL_mintaudio_stfa_h */
  18.106 -/* vi: set ts=4 sw=4 expandtab: */
    19.1 --- a/src/audio/mint/SDL_mintaudio_xbios.c	Sun Sep 20 04:13:23 2009 +0000
    19.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.3 @@ -1,500 +0,0 @@
    19.4 -/*
    19.5 -    SDL - Simple DirectMedia Layer
    19.6 -    Copyright (C) 1997-2009 Sam Lantinga
    19.7 -
    19.8 -    This library is free software; you can redistribute it and/or
    19.9 -    modify it under the terms of the GNU Library General Public
   19.10 -    License as published by the Free Software Foundation; either
   19.11 -    version 2 of the License, or (at your option) any later version.
   19.12 -
   19.13 -    This library is distributed in the hope that it will be useful,
   19.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   19.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   19.16 -    Library General Public License for more details.
   19.17 -
   19.18 -    You should have received a copy of the GNU Library General Public
   19.19 -    License along with this library; if not, write to the Free
   19.20 -    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   19.21 -
   19.22 -    Sam Lantinga
   19.23 -    slouken@libsdl.org
   19.24 -*/
   19.25 -#include "SDL_config.h"
   19.26 -
   19.27 -/*
   19.28 -	MiNT audio driver
   19.29 -	using XBIOS functions (Falcon)
   19.30 -
   19.31 -	Patrice Mandin, Didier Méquignon
   19.32 -*/
   19.33 -
   19.34 -#include <unistd.h>
   19.35 -#include <support.h>
   19.36 -
   19.37 -/* Mint includes */
   19.38 -#include <mint/osbind.h>
   19.39 -#include <mint/falcon.h>
   19.40 -#include <mint/cookie.h>
   19.41 -
   19.42 -#include "SDL_audio.h"
   19.43 -#include "../SDL_audio_c.h"
   19.44 -#include "../SDL_sysaudio.h"
   19.45 -
   19.46 -#include "../../video/ataricommon/SDL_atarimxalloc_c.h"
   19.47 -
   19.48 -#include "SDL_mintaudio.h"
   19.49 -#include "SDL_mintaudio_dma8.h"
   19.50 -
   19.51 -/*--- Defines ---*/
   19.52 -
   19.53 -#define MINT_AUDIO_DRIVER_NAME "mint_xbios"
   19.54 -
   19.55 -/* Debug print info */
   19.56 -#define DEBUG_NAME "audio:xbios: "
   19.57 -#if 0
   19.58 -#define DEBUG_PRINT(what) \
   19.59 -	{ \
   19.60 -		printf what; \
   19.61 -	}
   19.62 -#else
   19.63 -#define DEBUG_PRINT(what)
   19.64 -#endif
   19.65 -
   19.66 -static unsigned long cookie_snd = 0;
   19.67 -
   19.68 -static void
   19.69 -MINTXBIOS_LockDevice(_THIS)
   19.70 -{
   19.71 -    /* Stop replay */
   19.72 -    Buffoper(0);
   19.73 -}
   19.74 -
   19.75 -static void
   19.76 -MINTXBIOS_UnlockDevice(_THIS)
   19.77 -{
   19.78 -    /* Restart replay */
   19.79 -    Buffoper(SB_PLA_ENA | SB_PLA_RPT);
   19.80 -}
   19.81 -
   19.82 -static void
   19.83 -MINTXBIOS_CloseDevice(_THIS)
   19.84 -{
   19.85 -    if (this->hidden != NULL) {
   19.86 -        /* Stop replay */
   19.87 -        SDL_MintAudio_WaitThread();
   19.88 -        Buffoper(0);
   19.89 -
   19.90 -        if (!SDL_MintAudio_mint_present) {
   19.91 -            /* Uninstall interrupt */
   19.92 -            Jdisint(MFP_DMASOUND);
   19.93 -        }
   19.94 -
   19.95 -        /* Wait if currently playing sound */
   19.96 -        while (SDL_MintAudio_mutex != 0) {
   19.97 -        }
   19.98 -
   19.99 -        /* Clear buffers */
  19.100 -        if (SDL_MintAudio_audiobuf[0]) {
  19.101 -            Mfree(SDL_MintAudio_audiobuf[0]);
  19.102 -            SDL_MintAudio_audiobuf[0] = SDL_MintAudio_audiobuf[1] = NULL;
  19.103 -        }
  19.104 -
  19.105 -        /* Unlock sound system */
  19.106 -        Unlocksnd();
  19.107 -
  19.108 -        SDL_free(this->hidden);
  19.109 -        this->hidden = NULL;
  19.110 -    }
  19.111 -}
  19.112 -
  19.113 -/* Falcon XBIOS implementation of Devconnect() is buggy with external clock */
  19.114 -static void
  19.115 -Devconnect2(int src, int dst, int sclk, int pre)
  19.116 -{
  19.117 -    static const unsigned short MASK1[3] = { 0, 0x6000, 0 };
  19.118 -    static const unsigned short MASK2[4] = { 0xFFF0, 0xFF8F, 0xF0FF, 0x0FFF };
  19.119 -    static const unsigned short INDEX1[4] = { 1, 3, 5, 7 };
  19.120 -    static const unsigned short INDEX2[4] = { 0, 2, 4, 6 };
  19.121 -    unsigned short sync_div, dev_ctrl, dest_ctrl;
  19.122 -    void *oldstack;
  19.123 -
  19.124 -    if (dst == 0) {
  19.125 -        return;
  19.126 -    }
  19.127 -
  19.128 -    oldstack = (void *) Super(0);
  19.129 -
  19.130 -    dev_ctrl = DMAAUDIO_IO.dev_ctrl;
  19.131 -    dest_ctrl = DMAAUDIO_IO.dest_ctrl;
  19.132 -    dev_ctrl &= MASK2[src];
  19.133 -
  19.134 -    if (src == ADC) {
  19.135 -        dev_ctrl |= MASK1[sclk];
  19.136 -    } else {
  19.137 -        dev_ctrl |= (INDEX1[sclk] << (src << 4));
  19.138 -    }
  19.139 -
  19.140 -    if (dst & DMAREC) {
  19.141 -        dest_ctrl &= 0xFFF0;
  19.142 -        dest_ctrl |= INDEX1[src];
  19.143 -    }
  19.144 -
  19.145 -    if (dst & DSPRECV) {
  19.146 -        dest_ctrl &= 0xFF8F;
  19.147 -        dest_ctrl |= (INDEX1[src] << 4);
  19.148 -    }
  19.149 -
  19.150 -    if (dst & EXTOUT) {
  19.151 -        dest_ctrl &= 0xF0FF;
  19.152 -        dest_ctrl |= (INDEX1[src] << 8);
  19.153 -    }
  19.154 -
  19.155 -    if (dst & DAC) {
  19.156 -        dev_ctrl &= 0x0FFF;
  19.157 -        dev_ctrl |= MASK1[sclk];
  19.158 -        dest_ctrl &= 0x0FFF;
  19.159 -        dest_ctrl |= (INDEX2[src] << 12);
  19.160 -    }
  19.161 -
  19.162 -    sync_div = DMAAUDIO_IO.sync_div;
  19.163 -    if (sclk == CLKEXT) {
  19.164 -        pre <<= 8;
  19.165 -        sync_div &= 0xF0FF;
  19.166 -    } else {
  19.167 -        sync_div &= 0xFFF0;
  19.168 -    }
  19.169 -    sync_div |= pre;
  19.170 -
  19.171 -    DMAAUDIO_IO.dev_ctrl = dev_ctrl;
  19.172 -    DMAAUDIO_IO.dest_ctrl = dest_ctrl;
  19.173 -    DMAAUDIO_IO.sync_div = sync_div;
  19.174 -
  19.175 -    Super(oldstack);
  19.176 -}
  19.177 -
  19.178 -static void
  19.179 -MINTXBIOS_CheckExternalClock(_THIS)
  19.180 -{
  19.181 -#define SIZE_BUF_CLOCK_MEASURE (44100/10)
  19.182 -
  19.183 -    unsigned long cookie_snd;
  19.184 -    char *buffer;
  19.185 -    int i, j;
  19.186 -
  19.187 -    /* DSP present with its GPIO port ? */
  19.188 -    if (Getcookie(C__SND, &cookie_snd) == C_NOTFOUND) {
  19.189 -        return;
  19.190 -    }
  19.191 -    if ((cookie_snd & SND_DSP) == 0) {
  19.192 -        return;
  19.193 -    }
  19.194 -
  19.195 -    buffer = Atari_SysMalloc(SIZE_BUF_CLOCK_MEASURE, MX_STRAM);
  19.196 -    if (buffer == NULL) {
  19.197 -        DEBUG_PRINT((DEBUG_NAME "Not enough memory for the measure\n"));
  19.198 -        return;
  19.199 -    }
  19.200 -    SDL_memset(buffer, 0, SIZE_BUF_CLOCK_MEASURE);
  19.201 -
  19.202 -    Buffoper(0);
  19.203 -    Settracks(0, 0);
  19.204 -    Setmontracks(0);
  19.205 -    Setmode(MONO8);
  19.206 -    Jdisint(MFP_TIMERA);
  19.207 -
  19.208 -    for (i = 0; i < 2; i++) {
  19.209 -        Gpio(GPIO_SET, 7);      /* DSP port gpio outputs */
  19.210 -        Gpio(GPIO_WRITE, 2 + i);        /* 22.5792/24.576 MHz for 44.1/48KHz */
  19.211 -        Devconnect2(DMAPLAY, DAC, CLKEXT, CLK50K);      /* Matrix and clock source */
  19.212 -        Setbuffer(0, buffer, buffer + SIZE_BUF_CLOCK_MEASURE);  /* Set buffer */
  19.213 -        Xbtimer(XB_TIMERA, 5, 38, SDL_MintAudio_XbiosInterruptMeasureClock);    /* delay mode timer A, prediv /64, 1KHz */
  19.214 -        Jenabint(MFP_TIMERA);
  19.215 -        SDL_MintAudio_clocktics = 0;
  19.216 -        Buffoper(SB_PLA_ENA);
  19.217 -        usleep(110000);
  19.218 -
  19.219 -        if ((Buffoper(-1) & 1) == 0) {
  19.220 -            if (SDL_MintAudio_clocktics) {
  19.221 -                unsigned long khz;
  19.222 -
  19.223 -                khz =
  19.224 -                    ((SIZE_BUF_CLOCK_MEASURE /
  19.225 -                      SDL_MintAudio_clocktics) + 1) & 0xFFFFFFFE;
  19.226 -                DEBUG_PRINT((DEBUG_NAME "measure %d: freq=%lu KHz\n",
  19.227 -                             i + 1, khz));
  19.228 -
  19.229 -                if (khz == 44) {
  19.230 -                    for (j = 1; j < 4; j++) {
  19.231 -                        SDL_MintAudio_AddFrequency(this,
  19.232 -                                                   MASTERCLOCK_44K
  19.233 -                                                   /
  19.234 -                                                   (MASTERPREDIV_FALCON
  19.235 -                                                    * (1 << j)),
  19.236 -                                                   MASTERCLOCK_44K,
  19.237 -                                                   (1 << j) - 1, 2 + i);
  19.238 -                    }
  19.239 -                } else if (khz == 48) {
  19.240 -                    for (j = 1; j < 4; j++) {
  19.241 -                        SDL_MintAudio_AddFrequency(this,
  19.242 -                                                   MASTERCLOCK_48K
  19.243 -                                                   /
  19.244 -                                                   (MASTERPREDIV_FALCON
  19.245 -                                                    * (1 << j)),
  19.246 -                                                   MASTERCLOCK_48K,
  19.247 -                                                   (1 << j) - 1, 2 + i);
  19.248 -                    }
  19.249 -                }
  19.250 -            } else {
  19.251 -                DEBUG_PRINT((DEBUG_NAME "No measure\n"));
  19.252 -            }
  19.253 -        } else {
  19.254 -            DEBUG_PRINT((DEBUG_NAME "No SDMA clock\n"));
  19.255 -        }
  19.256 -
  19.257 -        Buffoper(0);            /* stop */
  19.258 -        Jdisint(MFP_TIMERA);    /* Uninstall interrupt */
  19.259 -    }
  19.260 -
  19.261 -    Mfree(buffer);
  19.262 -}
  19.263 -
  19.264 -static int
  19.265 -MINTXBIOS_CheckAudio(_THIS)
  19.266 -{
  19.267 -    int i;
  19.268 -    Uint32 extclock;
  19.269 -
  19.270 -    DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ",
  19.271 -                 SDL_AUDIO_BITSIZE(this->spec.format)));
  19.272 -    DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(this->spec.format)));
  19.273 -    DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(this->spec.format)));
  19.274 -    DEBUG_PRINT(("big endian=%d, ",
  19.275 -                 SDL_AUDIO_ISBIGENDIAN(this->spec.format)));
  19.276 -    DEBUG_PRINT(("channels=%d, ", this->spec.channels));
  19.277 -    DEBUG_PRINT(("freq=%d\n", this->spec.freq));
  19.278 -
  19.279 -    this->spec.format |= SDL_AUDIO_MASK_SIGNED; /* Audio is always signed */
  19.280 -
  19.281 -    /* clamp out int32/float32 */
  19.282 -    if (SDL_AUDIO_BITSIZE(this->spec.format) >= 16) {
  19.283 -        this->spec.format = AUDIO_S16MSB;       /* Audio is always big endian */
  19.284 -        this->spec.channels = 2;        /* 16 bits always stereo */
  19.285 -    } else if (this->spec.channels > 2) {
  19.286 -        this->spec.channels = 2;        /* no more than stereo! */
  19.287 -    }
  19.288 -
  19.289 -    MINTAUDIO_freqcount = 0;
  19.290 -
  19.291 -    /* Add external clocks if present */
  19.292 -    MINTXBIOS_CheckExternalClock(this);
  19.293 -
  19.294 -    /* Standard clocks */
  19.295 -    for (i = 1; i < 12; i++) {
  19.296 -        /* Remove unusable Falcon codec predivisors */
  19.297 -        if ((i == 6) || (i == 8) || (i == 10)) {
  19.298 -            continue;
  19.299 -        }
  19.300 -        SDL_MintAudio_AddFrequency(this,
  19.301 -                                   MASTERCLOCK_FALCON1 /
  19.302 -                                   (MASTERPREDIV_FALCON * (i + 1)),
  19.303 -                                   MASTERCLOCK_FALCON1, i, -1);
  19.304 -    }
  19.305 -
  19.306 -#if 1
  19.307 -    for (i = 0; i < MINTAUDIO_freqcount; i++) {
  19.308 -        DEBUG_PRINT((DEBUG_NAME "freq %d: %lu Hz, clock %lu, prediv %d\n",
  19.309 -                     i, MINTAUDIO_frequencies[i].frequency,
  19.310 -                     MINTAUDIO_frequencies[i].masterclock,
  19.311 -                     MINTAUDIO_frequencies[i].predivisor));
  19.312 -    }
  19.313 -#endif
  19.314 -
  19.315 -    MINTAUDIO_numfreq = SDL_MintAudio_SearchFrequency(this, this->spec.freq);
  19.316 -    this->spec.freq = MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency;
  19.317 -
  19.318 -    DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ",
  19.319 -                 SDL_AUDIO_BITSIZE(this->spec.format)));
  19.320 -    DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(this->spec.format)));
  19.321 -    DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(this->spec.format)));
  19.322 -    DEBUG_PRINT(("big endian=%d, ",
  19.323 -                 SDL_AUDIO_ISBIGENDIAN(this->spec.format)));
  19.324 -    DEBUG_PRINT(("channels=%d, ", this->spec.channels));
  19.325 -    DEBUG_PRINT(("freq=%d\n", this->spec.freq));
  19.326 -
  19.327 -    return 0;
  19.328 -}
  19.329 -
  19.330 -static void
  19.331 -MINTXBIOS_InitAudio(_THIS)
  19.332 -{
  19.333 -    int channels_mode, dmaclock, prediv;
  19.334 -    void *buffer;
  19.335 -
  19.336 -    /* Stop currently playing sound */
  19.337 -    SDL_MintAudio_quit_thread = SDL_FALSE;
  19.338 -    SDL_MintAudio_thread_finished = SDL_TRUE;
  19.339 -    SDL_MintAudio_WaitThread();
  19.340 -    Buffoper(0);
  19.341 -
  19.342 -    /* Set replay tracks */
  19.343 -    Settracks(0, 0);
  19.344 -    Setmontracks(0);
  19.345 -
  19.346 -    /* Select replay format */
  19.347 -    channels_mode = STEREO16;
  19.348 -    switch (SDL_AUDIO_BITSIZE(this->spec.format)) {
  19.349 -    case 8:
  19.350 -        if (this->spec.channels == 2) {
  19.351 -            channels_mode = STEREO8;
  19.352 -        } else {
  19.353 -            channels_mode = MONO8;
  19.354 -        }
  19.355 -        break;
  19.356 -    }
  19.357 -    if (Setmode(channels_mode) < 0) {
  19.358 -        DEBUG_PRINT((DEBUG_NAME "Setmode() failed\n"));
  19.359 -    }
  19.360 -
  19.361 -    dmaclock = MINTAUDIO_frequencies[MINTAUDIO_numfreq].masterclock;
  19.362 -    prediv = MINTAUDIO_frequencies[MINTAUDIO_numfreq].predivisor;
  19.363 -    if (MINTAUDIO_frequencies[MINTAUDIO_numfreq].gpio_bits != -1) {
  19.364 -        Gpio(GPIO_SET, 7);      /* DSP port gpio outputs */
  19.365 -        Gpio(GPIO_WRITE, MINTAUDIO_frequencies[MINTAUDIO_numfreq].gpio_bits);
  19.366 -        Devconnect2(DMAPLAY, DAC | EXTOUT, CLKEXT, prediv);
  19.367 -    } else {
  19.368 -        Devconnect2(DMAPLAY, DAC, CLK25M, prediv);
  19.369 -    }
  19.370 -
  19.371 -    /* Set buffer */
  19.372 -    buffer = SDL_MintAudio_audiobuf[SDL_MintAudio_numbuf];
  19.373 -    if (Setbuffer(0, buffer, buffer + this->spec.size) < 0) {
  19.374 -        DEBUG_PRINT((DEBUG_NAME "Setbuffer() failed\n"));
  19.375 -    }
  19.376 -
  19.377 -    if (SDL_MintAudio_mint_present) {
  19.378 -        SDL_MintAudio_thread_pid = tfork(SDL_MintAudio_Thread, 0);
  19.379 -    } else {
  19.380 -        /* Install interrupt */
  19.381 -        Jdisint(MFP_DMASOUND);
  19.382 -        /*Xbtimer(XB_TIMERA, 8, 1, SDL_MintAudio_XbiosInterrupt); */
  19.383 -        Xbtimer(XB_TIMERA, 8, 1, SDL_MintAudio_Dma8Interrupt);
  19.384 -        Jenabint(MFP_DMASOUND);
  19.385 -
  19.386 -        if (Setinterrupt(SI_TIMERA, SI_PLAY) < 0) {
  19.387 -            DEBUG_PRINT((DEBUG_NAME "Setinterrupt() failed\n"));
  19.388 -        }
  19.389 -    }
  19.390 -
  19.391 -    /* Go */
  19.392 -    Buffoper(SB_PLA_ENA | SB_PLA_RPT);
  19.393 -    DEBUG_PRINT((DEBUG_NAME "hardware initialized\n"));
  19.394 -}
  19.395 -
  19.396 -static int
  19.397 -MINTXBIOS_OpenDevice(_THIS, const char *devname, int iscapture)
  19.398 -{
  19.399 -    /* Lock sound system */
  19.400 -    if (Locksnd() != 1) {
  19.401 -        SDL_SetError("MINTXBIOS_OpenAudio: Audio system already in use");
  19.402 -        return 0;
  19.403 -    }
  19.404 -
  19.405 -    SDL_MintAudio_device = this;
  19.406 -
  19.407 -    /* Check audio capabilities */
  19.408 -    if (MINTXBIOS_CheckAudio(this) == -1) {
  19.409 -        return 0;
  19.410 -    }
  19.411 -
  19.412 -    /* Initialize all variables that we clean on shutdown */
  19.413 -    this->hidden = (struct SDL_PrivateAudioData *)
  19.414 -        SDL_malloc((sizeof *this->hidden));
  19.415 -    if (this->hidden == NULL) {
  19.416 -        SDL_OutOfMemory();
  19.417 -        return 0;
  19.418 -    }
  19.419 -    SDL_memset(this->hidden, 0, (sizeof *this->hidden));
  19.420 -
  19.421 -    SDL_CalculateAudioSpec(&this->spec);
  19.422 -
  19.423 -    /* Allocate memory for audio buffers in DMA-able RAM */
  19.424 -    DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", this->spec.size));
  19.425 -
  19.426 -    SDL_MintAudio_audiobuf[0] =
  19.427 -        Atari_SysMalloc(this->spec.size * 2, MX_STRAM);
  19.428 -    if (SDL_MintAudio_audiobuf[0] == NULL) {
  19.429 -        SDL_free(this->hidden);
  19.430 -        this->hidden = NULL;
  19.431 -        SDL_OutOfMemory();
  19.432 -        return 0;
  19.433 -    }
  19.434 -    SDL_MintAudio_audiobuf[1] = SDL_MintAudio_audiobuf[0] + this->spec.size;
  19.435 -    SDL_MintAudio_numbuf = 0;
  19.436 -    SDL_memset(SDL_MintAudio_audiobuf[0], this->spec.silence,
  19.437 -               this->spec.size * 2);
  19.438 -    SDL_MintAudio_audiosize = this->spec.size;
  19.439 -    SDL_MintAudio_mutex = 0;
  19.440 -
  19.441 -    DEBUG_PRINT((DEBUG_NAME "buffer 0 at 0x%08x\n",
  19.442 -                 SDL_MintAudio_audiobuf[0]));
  19.443 -    DEBUG_PRINT((DEBUG_NAME "buffer 1 at 0x%08x\n",
  19.444 -                 SDL_MintAudio_audiobuf[1]));
  19.445 -
  19.446 -    SDL_MintAudio_CheckFpu();
  19.447 -
  19.448 -    /* Setup audio hardware */
  19.449 -    MINTXBIOS_InitAudio(this);
  19.450 -
  19.451 -    return 1;                   /* good to go. */
  19.452 -}
  19.453 -
  19.454 -static int
  19.455 -MINTXBIOS_Init(SDL_AudioDriverImpl * impl)
  19.456 -{
  19.457 -    unsigned long dummy = 0;
  19.458 -    /*SDL_MintAudio_mint_present = (Getcookie(C_MiNT, &dummy) == C_FOUND); */
  19.459 -    SDL_MintAudio_mint_present = SDL_FALSE;
  19.460 -
  19.461 -    /* We can't use XBIOS in interrupt with Magic, don't know about thread */
  19.462 -    if (Getcookie(C_MagX, &dummy) == C_FOUND) {
  19.463 -        return (0);
  19.464 -    }
  19.465 -
  19.466 -    /* Cookie _SND present ? if not, assume ST machine */
  19.467 -    if (Getcookie(C__SND, &cookie_snd) == C_NOTFOUND) {
  19.468 -        cookie_snd = SND_PSG;
  19.469 -    }
  19.470 -
  19.471 -    /* Check if we have 16 bits audio */
  19.472 -    if ((cookie_snd & SND_16BIT) == 0) {
  19.473 -        SDL_SetError(DEBUG_NAME "no 16-bit sound");
  19.474 -        return (0);
  19.475 -    }
  19.476 -
  19.477 -    /* Check if audio is lockable */
  19.478 -    if (Locksnd() != 1) {
  19.479 -        SDL_SetError(DEBUG_NAME "audio locked by other application");
  19.480 -        return (0);
  19.481 -    }
  19.482 -
  19.483 -    Unlocksnd();
  19.484 -
  19.485 -    DEBUG_PRINT((DEBUG_NAME "XBIOS audio available!\n"));
  19.486 -
  19.487 -    /* Set the function pointers */
  19.488 -    impl->OpenDevice = MINTXBIOS_OpenDevice;
  19.489 -    impl->CloseDevice = MINTXBIOS_CloseDevice;
  19.490 -    impl->LockDevice = MINTXBIOS_LockDevice;
  19.491 -    impl->UnlockDevice = MINTXBIOS_UnlockDevice;
  19.492 -    impl->OnlyHasDefaultOutputDevice = 1;
  19.493 -    impl->ProvidesOwnCallbackThread = 1;
  19.494 -    impl->SkipMixerLock = 1;
  19.495 -
  19.496 -    return 2;                   /* 2 == definitely has an audio device. */
  19.497 -}
  19.498 -
  19.499 -AudioBootStrap MINTAUDIO_XBIOS_bootstrap = {
  19.500 -    MINT_AUDIO_DRIVER_NAME, "MiNT XBIOS audio driver", MINTXBIOS_Init, 0
  19.501 -};
  19.502 -
  19.503 -/* vi: set ts=4 sw=4 expandtab: */
    20.1 --- a/src/joystick/mint/SDL_sysjoystick.c	Sun Sep 20 04:13:23 2009 +0000
    20.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.3 @@ -1,729 +0,0 @@
    20.4 -/*
    20.5 -    SDL - Simple DirectMedia Layer
    20.6 -    Copyright (C) 1997-2009 Sam Lantinga
    20.7 -
    20.8 -    This library is free software; you can redistribute it and/or
    20.9 -    modify it under the terms of the GNU Lesser General Public
   20.10 -    License as published by the Free Software Foundation; either
   20.11 -    version 2.1 of the License, or (at your option) any later version.
   20.12 -
   20.13 -    This library is distributed in the hope that it will be useful,
   20.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   20.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   20.16 -    Lesser General Public License for more details.
   20.17 -
   20.18 -    You should have received a copy of the GNU Lesser General Public
   20.19 -    License along with this library; if not, write to the Free Software
   20.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   20.21 -
   20.22 -    Sam Lantinga
   20.23 -    slouken@libsdl.org
   20.24 -*/
   20.25 -#include "SDL_config.h"
   20.26 -
   20.27 -#ifdef SDL_JOYSTICK_MINT
   20.28 -
   20.29 -/*
   20.30 - *	Atari Joystick/Joypad drivers
   20.31 - *
   20.32 - *	Patrice Mandin
   20.33 - */
   20.34 -
   20.35 -#include <mint/cookie.h>
   20.36 -#include <mint/osbind.h>
   20.37 -
   20.38 -#include "SDL_events.h"
   20.39 -#include "../SDL_sysjoystick.h"
   20.40 -#include "../SDL_joystick_c.h"
   20.41 -
   20.42 -#include "../../video/ataricommon/SDL_ikbdinterrupt_s.h"
   20.43 -#include "../../video/ataricommon/SDL_xbiosevents_c.h"
   20.44 -#include "../../video/ataricommon/SDL_xbiosinterrupt_s.h"
   20.45 -
   20.46 -/*--- Const ---*/
   20.47 -
   20.48 -/* We can have:
   20.49 -	1 joystick on IKBD port 1, read via hardware I/O
   20.50 -	  or same joystick on IKBD port 1, read via xbios
   20.51 -	1 joypad on port A (up to 4 with teamtap)
   20.52 -	  or 2 joysticks on joypad port A
   20.53 -	  or 1 analog paddle on joypad port A
   20.54 -	  or 1 lightpen on joypad port A
   20.55 -	1 joypad on port B (up to 4 with teamtap)
   20.56 -	  or 2 joysticks on joypad port B
   20.57 -	  or 1 analog paddle on joypad port B
   20.58 -	2 joysticks on parallel port
   20.59 -*/
   20.60 -
   20.61 -enum
   20.62 -{
   20.63 -    IKBD_JOY1 = 0,
   20.64 -    XBIOS_JOY1,
   20.65 -    PORTA_PAD0,
   20.66 -    PORTA_PAD1,
   20.67 -    PORTA_PAD2,
   20.68 -    PORTA_PAD3,
   20.69 -    PORTB_PAD0,
   20.70 -    PORTB_PAD1,
   20.71 -    PORTB_PAD2,
   20.72 -    PORTB_PAD3,
   20.73 -    PORTA_JOY0,
   20.74 -    PORTA_JOY1,
   20.75 -    PORTB_JOY0,
   20.76 -    PORTB_JOY1,
   20.77 -    PORTA_LP,
   20.78 -    PORTA_ANPAD,
   20.79 -    PORTB_ANPAD,
   20.80 -#if 0
   20.81 -    PARA_JOY0,
   20.82 -    PARA_JOY1,
   20.83 -#endif
   20.84 -    MAX_JOYSTICKS
   20.85 -};
   20.86 -
   20.87 -enum
   20.88 -{
   20.89 -    MCH_ST = 0,
   20.90 -    MCH_STE,
   20.91 -    MCH_TT,
   20.92 -    MCH_F30,
   20.93 -    MCH_CLONE,
   20.94 -    MCH_ARANYM
   20.95 -};
   20.96 -
   20.97 -/*	Joypad buttons
   20.98 - *		Procontroller note:
   20.99 - *			L,R are connected to 4,6
  20.100 - *			X,Y,Z are connected to 7,8,9
  20.101 - */
  20.102 -
  20.103 -enum
  20.104 -{
  20.105 -    JP_UP = 0, JP_DOWN, JP_LEFT, JP_RIGHT,
  20.106 -    JP_KPMULT, JP_KP7, JP_KP4, JP_KP1,
  20.107 -    JP_KP0, JP_KP8, JP_KP5, JP_KP2,
  20.108 -    JP_KPNUM, JP_KP9, JP_KP6, JP_KP3,
  20.109 -    JP_PAUSE, JP_FIRE0, JP_UNDEF0, JP_FIRE1,
  20.110 -    JP_UNDEF1, JP_FIRE2, JP_UNDEF2, JP_OPTION
  20.111 -};
  20.112 -
  20.113 -#define JP_NUM_BUTTONS 17
  20.114 -
  20.115 -#define PORT_JS_RIGHT	(1<<0)
  20.116 -#define PORT_JS_LEFT	(1<<1)
  20.117 -#define PORT_JS_DOWN	(1<<2)
  20.118 -#define PORT_JS_UP		(1<<3)
  20.119 -#define PORT_JS_FIRE	(1<<4)
  20.120 -
  20.121 -/*--- Types ---*/
  20.122 -
  20.123 -typedef struct
  20.124 -{
  20.125 -    SDL_bool enabled;
  20.126 -    unsigned char *name;
  20.127 -    Uint32 prevstate;
  20.128 -} atarijoy_t;
  20.129 -
  20.130 -/*--- Variables ---*/
  20.131 -
  20.132 -static atarijoy_t atarijoysticks[MAX_JOYSTICKS] = {
  20.133 -    {SDL_FALSE, "IKBD joystick port 1", 0},
  20.134 -    {SDL_FALSE, "Xbios joystick port 1", 0},
  20.135 -    {SDL_FALSE, "Joypad 0 port A", 0},
  20.136 -    {SDL_FALSE, "Joypad 1 port A", 0},
  20.137 -    {SDL_FALSE, "Joypad 2 port A", 0},
  20.138 -    {SDL_FALSE, "Joypad 3 port A", 0},
  20.139 -    {SDL_FALSE, "Joypad 0 port B", 0},
  20.140 -    {SDL_FALSE, "Joypad 1 port B", 0},
  20.141 -    {SDL_FALSE, "Joypad 2 port B", 0},
  20.142 -    {SDL_FALSE, "Joypad 3 port B", 0},
  20.143 -    {SDL_FALSE, "Joystick 0 port A", 0},
  20.144 -    {SDL_FALSE, "Joystick 1 port A", 0},
  20.145 -    {SDL_FALSE, "Joystick 0 port B", 0},
  20.146 -    {SDL_FALSE, "Joystick 1 port B", 0},
  20.147 -    {SDL_FALSE, "Lightpen port A", 0},
  20.148 -    {SDL_FALSE, "Analog paddle port A", 0},
  20.149 -    {SDL_FALSE, "Analog paddle port B", 0}
  20.150 -#if 0
  20.151 -    , {SDL_FALSE, "Joystick 0 parallel port", 0},
  20.152 -    {SDL_FALSE, "Joystick 1 parallel port", 0}
  20.153 -#endif
  20.154 -};
  20.155 -
  20.156 -static const int jp_buttons[JP_NUM_BUTTONS] = {
  20.157 -    JP_FIRE0, JP_FIRE1, JP_FIRE2, JP_PAUSE,
  20.158 -    JP_OPTION, JP_KPMULT, JP_KPNUM, JP_KP0,
  20.159 -    JP_KP1, JP_KP2, JP_KP3, JP_KP4,
  20.160 -    JP_KP5, JP_KP6, JP_KP7, JP_KP8,
  20.161 -    JP_KP9
  20.162 -};
  20.163 -
  20.164 -static SDL_bool joypad_ports_enabled = SDL_FALSE;
  20.165 -
  20.166 -/* Updated joypad ports */
  20.167 -static Uint16 jp_paddles[4];
  20.168 -static Uint16 jp_lightpens[2];
  20.169 -static Uint16 jp_directions;
  20.170 -static Uint16 jp_fires;
  20.171 -static Uint32 jp_joypads[8];
  20.172 -
  20.173 -/*--- Functions prototypes ---*/
  20.174 -
  20.175 -static int GetEnabledAtariJoystick(int index);
  20.176 -static void UpdateJoypads(void);
  20.177 -
  20.178 -/*--- Functions ---*/
  20.179 -
  20.180 -int
  20.181 -SDL_SYS_JoystickInit(void)
  20.182 -{
  20.183 -    int i;
  20.184 -    unsigned long cookie_mch;
  20.185 -    const char *envr = SDL_getenv("SDL_JOYSTICK_ATARI");
  20.186 -
  20.187 -#define TEST_JOY_ENABLED(env,idstring,num) \
  20.188 -	if (SDL_strstr(env,idstring"-off")) { \
  20.189 -		atarijoysticks[num].enabled=SDL_FALSE; \
  20.190 -	} \
  20.191 -	if (SDL_strstr(env,idstring"-on")) { \
  20.192 -		atarijoysticks[num].enabled=SDL_TRUE; \
  20.193 -	}
  20.194 -
  20.195 -    /* Cookie _MCH present ? if not, assume ST machine */
  20.196 -    if (Getcookie(C__MCH, &cookie_mch) != C_FOUND) {
  20.197 -        cookie_mch = MCH_ST << 16;
  20.198 -    }
  20.199 -
  20.200 -    /* Enable some default joysticks */
  20.201 -    if ((cookie_mch == MCH_ST << 16) || ((cookie_mch >> 16) == MCH_STE) ||
  20.202 -        (cookie_mch == MCH_TT << 16) || (cookie_mch == MCH_F30 << 16) ||
  20.203 -        (cookie_mch == MCH_ARANYM << 16)) {
  20.204 -        atarijoysticks[IKBD_JOY1].enabled = (SDL_AtariIkbd_enabled != 0);
  20.205 -    }
  20.206 -    if ((cookie_mch == MCH_STE << 16) || (cookie_mch == MCH_F30 << 16)) {
  20.207 -        atarijoysticks[PORTA_PAD0].enabled =
  20.208 -            atarijoysticks[PORTA_PAD1].enabled =
  20.209 -            atarijoysticks[PORTA_PAD2].enabled =
  20.210 -            atarijoysticks[PORTA_PAD3].enabled =
  20.211 -            atarijoysticks[PORTB_PAD0].enabled =
  20.212 -            atarijoysticks[PORTB_PAD1].enabled =
  20.213 -            atarijoysticks[PORTB_PAD2].enabled =
  20.214 -            atarijoysticks[PORTB_PAD3].enabled = SDL_TRUE;
  20.215 -    }
  20.216 -    if (!atarijoysticks[IKBD_JOY1].enabled) {
  20.217 -        atarijoysticks[XBIOS_JOY1].enabled = (SDL_AtariXbios_enabled != 0);
  20.218 -    }
  20.219 -
  20.220 -    /* Read environment for joysticks to enable */
  20.221 -    if (envr) {
  20.222 -        /* IKBD on any Atari, maybe clones */
  20.223 -        if ((cookie_mch == MCH_ST << 16) || ((cookie_mch >> 16) == MCH_STE)
  20.224 -            || (cookie_mch == MCH_TT << 16) || (cookie_mch == MCH_F30 << 16)
  20.225 -            || (cookie_mch == MCH_ARANYM << 16)) {
  20.226 -            if (SDL_AtariIkbd_enabled != 0) {
  20.227 -                TEST_JOY_ENABLED(envr, "ikbd-joy1", IKBD_JOY1);
  20.228 -            }
  20.229 -        }
  20.230 -        /* Joypads ports only on STE and Falcon */
  20.231 -        if ((cookie_mch == MCH_STE << 16) || (cookie_mch == MCH_F30 << 16)) {
  20.232 -            TEST_JOY_ENABLED(envr, "porta-pad", PORTA_PAD0);
  20.233 -            if (!atarijoysticks[PORTA_PAD0].enabled) {
  20.234 -                TEST_JOY_ENABLED(envr, "porta-joy0", PORTA_JOY0);
  20.235 -                TEST_JOY_ENABLED(envr, "porta-joy1", PORTA_JOY1);
  20.236 -                if (!(atarijoysticks[PORTA_JOY0].enabled)
  20.237 -                    && !(atarijoysticks[PORTA_JOY1].enabled)) {
  20.238 -                    TEST_JOY_ENABLED(envr, "porta-lp", PORTA_LP);
  20.239 -                    if (!atarijoysticks[PORTA_LP].enabled) {
  20.240 -                        TEST_JOY_ENABLED(envr, "porta-anpad", PORTA_ANPAD);
  20.241 -                    }
  20.242 -                }
  20.243 -            }
  20.244 -
  20.245 -            TEST_JOY_ENABLED(envr, "portb-pad", PORTB_PAD0);
  20.246 -            if (!atarijoysticks[PORTB_PAD0].enabled) {
  20.247 -                TEST_JOY_ENABLED(envr, "portb-joy0", PORTB_JOY0);
  20.248 -                TEST_JOY_ENABLED(envr, "portb-joy1", PORTB_JOY1);
  20.249 -                if (!(atarijoysticks[PORTB_JOY0].enabled)
  20.250 -                    && !(atarijoysticks[PORTB_JOY1].enabled)) {
  20.251 -                    TEST_JOY_ENABLED(envr, "portb-anpad", PORTB_ANPAD);
  20.252 -                }
  20.253 -            }
  20.254 -        }
  20.255 -
  20.256 -        if (!atarijoysticks[IKBD_JOY1].enabled) {
  20.257 -            if (SDL_AtariXbios_enabled != 0) {
  20.258 -                TEST_JOY_ENABLED(envr, "xbios-joy1", XBIOS_JOY1);
  20.259 -            }
  20.260 -        }
  20.261 -#if 0
  20.262 -        /* Parallel port on any Atari, maybe clones */
  20.263 -        if ((cookie_mch == MCH_ST << 16) || ((cookie_mch >> 16) == MCH_STE)
  20.264 -            || (cookie_mch == MCH_TT << 16)
  20.265 -            || (cookie_mch == MCH_F30 << 16)) {
  20.266 -            TEST_JOY_ENABLED(envr, "para-joy0", PARA_JOY0);
  20.267 -            TEST_JOY_ENABLED(envr, "para-joy1", PARA_JOY1);
  20.268 -        }
  20.269 -#endif
  20.270 -    }
  20.271 -
  20.272 -    /* Need to update joypad ports ? */
  20.273 -    joypad_ports_enabled = SDL_FALSE;
  20.274 -    for (i = PORTA_PAD0; i <= PORTB_ANPAD; i++) {
  20.275 -        if (atarijoysticks[i].enabled) {
  20.276 -            joypad_ports_enabled = SDL_TRUE;
  20.277 -            break;
  20.278 -        }
  20.279 -    }
  20.280 -
  20.281 -    SDL_numjoysticks = 0;
  20.282 -    for (i = 0; i < MAX_JOYSTICKS; i++) {
  20.283 -        if (atarijoysticks[i].enabled) {
  20.284 -            ++SDL_numjoysticks;
  20.285 -        }
  20.286 -    }
  20.287 -
  20.288 -    return (SDL_numjoysticks);
  20.289 -}
  20.290 -
  20.291 -static int
  20.292 -GetEnabledAtariJoystick(int index)
  20.293 -{
  20.294 -    int i, j;
  20.295 -
  20.296 -    /* Return the nth'index' enabled atari joystick */
  20.297 -    j = 0;
  20.298 -    for (i = 0; i < MAX_JOYSTICKS; i++) {
  20.299 -        if (!atarijoysticks[i].enabled) {
  20.300 -            continue;
  20.301 -        }
  20.302 -
  20.303 -        if (j == index) {
  20.304 -            break;
  20.305 -        }
  20.306 -
  20.307 -        ++j;
  20.308 -    }
  20.309 -    if (i == MAX_JOYSTICKS)
  20.310 -        return -1;
  20.311 -
  20.312 -    return i;
  20.313 -}
  20.314 -
  20.315 -const char *
  20.316 -SDL_SYS_JoystickName(int index)
  20.317 -{
  20.318 -    int numjoystick;
  20.319 -
  20.320 -    numjoystick = GetEnabledAtariJoystick(index);
  20.321 -    if (numjoystick == -1)
  20.322 -        return NULL;
  20.323 -
  20.324 -    return (atarijoysticks[numjoystick].name);
  20.325 -}
  20.326 -
  20.327 -int
  20.328 -SDL_SYS_JoystickOpen(SDL_Joystick * joystick)
  20.329 -{
  20.330 -    int numjoystick;
  20.331 -
  20.332 -    numjoystick = GetEnabledAtariJoystick(joystick->index);
  20.333 -    if (numjoystick == -1)
  20.334 -        return -1;
  20.335 -
  20.336 -    joystick->naxes = 0;
  20.337 -    joystick->nhats = 0;
  20.338 -    joystick->nballs = 0;
  20.339 -
  20.340 -    switch (numjoystick) {
  20.341 -    case PORTA_PAD0:
  20.342 -    case PORTA_PAD1:
  20.343 -    case PORTA_PAD2:
  20.344 -    case PORTA_PAD3:
  20.345 -    case PORTB_PAD0:
  20.346 -    case PORTB_PAD1:
  20.347 -    case PORTB_PAD2:
  20.348 -    case PORTB_PAD3:
  20.349 -        joystick->nhats = 1;
  20.350 -        joystick->nbuttons = JP_NUM_BUTTONS;
  20.351 -        break;
  20.352 -    case PORTA_LP:
  20.353 -    case PORTA_ANPAD:
  20.354 -    case PORTB_ANPAD:
  20.355 -        joystick->naxes = 2;
  20.356 -        joystick->nbuttons = 2;
  20.357 -        break;
  20.358 -    default:
  20.359 -        joystick->nhats = 1;
  20.360 -        joystick->nbuttons = 1;
  20.361 -        break;
  20.362 -    }
  20.363 -
  20.364 -    return (0);
  20.365 -}
  20.366 -
  20.367 -void
  20.368 -SDL_SYS_JoystickUpdate(SDL_Joystick * joystick)
  20.369 -{
  20.370 -    int numjoystick;
  20.371 -    Uint8 hatstate;
  20.372 -    Uint32 curstate, prevstate;
  20.373 -
  20.374 -    numjoystick = GetEnabledAtariJoystick(joystick->index);
  20.375 -    if (numjoystick == -1)
  20.376 -        return;
  20.377 -
  20.378 -    prevstate = atarijoysticks[numjoystick].prevstate;
  20.379 -
  20.380 -    if (joypad_ports_enabled) {
  20.381 -        Supexec(UpdateJoypads);
  20.382 -    }
  20.383 -
  20.384 -    switch (numjoystick) {
  20.385 -    case IKBD_JOY1:
  20.386 -    case XBIOS_JOY1:
  20.387 -        {
  20.388 -            curstate = 0;
  20.389 -
  20.390 -            if (numjoystick == IKBD_JOY1) {
  20.391 -                curstate = SDL_AtariIkbd_joystick & 0xff;
  20.392 -            }
  20.393 -            if (numjoystick == XBIOS_JOY1) {
  20.394 -                curstate = SDL_AtariXbios_joystick & 0xff;
  20.395 -            }
  20.396 -
  20.397 -            if (curstate != prevstate) {
  20.398 -                hatstate = SDL_HAT_CENTERED;
  20.399 -                if (curstate & IKBD_JOY_LEFT) {
  20.400 -                    hatstate |= SDL_HAT_LEFT;
  20.401 -                }
  20.402 -                if (curstate & IKBD_JOY_RIGHT) {
  20.403 -                    hatstate |= SDL_HAT_RIGHT;
  20.404 -                }
  20.405 -                if (curstate & IKBD_JOY_UP) {
  20.406 -                    hatstate |= SDL_HAT_UP;
  20.407 -                }
  20.408 -                if (curstate & IKBD_JOY_DOWN) {
  20.409 -                    hatstate |= SDL_HAT_DOWN;
  20.410 -                }
  20.411 -                SDL_PrivateJoystickHat(joystick, 0, hatstate);
  20.412 -
  20.413 -                /* Button */
  20.414 -                if ((curstate & IKBD_JOY_FIRE)
  20.415 -                    && !(prevstate & IKBD_JOY_FIRE)) {
  20.416 -                    SDL_PrivateJoystickButton(joystick, 0, SDL_PRESSED);
  20.417 -                }
  20.418 -                if (!(curstate & IKBD_JOY_FIRE)
  20.419 -                    && (prevstate & IKBD_JOY_FIRE)) {
  20.420 -                    SDL_PrivateJoystickButton(joystick, 0, SDL_RELEASED);
  20.421 -                }
  20.422 -            }
  20.423 -            atarijoysticks[numjoystick].prevstate = curstate;
  20.424 -        }
  20.425 -        break;
  20.426 -    case PORTA_PAD0:
  20.427 -    case PORTA_PAD1:
  20.428 -    case PORTA_PAD2:
  20.429 -    case PORTA_PAD3:
  20.430 -    case PORTB_PAD0:
  20.431 -    case PORTB_PAD1:
  20.432 -    case PORTB_PAD2:
  20.433 -    case PORTB_PAD3:
  20.434 -        {
  20.435 -            int numjoypad, i;
  20.436 -
  20.437 -            numjoypad = 0;
  20.438 -            switch (numjoystick) {
  20.439 -            case PORTA_PAD0:
  20.440 -                numjoypad = 0;
  20.441 -                break;
  20.442 -            case PORTA_PAD1:
  20.443 -                numjoypad = 1;
  20.444 -                break;
  20.445 -            case PORTA_PAD2:
  20.446 -                numjoypad = 2;
  20.447 -                break;
  20.448 -            case PORTA_PAD3:
  20.449 -                numjoypad = 3;
  20.450 -                break;
  20.451 -            case PORTB_PAD0:
  20.452 -                numjoypad = 4;
  20.453 -                break;
  20.454 -            case PORTB_PAD1:
  20.455 -                numjoypad = 5;
  20.456 -                break;
  20.457 -            case PORTB_PAD2:
  20.458 -                numjoypad = 6;
  20.459 -                break;
  20.460 -            case PORTB_PAD3:
  20.461 -                numjoypad = 7;
  20.462 -                break;
  20.463 -            }
  20.464 -
  20.465 -            curstate = jp_joypads[numjoypad];
  20.466 -            if (curstate != prevstate) {
  20.467 -                hatstate = SDL_HAT_CENTERED;
  20.468 -                if (curstate & (1 << JP_LEFT)) {
  20.469 -                    hatstate |= SDL_HAT_LEFT;
  20.470 -                }
  20.471 -                if (curstate & (1 << JP_RIGHT)) {
  20.472 -                    hatstate |= SDL_HAT_RIGHT;
  20.473 -                }
  20.474 -                if (curstate & (1 << JP_UP)) {
  20.475 -                    hatstate |= SDL_HAT_UP;
  20.476 -                }
  20.477 -                if (curstate & (1 << JP_DOWN)) {
  20.478 -                    hatstate |= SDL_HAT_DOWN;
  20.479 -                }
  20.480 -                SDL_PrivateJoystickHat(joystick, 0, hatstate);
  20.481 -
  20.482 -                /* Buttons */
  20.483 -                for (i = 0; i < JP_NUM_BUTTONS; i++) {
  20.484 -                    int button;
  20.485 -
  20.486 -                    button = 1 << jp_buttons[i];
  20.487 -
  20.488 -                    if ((curstate & button) && !(prevstate & button)) {
  20.489 -                        SDL_PrivateJoystickButton(joystick, i, SDL_PRESSED);
  20.490 -                    }
  20.491 -                    if (!(curstate & button) && (prevstate & button)) {
  20.492 -                        SDL_PrivateJoystickButton(joystick, i, SDL_RELEASED);
  20.493 -                    }
  20.494 -                }
  20.495 -            }
  20.496 -            atarijoysticks[numjoystick].prevstate = curstate;
  20.497 -        }
  20.498 -        break;
  20.499 -    case PORTA_JOY0:
  20.500 -    case PORTA_JOY1:
  20.501 -    case PORTB_JOY0:
  20.502 -    case PORTB_JOY1:
  20.503 -        {
  20.504 -            int fire_shift = 0, dir_shift = 0;
  20.505 -
  20.506 -            if (numjoystick == PORTA_JOY0) {
  20.507 -                fire_shift = 0;
  20.508 -                dir_shift = 0;
  20.509 -            }
  20.510 -            if (numjoystick == PORTA_JOY1) {
  20.511 -                fire_shift = 1;
  20.512 -                dir_shift = 4;
  20.513 -            }
  20.514 -            if (numjoystick == PORTB_JOY0) {
  20.515 -                fire_shift = 2;
  20.516 -                dir_shift = 8;
  20.517 -            }
  20.518 -            if (numjoystick == PORTB_JOY1) {
  20.519 -                fire_shift = 3;
  20.520 -                dir_shift = 12;
  20.521 -            }
  20.522 -
  20.523 -            curstate = (jp_directions >> dir_shift) & 15;
  20.524 -            curstate |= ((jp_fires >> fire_shift) & 1) << 4;
  20.525 -
  20.526 -            if (curstate != prevstate) {
  20.527 -                hatstate = SDL_HAT_CENTERED;
  20.528 -                if (curstate & PORT_JS_LEFT) {
  20.529 -                    hatstate |= SDL_HAT_LEFT;
  20.530 -                }
  20.531 -                if (curstate & PORT_JS_RIGHT) {
  20.532 -                    hatstate |= SDL_HAT_RIGHT;
  20.533 -                }
  20.534 -                if (curstate & PORT_JS_UP) {
  20.535 -                    hatstate |= SDL_HAT_UP;
  20.536 -                }
  20.537 -                if (curstate & PORT_JS_DOWN) {
  20.538 -                    hatstate |= SDL_HAT_DOWN;
  20.539 -                }
  20.540 -                SDL_PrivateJoystickHat(joystick, 0, hatstate);
  20.541 -
  20.542 -                /* Button */
  20.543 -                if ((curstate & PORT_JS_FIRE)
  20.544 -                    && !(prevstate & PORT_JS_FIRE)) {
  20.545 -                    SDL_PrivateJoystickButton(joystick, 0, SDL_PRESSED);
  20.546 -                }
  20.547 -                if (!(curstate & PORT_JS_FIRE)
  20.548 -                    && (prevstate & PORT_JS_FIRE)) {
  20.549 -                    SDL_PrivateJoystickButton(joystick, 0, SDL_RELEASED);
  20.550 -                }
  20.551 -            }
  20.552 -            atarijoysticks[numjoystick].prevstate = curstate;
  20.553 -        }
  20.554 -        break;
  20.555 -    case PORTA_LP:
  20.556 -        {
  20.557 -            int i;
  20.558 -
  20.559 -            curstate = jp_lightpens[0] >> 1;
  20.560 -            curstate |= (jp_lightpens[1] >> 1) << 15;
  20.561 -            curstate |= (jp_fires & 3) << 30;
  20.562 -
  20.563 -            if (curstate != prevstate) {
  20.564 -                /* X axis */
  20.565 -                SDL_PrivateJoystickAxis(joystick, 0,
  20.566 -                                        jp_lightpens[0] ^ 0x8000);
  20.567 -                /* Y axis */
  20.568 -                SDL_PrivateJoystickAxis(joystick, 1,
  20.569 -                                        jp_lightpens[1] ^ 0x8000);
  20.570 -                /* Buttons */
  20.571 -                for (i = 0; i < 2; i++) {
  20.572 -                    int button;
  20.573 -
  20.574 -                    button = 1 << (30 + i);
  20.575 -
  20.576 -                    if ((curstate & button) && !(prevstate & button)) {
  20.577 -                        SDL_PrivateJoystickButton(joystick, i, SDL_PRESSED);
  20.578 -                    }
  20.579 -                    if (!(curstate & button) && (prevstate & button)) {
  20.580 -                        SDL_PrivateJoystickButton(joystick, i, SDL_RELEASED);
  20.581 -                    }
  20.582 -                }
  20.583 -            }
  20.584 -            atarijoysticks[numjoystick].prevstate = curstate;
  20.585 -        }
  20.586 -        break;
  20.587 -    case PORTA_ANPAD:
  20.588 -    case PORTB_ANPAD:
  20.589 -        {
  20.590 -            int numpaddle, i;
  20.591 -
  20.592 -            numpaddle = 0 << 1;
  20.593 -            if (numjoystick == PORTB_ANPAD)
  20.594 -                numpaddle = 1 << 1;
  20.595 -
  20.596 -            curstate = jp_paddles[numpaddle] >> 1;
  20.597 -            curstate |= (jp_paddles[numpaddle + 1] >> 1) << 15;
  20.598 -            curstate |= ((jp_fires >> numpaddle) & 3) << 30;
  20.599 -
  20.600 -            if (curstate != prevstate) {
  20.601 -                /* X axis */
  20.602 -                SDL_PrivateJoystickAxis(joystick, 0,
  20.603 -                                        jp_paddles[numpaddle] ^ 0x8000);
  20.604 -                /* Y axis */
  20.605 -                SDL_PrivateJoystickAxis(joystick, 1,
  20.606 -                                        jp_paddles[numpaddle + 1] ^ 0x8000);
  20.607 -                /* Buttons */
  20.608 -                for (i = 0; i < 2; i++) {
  20.609 -                    int button;
  20.610 -
  20.611 -                    button = 1 << (30 + i);
  20.612 -
  20.613 -                    if ((curstate & button) && !(prevstate & button)) {
  20.614 -                        SDL_PrivateJoystickButton(joystick, i, SDL_PRESSED);
  20.615 -                    }
  20.616 -                    if (!(curstate & button) && (prevstate & button)) {
  20.617 -                        SDL_PrivateJoystickButton(joystick, i, SDL_RELEASED);
  20.618 -                    }
  20.619 -                }
  20.620 -            }
  20.621 -            atarijoysticks[numjoystick].prevstate = curstate;
  20.622 -        }
  20.623 -        break;
  20.624 -#if 0
  20.625 -    case PARA_JOY0:
  20.626 -    case PARA_JOY1:
  20.627 -        break;
  20.628 -#endif
  20.629 -    };
  20.630 -
  20.631 -    return;
  20.632 -}
  20.633 -
  20.634 -void
  20.635 -SDL_SYS_JoystickClose(SDL_Joystick * joystick)
  20.636 -{
  20.637 -    return;
  20.638 -}
  20.639 -
  20.640 -void
  20.641 -SDL_SYS_JoystickQuit(void)
  20.642 -{
  20.643 -    SDL_numjoysticks = 0;
  20.644 -    return;
  20.645 -}
  20.646 -
  20.647 -/*--- Joypad I/O read/write interface ---*/
  20.648 -
  20.649 -#define JOYPAD_IO_BASE (0xffff9200)
  20.650 -struct JOYPAD_IO_S
  20.651 -{
  20.652 -    Uint16 fires;
  20.653 -    Uint16 directions;
  20.654 -    Uint16 dummy1[6];
  20.655 -    Uint16 paddles[4];
  20.656 -    Uint16 dummy2[4];
  20.657 -    Uint16 lightpens[2];
  20.658 -};
  20.659 -#define JOYPAD_IO ((*(volatile struct JOYPAD_IO_S *)JOYPAD_IO_BASE))
  20.660 -
  20.661 -static const Uint16 joypad_masks[8 * 4] = {
  20.662 -    0xfffe, 0xfffd, 0xfffb, 0xfff7,
  20.663 -    0xfff0, 0xfff1, 0xfff2, 0xfff3,
  20.664 -    0xfff4, 0xfff5, 0xfff6, 0xfff8,
  20.665 -    0xfff9, 0xfffa, 0xfffc, 0xffff,
  20.666 -    0xffef, 0xffdf, 0xffbf, 0xff7f,
  20.667 -    0xff0f, 0xff1f, 0xff2f, 0xff3f,
  20.668 -    0xff4f, 0xff5f, 0xff6f, 0xff8f,
  20.669 -    0xff9f, 0xffaf, 0xffcf, 0xffff
  20.670 -};
  20.671 -
  20.672 -static void
  20.673 -UpdateJoypads(void)
  20.674 -{
  20.675 -    Uint16 tmp, i, j;
  20.676 -    Uint32 cur_fire, cur_dir;
  20.677 -
  20.678 -        /*--- This function is called in supervisor mode ---*/
  20.679 -
  20.680 -    /* Update joysticks */
  20.681 -    jp_fires = (~(JOYPAD_IO.fires)) & 15;
  20.682 -    jp_directions = (~(JOYPAD_IO.directions));
  20.683 -
  20.684 -    /* Update lightpen */
  20.685 -    tmp = JOYPAD_IO.lightpens[0] & 1023;
  20.686 -    jp_lightpens[0] = (tmp << 6) | (tmp >> 4);
  20.687 -    tmp = JOYPAD_IO.lightpens[1] & 1023;
  20.688 -    jp_lightpens[1] = (tmp << 6) | (tmp >> 4);
  20.689 -
  20.690 -    /* Update paddles */
  20.691 -    tmp = (JOYPAD_IO.paddles[0] & 255);
  20.692 -    jp_paddles[0] = (tmp << 8) | tmp;
  20.693 -    tmp = (JOYPAD_IO.paddles[1] & 255);
  20.694 -    jp_paddles[1] = (tmp << 8) | tmp;
  20.695 -    tmp = (JOYPAD_IO.paddles[2] & 255);
  20.696 -    jp_paddles[2] = (tmp << 8) | tmp;
  20.697 -    tmp = (JOYPAD_IO.paddles[3] & 255);
  20.698 -    jp_paddles[3] = (tmp << 8) | tmp;
  20.699 -
  20.700 -    /* Update joypads on teamtap port A */
  20.701 -    for (i = 0; i < 4; i++) {
  20.702 -        jp_joypads[i] = 0;
  20.703 -        for (j = 0; j < 4; j++) {
  20.704 -            JOYPAD_IO.directions = joypad_masks[(i * 4) + j];
  20.705 -
  20.706 -            cur_fire = (~(JOYPAD_IO.fires) & 3) << 16;
  20.707 -            cur_dir = (~(JOYPAD_IO.directions) >> 8) & 15;
  20.708 -
  20.709 -            jp_joypads[i] |= cur_fire << (j * 2);
  20.710 -            jp_joypads[i] |= cur_dir << (j * 4);
  20.711 -        }
  20.712 -    }
  20.713 -
  20.714 -    /* Update joypads on teamtap port B */
  20.715 -    for (i = 4; i < 8; i++) {
  20.716 -        jp_joypads[i] = 0;
  20.717 -        for (j = 0; j < 4; j++) {
  20.718 -            JOYPAD_IO.directions = joypad_masks[(i * 4) + j];
  20.719 -
  20.720 -            cur_fire = (~(JOYPAD_IO.fires) & 0xc) << 14;
  20.721 -            cur_dir = (~(JOYPAD_IO.directions) >> 12) & 15;
  20.722 -
  20.723 -            jp_joypads[i] |= cur_fire << (j * 2);
  20.724 -            jp_joypads[i] |= cur_dir << (j * 4);
  20.725 -        }
  20.726 -    }
  20.727 -
  20.728 -    JOYPAD_IO.directions = 0xffff;
  20.729 -}
  20.730 -
  20.731 -#endif /* SDL_JOYSTICK_MINT */
  20.732 -/* vi: set ts=4 sw=4 expandtab: */
    21.1 --- a/src/loadso/mint/SDL_sysloadso.c	Sun Sep 20 04:13:23 2009 +0000
    21.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.3 @@ -1,67 +0,0 @@
    21.4 -/*
    21.5 -    SDL - Simple DirectMedia Layer
    21.6 -    Copyright (C) 1997-2009 Sam Lantinga
    21.7 -
    21.8 -    This library is free software; you can redistribute it and/or
    21.9 -    modify it under the terms of the GNU Lesser General Public
   21.10 -    License as published by the Free Software Foundation; either
   21.11 -    version 2.1 of the License, or (at your option) any later version.
   21.12 -
   21.13 -    This library is distributed in the hope that it will be useful,
   21.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   21.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   21.16 -    Lesser General Public License for more details.
   21.17 -
   21.18 -    You should have received a copy of the GNU Lesser General Public
   21.19 -    License along with this library; if not, write to the Free Software
   21.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   21.21 -
   21.22 -    Sam Lantinga
   21.23 -    slouken@libsdl.org
   21.24 -*/
   21.25 -#include "SDL_config.h"
   21.26 -
   21.27 -#ifdef SDL_LOADSO_LDG
   21.28 -
   21.29 -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
   21.30 -/* System dependent library loading routines                           */
   21.31 -
   21.32 -#include <stdio.h>
   21.33 -#include <gem.h>
   21.34 -#include <ldg.h>
   21.35 -
   21.36 -#include "SDL_loadso.h"
   21.37 -
   21.38 -void *
   21.39 -SDL_LoadObject(const char *sofile)
   21.40 -{
   21.41 -    const char *loaderror = "Unknown error";
   21.42 -    void *handle = (void *) ldg_open((char *) sofile, ldg_global);
   21.43 -    if (handle == NULL) {
   21.44 -        SDL_SetError("Failed loading %s: %s", sofile, loaderror);
   21.45 -    }
   21.46 -    return (handle);
   21.47 -}
   21.48 -
   21.49 -void *
   21.50 -SDL_LoadFunction(void *handle, const char *name)
   21.51 -{
   21.52 -    const char *loaderror = "Unknown error";
   21.53 -    void *symbol = (void *) ldg_find((char *) name, (LDG *) handle);
   21.54 -    if (symbol == NULL) {
   21.55 -        SDL_SetError("Failed loading %s: %s", name, loaderror);
   21.56 -    }
   21.57 -    return (symbol);
   21.58 -}
   21.59 -
   21.60 -void
   21.61 -SDL_UnloadObject(void *handle)
   21.62 -{
   21.63 -    if (handle != NULL) {
   21.64 -        ldg_close((LDG *) handle, ldg_global);
   21.65 -    }
   21.66 -}
   21.67 -
   21.68 -#endif /* SDL_LOADSO_LDG */
   21.69 -
   21.70 -/* vi: set ts=4 sw=4 expandtab: */
    22.1 --- a/src/timer/mint/SDL_systimer.c	Sun Sep 20 04:13:23 2009 +0000
    22.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.3 @@ -1,155 +0,0 @@
    22.4 -/*
    22.5 -    SDL - Simple DirectMedia Layer
    22.6 -    Copyright (C) 1997-2009 Sam Lantinga
    22.7 -
    22.8 -    This library is free software; you can redistribute it and/or
    22.9 -    modify it under the terms of the GNU Lesser General Public
   22.10 -    License as published by the Free Software Foundation; either
   22.11 -    version 2.1 of the License, or (at your option) any later version.
   22.12 -
   22.13 -    This library is distributed in the hope that it will be useful,
   22.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   22.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   22.16 -    Lesser General Public License for more details.
   22.17 -
   22.18 -    You should have received a copy of the GNU Lesser General Public
   22.19 -    License along with this library; if not, write to the Free Software
   22.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   22.21 -
   22.22 -    Sam Lantinga
   22.23 -    slouken@libsdl.org
   22.24 -*/
   22.25 -#include "SDL_config.h"
   22.26 -
   22.27 -#ifdef SDL_TIMER_MINT
   22.28 -
   22.29 -/*
   22.30 - *	TOS/MiNT timer driver
   22.31 - *	based on vbl vector
   22.32 - *
   22.33 - *	Patrice Mandin
   22.34 - */
   22.35 -
   22.36 -#include <stdio.h>
   22.37 -#include <sys/time.h>
   22.38 -#include <signal.h>
   22.39 -#include <unistd.h>
   22.40 -#include <string.h>
   22.41 -#include <errno.h>
   22.42 -
   22.43 -#include <mint/cookie.h>
   22.44 -#include <mint/sysvars.h>
   22.45 -#include <mint/osbind.h>
   22.46 -#include <mint/mintbind.h>
   22.47 -
   22.48 -#include "SDL_timer.h"
   22.49 -#include "../SDL_timer_c.h"
   22.50 -#include "SDL_thread.h"
   22.51 -
   22.52 -#include "SDL_vbltimer_s.h"
   22.53 -
   22.54 -/* from audio/mint */
   22.55 -void SDL_MintAudio_CheckFpu(void);
   22.56 -
   22.57 -/* The first ticks value of the application */
   22.58 -static Uint32 start;
   22.59 -static SDL_bool read_hz200_from_vbl = SDL_FALSE;
   22.60 -static int mint_present;        /* can we use Syield() ? */
   22.61 -
   22.62 -void
   22.63 -SDL_StartTicks(void)
   22.64 -{
   22.65 -    void *oldpile;
   22.66 -    unsigned long dummy;
   22.67 -
   22.68 -    /* Set first ticks value */
   22.69 -    oldpile = (void *) Super(0);
   22.70 -    start = *((volatile long *) _hz_200);
   22.71 -    Super(oldpile);
   22.72 -
   22.73 -    start *= 5;                 /* One _hz_200 tic is 5ms */
   22.74 -
   22.75 -    mint_present = (Getcookie(C_MiNT, &dummy) == C_FOUND);
   22.76 -}
   22.77 -
   22.78 -Uint32
   22.79 -SDL_GetTicks(void)
   22.80 -{
   22.81 -    Uint32 now = start;
   22.82 -
   22.83 -    if (read_hz200_from_vbl) {
   22.84 -        now = SDL_Atari_hz200;
   22.85 -    } else {
   22.86 -        void *old_stack = (void *) Super(0);
   22.87 -        now = *((volatile long *) _hz_200);
   22.88 -        Super(old_stack);
   22.89 -    }
   22.90 -
   22.91 -    return ((now * 5) - start);
   22.92 -}
   22.93 -
   22.94 -void
   22.95 -SDL_Delay(Uint32 ms)
   22.96 -{
   22.97 -    Uint32 now;
   22.98 -
   22.99 -    now = SDL_GetTicks();
  22.100 -    while ((SDL_GetTicks() - now) < ms) {
  22.101 -        if (mint_present) {
  22.102 -            Syield();
  22.103 -        }
  22.104 -    }
  22.105 -}
  22.106 -
  22.107 -/* Data to handle a single periodic alarm */
  22.108 -static SDL_bool timer_installed = SDL_FALSE;
  22.109 -
  22.110 -/* This is only called if the event thread is not running */
  22.111 -int
  22.112 -SDL_SYS_TimerInit(void)
  22.113 -{
  22.114 -    void *old_stack;
  22.115 -
  22.116 -    SDL_MintAudio_CheckFpu();
  22.117 -
  22.118 -    /* Install RunTimer in vbl vector */
  22.119 -    old_stack = (void *) Super(0);
  22.120 -    timer_installed = !SDL_AtariVblInstall(SDL_ThreadedTimerCheck);
  22.121 -    Super(old_stack);
  22.122 -
  22.123 -    if (!timer_installed) {
  22.124 -        return (-1);
  22.125 -    }
  22.126 -
  22.127 -    read_hz200_from_vbl = SDL_TRUE;
  22.128 -    return (SDL_SetTimerThreaded(0));
  22.129 -}
  22.130 -
  22.131 -void
  22.132 -SDL_SYS_TimerQuit(void)
  22.133 -{
  22.134 -    if (timer_installed) {
  22.135 -        /* Uninstall RunTimer vbl vector */
  22.136 -        void *old_stack = (void *) Super(0);
  22.137 -        SDL_AtariVblUninstall(SDL_ThreadedTimerCheck);
  22.138 -        Super(old_stack);
  22.139 -        timer_installed = SDL_FALSE;
  22.140 -    }
  22.141 -    read_hz200_from_vbl = SDL_FALSE;
  22.142 -}
  22.143 -
  22.144 -int
  22.145 -SDL_SYS_StartTimer(void)
  22.146 -{
  22.147 -    SDL_SetError("Internal logic error: MiNT uses vbl timer");
  22.148 -    return (-1);
  22.149 -}
  22.150 -
  22.151 -void
  22.152 -SDL_SYS_StopTimer(void)
  22.153 -{
  22.154 -    return;
  22.155 -}
  22.156 -
  22.157 -#endif /* SDL_TIMER_MINT */
  22.158 -/* vi: set ts=4 sw=4 expandtab: */
    23.1 --- a/src/timer/mint/SDL_vbltimer.S	Sun Sep 20 04:13:23 2009 +0000
    23.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.3 @@ -1,159 +0,0 @@
    23.4 -/*
    23.5 -    SDL - Simple DirectMedia Layer
    23.6 -    Copyright (C) 1997-2009 Sam Lantinga
    23.7 -
    23.8 -    This library is free software; you can redistribute it and/or
    23.9 -    modify it under the terms of the GNU Lesser General Public
   23.10 -    License as published by the Free Software Foundation; either
   23.11 -    version 2.1 of the License, or (at your option) any later version.
   23.12 -
   23.13 -    This library is distributed in the hope that it will be useful,
   23.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   23.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   23.16 -    Lesser General Public License for more details.
   23.17 -
   23.18 -    You should have received a copy of the GNU Lesser General Public
   23.19 -    License along with this library; if not, write to the Free Software
   23.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   23.21 -
   23.22 -    Sam Lantinga
   23.23 -    slouken@libsdl.org
   23.24 -*/
   23.25 -
   23.26 -/*
   23.27 - *	VBL queue routine
   23.28 - *
   23.29 - *	Patrice Mandin
   23.30 - */
   23.31 -
   23.32 -#define _vbl_queue 0x456
   23.33 -#define _hz_200    0x4ba
   23.34 -
   23.35 -	.text
   23.36 -
   23.37 -	.globl	_SDL_AtariVblInstall
   23.38 -	.globl	_SDL_AtariVblUninstall
   23.39 -
   23.40 -	.globl	_SDL_MintAudio_hasfpu
   23.41 -
   23.42 -/*--- Vector installer ---*/
   23.43 -
   23.44 -_SDL_AtariVblInstall:
   23.45 -	movel	sp@(4),my_vector
   23.46 -	lea		_my_vbl,a0
   23.47 -
   23.48 -	clrw	vbl_mutex
   23.49 -	movel	_hz_200.w, _SDL_Atari_hz200
   23.50 -
   23.51 -	/* Stop interrupts */
   23.52 -
   23.53 -	movew	#0x2700,sr
   23.54 -
   23.55 -	/* Read vbl_queue pointer */
   23.56 -	movel	_vbl_queue.w,a1
   23.57 -
   23.58 -	/* Search a free place */
   23.59 -	moveq	#7,d0
   23.60 -bcl_search_place:
   23.61 -	movel	(a1),d1
   23.62 -	beqs	place_found
   23.63 -	addql	#4,a1
   23.64 -	dbra	d0,bcl_search_place
   23.65 -
   23.66 -	/* Not found */
   23.67 -	moveq	#1,d0
   23.68 -	bras	exit_vbl_queue
   23.69 -
   23.70 -	/* Then install ourselves */
   23.71 -place_found:
   23.72 -	movel	a0,(a1)
   23.73 -	moveq	#0,d0	
   23.74 -
   23.75 -exit_vbl_queue:
   23.76 -	/* Restart interrupts */
   23.77 -	movew	#0x2300,sr
   23.78 -
   23.79 -	rts
   23.80 -
   23.81 -/*--- Vector uninstaller ---*/
   23.82 -
   23.83 -_SDL_AtariVblUninstall:
   23.84 -	movel	sp@(4),d0
   23.85 -	cmpl	my_vector,d0
   23.86 -	bnes	badvector
   23.87 -	
   23.88 -	movel	#_my_vbl,d0
   23.89 -
   23.90 -	/* Stop interrupts */
   23.91 -
   23.92 -	movew	#0x2700,sr
   23.93 -
   23.94 -	/* Read vbl_queue pointer */
   23.95 -	movel	_vbl_queue.w,a1
   23.96 -
   23.97 -	/* Search where we are */
   23.98 -	moveq	#7,d1
   23.99 -bcl2_search_place:
  23.100 -	cmpl	(a1),d0
  23.101 -	bnes	next_place
  23.102 -	clrl	(a1)
  23.103 -	moveq	#0,d1
  23.104 -next_place:
  23.105 -	addql	#4,a1
  23.106 -	dbra	d1,bcl2_search_place
  23.107 -
  23.108 -	/* Restart interrupts */
  23.109 -	movew	#0x2300,sr
  23.110 -badvector:
  23.111 -	rts
  23.112 -
  23.113 -/*--- Our vbl ---*/
  23.114 -
  23.115 -_my_vbl:
  23.116 -	/* Update _hz_200 */
  23.117 -	movel	_hz_200.w, _SDL_Atari_hz200
  23.118 -
  23.119 -	/* Verify if this is not already running */
  23.120 -
  23.121 -	tstw	vbl_mutex
  23.122 -	bnes	vbl_end
  23.123 -	notw	vbl_mutex
  23.124 -
  23.125 -	moveml	d0-d7/a0-a6,sp@-
  23.126 -
  23.127 -	/* Save FPU if needed */
  23.128 -	tstw	_SDL_MintAudio_hasfpu
  23.129 -	beqs	SDL_AtariVbl_nofpu1
  23.130 -	.chip	68060
  23.131 -	fsave	sp@-
  23.132 -	fmoveml fpcr/fpsr/fpiar,sp@-
  23.133 -	fmovemx	fp0-fp7,sp@-
  23.134 -	.chip	68000
  23.135 -SDL_AtariVbl_nofpu1:
  23.136 -
  23.137 -	movel	my_vector,a0
  23.138 -	jsr		a0@
  23.139 -
  23.140 -	/* Restore FPU if needed */
  23.141 -	tstw	_SDL_MintAudio_hasfpu
  23.142 -	beqs	SDL_AtariVbl_Xbios_nofpu2
  23.143 -	.chip	68060
  23.144 -	fmovemx	sp@+,fp0-fp7
  23.145 -	fmoveml	sp@+,fpcr/fpsr/fpiar
  23.146 -	frestore	sp@+
  23.147 -	.chip	68000
  23.148 -SDL_AtariVbl_Xbios_nofpu2:
  23.149 -
  23.150 -	moveml	sp@+,d0-d7/a0-a6
  23.151 -
  23.152 -	clrw	vbl_mutex
  23.153 -vbl_end:
  23.154 -	rts
  23.155 -
  23.156 -	.data
  23.157 -	.even
  23.158 -	.comm	_SDL_Atari_hz200,4*1
  23.159 -	.even
  23.160 -	.comm	vbl_mutex,2*1
  23.161 -	.even
  23.162 -	.comm	my_vector,4*1
    24.1 --- a/src/timer/mint/SDL_vbltimer_s.h	Sun Sep 20 04:13:23 2009 +0000
    24.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.3 @@ -1,36 +0,0 @@
    24.4 -/*
    24.5 -    SDL - Simple DirectMedia Layer
    24.6 -    Copyright (C) 1997-2009 Sam Lantinga
    24.7 -
    24.8 -    This library is free software; you can redistribute it and/or
    24.9 -    modify it under the terms of the GNU Lesser General Public
   24.10 -    License as published by the Free Software Foundation; either
   24.11 -    version 2.1 of the License, or (at your option) any later version.
   24.12 -
   24.13 -    This library is distributed in the hope that it will be useful,
   24.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   24.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   24.16 -    Lesser General Public License for more details.
   24.17 -
   24.18 -    You should have received a copy of the GNU Lesser General Public
   24.19 -    License along with this library; if not, write to the Free Software
   24.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   24.21 -
   24.22 -    Sam Lantinga
   24.23 -    slouken@libsdl.org
   24.24 -*/
   24.25 -#include "SDL_config.h"
   24.26 -
   24.27 -/*
   24.28 - *	TOS/MiNT timer driver
   24.29 - *	based on vbl vector
   24.30 - *
   24.31 - *	Patrice Mandin
   24.32 - */
   24.33 -
   24.34 -extern volatile long SDL_Atari_hz200;
   24.35 -
   24.36 -/* Functions prototypes */
   24.37 -extern int SDL_AtariVblInstall(void *newvector);
   24.38 -extern void SDL_AtariVblUninstall(void *newvector);
   24.39 -/* vi: set ts=4 sw=4 expandtab: */
    25.1 --- a/src/video/SDL_renderer_gl.c	Sun Sep 20 04:13:23 2009 +0000
    25.2 +++ b/src/video/SDL_renderer_gl.c	Sun Sep 20 04:15:19 2009 +0000
    25.3 @@ -234,8 +234,6 @@
    25.4  {
    25.5  #if defined(__QNXNTO__) && (_NTO_VERSION < 630)
    25.6  #define __SDL_NOGETPROCADDR__
    25.7 -#elif defined(__MINT__)
    25.8 -#define __SDL_NOGETPROCADDR__
    25.9  #endif
   25.10  #ifdef __SDL_NOGETPROCADDR__
   25.11  #define SDL_PROC(ret,func,params) data->func=func;
    26.1 --- a/src/video/SDL_sysvideo.h	Sun Sep 20 04:13:23 2009 +0000
    26.2 +++ b/src/video/SDL_sysvideo.h	Sun Sep 20 04:15:19 2009 +0000
    26.3 @@ -379,12 +379,6 @@
    26.4  #if SDL_VIDEO_DRIVER_EPOC
    26.5  extern VideoBootStrap EPOC_bootstrap;
    26.6  #endif
    26.7 -#if SDL_VIDEO_DRIVER_XBIOS
    26.8 -extern VideoBootStrap XBIOS_bootstrap;
    26.9 -#endif
   26.10 -#if SDL_VIDEO_DRIVER_GEM
   26.11 -extern VideoBootStrap GEM_bootstrap;
   26.12 -#endif
   26.13  #if SDL_VIDEO_DRIVER_RISCOS
   26.14  extern VideoBootStrap RISCOS_bootstrap;
   26.15  #endif
    27.1 --- a/src/video/SDL_video.c	Sun Sep 20 04:13:23 2009 +0000
    27.2 +++ b/src/video/SDL_video.c	Sun Sep 20 04:15:19 2009 +0000
    27.3 @@ -88,12 +88,6 @@
    27.4  #if SDL_VIDEO_DRIVER_EPOC
    27.5      &EPOC_bootstrap,
    27.6  #endif
    27.7 -#if SDL_VIDEO_DRIVER_XBIOS
    27.8 -    &XBIOS_bootstrap,
    27.9 -#endif
   27.10 -#if SDL_VIDEO_DRIVER_GEM
   27.11 -    &GEM_bootstrap,
   27.12 -#endif
   27.13  #if SDL_VIDEO_DRIVER_RISCOS
   27.14      &RISCOS_bootstrap,
   27.15  #endif
    28.1 --- a/src/video/ataricommon/SDL_ataric2p.S	Sun Sep 20 04:13:23 2009 +0000
    28.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.3 @@ -1,447 +0,0 @@
    28.4 -/*
    28.5 -    SDL - Simple DirectMedia Layer
    28.6 -    Copyright (C) 1997-2009 Sam Lantinga
    28.7 -
    28.8 -    This library is free software; you can redistribute it and/or
    28.9 -    modify it under the terms of the GNU Lesser General Public
   28.10 -    License as published by the Free Software Foundation; either
   28.11 -    version 2.1 of the License, or (at your option) any later version.
   28.12 -
   28.13 -    This library is distributed in the hope that it will be useful,
   28.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   28.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   28.16 -    Lesser General Public License for more details.
   28.17 -
   28.18 -    You should have received a copy of the GNU Lesser General Public
   28.19 -    License along with this library; if not, write to the Free Software
   28.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   28.21 -
   28.22 -    Sam Lantinga
   28.23 -    slouken@libsdl.org
   28.24 -*/
   28.25 -
   28.26 -/*
   28.27 -	Chunky to planar conversion routine
   28.28 -	1 byte/pixel -> 4 or 8 bit planes
   28.29 -
   28.30 -	Patrice Mandin
   28.31 -	Xavier Joubert
   28.32 -	Mikael Kalms
   28.33 -*/
   28.34 -
   28.35 -	.globl	_SDL_Atari_C2pConvert
   28.36 -	.globl	_SDL_Atari_C2pConvert8
   28.37 -	.globl	_SDL_Atari_C2pConvert4
   28.38 -	.globl	_SDL_Atari_C2pConvert4_pal
   28.39 -
   28.40 -/* ------------	Conversion C2P, 8 bits ------------ */
   28.41 -
   28.42 -	.text
   28.43 -_SDL_Atari_C2pConvert8:
   28.44 -	movel	sp@(4),c2p_source
   28.45 -	movel	sp@(8),c2p_dest
   28.46 -	movel	sp@(12),c2p_width
   28.47 -	movel	sp@(16),c2p_height
   28.48 -	movel	sp@(20),c2p_dblligne
   28.49 -	movel	sp@(24),c2p_srcpitch
   28.50 -	movel	sp@(28),c2p_dstpitch
   28.51 -
   28.52 -	moveml	d2-d7/a2-a6,sp@-
   28.53 -
   28.54 -	movel	c2p_source,c2p_cursrc
   28.55 -	movel	c2p_dest,c2p_curdst
   28.56 -	movel	#0x0f0f0f0f,d4
   28.57 -	movel	#0x00ff00ff,d5
   28.58 -	movel	#0x55555555,d6
   28.59 -	movew	c2p_height+2,c2p_row
   28.60 -	movew	c2p_width+2,d0
   28.61 -	andw	#-8,d0
   28.62 -	movew	d0,c2p_rowlen
   28.63 -
   28.64 -SDL_Atari_C2p8_rowloop:
   28.65 -
   28.66 -	movel	c2p_cursrc,a0
   28.67 -	movel	c2p_curdst,a1
   28.68 -
   28.69 -	movel	a0,a2
   28.70 -	addw	c2p_rowlen,a2
   28.71 -
   28.72 -	movel	a0@+,d0
   28.73 -	movel	a0@+,d1
   28.74 -	movel	a0@+,d2
   28.75 -	movel	a0@+,d3
   28.76 -/*
   28.77 -	d0 = a7a6a5a4a3a2a1a0 b7b6b5b4b3b2b1b0 c7c6c5c4c3c2c1c0 d7d6d5d4d3d2d1d0
   28.78 -	d1 = e7e6e5e4e3e2e1e0 f7f6f5f4f3f2f1f0 g7g6g5g4g3g2g1g0 h7h6h5h4h3h2h1h0
   28.79 -	d2 = i7i6i5i4i3i2i1i0 j7j6j5j4j3j2j1j0 k7k6k5k4k3k2k1k0 l7l6l5l4l3l2l1l0
   28.80 -	d3 = m7m6m5m4m3m2m1m0 n7n6n5n4n3n2n1n0 o7o6o5o4o3o2o1o0 p7p6p5p4p3p2p1p0
   28.81 -*/
   28.82 -	movel	d1,d7
   28.83 -	lsrl	#4,d7
   28.84 -	eorl	d0,d7
   28.85 -	andl	d4,d7
   28.86 -	eorl	d7,d0
   28.87 -	lsll	#4,d7
   28.88 -	eorl	d7,d1
   28.89 -
   28.90 -	movel	d3,d7
   28.91 -	lsrl	#4,d7
   28.92 -	eorl	d2,d7
   28.93 -	andl	d4,d7
   28.94 -	eorl	d7,d2
   28.95 -	lsll	#4,d7
   28.96 -	eorl	d7,d3
   28.97 -
   28.98 -	movel	d2,d7
   28.99 -	lsrl	#8,d7
  28.100 -	eorl	d0,d7
  28.101 - 	andl	d5,d7
  28.102 -	eorl	d7,d0
  28.103 -	lsll	#8,d7
  28.104 -	eorl	d7,d2
  28.105 -
  28.106 -	movel	d3,d7
  28.107 -	lsrl	#8,d7
  28.108 -	eorl	d1,d7
  28.109 - 	andl	d5,d7
  28.110 -	eorl	d7,d1
  28.111 -	lsll	#8,d7
  28.112 -	eorl	d7,d3
  28.113 -/*
  28.114 -	d0 = a7a6a5a4e7e6e5e4 i7i6i5i4m7m6m5m4 c7c6c5c4g7g6g5g4 k7k6k5k4o7o6o5o4
  28.115 -	d1 = a3a2a1a0e3e2e1e0 i3i2i1i0m3m2m1m0 c3c2c1c0g3g2g1g0 k3k2k1k0o3o2o1o0
  28.116 -	d2 = b7b6b5b4f7f6f5f4 j7j6j5j4n7n6n5n4 d7d6d5d4h7h6h5h4 l7l6l5l4p7p6p5p4
  28.117 -	d3 = b3b2b1b0f3f2f1f0 j3j2j1j0n3n2n1n0 d3d2d1d0h3h2h1h0 l3l2l1l0p3p2p1p0
  28.118 -*/
  28.119 -	bras	SDL_Atari_C2p8_start
  28.120 -
  28.121 -SDL_Atari_C2p8_pix16:
  28.122 -
  28.123 -	movel	a0@+,d0
  28.124 -	movel	a0@+,d1
  28.125 -	movel	a0@+,d2
  28.126 -	movel	a0@+,d3
  28.127 -/*
  28.128 -	d0 = a7a6a5a4a3a2a1a0 b7b6b5b4b3b2b1b0 c7c6c5c4c3c2c1c0 d7d6d5d4d3d2d1d0
  28.129 -	d1 = e7e6e5e4e3e2e1e0 f7f6f5f4f3f2f1f0 g7g6g5g4g3g2g1g0 h7h6h5h4h3h2h1h0
  28.130 -	d2 = i7i6i5i4i3i2i1i0 j7j6j5j4j3j2j1j0 k7k6k5k4k3k2k1k0 l7l6l5l4l3l2l1l0
  28.131 -	d3 = m7m6m5m4m3m2m1m0 n7n6n5n4n3n2n1n0 o7o6o5o4o3o2o1o0 p7p6p5p4p3p2p1p0
  28.132 -*/
  28.133 -	movel	d1,d7
  28.134 -	lsrl	#4,d7
  28.135 -	movel	a3,a1@+
  28.136 -	eorl	d0,d7
  28.137 -	andl	d4,d7
  28.138 -	eorl	d7,d0
  28.139 -	lsll	#4,d7
  28.140 -	eorl	d7,d1
  28.141 -
  28.142 -	movel	d3,d7
  28.143 -	lsrl	#4,d7
  28.144 -	eorl	d2,d7
  28.145 -	andl	d4,d7
  28.146 -	eorl	d7,d2
  28.147 -	movel	a4,a1@+
  28.148 -	lsll	#4,d7
  28.149 -	eorl	d7,d3
  28.150 -
  28.151 -	movel	d2,d7
  28.152 -	lsrl	#8,d7
  28.153 -	eorl	d0,d7
  28.154 -	andl	d5,d7
  28.155 -	eorl	d7,d0
  28.156 -	movel	a5,a1@+
  28.157 -	lsll	#8,d7
  28.158 -	eorl	d7,d2
  28.159 -
  28.160 -	movel	d3,d7
  28.161 -	lsrl	#8,d7
  28.162 -	eorl	d1,d7
  28.163 -	andl	d5,d7
  28.164 -	eorl	d7,d1
  28.165 -	movel	a6,a1@+
  28.166 -	lsll	#8,d7
  28.167 -	eorl	d7,d3
  28.168 -/*
  28.169 -	d0 = a7a6a5a4e7e6e5e4 i7i6i5i4m7m6m5m4 c7c6c5c4g7g6g5g4 k7k6k5k4o7o6o5o4
  28.170 -	d1 = a3a2a1a0e3e2e1e0 i3i2i1i0m3m2m1m0 c3c2c1c0g3g2g1g0 k3k2k1k0o3o2o1o0
  28.171 -	d2 = b7b6b5b4f7f6f5f4 j7j6j5j4n7n6n5n4 d7d6d5d4h7h6h5h4 l7l6l5l4p7p6p5p4
  28.172 -	d3 = b3b2b1b0f3f2f1f0 j3j2j1j0n3n2n1n0 d3d2d1d0h3h2h1h0 l3l2l1l0p3p2p1p0
  28.173 -*/
  28.174 -
  28.175 -SDL_Atari_C2p8_start:
  28.176 -
  28.177 -	movel	d2,d7
  28.178 -	lsrl	#1,d7
  28.179 -	eorl	d0,d7
  28.180 -	andl	d6,d7
  28.181 -	eorl	d7,d0
  28.182 -	addl	d7,d7
  28.183 -	eorl	d7,d2
  28.184 -
  28.185 -	movel	d3,d7
  28.186 -	lsrl	#1,d7
  28.187 -	eorl	d1,d7
  28.188 -	andl	d6,d7
  28.189 -	eorl	d7,d1
  28.190 -	addl	d7,d7
  28.191 -	eorl	d7,d3
  28.192 -/*
  28.193 -	d0 = a7b7a5b5e7f7e5f5 i7j7i5j5m7n7m5n5 c7d7c5d5g7h7g5h5 k7l7k5l5o7p7o5p5
  28.194 -	d1 = a3b3a1b1e3f3e1f1 i3j3i1j1m3n3m1n1 c3d3c1d1g3h3g1h1 k3l3k1l1o3p3o1p1
  28.195 -	d2 = a6b6a4b4e6f6e4f4 i6j6i4j4m6n6m4n4 c6d6c4d4g6h6g4h4 k6l6k4l4o6p6o4p4
  28.196 -	d3 = a2b2a0b0e2f2e0f0 i2j2i0j0m2n2m0n0 c2d2c0d0g2h2g0h0 k2l2k0l0o2p2o0p0
  28.197 -*/
  28.198 -	movew	d2,d7
  28.199 -	movew	d0,d2
  28.200 -	swap	d2
  28.201 -	movew	d2,d0
  28.202 -	movew	d7,d2
  28.203 -
  28.204 -	movew	d3,d7
  28.205 -	movew	d1,d3
  28.206 -	swap	d3
  28.207 -	movew	d3,d1
  28.208 -	movew	d7,d3
  28.209 -/*
  28.210 -	d0 = a7b7a5b5e7f7e5f5 i7j7i5j5m7n7m5n5 a6b6a4b4e6f6e4f4 i6j6i4j4m6n6m4n4
  28.211 -	d1 = a3b3a1b1e3f3e1f1 i3j3i1j1m3n3m1n1 a2b2a0b0e2f2e0f0 i2j2i0j0m2n2m0n0
  28.212 -	d2 = c7d7c5d5g7h7g5h5 k7l7k5l5o7p7o5p5 c6d6c4d4g6h6g4h4 k6l6k4l4o6p6o4p4
  28.213 -	d3 = c3d3c1d1g3h3g1h1 k3l3k1l1o3p3o1p1 c2d2c0d0g2h2g0h0 k2l2k0l0o2p2o0p0
  28.214 -*/
  28.215 -	movel	d2,d7
  28.216 -	lsrl	#2,d7
  28.217 -	eorl	d0,d7
  28.218 -	andl	#0x33333333,d7
  28.219 -	eorl	d7,d0
  28.220 -	lsll	#2,d7
  28.221 -	eorl	d7,d2
  28.222 -
  28.223 -	movel	d3,d7
  28.224 -	lsrl	#2,d7
  28.225 -	eorl	d1,d7
  28.226 -	andl	#0x33333333,d7
  28.227 -	eorl	d7,d1
  28.228 -	lsll	#2,d7
  28.229 -	eorl	d7,d3
  28.230 -/*
  28.231 -	d0 = a7b7c7d7e7f7g7h7 i7j7k7l7m7n7o7p7 a6b6c6d6e6f6g6h6 i6j6k6l6m6n6o6p6
  28.232 -	d1 = a3b3c3d3e3f3g3h3 i3j3k3l3m3n3o3p3 a2b2c2d2e2f2g2h2 i2j2k2l2m2n2o2p2
  28.233 -	d2 = a5b5c5d5e5f5g5h5 i5j5k5l5m5n5o5p5 a4b4c4d4e4f4g4h4 i4j4k4l4m4n4o4p4
  28.234 -	d3 = a1b1c1d1e1f1g1h1 i1j1k1l1m1n1o1p1 a0b0c0d0e0f0g0h0 i0j0k0l0m0n0o0p0
  28.235 -*/
  28.236 -	swap	d0
  28.237 -	swap	d1
  28.238 -	swap	d2
  28.239 -	swap	d3
  28.240 -
  28.241 -	movel	d0,a6
  28.242 -	movel	d2,a5
  28.243 -	movel	d1,a4
  28.244 -	movel	d3,a3
  28.245 -
  28.246 -	cmpl	a0,a2
  28.247 -	bgt		SDL_Atari_C2p8_pix16
  28.248 -
  28.249 -	movel	a3,a1@+
  28.250 -	movel	a4,a1@+
  28.251 -	movel	a5,a1@+
  28.252 -	movel	a6,a1@+
  28.253 -
  28.254 -	/* Double the line ? */
  28.255 -
  28.256 -	movel	c2p_srcpitch,d0
  28.257 -	movel	c2p_dstpitch,d1
  28.258 -
  28.259 -	tstl	c2p_dblligne
  28.260 -	beqs	SDL_Atari_C2p8_nodblline
  28.261 -
  28.262 -	movel	c2p_curdst,a0
  28.263 -	movel	a0,a1
  28.264 -	addl	d1,a1
  28.265 -
  28.266 -	movew	c2p_width+2,d7
  28.267 -	lsrw	#4,d7
  28.268 -	subql	#1,d7
  28.269 -SDL_Atari_C2p8_dblloop:
  28.270 -	movel	a0@+,a1@+
  28.271 -	movel	a0@+,a1@+
  28.272 -	movel	a0@+,a1@+
  28.273 -	movel	a0@+,a1@+
  28.274 -	dbra	d7,SDL_Atari_C2p8_dblloop
  28.275 -
  28.276 -	addl	d1,c2p_curdst
  28.277 -
  28.278 -SDL_Atari_C2p8_nodblline:
  28.279 -
  28.280 -	/* Next line */
  28.281 -
  28.282 -	addl	d0,c2p_cursrc
  28.283 -	addl	d1,c2p_curdst
  28.284 -
  28.285 -	subqw	#1,c2p_row
  28.286 -	bne		SDL_Atari_C2p8_rowloop	
  28.287 -
  28.288 -	moveml	sp@+,d2-d7/a2-a6
  28.289 -	rts
  28.290 -
  28.291 -/* ------------	Conversion C2P, 4 bits ------------ */
  28.292 -
  28.293 -_SDL_Atari_C2pConvert4:
  28.294 -	movel	sp@(4),c2p_source
  28.295 -	movel	sp@(8),c2p_dest
  28.296 -	movel	sp@(12),c2p_width
  28.297 -	movel	sp@(16),c2p_height
  28.298 -	movel	sp@(20),c2p_dblligne
  28.299 -	movel	sp@(24),c2p_srcpitch
  28.300 -	movel	sp@(28),c2p_dstpitch
  28.301 -
  28.302 -	moveml	d2-d7/a2-a6,sp@-
  28.303 -
  28.304 -	movel	c2p_source,a0
  28.305 -	movel	c2p_dest,a1
  28.306 -	lea	_SDL_Atari_table_c2p,a2
  28.307 -	movel	#0x00070001,d3
  28.308 -#if defined(__M68020__)
  28.309 -	moveq	#0,d0
  28.310 -#endif
  28.311 -	
  28.312 -	movel	c2p_height,d7
  28.313 -	subql	#1,d7
  28.314 -c2p4_bcly:
  28.315 -	movel	a0,a4	| Save start address of source
  28.316 -	movel	a1,a5	| Save start address of dest
  28.317 -
  28.318 -	| Conversion
  28.319 -                 			
  28.320 -	movel	c2p_width,d6
  28.321 -	lsrw	#4,d6
  28.322 -	subql	#1,d6
  28.323 -c2p4_bclx:
  28.324 -	| Octets 0-7
  28.325 -	
  28.326 -	moveq	#0,d1
  28.327 -	moveq	#7,d5
  28.328 -c2p4_bcl07:
  28.329 -#if defined(__M68020__)
  28.330 -	moveb	a0@+,d0
  28.331 -	lea		a2@(0,d0:w:4),a3
  28.332 -#else
  28.333 -	moveq	#0,d0
  28.334 -	moveb	a0@+,d0
  28.335 -	lslw	#2,d0
  28.336 -	lea		a2@(0,d0:w),a3
  28.337 -#endif
  28.338 -	lsll	#1,d1
  28.339 -	orl		a3@,d1
  28.340 -	dbra	d5,c2p4_bcl07
  28.341 -
  28.342 -	movepl	d1,a1@(0)
  28.343 -	addw	d3,a1
  28.344 -	swap	d3
  28.345 -	
  28.346 -	| Octets 8-15
  28.347 -
  28.348 -	moveq	#0,d1
  28.349 -	moveq	#7,d5
  28.350 -c2p4_bcl815:
  28.351 -#if defined(__M68020__)
  28.352 -	moveb	a0@+,d0
  28.353 -	lea		a2@(0,d0:w:4),a3
  28.354 -#else
  28.355 -	moveq	#0,d0
  28.356 -	moveb	a0@+,d0
  28.357 -	lslw	#2,d0
  28.358 -	lea		a2@(0,d0:w),a3
  28.359 -#endif
  28.360 -	lsll	#1,d1
  28.361 -	orl		a3@,d1
  28.362 -	dbra	d5,c2p4_bcl815
  28.363 -
  28.364 -	movepl	d1,a1@(0)
  28.365 -	addw	d3,a1
  28.366 -	swap	d3
  28.367 -
  28.368 -	dbra	d6,c2p4_bclx
  28.369 -
  28.370 -	| Double line ?
  28.371 -
  28.372 -	tstl	c2p_dblligne
  28.373 -	beqs	c2p4_nodblligne
  28.374 -
  28.375 -	movel	a5,a6			| src line
  28.376 -	movel	a5,a1			| dest line
  28.377 -	addl	c2p_dstpitch,a1
  28.378 -
  28.379 -	movel	c2p_width,d6
  28.380 -	lsrw	#3,d6
  28.381 -	subql	#1,d6
  28.382 -c2p4_copydbl:
  28.383 -	movel	a6@+,a1@+
  28.384 -	dbra	d6,c2p4_copydbl
  28.385 -
  28.386 -	addl	c2p_dstpitch,a5
  28.387 -c2p4_nodblligne:
  28.388 -
  28.389 -	| Next line
  28.390 -
  28.391 -	movel	a4,a0		
  28.392 -	addl	c2p_srcpitch,a0
  28.393 -	movel	a5,a1
  28.394 -	addl	c2p_dstpitch,a1
  28.395 -
  28.396 -	dbra	d7,c2p4_bcly
  28.397 -
  28.398 -	moveml	sp@+,d2-d7/a2-a6
  28.399 -	rts
  28.400 -
  28.401 -/* ------------	Conversion of a light palette in 4 bits ------------ */
  28.402 -
  28.403 -_SDL_Atari_C2pConvert4_pal:
  28.404 -	/* a0 is a 256-word light palette */
  28.405 -	movel	sp@(4),a0
  28.406 -
  28.407 -	moveml	d2-d3,sp@-
  28.408 -
  28.409 -	lea		_SDL_Atari_table_c2p,a1
  28.410 -	movew	#255,d3
  28.411 -c2p_pal_initbcl:
  28.412 -	movew	a0@+,d0
  28.413 -	lsrw	#4,d0
  28.414 -	andw	#15,d0
  28.415 -
  28.416 -	moveq	#3,d1
  28.417 -c2p_pal_initbyte:
  28.418 -	btst	d1,d0
  28.419 -	sne		d2
  28.420 -	negw	d2
  28.421 -	moveb	d2,a1@(0,d1:w)
  28.422 -
  28.423 -	dbra	d1,c2p_pal_initbyte
  28.424 -
  28.425 -	addql	#4,a1
  28.426 -	dbra	d3,c2p_pal_initbcl
  28.427 -
  28.428 -	moveml	sp@+,d2-d3
  28.429 -
  28.430 -	rts
  28.431 -
  28.432 -/* ------------	Buffers ------------ */
  28.433 -
  28.434 -	.bss
  28.435 -
  28.436 -	.even
  28.437 -	.comm	_SDL_Atari_C2pConvert,4
  28.438 -	.comm	_SDL_Atari_table_c2p,1024
  28.439 -
  28.440 -	.comm	c2p_source,4	/* Source framebuffer */
  28.441 -	.comm	c2p_dest,4		/* Destination framebuffer */
  28.442 -	.comm	c2p_width,4		/* Width of zone to convert */
  28.443 -	.comm	c2p_height,4	/* Height of zone to convert */
  28.444 -	.comm	c2p_dblligne,4	/* Double the lines while converting ? */
  28.445 -	.comm	c2p_srcpitch,4	/* Source pitch */
  28.446 -	.comm	c2p_dstpitch,4	/* Destination pitch */
  28.447 -	.comm	c2p_cursrc,4	/* Current source line */
  28.448 -	.comm	c2p_curdst,4	/* Current destination line */
  28.449 -	.comm	c2p_rowlen,2	/* Line length in bytes */
  28.450 -	.comm	c2p_row,2		/* Current line number */
    29.1 --- a/src/video/ataricommon/SDL_ataric2p_s.h	Sun Sep 20 04:13:23 2009 +0000
    29.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.3 @@ -1,70 +0,0 @@
    29.4 -/*
    29.5 -    SDL - Simple DirectMedia Layer
    29.6 -    Copyright (C) 1997-2009 Sam Lantinga
    29.7 -
    29.8 -    This library is free software; you can redistribute it and/or
    29.9 -    modify it under the terms of the GNU Lesser General Public
   29.10 -    License as published by the Free Software Foundation; either
   29.11 -    version 2.1 of the License, or (at your option) any later version.
   29.12 -
   29.13 -    This library is distributed in the hope that it will be useful,
   29.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   29.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   29.16 -    Lesser General Public License for more details.
   29.17 -
   29.18 -    You should have received a copy of the GNU Lesser General Public
   29.19 -    License along with this library; if not, write to the Free Software
   29.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   29.21 -
   29.22 -    Sam Lantinga
   29.23 -    slouken@libsdl.org
   29.24 -*/
   29.25 -#include "SDL_config.h"
   29.26 -
   29.27 -#ifndef _ATARI_C2P_h
   29.28 -#define _ATARI_C2P_h
   29.29 -
   29.30 -#include "SDL_stdinc.h"
   29.31 -
   29.32 -/*--- Functions pointers ---*/
   29.33 -
   29.34 -/* Convert a chunky screen to bitplane screen */
   29.35 -
   29.36 -extern void (*SDL_Atari_C2pConvert) (Uint8 * src,       /* Source screen (one byte=one pixel) */
   29.37 -                                     Uint8 * dest,      /* Destination (4/8 bits planes) */
   29.38 -                                     Uint32 width,      /* Dimensions of screen to convert */
   29.39 -                                     Uint32 height, Uint32 dblligne,    /* Double the lines when converting ? */
   29.40 -                                     Uint32 srcpitch,   /* Length of one source line in bytes */
   29.41 -                                     Uint32 dstpitch    /* Length of one destination line in bytes */
   29.42 -    );
   29.43 -
   29.44 -/*--- 8 bits functions ---*/
   29.45 -
   29.46 -/* Convert a chunky screen to bitplane screen */
   29.47 -
   29.48 -void SDL_Atari_C2pConvert8(Uint8 * src, /* Source screen (one byte=one pixel) */
   29.49 -                           Uint8 * dest,        /* Destination (8 bits planes) */
   29.50 -                           Uint32 width,        /* Dimensions of screen to convert */
   29.51 -                           Uint32 height, Uint32 dblligne,      /* Double the lines when converting ? */
   29.52 -                           Uint32 srcpitch,     /* Length of one source line in bytes */
   29.53 -                           Uint32 dstpitch      /* Length of one destination line in bytes */
   29.54 -    );
   29.55 -
   29.56 -/*--- 4 bits functions ---*/
   29.57 -
   29.58 -/* Convert a chunky screen to bitplane screen */
   29.59 -
   29.60 -void SDL_Atari_C2pConvert4(Uint8 * src, /* Source screen (one byte=one pixel) */
   29.61 -                           Uint8 * dest,        /* Destination (4 bits planes) */
   29.62 -                           Uint32 width,        /* Dimensions of screen to convert */
   29.63 -                           Uint32 height, Uint32 dblligne,      /* Double the lines when converting ? */
   29.64 -                           Uint32 srcpitch,     /* Length of one source line in bytes */
   29.65 -                           Uint32 dstpitch      /* Length of one destination line in bytes */
   29.66 -    );
   29.67 -
   29.68 -/* Conversion palette */
   29.69 -
   29.70 -void SDL_Atari_C2pConvert4_pal(Uint16 * lightpalette);
   29.71 -
   29.72 -#endif /* _ATARI_C2P_h */
   29.73 -/* vi: set ts=4 sw=4 expandtab: */
    30.1 --- a/src/video/ataricommon/SDL_ataridevmouse.c	Sun Sep 20 04:13:23 2009 +0000
    30.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.3 @@ -1,166 +0,0 @@
    30.4 -/*
    30.5 -    SDL - Simple DirectMedia Layer
    30.6 -    Copyright (C) 1997-2009 Sam Lantinga
    30.7 -
    30.8 -    This library is free software; you can redistribute it and/or
    30.9 -    modify it under the terms of the GNU Lesser General Public
   30.10 -    License as published by the Free Software Foundation; either
   30.11 -    version 2.1 of the License, or (at your option) any later version.
   30.12 -
   30.13 -    This library is distributed in the hope that it will be useful,
   30.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   30.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   30.16 -    Lesser General Public License for more details.
   30.17 -
   30.18 -    You should have received a copy of the GNU Lesser General Public
   30.19 -    License along with this library; if not, write to the Free Software
   30.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   30.21 -
   30.22 -    Sam Lantinga
   30.23 -    slouken@libsdl.org
   30.24 -*/
   30.25 -#include "SDL_config.h"
   30.26 -
   30.27 -/*
   30.28 -	MiNT /dev/mouse driver
   30.29 -
   30.30 -	Patrice Mandin
   30.31 -*/
   30.32 -
   30.33 -#include <fcntl.h>
   30.34 -#include <unistd.h>
   30.35 -
   30.36 -#include "../../events/SDL_events_c.h"
   30.37 -#include "SDL_ataridevmouse_c.h"
   30.38 -
   30.39 -/* Defines */
   30.40 -
   30.41 -#define DEVICE_NAME	"/dev/mouse"
   30.42 -
   30.43 -/* Local variables */
   30.44 -
   30.45 -static int handle = -1;
   30.46 -static int mouseb, prev_mouseb;
   30.47 -
   30.48 -/* Functions */
   30.49 -
   30.50 -int
   30.51 -SDL_AtariDevMouse_Open(void)
   30.52 -{
   30.53 -    int r;
   30.54 -    const char *mousedev;
   30.55 -
   30.56 -    /*
   30.57 -       TODO: Fix the MiNT device driver, that locks mouse for other
   30.58 -       applications, so this is disabled till fixed
   30.59 -     */
   30.60 -    return 0;
   30.61 -
   30.62 -    /* First, try SDL_MOUSEDEV device */
   30.63 -    mousedev = SDL_getenv("SDL_MOUSEDEV");
   30.64 -    if (!mousedev) {
   30.65 -        handle = open(mousedev, 0);
   30.66 -    }
   30.67 -
   30.68 -    /* Failed, try default device */
   30.69 -    if (handle < 0) {
   30.70 -        handle = open(DEVICE_NAME, 0);
   30.71 -    }
   30.72 -
   30.73 -    if (handle < 0) {
   30.74 -        handle = -1;
   30.75 -        return 0;
   30.76 -    }
   30.77 -
   30.78 -    /* Set non blocking mode */
   30.79 -    r = fcntl(handle, F_GETFL, 0);
   30.80 -    if (r < 0) {
   30.81 -        close(handle);
   30.82 -        handle = -1;
   30.83 -        return 0;
   30.84 -    }
   30.85 -
   30.86 -    r |= O_NDELAY;
   30.87 -
   30.88 -    r = fcntl(handle, F_SETFL, r);
   30.89 -    if (r < 0) {
   30.90 -        close(handle);
   30.91 -        handle = -1;
   30.92 -        return 0;
   30.93 -    }
   30.94 -
   30.95 -    prev_mouseb = 7;
   30.96 -    return 1;
   30.97 -}
   30.98 -
   30.99 -void
  30.100 -SDL_AtariDevMouse_Close(void)
  30.101 -{
  30.102 -    if (handle > 0) {
  30.103 -        close(handle);
  30.104 -        handle = -1;
  30.105 -    }
  30.106 -}
  30.107 -
  30.108 -static int
  30.109 -atari_GetButton(int button)
  30.110 -{
  30.111 -    switch (button) {
  30.112 -    case 0:
  30.113 -        return SDL_BUTTON_RIGHT;
  30.114 -    case 1:
  30.115 -        return SDL_BUTTON_MIDDLE;
  30.116 -    default:
  30.117 -        break;
  30.118 -    }
  30.119 -
  30.120 -    return SDL_BUTTON_LEFT;
  30.121 -}
  30.122 -
  30.123 -void
  30.124 -SDL_AtariDevMouse_PostMouseEvents(_THIS, SDL_bool buttonEvents)
  30.125 -{
  30.126 -    unsigned char buffer[3];
  30.127 -    int mousex, mousey;
  30.128 -
  30.129 -    if (handle < 0) {
  30.130 -        return;
  30.131 -    }
  30.132 -
  30.133 -    mousex = mousey = 0;
  30.134 -    while (read(handle, buffer, sizeof(buffer)) == sizeof(buffer)) {
  30.135 -        mouseb = buffer[0] & 7;
  30.136 -        mousex += (char) buffer[1];
  30.137 -        mousey += (char) buffer[2];
  30.138 -
  30.139 -        /* Mouse button events */
  30.140 -        if (buttonEvents && (mouseb != prev_mouseb)) {
  30.141 -            int i;
  30.142 -
  30.143 -            for (i = 0; i < 3; i++) {
  30.144 -                int curbutton, prevbutton;
  30.145 -
  30.146 -                curbutton = mouseb & (1 << i);
  30.147 -                prevbutton = prev_mouseb & (1 << i);
  30.148 -
  30.149 -                if (curbutton && !prevbutton) {
  30.150 -                    SDL_PrivateMouseButton(SDL_RELEASED,
  30.151 -                                           atari_GetButton(i), 0, 0);
  30.152 -                }
  30.153 -                if (!curbutton && prevbutton) {
  30.154 -                    SDL_PrivateMouseButton(SDL_PRESSED,
  30.155 -                                           atari_GetButton(i), 0, 0);
  30.156 -                }
  30.157 -            }
  30.158 -
  30.159 -            prev_mouseb = mouseb;
  30.160 -        }
  30.161 -    }
  30.162 -
  30.163 -    /* Mouse motion event */
  30.164 -    if (mousex || mousey) {
  30.165 -        SDL_PrivateMouseMotion(0, 1, mousex, -mousey);
  30.166 -    }
  30.167 -}
  30.168 -
  30.169 -/* vi: set ts=4 sw=4 expandtab: */
    31.1 --- a/src/video/ataricommon/SDL_ataridevmouse_c.h	Sun Sep 20 04:13:23 2009 +0000
    31.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.3 @@ -1,40 +0,0 @@
    31.4 -/*
    31.5 -    SDL - Simple DirectMedia Layer
    31.6 -    Copyright (C) 1997-2009 Sam Lantinga
    31.7 -
    31.8 -    This library is free software; you can redistribute it and/or
    31.9 -    modify it under the terms of the GNU Lesser General Public
   31.10 -    License as published by the Free Software Foundation; either
   31.11 -    version 2.1 of the License, or (at your option) any later version.
   31.12 -
   31.13 -    This library is distributed in the hope that it will be useful,
   31.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   31.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   31.16 -    Lesser General Public License for more details.
   31.17 -
   31.18 -    You should have received a copy of the GNU Lesser General Public
   31.19 -    License along with this library; if not, write to the Free Software
   31.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   31.21 -
   31.22 -    Sam Lantinga
   31.23 -    slouken@libsdl.org
   31.24 -*/
   31.25 -#include "SDL_config.h"
   31.26 -
   31.27 -/*
   31.28 -	MiNT /dev/mouse driver
   31.29 -
   31.30 -	Patrice Mandin
   31.31 -*/
   31.32 -
   31.33 -#ifndef _SDL_ATARI_DEVMOUSE_H_
   31.34 -#define _SDL_ATARI_DEVMOUSE_H_
   31.35 -
   31.36 -#include "../SDL_sysvideo.h"
   31.37 -
   31.38 -extern int SDL_AtariDevMouse_Open(void);
   31.39 -extern void SDL_AtariDevMouse_Close(void);
   31.40 -extern void SDL_AtariDevMouse_PostMouseEvents(_THIS, SDL_bool buttonEvents);
   31.41 -
   31.42 -#endif /* _SDL_ATARI_DEVMOUSE_H_ */
   31.43 -/* vi: set ts=4 sw=4 expandtab: */
    32.1 --- a/src/video/ataricommon/SDL_atarieddi.S	Sun Sep 20 04:13:23 2009 +0000
    32.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.3 @@ -1,42 +0,0 @@
    32.4 -/*
    32.5 -    SDL - Simple DirectMedia Layer
    32.6 -    Copyright (C) 1997-2009 Sam Lantinga
    32.7 -
    32.8 -    This library is free software; you can redistribute it and/or
    32.9 -    modify it under the terms of the GNU Lesser General Public
   32.10 -    License as published by the Free Software Foundation; either
   32.11 -    version 2.1 of the License, or (at your option) any later version.
   32.12 -
   32.13 -    This library is distributed in the hope that it will be useful,
   32.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   32.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   32.16 -    Lesser General Public License for more details.
   32.17 -
   32.18 -    You should have received a copy of the GNU Lesser General Public
   32.19 -    License along with this library; if not, write to the Free Software
   32.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   32.21 -
   32.22 -    Sam Lantinga
   32.23 -    slouken@libsdl.org
   32.24 -*/
   32.25 -
   32.26 -/*
   32.27 - *	Read EdDI version
   32.28 - *
   32.29 - *	Patrice Mandin
   32.30 - */
   32.31 -
   32.32 -	.text
   32.33 -
   32.34 -	.globl	_Atari_get_EdDI_version
   32.35 -
   32.36 -/*--- Vector installer ---*/
   32.37 -
   32.38 -_Atari_get_EdDI_version:
   32.39 -	movel	sp@(4),a0	/* Value of EdDI cookie */
   32.40 -
   32.41 -	/* Call EdDI function #0 */
   32.42 -	clrw	d0
   32.43 -	jsr	(a0)
   32.44 -
   32.45 -	rts
    33.1 --- a/src/video/ataricommon/SDL_atarieddi_s.h	Sun Sep 20 04:13:23 2009 +0000
    33.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.3 @@ -1,57 +0,0 @@
    33.4 -/*
    33.5 -    SDL - Simple DirectMedia Layer
    33.6 -    Copyright (C) 1997-2009 Sam Lantinga
    33.7 -
    33.8 -    This library is free software; you can redistribute it and/or
    33.9 -    modify it under the terms of the GNU Lesser General Public
   33.10 -    License as published by the Free Software Foundation; either
   33.11 -    version 2.1 of the License, or (at your option) any later version.
   33.12 -
   33.13 -    This library is distributed in the hope that it will be useful,
   33.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   33.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   33.16 -    Lesser General Public License for more details.
   33.17 -
   33.18 -    You should have received a copy of the GNU Lesser General Public
   33.19 -    License along with this library; if not, write to the Free Software
   33.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   33.21 -
   33.22 -    Sam Lantinga
   33.23 -    slouken@libsdl.org
   33.24 -*/
   33.25 -#include "SDL_config.h"
   33.26 -
   33.27 -#ifndef _SDL_Atari_eddi_s_h
   33.28 -#define _SDL_Atari_eddi_s_h
   33.29 -
   33.30 -/*--- Defines ---*/
   33.31 -
   33.32 -/* EdDI versions */
   33.33 -
   33.34 -#define EDDI_10	(0x0100)
   33.35 -#define EDDI_11 (0x0110)
   33.36 -
   33.37 -/* Screen format */
   33.38 -
   33.39 -enum
   33.40 -{
   33.41 -    VDI_FORMAT_UNKNOWN = -1,
   33.42 -    VDI_FORMAT_INTER = 0,       /* Interleaved bitplanes */
   33.43 -    VDI_FORMAT_VDI = 1,         /* VDI independent */
   33.44 -    VDI_FORMAT_PACK = 2         /* Packed pixels */
   33.45 -};
   33.46 -
   33.47 -/* CLUT types */
   33.48 -enum
   33.49 -{
   33.50 -    VDI_CLUT_NONE = 0,          /* Monochrome mode */
   33.51 -    VDI_CLUT_HARDWARE,          /* <256 colours mode */
   33.52 -    VDI_CLUT_SOFTWARE           /* True colour mode */
   33.53 -};
   33.54 -
   33.55 -/*--- Functions ---*/
   33.56 -
   33.57 -unsigned long Atari_get_EdDI_version(void *function_pointer);
   33.58 -
   33.59 -#endif /* _SDL_Atari_eddi_s_h */
   33.60 -/* vi: set ts=4 sw=4 expandtab: */
    34.1 --- a/src/video/ataricommon/SDL_atarievents.c	Sun Sep 20 04:13:23 2009 +0000
    34.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.3 @@ -1,232 +0,0 @@
    34.4 -/*
    34.5 -    SDL - Simple DirectMedia Layer
    34.6 -    Copyright (C) 1997-2009 Sam Lantinga
    34.7 -
    34.8 -    This library is free software; you can redistribute it and/or
    34.9 -    modify it under the terms of the GNU Lesser General Public
   34.10 -    License as published by the Free Software Foundation; either
   34.11 -    version 2.1 of the License, or (at your option) any later version.
   34.12 -
   34.13 -    This library is distributed in the hope that it will be useful,
   34.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   34.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   34.16 -    Lesser General Public License for more details.
   34.17 -
   34.18 -    You should have received a copy of the GNU Lesser General Public
   34.19 -    License along with this library; if not, write to the Free Software
   34.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   34.21 -
   34.22 -    Sam Lantinga
   34.23 -    slouken@libsdl.org
   34.24 -*/
   34.25 -#include "SDL_config.h"
   34.26 -
   34.27 -/*
   34.28 - *	Atari keyboard events manager
   34.29 - *
   34.30 - *	Patrice Mandin
   34.31 - *
   34.32 - *	This routines choose what the final event manager will be
   34.33 - */
   34.34 -
   34.35 -#include <mint/cookie.h>
   34.36 -#include <mint/ostruct.h>
   34.37 -#include <mint/osbind.h>
   34.38 -
   34.39 -#include "../../events/SDL_sysevents.h"
   34.40 -#include "../../events/SDL_events_c.h"
   34.41 -
   34.42 -#include "SDL_atarikeys.h"
   34.43 -#include "SDL_atarievents_c.h"
   34.44 -#include "SDL_biosevents_c.h"
   34.45 -#include "SDL_gemdosevents_c.h"
   34.46 -#include "SDL_ikbdevents_c.h"
   34.47 -
   34.48 -enum
   34.49 -{
   34.50 -    MCH_ST = 0,
   34.51 -    MCH_STE,
   34.52 -    MCH_TT,
   34.53 -    MCH_F30,
   34.54 -    MCH_CLONE,
   34.55 -    MCH_ARANYM
   34.56 -};
   34.57 -
   34.58 -#ifndef KT_NOCHANGE
   34.59 -# define KT_NOCHANGE -1
   34.60 -#endif
   34.61 -
   34.62 -/* The translation tables from a console scancode to a SDL keysym */
   34.63 -static SDLKey keymap[ATARIBIOS_MAXKEYS];
   34.64 -static unsigned char *keytab_normal;
   34.65 -
   34.66 -void (*SDL_Atari_ShutdownEvents) (void);
   34.67 -
   34.68 -static void
   34.69 -SDL_Atari_InitializeEvents(_THIS)
   34.70 -{
   34.71 -    const char *envr;
   34.72 -    unsigned long cookie_mch;
   34.73 -
   34.74 -    /* Test if we are on an Atari machine or not */
   34.75 -    if (Getcookie(C__MCH, &cookie_mch) == C_NOTFOUND) {
   34.76 -        cookie_mch = 0;
   34.77 -    }
   34.78 -    cookie_mch >>= 16;
   34.79 -
   34.80 -    /* Default is Ikbd, the faster except for clones */
   34.81 -    switch (cookie_mch) {
   34.82 -    case MCH_ST:
   34.83 -    case MCH_STE:
   34.84 -    case MCH_TT:
   34.85 -    case MCH_F30:
   34.86 -    case MCH_ARANYM:
   34.87 -        _this->PumpEvents = AtariIkbd_PumpEvents;
   34.88 -        SDL_Atari_ShutdownEvents = AtariIkbd_ShutdownEvents;
   34.89 -        break;
   34.90 -    default:
   34.91 -        _this->PumpEvents = AtariGemdos_PumpEvents;
   34.92 -        SDL_Atari_ShutdownEvents = AtariGemdos_ShutdownEvents;
   34.93 -        break;
   34.94 -    }
   34.95 -
   34.96 -    envr = SDL_getenv("SDL_ATARI_EVENTSDRIVER");
   34.97 -
   34.98 -    if (!envr) {
   34.99 -        return;
  34.100 -    }
  34.101 -
  34.102 -    if (SDL_strcmp(envr, "ikbd") == 0) {
  34.103 -        _this->PumpEvents = AtariIkbd_PumpEvents;
  34.104 -        SDL_Atari_ShutdownEvents = AtariIkbd_ShutdownEvents;
  34.105 -    }
  34.106 -
  34.107 -    if (SDL_strcmp(envr, "gemdos") == 0) {
  34.108 -        _this->PumpEvents = AtariGemdos_PumpEvents;
  34.109 -        SDL_Atari_ShutdownEvents = AtariGemdos_ShutdownEvents;
  34.110 -    }
  34.111 -
  34.112 -    if (SDL_strcmp(envr, "bios") == 0) {
  34.113 -        _this->PumpEvents = AtariBios_PumpEvents;
  34.114 -        SDL_Atari_ShutdownEvents = AtariBios_ShutdownEvents;
  34.115 -    }
  34.116 -
  34.117 -    SDL_Atari_InitInternalKeymap(_this);
  34.118 -}
  34.119 -
  34.120 -void
  34.121 -Atari_PumpEvents(_THIS)
  34.122 -{
  34.123 -    Atari_InitializeEvents(_this);
  34.124 -
  34.125 -    /* Call choosen routine */
  34.126 -    _this->PumpEvents(_this);
  34.127 -}
  34.128 -
  34.129 -void
  34.130 -SDL_Atari_InitInternalKeymap(_THIS)
  34.131 -{
  34.132 -    int i;
  34.133 -    _KEYTAB *key_tables;
  34.134 -
  34.135 -    /* Read system tables for scancode -> ascii translation */
  34.136 -    key_tables = (_KEYTAB *) Keytbl(KT_NOCHANGE, KT_NOCHANGE, KT_NOCHANGE);
  34.137 -    keytab_normal = key_tables->unshift;
  34.138 -
  34.139 -    /* Initialize keymap */
  34.140 -    for (i = 0; i < ATARIBIOS_MAXKEYS; i++)
  34.141 -        keymap[i] = SDLK_UNKNOWN;
  34.142 -
  34.143 -    /* Functions keys */
  34.144 -    for (i = 0; i < 10; i++)
  34.145 -        keymap[SCANCODE_F1 + i] = SDLK_F1 + i;
  34.146 -
  34.147 -    /* Cursor keypad */
  34.148 -    keymap[SCANCODE_HELP] = SDLK_HELP;
  34.149 -    keymap[SCANCODE_UNDO] = SDLK_UNDO;
  34.150 -    keymap[SCANCODE_INSERT] = SDLK_INSERT;
  34.151 -    keymap[SCANCODE_CLRHOME] = SDLK_HOME;
  34.152 -    keymap[SCANCODE_UP] = SDLK_UP;
  34.153 -    keymap[SCANCODE_DOWN] = SDLK_DOWN;
  34.154 -    keymap[SCANCODE_RIGHT] = SDLK_RIGHT;
  34.155 -    keymap[SCANCODE_LEFT] = SDLK_LEFT;
  34.156 -
  34.157 -    /* Special keys */
  34.158 -    keymap[SCANCODE_ESCAPE] = SDLK_ESCAPE;
  34.159 -    keymap[SCANCODE_BACKSPACE] = SDLK_BACKSPACE;
  34.160 -    keymap[SCANCODE_TAB] = SDLK_TAB;
  34.161 -    keymap[SCANCODE_ENTER] = SDLK_RETURN;
  34.162 -    keymap[SCANCODE_DELETE] = SDLK_DELETE;
  34.163 -    keymap[SCANCODE_LEFTCONTROL] = SDLK_LCTRL;
  34.164 -    keymap[SCANCODE_LEFTSHIFT] = SDLK_LSHIFT;
  34.165 -    keymap[SCANCODE_RIGHTSHIFT] = SDLK_RSHIFT;
  34.166 -    keymap[SCANCODE_LEFTALT] = SDLK_LALT;
  34.167 -    keymap[SCANCODE_CAPSLOCK] = SDLK_CAPSLOCK;
  34.168 -}
  34.169 -
  34.170 -/* Atari to Unicode charset translation table */
  34.171 -
  34.172 -Uint16 SDL_AtariToUnicodeTable[256] = {
  34.173 -    /* Standard ASCII characters from 0x00 to 0x7e */
  34.174 -    /* Unicode stuff from 0x7f to 0xff */
  34.175 -
  34.176 -    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007,
  34.177 -    0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
  34.178 -    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017,
  34.179 -    0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
  34.180 -    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027,
  34.181 -    0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
  34.182 -    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
  34.183 -    0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
  34.184 -
  34.185 -    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
  34.186 -    0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
  34.187 -    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057,
  34.188 -    0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
  34.189 -    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067,
  34.190 -    0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
  34.191 -    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077,
  34.192 -    0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x0394,
  34.193 -
  34.194 -    0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7,
  34.195 -    0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5,
  34.196 -    0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9,
  34.197 -    0x00FF, 0x00D6, 0x00DC, 0x00A2, 0x00A3, 0x00A5, 0x00DF, 0x0192,
  34.198 -    0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA,
  34.199 -    0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
  34.200 -    0x00C3, 0x00F5, 0x00D8, 0x00F8, 0x0153, 0x0152, 0x00C0, 0x00C3,
  34.201 -    0x00D5, 0x00A8, 0x00B4, 0x2020, 0x00B6, 0x00A9, 0x00AE, 0x2122,
  34.202 -
  34.203 -    0x0133, 0x0132, 0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5,
  34.204 -    0x05D6, 0x05D7, 0x05D8, 0x05D9, 0x05DB, 0x05DC, 0x05DE, 0x05E0,
  34.205 -    0x05E1, 0x05E2, 0x05E4, 0x05E6, 0x05E7, 0x05E8, 0x05E9, 0x05EA,
  34.206 -    0x05DF, 0x05DA, 0x05DD, 0x05E3, 0x05E5, 0x00A7, 0x2038, 0x221E,
  34.207 -    0x03B1, 0x03B2, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4,
  34.208 -    0x03A6, 0x0398, 0x03A9, 0x03B4, 0x222E, 0x03C6, 0x2208, 0x2229,
  34.209 -    0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248,
  34.210 -    0x00B0, 0x2022, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x00B3, 0x00AF
  34.211 -};
  34.212 -
  34.213 -SDL_keysym *
  34.214 -SDL_Atari_TranslateKey(int scancode, SDL_keysym * keysym, SDL_bool pressed)
  34.215 -{
  34.216 -    int asciicode = 0;
  34.217 -
  34.218 -    /* Set the keysym information */
  34.219 -    keysym->scancode = scancode;
  34.220 -    keysym->mod = KMOD_NONE;
  34.221 -    keysym->sym = keymap[scancode];
  34.222 -    keysym->unicode = 0;
  34.223 -
  34.224 -    if (keysym->sym == SDLK_UNKNOWN) {
  34.225 -        keysym->sym = asciicode = keytab_normal[scancode];
  34.226 -    }
  34.227 -
  34.228 -    if (SDL_TranslateUNICODE && pressed) {
  34.229 -        keysym->unicode = SDL_AtariToUnicodeTable[asciicode];
  34.230 -    }
  34.231 -
  34.232 -    return (keysym);
  34.233 -}
  34.234 -
  34.235 -/* vi: set ts=4 sw=4 expandtab: */
    35.1 --- a/src/video/ataricommon/SDL_atarievents_c.h	Sun Sep 20 04:13:23 2009 +0000
    35.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.3 @@ -1,63 +0,0 @@
    35.4 -/*
    35.5 -    SDL - Simple DirectMedia Layer
    35.6 -    Copyright (C) 1997-2009 Sam Lantinga
    35.7 -
    35.8 -    This library is free software; you can redistribute it and/or
    35.9 -    modify it under the terms of the GNU Lesser General Public
   35.10 -    License as published by the Free Software Foundation; either
   35.11 -    version 2.1 of the License, or (at your option) any later version.
   35.12 -
   35.13 -    This library is distributed in the hope that it will be useful,
   35.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   35.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   35.16 -    Lesser General Public License for more details.
   35.17 -
   35.18 -    You should have received a copy of the GNU Lesser General Public
   35.19 -    License along with this library; if not, write to the Free Software
   35.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   35.21 -
   35.22 -    Sam Lantinga
   35.23 -    slouken@libsdl.org
   35.24 -*/
   35.25 -#include "SDL_config.h"
   35.26 -
   35.27 -/*
   35.28 - *	Atari keyboard events manager
   35.29 - *
   35.30 - *	Patrice Mandin
   35.31 - */
   35.32 -
   35.33 -#ifndef _SDL_ATARI_EVENTS_H_
   35.34 -#define _SDL_ATARI_EVENTS_H_
   35.35 -
   35.36 -#include "../SDL_sysvideo.h"
   35.37 -
   35.38 -#define ATARIBIOS_MAXKEYS 128
   35.39 -
   35.40 -/* Special keys state */
   35.41 -#ifndef K_RSHIFT
   35.42 -enum
   35.43 -{
   35.44 -    K_RSHIFT = 0,
   35.45 -    K_LSHIFT,
   35.46 -    K_CTRL,
   35.47 -    K_ALT,
   35.48 -    K_CAPSLOCK,
   35.49 -    K_CLRHOME,
   35.50 -    K_INSERT
   35.51 -};
   35.52 -#endif
   35.53 -
   35.54 -extern void (*SDL_Atari_ShutdownEvents) (void);
   35.55 -
   35.56 -extern void SDL_Atari_PumpEvents(_THIS);
   35.57 -
   35.58 -extern void SDL_Atari_InitInternalKeymap(_THIS);
   35.59 -
   35.60 -/* Atari to Unicode charset translation table */
   35.61 -extern Uint16 SDL_AtariToUnicodeTable[256];
   35.62 -SDL_keysym *SDL_Atari_TranslateKey(int scancode, SDL_keysym * keysym,
   35.63 -                                   SDL_bool pressed);
   35.64 -
   35.65 -#endif /* _SDL_ATARI_EVENTS_H_ */
   35.66 -/* vi: set ts=4 sw=4 expandtab: */
    36.1 --- a/src/video/ataricommon/SDL_atarigl.c	Sun Sep 20 04:13:23 2009 +0000
    36.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    36.3 @@ -1,1127 +0,0 @@
    36.4 -/*
    36.5 -    SDL - Simple DirectMedia Layer
    36.6 -    Copyright (C) 1997-2009 Sam Lantinga
    36.7 -
    36.8 -    This library is free software; you can redistribute it and/or
    36.9 -    modify it under the terms of the GNU Library General Public
   36.10 -    License as published by the Free Software Foundation; either
   36.11 -    version 2 of the License, or (at your option) any later version.
   36.12 -
   36.13 -    This library is distributed in the hope that it will be useful,
   36.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   36.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   36.16 -    Library General Public License for more details.
   36.17 -
   36.18 -    You should have received a copy of the GNU Library General Public
   36.19 -    License along with this library; if not, write to the Free
   36.20 -    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   36.21 -
   36.22 -    Sam Lantinga
   36.23 -    slouken@libsdl.org
   36.24 -*/
   36.25 -#include "SDL_config.h"
   36.26 -
   36.27 -/* Atari OSMesa.ldg implementation of SDL OpenGL support */
   36.28 -
   36.29 -/*--- Includes ---*/
   36.30 -
   36.31 -#if SDL_VIDEO_OPENGL
   36.32 -#include <GL/osmesa.h>
   36.33 -#endif
   36.34 -
   36.35 -#include <mint/osbind.h>
   36.36 -
   36.37 -#include "SDL_endian.h"
   36.38 -#include "SDL_video.h"
   36.39 -#include "SDL_atarigl_c.h"
   36.40 -#if SDL_VIDEO_OPENGL_OSMESA_DYNAMIC
   36.41 -#include "SDL_loadso.h"
   36.42 -#endif
   36.43 -
   36.44 -/*--- Defines ---*/
   36.45 -
   36.46 -#define PATH_OSMESA_LDG	"osmesa.ldg"
   36.47 -#define PATH_MESAGL_LDG	"mesa_gl.ldg"
   36.48 -#define PATH_TINYGL_LDG	"tiny_gl.ldg"
   36.49 -
   36.50 -#define VDI_RGB	0xf
   36.51 -
   36.52 -/*--- Functions prototypes ---*/
   36.53 -
   36.54 -static void SDL_AtariGL_UnloadLibrary(_THIS);
   36.55 -
   36.56 -#if SDL_VIDEO_OPENGL
   36.57 -static void CopyShadowNull(_THIS, SDL_Surface * surface);
   36.58 -static void CopyShadowDirect(_THIS, SDL_Surface * surface);
   36.59 -static void CopyShadowRGBTo555(_THIS, SDL_Surface * surface);
   36.60 -static void CopyShadowRGBTo565(_THIS, SDL_Surface * surface);
   36.61 -static void CopyShadowRGBSwap(_THIS, SDL_Surface * surface);
   36.62 -static void CopyShadowRGBToARGB(_THIS, SDL_Surface * surface);
   36.63 -static void CopyShadowRGBToABGR(_THIS, SDL_Surface * surface);
   36.64 -static void CopyShadowRGBToBGRA(_THIS, SDL_Surface * surface);
   36.65 -static void CopyShadowRGBToRGBA(_THIS, SDL_Surface * surface);
   36.66 -static void CopyShadow8888To555(_THIS, SDL_Surface * surface);
   36.67 -static void CopyShadow8888To565(_THIS, SDL_Surface * surface);
   36.68 -
   36.69 -static void ConvertNull(_THIS, SDL_Surface * surface);
   36.70 -static void Convert565To555be(_THIS, SDL_Surface * surface);
   36.71 -static void Convert565To555le(_THIS, SDL_Surface * surface);
   36.72 -static void Convert565le(_THIS, SDL_Surface * surface);
   36.73 -static void ConvertBGRAToABGR(_THIS, SDL_Surface * surface);
   36.74 -
   36.75 -static int InitNew(_THIS, SDL_Surface * current);
   36.76 -static int InitOld(_THIS, SDL_Surface * current);
   36.77 -#endif
   36.78 -
   36.79 -/*--- Public functions ---*/
   36.80 -
   36.81 -int
   36.82 -SDL_AtariGL_Init(_THIS, SDL_Surface * current)
   36.83 -{
   36.84 -#if SDL_VIDEO_OPENGL
   36.85 -    if (gl_oldmesa) {
   36.86 -        gl_active = InitOld(_this, current);
   36.87 -    } else {
   36.88 -        gl_active = InitNew(_this, current);
   36.89 -    }
   36.90 -#endif
   36.91 -
   36.92 -    return (gl_active);
   36.93 -}
   36.94 -
   36.95 -void
   36.96 -SDL_AtariGL_Quit(_THIS, SDL_bool unload)
   36.97 -{
   36.98 -#if SDL_VIDEO_OPENGL
   36.99 -    if (gl_oldmesa) {
  36.100 -        /* Old mesa implementations */
  36.101 -        if (_this->gl_data->OSMesaDestroyLDG) {
  36.102 -            _this->gl_data->OSMesaDestroyLDG();
  36.103 -        }
  36.104 -        if (gl_shadow) {
  36.105 -            Mfree(gl_shadow);
  36.106 -            gl_shadow = NULL;
  36.107 -        }
  36.108 -    } else {
  36.109 -        /* New mesa implementation */
  36.110 -        if (gl_ctx) {
  36.111 -            if (_this->gl_data->OSMesaDestroyContext) {
  36.112 -                _this->gl_data->OSMesaDestroyContext(gl_ctx);
  36.113 -            }
  36.114 -            gl_ctx = NULL;
  36.115 -        }
  36.116 -    }
  36.117 -
  36.118 -    if (unload) {
  36.119 -        SDL_AtariGL_UnloadLibrary(_this);
  36.120 -    }
  36.121 -#endif /* SDL_VIDEO_OPENGL */
  36.122 -    gl_active = 0;
  36.123 -}
  36.124 -
  36.125 -int
  36.126 -SDL_AtariGL_LoadLibrary(_THIS, const char *path)
  36.127 -{
  36.128 -#if SDL_VIDEO_OPENGL
  36.129 -
  36.130 -#if SDL_VIDEO_OPENGL_OSMESA_DYNAMIC
  36.131 -    void *handle;
  36.132 -    SDL_bool cancel_load;
  36.133 -
  36.134 -    if (gl_active) {
  36.135 -        SDL_SetError("OpenGL context already created");
  36.136 -        return -1;
  36.137 -    }
  36.138 -
  36.139 -    /* Unload previous driver */
  36.140 -    SDL_AtariGL_UnloadLibrary(_this);
  36.141 -
  36.142 -    /* Load library given by path */
  36.143 -    handle = SDL_LoadObject(path);
  36.144 -    if (handle == NULL) {
  36.145 -        /* Try to load another one */
  36.146 -        path = SDL_getenv("SDL_VIDEO_GL_DRIVER");
  36.147 -        if (path != NULL) {
  36.148 -            handle = SDL_LoadObject(path);
  36.149 -        }
  36.150 -
  36.151 -        /* If it does not work, try some other */
  36.152 -        if (handle == NULL) {
  36.153 -            path = PATH_OSMESA_LDG;
  36.154 -            handle = SDL_LoadObject(path);
  36.155 -        }
  36.156 -
  36.157 -        if (handle == NULL) {
  36.158 -            path = PATH_MESAGL_LDG;
  36.159 -            handle = SDL_LoadObject(path);
  36.160 -        }
  36.161 -
  36.162 -        if (handle == NULL) {
  36.163 -            path = PATH_TINYGL_LDG;
  36.164 -            handle = SDL_LoadObject(path);
  36.165 -        }
  36.166 -    }
  36.167 -
  36.168 -    if (handle == NULL) {
  36.169 -        SDL_SetError("Could not load OpenGL library");
  36.170 -        return -1;
  36.171 -    }
  36.172 -
  36.173 -    _this->gl_data->glGetIntegerv = SDL_LoadFunction(handle, "glGetIntegerv");
  36.174 -    _this->gl_data->glFinish = SDL_LoadFunction(handle, "glFinish");
  36.175 -    _this->gl_data->glFlush = SDL_LoadFunction(handle, "glFlush");
  36.176 -
  36.177 -    cancel_load = SDL_FALSE;
  36.178 -    if (_this->gl_data->glGetIntegerv == NULL) {
  36.179 -        cancel_load = SDL_TRUE;
  36.180 -    } else {
  36.181 -        /* We need either glFinish (OSMesa) or glFlush (TinyGL) */
  36.182 -        if ((_this->gl_data->glFinish == NULL) &&
  36.183 -            (_this->gl_data->glFlush == NULL)) {
  36.184 -            cancel_load = SDL_TRUE;
  36.185 -        }
  36.186 -    }
  36.187 -    if (cancel_load) {
  36.188 -        SDL_SetError("Could not retrieve OpenGL functions");
  36.189 -        SDL_UnloadObject(handle);
  36.190 -        /* Restore pointers to static library */
  36.191 -        SDL_AtariGL_InitPointers(this);
  36.192 -        return -1;
  36.193 -    }
  36.194 -
  36.195 -    /* Load functions pointers (osmesa.ldg) */
  36.196 -    _this->gl_data->OSMesaCreateContextExt =
  36.197 -        SDL_LoadFunction(handle, "OSMesaCreateContextExt");
  36.198 -    _this->gl_data->OSMesaDestroyContext =
  36.199 -        SDL_LoadFunction(handle, "OSMesaDestroyContext");
  36.200 -    _this->gl_data->OSMesaMakeCurrent =
  36.201 -        SDL_LoadFunction(handle, "OSMesaMakeCurrent");
  36.202 -    _this->gl_data->OSMesaPixelStore =
  36.203 -        SDL_LoadFunction(handle, "OSMesaPixelStore");
  36.204 -    _this->gl_data->OSMesaGetProcAddress =
  36.205 -        SDL_LoadFunction(handle, "OSMesaGetProcAddress");
  36.206 -
  36.207 -    /* Load old functions pointers (mesa_gl.ldg, tiny_gl.ldg) */
  36.208 -    _this->gl_data->OSMesaCreateLDG =
  36.209 -        SDL_LoadFunction(handle, "OSMesaCreateLDG");
  36.210 -    _this->gl_data->OSMesaDestroyLDG =
  36.211 -        SDL_LoadFunction(handle, "OSMesaDestroyLDG");
  36.212 -
  36.213 -    gl_oldmesa = 0;
  36.214 -
  36.215 -    if ((_this->gl_data->OSMesaCreateContextExt == NULL) ||
  36.216 -        (_this->gl_data->OSMesaDestroyContext == NULL) ||
  36.217 -        (_this->gl_data->OSMesaMakeCurrent == NULL) ||
  36.218 -        (_this->gl_data->OSMesaPixelStore == NULL) ||
  36.219 -        (_this->gl_data->OSMesaGetProcAddress == NULL)) {
  36.220 -        /* Hum, maybe old library ? */
  36.221 -        if ((_this->gl_data->OSMesaCreateLDG == NULL) ||
  36.222 -            (_this->gl_data->OSMesaDestroyLDG == NULL)) {
  36.223 -            SDL_SetError("Could not retrieve OSMesa functions");
  36.224 -            SDL_UnloadObject(handle);
  36.225 -            /* Restore pointers to static library */
  36.226 -            SDL_AtariGL_InitPointers(_this);
  36.227 -            return -1;
  36.228 -        } else {
  36.229 -            gl_oldmesa = 1;
  36.230 -        }
  36.231 -    }
  36.232 -
  36.233 -    _this->gl_config.dll_handle = handle;
  36.234 -    if (path) {
  36.235 -        SDL_strlcpy(_this->gl_config.driver_path, path,
  36.236 -                    SDL_arraysize(_this->gl_config.driver_path));
  36.237 -    } else {
  36.238 -        *this->gl_config.driver_path = '\0';
  36.239 -    }
  36.240 -
  36.241 -#endif
  36.242 -    _this->gl_config.driver_loaded = 1;
  36.243 -
  36.244 -    return 0;
  36.245 -#else
  36.246 -    return -1;
  36.247 -#endif
  36.248 -}
  36.249 -
  36.250 -void *
  36.251 -SDL_AtariGL_GetProcAddress(_THIS, const char *proc)
  36.252 -{
  36.253 -    void *func = NULL;
  36.254 -#if SDL_VIDEO_OPENGL
  36.255 -
  36.256 -    if (_this->gl_config.dll_handle) {
  36.257 -        func = SDL_LoadFunction(this->gl_config.dll_handle, (void *) proc);
  36.258 -    } else if (_this->gl_data->OSMesaGetProcAddress) {
  36.259 -        func = _this->gl_data->OSMesaGetProcAddress(proc);
  36.260 -    }
  36.261 -#endif
  36.262 -    return func;
  36.263 -}
  36.264 -
  36.265 -int
  36.266 -SDL_AtariGL_GetAttribute(_THIS, SDL_GLattr attrib, int *value)
  36.267 -{
  36.268 -#if SDL_VIDEO_OPENGL
  36.269 -    GLenum mesa_attrib;
  36.270 -    SDL_Surface *surface;
  36.271 -
  36.272 -    if (!gl_active) {
  36.273 -        return -1;
  36.274 -    }
  36.275 -
  36.276 -    switch (attrib) {
  36.277 -    case SDL_GL_RED_SIZE:
  36.278 -        mesa_attrib = GL_RED_BITS;
  36.279 -        break;
  36.280 -    case SDL_GL_GREEN_SIZE:
  36.281 -        mesa_attrib = GL_GREEN_BITS;
  36.282 -        break;
  36.283 -    case SDL_GL_BLUE_SIZE:
  36.284 -        mesa_attrib = GL_BLUE_BITS;
  36.285 -        break;
  36.286 -    case SDL_GL_ALPHA_SIZE:
  36.287 -        mesa_attrib = GL_ALPHA_BITS;
  36.288 -        break;
  36.289 -    case SDL_GL_DOUBLEBUFFER:
  36.290 -        surface = _this->screen;
  36.291 -        *value = ((surface->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF);
  36.292 -        return 0;
  36.293 -    case SDL_GL_DEPTH_SIZE:
  36.294 -        mesa_attrib = GL_DEPTH_BITS;
  36.295 -        break;
  36.296 -    case SDL_GL_STENCIL_SIZE:
  36.297 -        mesa_attrib = GL_STENCIL_BITS;
  36.298 -        break;
  36.299 -    case SDL_GL_ACCUM_RED_SIZE:
  36.300 -        mesa_attrib = GL_ACCUM_RED_BITS;
  36.301 -        break;
  36.302 -    case SDL_GL_ACCUM_GREEN_SIZE:
  36.303 -        mesa_attrib = GL_ACCUM_GREEN_BITS;
  36.304 -        break;
  36.305 -    case SDL_GL_ACCUM_BLUE_SIZE:
  36.306 -        mesa_attrib = GL_ACCUM_BLUE_BITS;
  36.307 -        break;
  36.308 -    case SDL_GL_ACCUM_ALPHA_SIZE:
  36.309 -        mesa_attrib = GL_ACCUM_ALPHA_BITS;
  36.310 -        break;
  36.311 -    default:
  36.312 -        return -1;
  36.313 -    }
  36.314 -
  36.315 -    _this->gl_data->glGetIntegerv(mesa_attrib, value);
  36.316 -    return 0;
  36.317 -#else
  36.318 -    return -1;
  36.319 -#endif
  36.320 -}
  36.321 -
  36.322 -int
  36.323 -SDL_AtariGL_MakeCurrent(_THIS)
  36.324 -{
  36.325 -#if SDL_VIDEO_OPENGL
  36.326 -    SDL_Surface *surface;
  36.327 -    GLenum type;
  36.328 -
  36.329 -    if (gl_oldmesa && gl_active) {
  36.330 -        return 0;
  36.331 -    }
  36.332 -
  36.333 -    if (_this->gl_config.dll_handle) {
  36.334 -        if ((_this->gl_data->OSMesaMakeCurrent == NULL) ||
  36.335 -            (_this->gl_data->OSMesaPixelStore == NULL)) {
  36.336 -            return -1;
  36.337 -        }
  36.338 -    }
  36.339 -
  36.340 -    if (!gl_active) {
  36.341 -        SDL_SetError("Invalid OpenGL context");
  36.342 -        return -1;
  36.343 -    }
  36.344 -
  36.345 -    surface = _this->screen;
  36.346 -
  36.347 -    if ((surface->format->BitsPerPixel == 15)
  36.348 -        || (surface->format->BitsPerPixel == 16)) {
  36.349 -        type = GL_UNSIGNED_SHORT_5_6_5;
  36.350 -    } else {
  36.351 -        type = GL_UNSIGNED_BYTE;
  36.352 -    }
  36.353 -
  36.354 -    if (!
  36.355 -        (_this->
  36.356 -         gl_data->OSMesaMakeCurrent(gl_ctx, surface->pixels, type, surface->w,
  36.357 -                                    surface->h))) {
  36.358 -        SDL_SetError("Can not make OpenGL context current");
  36.359 -        return -1;
  36.360 -    }
  36.361 -
  36.362 -    /* OSMesa draws upside down */
  36.363 -    _this->gl_data->OSMesaPixelStore(OSMESA_Y_UP, 0);
  36.364 -
  36.365 -    return 0;
  36.366 -#else
  36.367 -    return -1;
  36.368 -#endif
  36.369 -}
  36.370 -
  36.371 -void
  36.372 -SDL_AtariGL_SwapBuffers(_THIS)
  36.373 -{
  36.374 -#if SDL_VIDEO_OPENGL
  36.375 -    if (gl_active) {
  36.376 -        if (_this->gl_config.dll_handle) {
  36.377 -            if (_this->gl_data->glFinish) {
  36.378 -                _this->gl_data->glFinish();
  36.379 -            } else if (_this->gl_data->glFlush) {
  36.380 -                _this->gl_data->glFlush();
  36.381 -            }
  36.382 -        } else {
  36.383 -            _this->gl_data->glFinish();
  36.384 -        }
  36.385 -        gl_copyshadow(_this, _this->screen);
  36.386 -        gl_convert(_this, _this->screen);
  36.387 -    }
  36.388 -#endif
  36.389 -}
  36.390 -
  36.391 -void
  36.392 -SDL_AtariGL_InitPointers(_THIS)
  36.393 -{
  36.394 -#if SDL_VIDEO_OPENGL
  36.395 -    _this->gl_data->OSMesaCreateContextExt = OSMesaCreateContextExt;
  36.396 -    _this->gl_data->OSMesaDestroyContext = OSMesaDestroyContext;
  36.397 -    _this->gl_data->OSMesaMakeCurrent = OSMesaMakeCurrent;
  36.398 -    _this->gl_data->OSMesaPixelStore = OSMesaPixelStore;
  36.399 -    _this->gl_data->OSMesaGetProcAddress = OSMesaGetProcAddress;
  36.400 -
  36.401 -    _this->gl_data->glGetIntegerv = glGetIntegerv;
  36.402 -    _this->gl_data->glFinish = glFinish;
  36.403 -    _this->gl_data->glFlush = glFlush;
  36.404 -
  36.405 -    _this->gl_data->OSMesaCreateLDG = NULL;
  36.406 -    _this->gl_data->OSMesaDestroyLDG = NULL;
  36.407 -#endif
  36.408 -}
  36.409 -
  36.410 -/*--- Private functions ---*/
  36.411 -
  36.412 -static void
  36.413 -SDL_AtariGL_UnloadLibrary(_THIS)
  36.414 -{
  36.415 -#if SDL_VIDEO_OPENGL
  36.416 -    if (_this->gl_config.dll_handle) {
  36.417 -        SDL_UnloadObject(_this->gl_config.dll_handle);
  36.418 -        _this->gl_config.dll_handle = NULL;
  36.419 -
  36.420 -        /* Restore pointers to static library */
  36.421 -        SDL_AtariGL_InitPointers(_this);
  36.422 -    }
  36.423 -#endif
  36.424 -}
  36.425 -
  36.426 -/*--- Creation of an OpenGL context using new/old functions ---*/
  36.427 -
  36.428 -#if SDL_VIDEO_OPENGL
  36.429 -static int
  36.430 -InitNew(_THIS, SDL_Surface * current)
  36.431 -{
  36.432 -    GLenum osmesa_format;
  36.433 -    SDL_PixelFormat *pixel_format;
  36.434 -    Uint32 redmask;
  36.435 -    int recreatecontext;
  36.436 -    GLint newaccumsize;
  36.437 -
  36.438 -    if (_this->gl_config.dll_handle) {
  36.439 -        if (_this->gl_data->OSMesaCreateContextExt == NULL) {
  36.440 -            return 0;
  36.441 -        }
  36.442 -    }
  36.443 -
  36.444 -    /* Init OpenGL context using OSMesa */
  36.445 -    gl_convert = ConvertNull;
  36.446 -    gl_copyshadow = CopyShadowNull;
  36.447 -    gl_upsidedown = SDL_FALSE;
  36.448 -
  36.449 -    pixel_format = current->format;
  36.450 -    redmask = pixel_format->Rmask;
  36.451 -    switch (pixel_format->BitsPerPixel) {
  36.452 -    case 15:
  36.453 -        /* 1555, big and little endian, unsupported */
  36.454 -        gl_pixelsize = 2;
  36.455 -        osmesa_format = OSMESA_RGB_565;
  36.456 -        if (redmask == 31 << 10) {
  36.457 -            gl_convert = Convert565To555be;
  36.458 -        } else {
  36.459 -            gl_convert = Convert565To555le;
  36.460 -        }
  36.461 -        break;
  36.462 -    case 16:
  36.463 -        gl_pixelsize = 2;
  36.464 -        if (redmask == 31 << 11) {
  36.465 -            osmesa_format = OSMESA_RGB_565;
  36.466 -        } else {
  36.467 -            /* 565, little endian, unsupported */
  36.468 -            osmesa_format = OSMESA_RGB_565;
  36.469 -            gl_convert = Convert565le;
  36.470 -        }
  36.471 -        break;
  36.472 -    case 24:
  36.473 -        gl_pixelsize = 3;
  36.474 -        if (redmask == 255 << 16) {
  36.475 -            osmesa_format = OSMESA_RGB;
  36.476 -        } else {
  36.477 -            osmesa_format = OSMESA_BGR;
  36.478 -        }
  36.479 -        break;
  36.480 -    case 32:
  36.481 -        gl_pixelsize = 4;
  36.482 -        if (redmask == 255 << 16) {
  36.483 -            osmesa_format = OSMESA_ARGB;
  36.484 -        } else if (redmask == 255 << 8) {
  36.485 -            osmesa_format = OSMESA_BGRA;
  36.486 -        } else if (redmask == 255 << 24) {
  36.487 -            osmesa_format = OSMESA_RGBA;
  36.488 -        } else {
  36.489 -            /* ABGR format unsupported */
  36.490 -            osmesa_format = OSMESA_BGRA;
  36.491 -            gl_convert = ConvertBGRAToABGR;
  36.492 -        }
  36.493 -        break;
  36.494 -    default:
  36.495 -        gl_pixelsize = 1;
  36.496 -        osmesa_format = OSMESA_COLOR_INDEX;
  36.497 -        break;
  36.498 -    }
  36.499 -
  36.500 -    /* Try to keep current context if possible */
  36.501 -    newaccumsize =
  36.502 -        _this->gl_config.accum_red_size +
  36.503 -        _this->gl_config.accum_green_size +
  36.504 -        _this->gl_config.accum_blue_size + _this->gl_config.accum_alpha_size;
  36.505 -    recreatecontext = 1;
  36.506 -    if (gl_ctx &&
  36.507 -        (gl_curformat == osmesa_format) &&
  36.508 -        (gl_curdepth == _this->gl_config.depth_size) &&
  36.509 -        (gl_curstencil == _this->gl_config.stencil_size) &&
  36.510 -        (gl_curaccum == newaccumsize)) {
  36.511 -        recreatecontext = 0;
  36.512 -    }
  36.513 -    if (recreatecontext) {
  36.514 -        SDL_AtariGL_Quit(this, SDL_FALSE);
  36.515 -
  36.516 -        gl_ctx =
  36.517 -            _this->gl_data->OSMesaCreateContextExt(osmesa_format,
  36.518 -                                                   _this->
  36.519 -                                                   gl_config.depth_size,
  36.520 -                                                   _this->
  36.521 -                                                   gl_config.stencil_size,
  36.522 -                                                   newaccumsize, NULL);
  36.523 -
  36.524 -        if (gl_ctx) {
  36.525 -            gl_curformat = osmesa_format;
  36.526 -            gl_curdepth = _this->gl_config.depth_size;
  36.527 -            gl_curstencil = _this->gl_config.stencil_size;
  36.528 -            gl_curaccum = newaccumsize;
  36.529 -        } else {
  36.530 -            gl_curformat = 0;
  36.531 -            gl_curdepth = 0;
  36.532 -            gl_curstencil = 0;
  36.533 -            gl_curaccum = 0;
  36.534 -        }
  36.535 -    }
  36.536 -
  36.537 -    return (gl_ctx != NULL);
  36.538 -}
  36.539 -
  36.540 -
  36.541 -static int
  36.542 -InitOld(_THIS, SDL_Surface * current)
  36.543 -{
  36.544 -    GLenum osmesa_format;
  36.545 -    SDL_PixelFormat *pixel_format;
  36.546 -    Uint32 redmask;
  36.547 -    int recreatecontext, tinygl_present;
  36.548 -
  36.549 -    if (_this->gl_config.dll_handle) {
  36.550 -        if (_this->gl_data->OSMesaCreateLDG == NULL) {
  36.551 -            return 0;
  36.552 -        }
  36.553 -    }
  36.554 -
  36.555 -    /* TinyGL only supports VDI_RGB (OSMESA_RGB) */
  36.556 -    tinygl_present = 0;
  36.557 -    if (_this->gl_config.dll_handle) {
  36.558 -        if (_this->gl_data->glFinish == NULL) {
  36.559 -            tinygl_present = 1;
  36.560 -        }
  36.561 -    }
  36.562 -
  36.563 -    /* Init OpenGL context using OSMesa */
  36.564 -    gl_convert = ConvertNull;
  36.565 -    gl_copyshadow = CopyShadowNull;
  36.566 -    gl_upsidedown = SDL_FALSE;
  36.567 -
  36.568 -    pixel_format = current->format;
  36.569 -    redmask = pixel_format->Rmask;
  36.570 -    switch (pixel_format->BitsPerPixel) {
  36.571 -    case 15:
  36.572 -        /* 15 bits unsupported */
  36.573 -        if (tinygl_present) {
  36.574 -            gl_pixelsize = 3;
  36.575 -            osmesa_format = VDI_RGB;
  36.576 -            if (redmask == 31 << 10) {
  36.577 -                gl_copyshadow = CopyShadowRGBTo555;
  36.578 -            } else {
  36.579 -                gl_copyshadow = CopyShadowRGBTo565;
  36.580 -                gl_convert = Convert565To555le;
  36.581 -            }
  36.582 -        } else {
  36.583 -            gl_pixelsize = 4;
  36.584 -            gl_upsidedown = SDL_TRUE;
  36.585 -            osmesa_format = OSMESA_ARGB;
  36.586 -            if (redmask == 31 << 10) {
  36.587 -                gl_copyshadow = CopyShadow8888To555;
  36.588 -            } else {
  36.589 -                gl_copyshadow = CopyShadow8888To565;
  36.590 -                gl_convert = Convert565To555le;
  36.591 -            }
  36.592 -        }
  36.593 -        break;
  36.594 -    case 16:
  36.595 -        /* 16 bits unsupported */
  36.596 -        if (tinygl_present) {
  36.597 -            gl_pixelsize = 3;
  36.598 -            osmesa_format = VDI_RGB;
  36.599 -            gl_copyshadow = CopyShadowRGBTo565;
  36.600 -            if (redmask != 31 << 11) {
  36.601 -                /* 565, little endian, unsupported */
  36.602 -                gl_convert = Convert565le;
  36.603 -            }
  36.604 -        } else {
  36.605 -            gl_pixelsize = 4;
  36.606 -            gl_upsidedown = SDL_TRUE;
  36.607 -            osmesa_format = OSMESA_ARGB;
  36.608 -            gl_copyshadow = CopyShadow8888To565;
  36.609 -            if (redmask != 31 << 11) {
  36.610 -                /* 565, little endian, unsupported */
  36.611 -                gl_convert = Convert565le;
  36.612 -            }
  36.613 -        }
  36.614 -        break;
  36.615 -    case 24:
  36.616 -        gl_pixelsize = 3;
  36.617 -        if (tinygl_present) {
  36.618 -            osmesa_format = VDI_RGB;
  36.619 -            gl_copyshadow = CopyShadowDirect;
  36.620 -            if (redmask != 255 << 16) {
  36.621 -                gl_copyshadow = CopyShadowRGBSwap;
  36.622 -            }
  36.623 -        } else {
  36.624 -            gl_copyshadow = CopyShadowDirect;
  36.625 -            gl_upsidedown = SDL_TRUE;
  36.626 -            if (redmask == 255 << 16) {
  36.627 -                osmesa_format = OSMESA_RGB;
  36.628 -            } else {
  36.629 -                osmesa_format = OSMESA_BGR;
  36.630 -            }
  36.631 -        }
  36.632 -        break;
  36.633 -    case 32:
  36.634 -        if (tinygl_present) {
  36.635 -            gl_pixelsize = 3;
  36.636 -            osmesa_format = VDI_RGB;
  36.637 -            gl_copyshadow = CopyShadowRGBToARGB;
  36.638 -            if (redmask == 255) {
  36.639 -                gl_convert = CopyShadowRGBToABGR;
  36.640 -            } else if (redmask == 255 << 8) {
  36.641 -                gl_convert = CopyShadowRGBToBGRA;
  36.642 -            } else if (redmask == 255 << 24) {
  36.643 -                gl_convert = CopyShadowRGBToRGBA;
  36.644 -            }
  36.645 -        } else {
  36.646 -            gl_pixelsize = 4;
  36.647 -            gl_upsidedown = SDL_TRUE;
  36.648 -            gl_copyshadow = CopyShadowDirect;
  36.649 -            if (redmask == 255 << 16) {
  36.650 -                osmesa_format = OSMESA_ARGB;
  36.651 -            } else if (redmask == 255 << 8) {
  36.652 -                osmesa_format = OSMESA_BGRA;
  36.653 -            } else if (redmask == 255 << 24) {
  36.654 -                osmesa_format = OSMESA_RGBA;
  36.655 -            } else {
  36.656 -                /* ABGR format unsupported */
  36.657 -                osmesa_format = OSMESA_BGRA;
  36.658 -                gl_convert = ConvertBGRAToABGR;
  36.659 -            }
  36.660 -        }
  36.661 -        break;
  36.662 -    default:
  36.663 -        if (tinygl_present) {
  36.664 -            SDL_AtariGL_Quit(_this, SDL_FALSE);
  36.665 -            return 0;
  36.666 -        }
  36.667 -        gl_pixelsize = 1;
  36.668 -        gl_copyshadow = CopyShadowDirect;
  36.669 -        osmesa_format = OSMESA_COLOR_INDEX;
  36.670 -        break;
  36.671 -    }
  36.672 -
  36.673 -    /* Try to keep current context if possible */
  36.674 -    recreatecontext = 1;
  36.675 -    if (gl_shadow &&
  36.676 -        (gl_curformat == osmesa_format) &&
  36.677 -        (gl_curwidth == current->w) && (gl_curheight == current->h)) {
  36.678 -        recreatecontext = 0;
  36.679 -    }
  36.680 -    if (recreatecontext) {
  36.681 -        SDL_AtariGL_Quit(_this, SDL_FALSE);
  36.682 -
  36.683 -        gl_shadow =
  36.684 -            _this->gl_data->OSMesaCreateLDG(osmesa_format, GL_UNSIGNED_BYTE,
  36.685 -                                            current->w, current->h);
  36.686 -
  36.687 -        if (gl_shadow) {
  36.688 -            gl_curformat = osmesa_format;
  36.689 -            gl_curwidth = current->w;
  36.690 -            gl_curheight = current->h;
  36.691 -        } else {
  36.692 -            gl_curformat = 0;
  36.693 -            gl_curwidth = 0;
  36.694 -            gl_curheight = 0;
  36.695 -        }
  36.696 -    }
  36.697 -
  36.698 -    return (gl_shadow != NULL);
  36.699 -}
  36.700 -
  36.701 -/*--- Conversions routines from shadow buffer to the screen ---*/
  36.702 -
  36.703 -static void
  36.704 -CopyShadowNull(_THIS, SDL_Surface * surface)
  36.705 -{
  36.706 -}
  36.707 -
  36.708 -static void
  36.709 -CopyShadowDirect(_THIS, SDL_Surface * surface)
  36.710 -{
  36.711 -    int y, srcpitch, dstpitch;
  36.712 -    Uint8 *srcline, *dstline;
  36.713 -
  36.714 -    srcline = gl_shadow;
  36.715 -    srcpitch = surface->w * gl_pixelsize;
  36.716 -    dstline = surface->pixels;
  36.717 -    dstpitch = surface->pitch;
  36.718 -    if (gl_upsidedown) {
  36.719 -        srcline += (surface->h - 1) * srcpitch;
  36.720 -        srcpitch = -srcpitch;
  36.721 -    }
  36.722 -
  36.723 -    for (y = 0; y < surface->h; y++) {
  36.724 -        SDL_memcpy(dstline, srcline, srcpitch);
  36.725 -
  36.726 -        srcline += srcpitch;
  36.727 -        dstline += dstpitch;
  36.728 -    }
  36.729 -}
  36.730 -
  36.731 -static void
  36.732 -CopyShadowRGBTo555(_THIS, SDL_Surface * surface)
  36.733 -{
  36.734 -    int x, y, srcpitch, dstpitch;
  36.735 -    Uint16 *dstline, *dstcol;
  36.736 -    Uint8 *srcline, *srccol;
  36.737 -
  36.738 -    srcline = (Uint8 *) gl_shadow;
  36.739 -    srcpitch = surface->w * gl_pixelsize;
  36.740 -    dstline = surface->pixels;
  36.741 -    dstpitch = surface->pitch >> 1;
  36.742 -    if (gl_upsidedown) {
  36.743 -        srcline += (surface->h - 1) * srcpitch;
  36.744 -        srcpitch = -srcpitch;
  36.745 -    }
  36.746 -
  36.747 -    for (y = 0; y < surface->h; y++) {
  36.748 -        srccol = srcline;
  36.749 -        dstcol = dstline;
  36.750 -        for (x = 0; x < surface->w; x++) {
  36.751 -            Uint16 dstcolor;
  36.752 -
  36.753 -            dstcolor = ((*srccol++) << 7) & (31 << 10);
  36.754 -            dstcolor |= ((*srccol++) << 2) & (31 << 5);
  36.755 -            dstcolor |= ((*srccol++) >> 3) & 31;
  36.756 -            *dstcol++ = dstcolor;
  36.757 -        }
  36.758 -
  36.759 -        srcline += srcpitch;
  36.760 -        dstline += dstpitch;
  36.761 -    }
  36.762 -}
  36.763 -
  36.764 -static void
  36.765 -CopyShadowRGBTo565(_THIS, SDL_Surface * surface)
  36.766 -{
  36.767 -    int x, y, srcpitch, dstpitch;
  36.768 -    Uint16 *dstline, *dstcol;
  36.769 -    Uint8 *srcline, *srccol;
  36.770 -
  36.771 -    srcline = (Uint8 *) gl_shadow;
  36.772 -    srcpitch = surface->w * gl_pixelsize;
  36.773 -    dstline = surface->pixels;
  36.774 -    dstpitch = surface->pitch >> 1;
  36.775 -    if (gl_upsidedown) {
  36.776 -        srcline += (surface->h - 1) * srcpitch;
  36.777 -        srcpitch = -srcpitch;
  36.778 -    }
  36.779 -
  36.780 -    for (y = 0; y < surface->h; y++) {
  36.781 -        srccol = srcline;
  36.782 -        dstcol = dstline;
  36.783 -
  36.784 -        for (x = 0; x < surface->w; x++) {
  36.785 -            Uint16 dstcolor;
  36.786 -
  36.787 -            dstcolor = ((*srccol++) << 8) & (31 << 11);
  36.788 -            dstcolor |= ((*srccol++) << 3) & (63 << 5);
  36.789 -            dstcolor |= ((*srccol++) >> 3) & 31;
  36.790 -            *dstcol++ = dstcolor;
  36.791 -        }
  36.792 -
  36.793 -        srcline += srcpitch;
  36.794 -        dstline += dstpitch;
  36.795 -    }
  36.796 -}
  36.797 -
  36.798 -static void
  36.799 -CopyShadowRGBSwap(_THIS, SDL_Surface * surface)
  36.800 -{
  36.801 -    int x, y, srcpitch, dstpitch;
  36.802 -    Uint8 *dstline, *dstcol;
  36.803 -    Uint8 *srcline, *srccol;
  36.804 -
  36.805 -    srcline = (Uint8 *) gl_shadow;
  36.806 -    srcpitch = surface->w * gl_pixelsize;
  36.807 -    dstline = surface->pixels;
  36.808 -    dstpitch = surface->pitch;
  36.809 -    if (gl_upsidedown) {
  36.810 -        srcline += (surface->h - 1) * srcpitch;
  36.811 -        srcpitch = -srcpitch;
  36.812 -    }
  36.813 -
  36.814 -    for (y = 0; y < surface->h; y++) {
  36.815 -        srccol = srcline;
  36.816 -        dstcol = dstline;
  36.817 -
  36.818 -        for (x = 0; x < surface->w; x++) {
  36.819 -            *dstcol++ = srccol[2];
  36.820 -            *dstcol++ = srccol[1];
  36.821 -            *dstcol++ = srccol[0];
  36.822 -            srccol += 3;
  36.823 -        }
  36.824 -
  36.825 -        srcline += srcpitch;
  36.826 -        dstline += dstpitch;
  36.827 -    }
  36.828 -}
  36.829 -
  36.830 -static void
  36.831 -CopyShadowRGBToARGB(_THIS, SDL_Surface * surface)
  36.832 -{
  36.833 -    int x, y, srcpitch, dstpitch;
  36.834 -    Uint32 *dstline, *dstcol;
  36.835 -    Uint8 *srcline, *srccol;
  36.836 -
  36.837 -    srcline = (Uint8 *) gl_shadow;
  36.838 -    srcpitch = surface->w * gl_pixelsize;
  36.839 -    dstline = surface->pixels;
  36.840 -    dstpitch = surface->pitch >> 2;
  36.841 -    if (gl_upsidedown) {
  36.842 -        srcline += (surface->h - 1) * srcpitch;
  36.843 -        srcpitch = -srcpitch;
  36.844 -    }
  36.845 -
  36.846 -    for (y = 0; y < surface->h; y++) {
  36.847 -        srccol = srcline;
  36.848 -        dstcol = dstline;
  36.849 -
  36.850 -        for (x = 0; x < surface->w; x++) {
  36.851 -            Uint32 dstcolor;
  36.852 -
  36.853 -            dstcolor = (*srccol++) << 16;
  36.854 -            dstcolor |= (*srccol++) << 8;
  36.855 -            dstcolor |= *srccol++;
  36.856 -
  36.857 -            *dstcol++ = dstcolor;
  36.858 -        }
  36.859 -
  36.860 -        srcline += srcpitch;
  36.861 -        dstline += dstpitch;
  36.862 -    }
  36.863 -}
  36.864 -
  36.865 -static void
  36.866 -CopyShadowRGBToABGR(_THIS, SDL_Surface * surface)
  36.867 -{
  36.868 -    int x, y, srcpitch, dstpitch;
  36.869 -    Uint32 *dstline, *dstcol;
  36.870 -    Uint8 *srcline, *srccol;
  36.871 -
  36.872 -    srcline = (Uint8 *) gl_shadow;
  36.873 -    srcpitch = surface->w * gl_pixelsize;
  36.874 -    dstline = surface->pixels;
  36.875 -    dstpitch = surface->pitch >> 2;
  36.876 -    if (gl_upsidedown) {
  36.877 -        srcline += (surface->h - 1) * srcpitch;
  36.878 -        srcpitch = -srcpitch;
  36.879 -    }
  36.880 -
  36.881 -    for (y = 0; y < surface->h; y++) {
  36.882 -        srccol = srcline;
  36.883 -        dstcol = dstline;
  36.884 -
  36.885 -        for (x = 0; x < surface->w; x++) {
  36.886 -            Uint32 dstcolor;
  36.887 -
  36.888 -            dstcolor = *srccol++;
  36.889 -            dstcolor |= (*srccol++) << 8;
  36.890 -            dstcolor |= (*srccol++) << 16;
  36.891 -
  36.892 -            *dstcol++ = dstcolor;
  36.893 -        }
  36.894 -
  36.895 -        srcline += srcpitch;
  36.896 -        dstline += dstpitch;
  36.897 -    }
  36.898 -}
  36.899 -
  36.900 -static void
  36.901 -CopyShadowRGBToBGRA(_THIS, SDL_Surface * surface)
  36.902 -{
  36.903 -    int x, y, srcpitch, dstpitch;
  36.904 -    Uint32 *dstline, *dstcol;
  36.905 -    Uint8 *srcline, *srccol;
  36.906 -
  36.907 -    srcline = (Uint8 *) gl_shadow;
  36.908 -    srcpitch = surface->w * gl_pixelsize;
  36.909 -    dstline = surface->pixels;
  36.910 -    dstpitch = surface->pitch >> 2;
  36.911 -    if (gl_upsidedown) {
  36.912 -        srcline += (surface->h - 1) * srcpitch;
  36.913 -        srcpitch = -srcpitch;
  36.914 -    }
  36.915 -
  36.916 -    for (y = 0; y < surface->h; y++) {
  36.917 -        srccol = srcline;
  36.918 -        dstcol = dstline;
  36.919 -
  36.920 -        for (x = 0; x < surface->w; x++) {
  36.921 -            Uint32 dstcolor;
  36.922 -
  36.923 -            dstcolor = (*srccol++) << 8;
  36.924 -            dstcolor |= (*srccol++) << 16;
  36.925 -            dstcolor |= (*srccol++) << 24;
  36.926 -
  36.927 -            *dstcol++ = dstcolor;
  36.928 -        }
  36.929 -
  36.930 -        srcline += srcpitch;
  36.931 -        dstline += dstpitch;
  36.932 -    }
  36.933 -}
  36.934 -
  36.935 -static void
  36.936 -CopyShadowRGBToRGBA(_THIS, SDL_Surface * surface)
  36.937 -{
  36.938 -    int x, y, srcpitch, dstpitch;
  36.939 -    Uint32 *dstline, *dstcol;
  36.940 -    Uint8 *srcline, *srccol;
  36.941 -
  36.942 -    srcline = (Uint8 *) gl_shadow;
  36.943 -    srcpitch = surface->w * gl_pixelsize;
  36.944 -    dstline = surface->pixels;
  36.945 -    dstpitch = surface->pitch >> 2;
  36.946 -    if (gl_upsidedown) {
  36.947 -        srcline += (surface->h - 1) * srcpitch;
  36.948 -        srcpitch = -srcpitch;
  36.949 -    }
  36.950 -
  36.951 -    for (y = 0; y < surface->h; y++) {
  36.952 -        srccol = srcline;
  36.953 -        dstcol = dstline;
  36.954 -
  36.955 -        for (x = 0; x < surface->w; x++) {
  36.956 -            Uint32 dstcolor;
  36.957 -
  36.958 -            dstcolor = (*srccol++) << 24;
  36.959 -            dstcolor |= (*srccol++) << 16;
  36.960 -            dstcolor |= (*srccol++) << 8;
  36.961 -
  36.962 -            *dstcol++ = dstcolor;
  36.963 -        }
  36.964 -
  36.965 -        srcline += srcpitch;
  36.966 -        dstline += dstpitch;
  36.967 -    }
  36.968 -}
  36.969 -
  36.970 -static void
  36.971 -CopyShadow8888To555(_THIS, SDL_Surface * surface)
  36.972 -{
  36.973 -    int x, y, srcpitch, dstpitch;
  36.974 -    Uint16 *dstline, *dstcol;
  36.975 -    Uint32 *srcline, *srccol;
  36.976 -
  36.977 -    srcline = (Uint32 *) gl_shadow;
  36.978 -    srcpitch = (surface->w * gl_pixelsize) >> 2;
  36.979 -    dstline = surface->pixels;
  36.980 -    dstpitch = surface->pitch >> 1;
  36.981 -    if (gl_upsidedown) {
  36.982 -        srcline += (surface->h - 1) * srcpitch;
  36.983 -        srcpitch = -srcpitch;
  36.984 -    }
  36.985 -
  36.986 -    for (y = 0; y < surface->h; y++) {
  36.987 -        srccol = srcline;
  36.988 -        dstcol = dstline;
  36.989 -        for (x = 0; x < surface->w; x++) {
  36.990 -            Uint32 srccolor;
  36.991 -            Uint16 dstcolor;
  36.992 -
  36.993 -            srccolor = *srccol++;
  36.994 -            dstcolor = (srccolor >> 9) & (31 << 10);
  36.995 -            dstcolor |= (srccolor >> 6) & (31 << 5);
  36.996 -            dstcolor |= (srccolor >> 3) & 31;
  36.997 -            *dstcol++ = dstcolor;
  36.998 -        }
  36.999 -
 36.1000 -        srcline += srcpitch;
 36.1001 -        dstline += dstpitch;
 36.1002 -    }
 36.1003 -}
 36.1004 -
 36.1005 -static void
 36.1006 -CopyShadow8888To565(_THIS, SDL_Surface * surface)
 36.1007 -{
 36.1008 -    int x, y, srcpitch, dstpitch;
 36.1009 -    Uint16 *dstline, *dstcol;
 36.1010 -    Uint32 *srcline, *srccol;
 36.1011 -
 36.1012 -    srcline = (Uint32 *) gl_shadow;
 36.1013 -    srcpitch = (surface->w * gl_pixelsize) >> 2;
 36.1014 -    dstline = surface->pixels;
 36.1015 -    dstpitch = surface->pitch >> 1;
 36.1016 -    if (gl_upsidedown) {
 36.1017 -        srcline += (surface->h - 1) * srcpitch;
 36.1018 -        srcpitch = -srcpitch;
 36.1019 -    }
 36.1020 -
 36.1021 -    for (y = 0; y < surface->h; y++) {
 36.1022 -        srccol = srcline;
 36.1023 -        dstcol = dstline;
 36.1024 -
 36.1025 -        for (x = 0; x < surface->w; x++) {
 36.1026 -            Uint32 srccolor;
 36.1027 -            Uint16 dstcolor;
 36.1028 -
 36.1029 -            srccolor = *srccol++;
 36.1030 -            dstcolor = (srccolor >> 8) & (31 << 11);
 36.1031 -            dstcolor |= (srccolor >> 5) & (63 << 5);
 36.1032 -            dstcolor |= (srccolor >> 3) & 31;
 36.1033 -            *dstcol++ = dstcolor;
 36.1034 -        }
 36.1035 -
 36.1036 -        srcline += srcpitch;
 36.1037 -        dstline += dstpitch;
 36.1038 -    }
 36.1039 -}
 36.1040 -
 36.1041 -/*--- Conversions routines in the screen ---*/
 36.1042 -
 36.1043 -static void
 36.1044 -ConvertNull(_THIS, SDL_Surface * surface)
 36.1045 -{
 36.1046 -}
 36.1047 -
 36.1048 -static void
 36.1049 -Convert565To555be(_THIS, SDL_Surface * surface)
 36.1050 -{
 36.1051 -    int x, y, pitch;
 36.1052 -    unsigned short *line, *pixel;
 36.1053 -
 36.1054 -    line = surface->pixels;
 36.1055 -    pitch = surface->pitch >> 1;
 36.1056 -    for (y = 0; y < surface->h; y++) {
 36.1057 -        pixel = line;
 36.1058 -        for (x = 0; x < surface->w; x++) {
 36.1059 -            unsigned short color = *pixel;
 36.1060 -
 36.1061 -            *pixel++ = (color & 0x1f) | ((color >> 1) & 0xffe0);
 36.1062 -        }
 36.1063 -
 36.1064 -        line += pitch;
 36.1065 -    }
 36.1066 -}
 36.1067 -
 36.1068 -static void
 36.1069 -Convert565To555le(_THIS, SDL_Surface * surface)
 36.1070 -{
 36.1071 -    int x, y, pitch;
 36.1072 -    unsigned short *line, *pixel;
 36.1073 -
 36.1074 -    line = surface->pixels;
 36.1075 -    pitch = surface->pitch >> 1;
 36.1076 -    for (y = 0; y < surface->h; y++) {
 36.1077 -        pixel = line;
 36.1078 -        for (x = 0; x < surface->w; x++) {
 36.1079 -            unsigned short color = *pixel;
 36.1080 -
 36.1081 -            color = (color & 0x1f) | ((color >> 1) & 0xffe0);
 36.1082 -            *pixel++ = SDL_Swap16(color);
 36.1083 -        }
 36.1084 -
 36.1085 -        line += pitch;
 36.1086 -    }
 36.1087 -}
 36.1088 -
 36.1089 -static void
 36.1090 -Convert565le(_THIS, SDL_Surface * surface)
 36.1091 -{
 36.1092 -    int x, y, pitch;
 36.1093 -    unsigned short *line, *pixel;
 36.1094 -
 36.1095 -    line = surface->pixels;
 36.1096 -    pitch = surface->pitch >> 1;
 36.1097 -    for (y = 0; y < surface->h; y++) {
 36.1098 -        pixel = line;
 36.1099 -        for (x = 0; x < surface->w; x++) {
 36.1100 -            unsigned short color = *pixel;
 36.1101 -
 36.1102 -            *pixel++ = SDL_Swap16(color);
 36.1103 -        }
 36.1104 -
 36.1105 -        line += pitch;
 36.1106 -    }
 36.1107 -}
 36.1108 -
 36.1109 -static void
 36.1110 -ConvertBGRAToABGR(_THIS, SDL_Surface * surface)
 36.1111 -{
 36.1112 -    int x, y, pitch;
 36.1113 -    unsigned long *line, *pixel;
 36.1114 -
 36.1115 -    line = surface->pixels;
 36.1116 -    pitch = surface->pitch >> 2;
 36.1117 -    for (y = 0; y < surface->h; y++) {
 36.1118 -        pixel = line;
 36.1119 -        for (x = 0; x < surface->w; x++) {
 36.1120 -            unsigned long color = *pixel;
 36.1121 -
 36.1122 -            *pixel++ = (color << 24) | (color >> 8);
 36.1123 -        }
 36.1124 -
 36.1125 -        line += pitch;
 36.1126 -    }
 36.1127 -}
 36.1128 -
 36.1129 -#endif /* SDL_VIDEO_OPENGL */
 36.1130 -/* vi: set ts=4 sw=4 expandtab: */
    37.1 --- a/src/video/ataricommon/SDL_atarigl_c.h	Sun Sep 20 04:13:23 2009 +0000
    37.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    37.3 @@ -1,114 +0,0 @@
    37.4 -/*
    37.5 -    SDL - Simple DirectMedia Layer
    37.6 -    Copyright (C) 1997-2009 Sam Lantinga
    37.7 -
    37.8 -    This library is free software; you can redistribute it and/or
    37.9 -    modify it under the terms of the GNU Library General Public
   37.10 -    License as published by the Free Software Foundation; either
   37.11 -    version 2 of the License, or (at your option) any later version.
   37.12 -
   37.13 -    This library is distributed in the hope that it will be useful,
   37.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   37.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   37.16 -    Library General Public License for more details.
   37.17 -
   37.18 -    You should have received a copy of the GNU Library General Public
   37.19 -    License along with this library; if not, write to the Free
   37.20 -    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   37.21 -
   37.22 -    Sam Lantinga
   37.23 -    slouken@libsdl.org
   37.24 -*/
   37.25 -#include "SDL_config.h"
   37.26 -
   37.27 -/* Atari OSMesa.ldg implementation of SDL OpenGL support */
   37.28 -
   37.29 -#ifndef _SDL_ATARIGL_H_
   37.30 -#define _SDL_ATARIGL_H_
   37.31 -
   37.32 -#if SDL_VIDEO_OPENGL
   37.33 -#include <GL/osmesa.h>
   37.34 -#endif
   37.35 -
   37.36 -#include "../SDL_sysvideo.h"
   37.37 -
   37.38 -struct SDL_GLDriverData
   37.39 -{
   37.40 -
   37.41 -    int gl_active;              /* to stop switching drivers while we have a valid context */
   37.42 -
   37.43 -    int gl_oldmesa;             /* Old OpenGL support ? */
   37.44 -
   37.45 -    int gl_pixelsize;           /* for CopyShadow functions */
   37.46 -
   37.47 -    SDL_bool gl_upsidedown;     /* Some implementations draw upside down */
   37.48 -
   37.49 -    Uint8 *gl_shadow;           /* Shadow buffer for old implementations */
   37.50 -
   37.51 -    /* for unsupported OSMesa buffer formats */
   37.52 -    void (*ConvertSurface) (_THIS, SDL_Surface * surface);
   37.53 -
   37.54 -    /* to convert the shadow buffer to the screen format */
   37.55 -    void (*CopyShadow) (_THIS, SDL_Surface * surface);
   37.56 -
   37.57 -#if SDL_VIDEO_OPENGL
   37.58 -    OSMesaContext ctx;
   37.59 -
   37.60 -    /* OpenGL functions */
   37.61 -    void (*glGetIntegerv) (GLenum pname, GLint * value);
   37.62 -    void (*glFinish) (void);
   37.63 -    void (*glFlush) (void);
   37.64 -
   37.65 -    /* osmesa.ldg */
   37.66 -      OSMesaContext(*OSMesaCreateContextExt) (GLenum format, GLint depthBits,
   37.67 -                                              GLint stencilBits,
   37.68 -                                              GLint accumBits,
   37.69 -                                              OSMesaContext sharelist);
   37.70 -    void (*OSMesaDestroyContext) (OSMesaContext ctx);
   37.71 -      GLboolean(*OSMesaMakeCurrent) (OSMesaContext ctx, void *buffer,
   37.72 -                                     GLenum type, GLsizei width,
   37.73 -                                     GLsizei height);
   37.74 -    void (*OSMesaPixelStore) (GLint pname, GLint value);
   37.75 -    void *(*OSMesaGetProcAddress) (const char *funcName);
   37.76 -
   37.77 -    /* mesa_gl.ldg, tiny_gl.ldg */
   37.78 -    void *(*OSMesaCreateLDG) (long format, long type, long width,
   37.79 -                              long height);
   37.80 -    void (*OSMesaDestroyLDG) (void);
   37.81 -
   37.82 -    /* Info needed to compare existing context with new asked one */
   37.83 -    int width, height;
   37.84 -    GLenum format;
   37.85 -    GLint depth, stencil, accum;
   37.86 -#endif
   37.87 -};
   37.88 -
   37.89 -/* Variable names */
   37.90 -#define gl_active		(_this->gl_data->gl_active)
   37.91 -#define gl_ctx			(_this->gl_data->ctx)
   37.92 -#define gl_oldmesa		(_this->gl_data->gl_oldmesa)
   37.93 -#define gl_pixelsize	(_this->gl_data->gl_pixelsize)
   37.94 -#define gl_upsidedown	(_this->gl_data->gl_upsidedown)
   37.95 -#define gl_shadow		(_this->gl_data->gl_shadow)
   37.96 -#define gl_convert		(_this->gl_data->ConvertSurface)
   37.97 -#define gl_copyshadow	(_this->gl_data->CopyShadow)
   37.98 -#define gl_curformat	(_this->gl_data->format)
   37.99 -#define gl_curdepth		(_this->gl_data->depth)
  37.100 -#define gl_curstencil	(_this->gl_data->stencil)
  37.101 -#define gl_curaccum		(_this->gl_data->accum)
  37.102 -#define gl_curwidth		(_this->gl_data->width)
  37.103 -#define gl_curheight	(_this->gl_data->height)
  37.104 -
  37.105 -/* OpenGL functions */
  37.106 -extern int SDL_AtariGL_Init(_THIS, SDL_Surface * current);
  37.107 -extern void SDL_AtariGL_Quit(_THIS, SDL_bool unload);
  37.108 -extern void SDL_AtariGL_InitPointers(_THIS);
  37.109 -
  37.110 -extern int SDL_AtariGL_LoadLibrary(_THIS, const char *path);
  37.111 -extern void *SDL_AtariGL_GetProcAddress(_THIS, const char *proc);
  37.112 -extern int SDL_AtariGL_GetAttribute(_THIS, SDL_GLattr attrib, int *value);
  37.113 -extern int SDL_AtariGL_MakeCurrent(_THIS);
  37.114 -extern void SDL_AtariGL_SwapBuffers(_THIS);
  37.115 -
  37.116 -#endif /* _SDL_ATARIGL_H_ */
  37.117 -/* vi: set ts=4 sw=4 expandtab: */
    38.1 --- a/src/video/ataricommon/SDL_atarikeys.h	Sun Sep 20 04:13:23 2009 +0000
    38.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    38.3 @@ -1,141 +0,0 @@
    38.4 -/*
    38.5 -    SDL - Simple DirectMedia Layer
    38.6 -    Copyright (C) 1997-2009 Sam Lantinga
    38.7 -
    38.8 -    This library is free software; you can redistribute it and/or
    38.9 -    modify it under the terms of the GNU Lesser General Public
   38.10 -    License as published by the Free Software Foundation; either
   38.11 -    version 2.1 of the License, or (at your option) any later version.
   38.12 -
   38.13 -    This library is distributed in the hope that it will be useful,
   38.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   38.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   38.16 -    Lesser General Public License for more details.
   38.17 -
   38.18 -    You should have received a copy of the GNU Lesser General Public
   38.19 -    License along with this library; if not, write to the Free Software
   38.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   38.21 -
   38.22 -    Sam Lantinga
   38.23 -    slouken@libsdl.org
   38.24 -*/
   38.25 -
   38.26 -/*
   38.27 - *	Atari Scancode definitions
   38.28 - *
   38.29 - *	Patrice Mandin
   38.30 - */
   38.31 -
   38.32 -#ifndef _SDL_ATARIKEYS_H_
   38.33 -#define _SDL_ATARIKEYS_H_
   38.34 -
   38.35 -/* --- Keyboard scancodes --- */
   38.36 -/* taken from svgalib/vgakeyboard.h */
   38.37 -
   38.38 -#define SCANCODE_ESCAPE		0x01
   38.39 -#define SCANCODE_1		0x02
   38.40 -#define SCANCODE_2		0x03
   38.41 -#define SCANCODE_3		0x04
   38.42 -#define SCANCODE_4		0x05
   38.43 -#define SCANCODE_5		0x06
   38.44 -#define SCANCODE_6		0x07
   38.45 -#define SCANCODE_7		0x08
   38.46 -#define SCANCODE_8		0x09
   38.47 -#define SCANCODE_9		0x0a
   38.48 -#define SCANCODE_0		0x0b
   38.49 -#define SCANCODE_MINUS		0x0c
   38.50 -#define SCANCODE_EQUAL		0x0d
   38.51 -#define SCANCODE_BACKSPACE	0x0e
   38.52 -
   38.53 -#define SCANCODE_TAB		0x0f
   38.54 -#define SCANCODE_Q		0x10
   38.55 -#define SCANCODE_W		0x11
   38.56 -#define SCANCODE_E		0x12
   38.57 -#define SCANCODE_R		0x13
   38.58 -#define SCANCODE_T		0x14
   38.59 -#define SCANCODE_Y		0x15
   38.60 -#define SCANCODE_U		0x16
   38.61 -#define SCANCODE_I		0x17
   38.62 -#define SCANCODE_O		0x18
   38.63 -#define SCANCODE_P		0x19
   38.64 -#define SCANCODE_BRACKET_LEFT	0x1a
   38.65 -#define SCANCODE_BRACKET_RIGHT	0x1b
   38.66 -#define SCANCODE_ENTER		0x1c
   38.67 -#define SCANCODE_DELETE		0x53
   38.68 -
   38.69 -#define SCANCODE_LEFTCONTROL	0x1d
   38.70 -#define SCANCODE_A		0x1e
   38.71 -#define SCANCODE_S		0x1f
   38.72 -#define SCANCODE_D		0x20
   38.73 -#define SCANCODE_F		0x21
   38.74 -#define SCANCODE_G		0x22
   38.75 -#define SCANCODE_H		0x23
   38.76 -#define SCANCODE_J		0x24
   38.77 -#define SCANCODE_K		0x25
   38.78 -#define SCANCODE_L		0x26
   38.79 -#define SCANCODE_SEMICOLON	0x27
   38.80 -#define SCANCODE_APOSTROPHE	0x28
   38.81 -#define SCANCODE_GRAVE		0x29
   38.82 -
   38.83 -#define SCANCODE_LEFTSHIFT	0x2a
   38.84 -#define SCANCODE_BACKSLASH	0x2b
   38.85 -#define SCANCODE_Z		0x2c
   38.86 -#define SCANCODE_X		0x2d
   38.87 -#define SCANCODE_C		0x2e
   38.88 -#define SCANCODE_V		0x2f
   38.89 -#define SCANCODE_B		0x30
   38.90 -#define SCANCODE_N		0x31
   38.91 -#define SCANCODE_M		0x32
   38.92 -#define SCANCODE_COMMA		0x33
   38.93 -#define SCANCODE_PERIOD		0x34
   38.94 -#define SCANCODE_SLASH		0x35
   38.95 -#define SCANCODE_RIGHTSHIFT	0x36
   38.96 -
   38.97 -#define SCANCODE_LEFTALT	0x38
   38.98 -#define SCANCODE_SPACE		0x39
   38.99 -#define SCANCODE_CAPSLOCK	0x3a
  38.100 -
  38.101 -/* Functions keys */
  38.102 -#define SCANCODE_F1		0x3b
  38.103 -#define SCANCODE_F2		0x3c
  38.104 -#define SCANCODE_F3		0x3d
  38.105 -#define SCANCODE_F4		0x3e
  38.106 -#define SCANCODE_F5		0x3f
  38.107 -#define SCANCODE_F6		0x40
  38.108 -#define SCANCODE_F7		0x41
  38.109 -#define SCANCODE_F8		0x42
  38.110 -#define SCANCODE_F9		0x43
  38.111 -#define SCANCODE_F10	0x44
  38.112 -
  38.113 -/* Numeric keypad */
  38.114 -#define SCANCODE_KP0			0x70
  38.115 -#define SCANCODE_KP1			0x6d
  38.116 -#define SCANCODE_KP2			0x6e
  38.117 -#define SCANCODE_KP3			0x6f
  38.118 -#define SCANCODE_KP4			0x6a
  38.119 -#define SCANCODE_KP5			0x6b
  38.120 -#define SCANCODE_KP6			0x6c
  38.121 -#define SCANCODE_KP7			0x67
  38.122 -#define SCANCODE_KP8			0x68
  38.123 -#define SCANCODE_KP9			0x69
  38.124 -#define SCANCODE_KP_PERIOD		0x71
  38.125 -#define SCANCODE_KP_DIVIDE		0x65
  38.126 -#define SCANCODE_KP_MULTIPLY	0x66
  38.127 -#define SCANCODE_KP_MINUS		0x4a
  38.128 -#define SCANCODE_KP_PLUS		0x4e
  38.129 -#define SCANCODE_KP_ENTER		0x72
  38.130 -#define SCANCODE_KP_LEFTPAREN	0x63
  38.131 -#define SCANCODE_KP_RIGHTPAREN	0x64
  38.132 -
  38.133 -/* Cursor keypad */
  38.134 -#define SCANCODE_HELP		0x62
  38.135 -#define SCANCODE_UNDO		0x61
  38.136 -#define SCANCODE_INSERT		0x52
  38.137 -#define SCANCODE_CLRHOME	0x47
  38.138 -#define SCANCODE_UP			0x48
  38.139 -#define SCANCODE_DOWN		0x50
  38.140 -#define SCANCODE_RIGHT		0x4d
  38.141 -#define SCANCODE_LEFT		0x4b
  38.142 -
  38.143 -#endif /* _SDL_ATARIKEYS_H_ */
  38.144 -/* vi: set ts=4 sw=4 expandtab: */
    39.1 --- a/src/video/ataricommon/SDL_atarimxalloc.c	Sun Sep 20 04:13:23 2009 +0000
    39.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    39.3 @@ -1,56 +0,0 @@
    39.4 -/*
    39.5 -    SDL - Simple DirectMedia Layer
    39.6 -    Copyright (C) 1997-2009 Sam Lantinga
    39.7 -
    39.8 -    This library is free software; you can redistribute it and/or
    39.9 -    modify it under the terms of the GNU Lesser General Public
   39.10 -    License as published by the Free Software Foundation; either
   39.11 -    version 2.1 of the License, or (at your option) any later version.
   39.12 -
   39.13 -    This library is distributed in the hope that it will be useful,
   39.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   39.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   39.16 -    Lesser General Public License for more details.
   39.17 -
   39.18 -    You should have received a copy of the GNU Lesser General Public
   39.19 -    License along with this library; if not, write to the Free Software
   39.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   39.21 -
   39.22 -    Sam Lantinga
   39.23 -    slouken@libsdl.org
   39.24 -*/
   39.25 -#include "SDL_config.h"
   39.26 -
   39.27 -/*
   39.28 - *	Memory allocation
   39.29 - *
   39.30 - *	Patrice Mandin
   39.31 - */
   39.32 -
   39.33 -#include <mint/osbind.h>
   39.34 -
   39.35 -#include "SDL_stdinc.h"
   39.36 -
   39.37 -/*--- Variables ---*/
   39.38 -
   39.39 -static int atari_mxalloc_avail = -1;
   39.40 -
   39.41 -/*--- Functions ---*/
   39.42 -
   39.43 -void *
   39.44 -Atari_SysMalloc(Uint32 size, Uint16 alloc_type)
   39.45 -{
   39.46 -    /* Test if Mxalloc() available */
   39.47 -    if (atari_mxalloc_avail < 0) {
   39.48 -        atari_mxalloc_avail =
   39.49 -            ((Sversion() & 0xFF) >= 0x01) | (Sversion() >= 0x1900);
   39.50 -    }
   39.51 -
   39.52 -    if (atari_mxalloc_avail) {
   39.53 -        return (void *) Mxalloc(size, alloc_type);
   39.54 -    } else {
   39.55 -        return (void *) Malloc(size);
   39.56 -    }
   39.57 -}
   39.58 -
   39.59 -/* vi: set ts=4 sw=4 expandtab: */
    40.1 --- a/src/video/ataricommon/SDL_atarimxalloc_c.h	Sun Sep 20 04:13:23 2009 +0000
    40.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    40.3 @@ -1,46 +0,0 @@
    40.4 -/*
    40.5 -    SDL - Simple DirectMedia Layer
    40.6 -    Copyright (C) 1997-2009 Sam Lantinga
    40.7 -
    40.8 -    This library is free software; you can redistribute it and/or
    40.9 -    modify it under the terms of the GNU Lesser General Public
   40.10 -    License as published by the Free Software Foundation; either
   40.11 -    version 2.1 of the License, or (at your option) any later version.
   40.12 -
   40.13 -    This library is distributed in the hope that it will be useful,
   40.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   40.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   40.16 -    Lesser General Public License for more details.
   40.17 -
   40.18 -    You should have received a copy of the GNU Lesser General Public
   40.19 -    License along with this library; if not, write to the Free Software
   40.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   40.21 -
   40.22 -    Sam Lantinga
   40.23 -    slouken@libsdl.org
   40.24 -*/
   40.25 -#include "SDL_config.h"
   40.26 -
   40.27 -/*
   40.28 - *	Memory allocation
   40.29 - *
   40.30 - *	Patrice Mandin
   40.31 - */
   40.32 -
   40.33 -#ifndef _SDL_ATARI_MXALLOC_H_
   40.34 -#define _SDL_ATARI_MXALLOC_H_
   40.35 -
   40.36 -/*--- Defines ---*/
   40.37 -
   40.38 -/* Mxalloc parameters */
   40.39 -#define MX_STRAM 0
   40.40 -#define MX_TTRAM 1
   40.41 -#define MX_PREFSTRAM 2
   40.42 -#define MX_PREFTTRAM 3
   40.43 -
   40.44 -/*--- Functions ---*/
   40.45 -
   40.46 -extern void *Atari_SysMalloc(Uint32 size, Uint16 alloc_type);
   40.47 -
   40.48 -#endif /* _SDL_ATARI_MXALLOC_H_ */
   40.49 -/* vi: set ts=4 sw=4 expandtab: */
    41.1 --- a/src/video/ataricommon/SDL_biosevents.c	Sun Sep 20 04:13:23 2009 +0000
    41.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    41.3 @@ -1,140 +0,0 @@
    41.4 -/*
    41.5 -    SDL - Simple DirectMedia Layer
    41.6 -    Copyright (C) 1997-2009 Sam Lantinga
    41.7 -
    41.8 -    This library is free software; you can redistribute it and/or
    41.9 -    modify it under the terms of the GNU Lesser General Public
   41.10 -    License as published by the Free Software Foundation; either
   41.11 -    version 2.1 of the License, or (at your option) any later version.
   41.12 -
   41.13 -    This library is distributed in the hope that it will be useful,
   41.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   41.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   41.16 -    Lesser General Public License for more details.
   41.17 -
   41.18 -    You should have received a copy of the GNU Lesser General Public
   41.19 -    License along with this library; if not, write to the Free Software
   41.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   41.21 -
   41.22 -    Sam Lantinga
   41.23 -    slouken@libsdl.org
   41.24 -*/
   41.25 -#include "SDL_config.h"
   41.26 -
   41.27 -/*
   41.28 - *	Atari keyboard events manager, using BIOS
   41.29 - *
   41.30 - *	Patrice Mandin
   41.31 - */
   41.32 -
   41.33 -/* Mint includes */
   41.34 -#include <mint/osbind.h>
   41.35 -#include <mint/cookie.h>
   41.36 -
   41.37 -#include "../../events/SDL_sysevents.h"
   41.38 -#include "../../events/SDL_events_c.h"
   41.39 -
   41.40 -#include "SDL_atarikeys.h"
   41.41 -#include "SDL_atarievents_c.h"
   41.42 -#include "SDL_xbiosevents_c.h"
   41.43 -#include "SDL_ataridevmouse_c.h"
   41.44 -
   41.45 -static unsigned char bios_currentkeyboard[ATARIBIOS_MAXKEYS];
   41.46 -static unsigned char bios_previouskeyboard[ATARIBIOS_MAXKEYS];
   41.47 -static SDL_bool use_dev_mouse = SDL_FALSE;
   41.48 -
   41.49 -static void UpdateSpecialKeys(int special_keys_state);
   41.50 -
   41.51 -void
   41.52 -AtariBios_InitOSKeymap(_THIS)
   41.53 -{
   41.54 -    int i, vectors_mask;
   41.55 -    unsigned long dummy;
   41.56 -
   41.57 -    SDL_memset(bios_currentkeyboard, 0, sizeof(bios_currentkeyboard));
   41.58 -    SDL_memset(bios_previouskeyboard, 0, sizeof(bios_previouskeyboard));
   41.59 -
   41.60 -    use_dev_mouse = (SDL_AtariDevMouse_Open() != 0) ? SDL_TRUE : SDL_FALSE;
   41.61 -
   41.62 -    vectors_mask = ATARI_XBIOS_JOYSTICKEVENTS;  /* XBIOS joystick events */
   41.63 -    if (!use_dev_mouse) {
   41.64 -        vectors_mask |= ATARI_XBIOS_MOUSEEVENTS;        /* XBIOS mouse events */
   41.65 -    }
   41.66 -    /*if (Getcookie(C_MiNT, &dummy) == C_FOUND) {
   41.67 -       vectors_mask = 0;
   41.68 -       } */
   41.69 -
   41.70 -    SDL_AtariXbios_InstallVectors(vectors_mask);
   41.71 -}
   41.72 -
   41.73 -void
   41.74 -AtariBios_PumpEvents(_THIS)
   41.75 -{
   41.76 -    int i;
   41.77 -    SDL_keysym keysym;
   41.78 -
   41.79 -    /* Update pressed keys */
   41.80 -    SDL_memset(bios_currentkeyboard, 0, ATARIBIOS_MAXKEYS);
   41.81 -
   41.82 -    while (Bconstat(_CON)) {
   41.83 -        unsigned long key_pressed;
   41.84 -        key_pressed = Bconin(_CON);
   41.85 -        bios_currentkeyboard[(key_pressed >> 16) & (ATARIBIOS_MAXKEYS - 1)] =
   41.86 -            0xFF;
   41.87 -    }
   41.88 -
   41.89 -    /* Read special keys */
   41.90 -    UpdateSpecialKeys(Kbshift(-1));
   41.91 -
   41.92 -    /* Now generate events */
   41.93 -    for (i = 0; i < ATARIBIOS_MAXKEYS; i++) {
   41.94 -        /* Key pressed ? */
   41.95 -        if (bios_currentkeyboard[i] && !bios_previouskeyboard[i])
   41.96 -            SDL_PrivateKeyboard(SDL_PRESSED,
   41.97 -                                SDL_Atari_TranslateKey(i, &keysym, SDL_TRUE));
   41.98 -
   41.99 -        /* Key unpressed ? */
  41.100 -        if (bios_previouskeyboard[i] && !bios_currentkeyboard[i])
  41.101 -            SDL_PrivateKeyboard(SDL_RELEASED,
  41.102 -                                SDL_Atari_TranslateKey(i, &keysym,
  41.103 -                                                       SDL_FALSE));
  41.104 -    }
  41.105 -
  41.106 -    if (use_dev_mouse) {
  41.107 -        SDL_AtariDevMouse_PostMouseEvents(_this, SDL_TRUE);
  41.108 -    } else {
  41.109 -        SDL_AtariXbios_PostMouseEvents(_this, SDL_TRUE);
  41.110 -    }
  41.111 -
  41.112 -    /* Will be previous table */
  41.113 -    SDL_memcpy(bios_previouskeyboard, bios_currentkeyboard,
  41.114 -               sizeof(bios_previouskeyboard));
  41.115 -}
  41.116 -
  41.117 -static void
  41.118 -UpdateSpecialKeys(int special_keys_state)
  41.119 -{
  41.120 -#define UPDATE_SPECIAL_KEYS(numbit,scancode) \
  41.121 -	{	\
  41.122 -		if (special_keys_state & (1<<(numbit))) { \
  41.123 -			bios_currentkeyboard[scancode]=0xFF; \
  41.124 -		}	\
  41.125 -	}
  41.126 -
  41.127 -    UPDATE_SPECIAL_KEYS(K_RSHIFT, SCANCODE_RIGHTSHIFT);
  41.128 -    UPDATE_SPECIAL_KEYS(K_LSHIFT, SCANCODE_LEFTSHIFT);
  41.129 -    UPDATE_SPECIAL_KEYS(K_CTRL, SCANCODE_LEFTCONTROL);
  41.130 -    UPDATE_SPECIAL_KEYS(K_ALT, SCANCODE_LEFTALT);
  41.131 -    UPDATE_SPECIAL_KEYS(K_CAPSLOCK, SCANCODE_CAPSLOCK);
  41.132 -}
  41.133 -
  41.134 -void
  41.135 -AtariBios_ShutdownEvents(void)
  41.136 -{
  41.137 -    SDL_AtariXbios_RestoreVectors();
  41.138 -    if (use_dev_mouse) {
  41.139 -        SDL_AtariDevMouse_Close();
  41.140 -    }
  41.141 -}
  41.142 -
  41.143 -/* vi: set ts=4 sw=4 expandtab: */
    42.1 --- a/src/video/ataricommon/SDL_biosevents_c.h	Sun Sep 20 04:13:23 2009 +0000
    42.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    42.3 @@ -1,40 +0,0 @@
    42.4 -/*
    42.5 -    SDL - Simple DirectMedia Layer
    42.6 -    Copyright (C) 1997-2009 Sam Lantinga
    42.7 -
    42.8 -    This library is free software; you can redistribute it and/or
    42.9 -    modify it under the terms of the GNU Lesser General Public
   42.10 -    License as published by the Free Software Foundation; either
   42.11 -    version 2.1 of the License, or (at your option) any later version.
   42.12 -
   42.13 -    This library is distributed in the hope that it will be useful,
   42.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   42.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   42.16 -    Lesser General Public License for more details.
   42.17 -
   42.18 -    You should have received a copy of the GNU Lesser General Public
   42.19 -    License along with this library; if not, write to the Free Software
   42.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   42.21 -
   42.22 -    Sam Lantinga
   42.23 -    slouken@libsdl.org
   42.24 -*/
   42.25 -#include "SDL_config.h"
   42.26 -
   42.27 -/*
   42.28 - *	Atari keyboard events manager, using BIOS
   42.29 - *
   42.30 - *	Patrice Mandin
   42.31 - */
   42.32 -
   42.33 -#ifndef _SDL_ATARI_BIOSEVENTS_H_
   42.34 -#define _SDL_ATARI_BIOSEVENTS_H_
   42.35 -
   42.36 -#include "../SDL_sysvideo.h"
   42.37 -
   42.38 -extern void AtariBios_InitOSKeymap(_THIS);
   42.39 -extern void AtariBios_PumpEvents(_THIS);
   42.40 -extern void AtariBios_ShutdownEvents(void);
   42.41 -
   42.42 -#endif /* _SDL_ATARI_BIOSEVENTS_H_ */
   42.43 -/* vi: set ts=4 sw=4 expandtab: */
    43.1 --- a/src/video/ataricommon/SDL_gemdosevents.c	Sun Sep 20 04:13:23 2009 +0000
    43.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.3 @@ -1,148 +0,0 @@
    43.4 -/*
    43.5 -    SDL - Simple DirectMedia Layer
    43.6 -    Copyright (C) 1997-2009 Sam Lantinga
    43.7 -
    43.8 -    This library is free software; you can redistribute it and/or
    43.9 -    modify it under the terms of the GNU Lesser General Public
   43.10 -    License as published by the Free Software Foundation; either
   43.11 -    version 2.1 of the License, or (at your option) any later version.
   43.12 -
   43.13 -    This library is distributed in the hope that it will be useful,
   43.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   43.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   43.16 -    Lesser General Public License for more details.
   43.17 -
   43.18 -    You should have received a copy of the GNU Lesser General Public
   43.19 -    License along with this library; if not, write to the Free Software
   43.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   43.21 -
   43.22 -    Sam Lantinga
   43.23 -    slouken@libsdl.org
   43.24 -*/
   43.25 -#include "SDL_config.h"
   43.26 -
   43.27 -/*
   43.28 - *	Atari keyboard events manager, using Gemdos
   43.29 - *
   43.30 - *	Patrice Mandin
   43.31 - */
   43.32 -
   43.33 -/* Mint includes */
   43.34 -#include <mint/osbind.h>
   43.35 -#include <mint/cookie.h>
   43.36 -
   43.37 -#include "../../events/SDL_sysevents.h"
   43.38 -#include "../../events/SDL_events_c.h"
   43.39 -
   43.40 -#include "SDL_atarikeys.h"
   43.41 -#include "SDL_atarievents_c.h"
   43.42 -#include "SDL_xbiosevents_c.h"
   43.43 -#include "SDL_ataridevmouse_c.h"
   43.44 -
   43.45 -/* To save state of keyboard */
   43.46 -
   43.47 -static unsigned char gemdos_currentkeyboard[ATARIBIOS_MAXKEYS];
   43.48 -static unsigned char gemdos_previouskeyboard[ATARIBIOS_MAXKEYS];
   43.49 -static SDL_bool use_dev_mouse = SDL_FALSE;
   43.50 -
   43.51 -enum
   43.52 -{
   43.53 -    DEV_BUSY = 0,
   43.54 -    DEV_READY
   43.55 -};
   43.56 -
   43.57 -static void UpdateSpecialKeys(int special_keys_state);
   43.58 -
   43.59 -void
   43.60 -AtariGemdos_InitOSKeymap(_THIS)
   43.61 -{
   43.62 -    int i, vectors_mask;
   43.63 -    unsigned long dummy;
   43.64 -
   43.65 -    SDL_memset(gemdos_currentkeyboard, 0, sizeof(gemdos_currentkeyboard));
   43.66 -    SDL_memset(gemdos_previouskeyboard, 0, sizeof(gemdos_previouskeyboard));
   43.67 -
   43.68 -    use_dev_mouse = (SDL_AtariDevMouse_Open() != 0) ? SDL_TRUE : SDL_FALSE;
   43.69 -
   43.70 -    vectors_mask = ATARI_XBIOS_JOYSTICKEVENTS;  /* XBIOS joystick events */
   43.71 -    if (!use_dev_mouse) {
   43.72 -        vectors_mask |= ATARI_XBIOS_MOUSEEVENTS;        /* XBIOS mouse events */
   43.73 -    }
   43.74 -    /*if (Getcookie(C_MiNT, &dummy) == C_FOUND) {
   43.75 -       vectors_mask = 0;
   43.76 -       } */
   43.77 -
   43.78 -    SDL_AtariXbios_InstallVectors(vectors_mask);
   43.79 -}
   43.80 -
   43.81 -void
   43.82 -AtariGemdos_PumpEvents(_THIS)
   43.83 -{
   43.84 -    int i;
   43.85 -    SDL_keysym keysym;
   43.86 -
   43.87 -    /* Update pressed keys */
   43.88 -    SDL_memset(gemdos_currentkeyboard, 0, ATARIBIOS_MAXKEYS);
   43.89 -
   43.90 -    while (Cconis() != DEV_BUSY) {
   43.91 -        unsigned long key_pressed;
   43.92 -        key_pressed = Cnecin();
   43.93 -        gemdos_currentkeyboard[(key_pressed >> 16) & (ATARIBIOS_MAXKEYS - 1)]
   43.94 -            = 0xFF;
   43.95 -    }
   43.96 -
   43.97 -    /* Read special keys */
   43.98 -    UpdateSpecialKeys(Kbshift(-1));
   43.99 -
  43.100 -    /* Now generate events */
  43.101 -    for (i = 0; i < ATARIBIOS_MAXKEYS; i++) {
  43.102 -        /* Key pressed ? */
  43.103 -        if (gemdos_currentkeyboard[i] && !gemdos_previouskeyboard[i])
  43.104 -            SDL_PrivateKeyboard(SDL_PRESSED,
  43.105 -                                SDL_Atari_TranslateKey(i, &keysym, SDL_TRUE));
  43.106 -
  43.107 -        /* Key unpressed ? */
  43.108 -        if (gemdos_previouskeyboard[i] && !gemdos_currentkeyboard[i])
  43.109 -            SDL_PrivateKeyboard(SDL_RELEASED,
  43.110 -                                SDL_Atari_TranslateKey(i, &keysym,
  43.111 -                                                       SDL_FALSE));
  43.112 -    }
  43.113 -
  43.114 -    if (use_dev_mouse) {
  43.115 -        SDL_AtariDevMouse_PostMouseEvents(_this, SDL_TRUE);
  43.116 -    } else {
  43.117 -        SDL_AtariXbios_PostMouseEvents(_this, SDL_TRUE);
  43.118 -    }
  43.119 -
  43.120 -    /* Will be previous table */
  43.121 -    SDL_memcpy(gemdos_previouskeyboard, gemdos_currentkeyboard,
  43.122 -               sizeof(gemdos_previouskeyboard));
  43.123 -}
  43.124 -
  43.125 -static void
  43.126 -UpdateSpecialKeys(int special_keys_state)
  43.127 -{
  43.128 -#define UPDATE_SPECIAL_KEYS(numbit,scancode) \
  43.129 -	{	\
  43.130 -		if (special_keys_state & (1<<(numbit))) { \
  43.131 -			gemdos_currentkeyboard[scancode]=0xFF; \
  43.132 -		}	\
  43.133 -	}
  43.134 -
  43.135 -    UPDATE_SPECIAL_KEYS(K_RSHIFT, SCANCODE_RIGHTSHIFT);
  43.136 -    UPDATE_SPECIAL_KEYS(K_LSHIFT, SCANCODE_LEFTSHIFT);
  43.137 -    UPDATE_SPECIAL_KEYS(K_CTRL, SCANCODE_LEFTCONTROL);
  43.138 -    UPDATE_SPECIAL_KEYS(K_ALT, SCANCODE_LEFTALT);
  43.139 -    UPDATE_SPECIAL_KEYS(K_CAPSLOCK, SCANCODE_CAPSLOCK);
  43.140 -}
  43.141 -
  43.142 -void
  43.143 -AtariGemdos_ShutdownEvents(void)
  43.144 -{
  43.145 -    SDL_AtariXbios_RestoreVectors();
  43.146 -    if (use_dev_mouse) {
  43.147 -        SDL_AtariDevMouse_Close();
  43.148 -    }
  43.149 -}
  43.150 -
  43.151 -/* vi: set ts=4 sw=4 expandtab: */
    44.1 --- a/src/video/ataricommon/SDL_gemdosevents_c.h	Sun Sep 20 04:13:23 2009 +0000
    44.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    44.3 @@ -1,40 +0,0 @@
    44.4 -/*
    44.5 -    SDL - Simple DirectMedia Layer
    44.6 -    Copyright (C) 1997-2009 Sam Lantinga
    44.7 -
    44.8 -    This library is free software; you can redistribute it and/or
    44.9 -    modify it under the terms of the GNU Lesser General Public
   44.10 -    License as published by the Free Software Foundation; either
   44.11 -    version 2.1 of the License, or (at your option) any later version.
   44.12 -
   44.13 -    This library is distributed in the hope that it will be useful,
   44.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   44.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   44.16 -    Lesser General Public License for more details.
   44.17 -
   44.18 -    You should have received a copy of the GNU Lesser General Public
   44.19 -    License along with this library; if not, write to the Free Software
   44.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   44.21 -
   44.22 -    Sam Lantinga
   44.23 -    slouken@libsdl.org
   44.24 -*/
   44.25 -#include "SDL_config.h"
   44.26 -
   44.27 -/*
   44.28 - *	Atari keyboard events manager, using Gemdos
   44.29 - *
   44.30 - *	Patrice Mandin
   44.31 - */
   44.32 -
   44.33 -#ifndef _SDL_ATARI_GEMDOSEVENTS_H_
   44.34 -#define _SDL_ATARI_GEMDOSEVENTS_H_
   44.35 -
   44.36 -#include "../SDL_sysvideo.h"
   44.37 -
   44.38 -extern void AtariGemdos_InitOSKeymap(_THIS);
   44.39 -extern void AtariGemdos_PumpEvents(_THIS);
   44.40 -extern void AtariGemdos_ShutdownEvents(void);
   44.41 -
   44.42 -#endif /* _SDL_ATARI_GEMDOSEVENTS_H_ */
   44.43 -/* vi: set ts=4 sw=4 expandtab: */
    45.1 --- a/src/video/ataricommon/SDL_ikbdevents.c	Sun Sep 20 04:13:23 2009 +0000
    45.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    45.3 @@ -1,135 +0,0 @@
    45.4 -/*
    45.5 -    SDL - Simple DirectMedia Layer
    45.6 -    Copyright (C) 1997-2009 Sam Lantinga
    45.7 -
    45.8 -    This library is free software; you can redistribute it and/or
    45.9 -    modify it under the terms of the GNU Lesser General Public
   45.10 -    License as published by the Free Software Foundation; either
   45.11 -    version 2.1 of the License, or (at your option) any later version.
   45.12 -
   45.13 -    This library is distributed in the hope that it will be useful,
   45.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   45.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   45.16 -    Lesser General Public License for more details.
   45.17 -
   45.18 -    You should have received a copy of the GNU Lesser General Public
   45.19 -    License along with this library; if not, write to the Free Software
   45.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   45.21 -
   45.22 -    Sam Lantinga
   45.23 -    slouken@libsdl.org
   45.24 -*/
   45.25 -#include "SDL_config.h"
   45.26 -
   45.27 -/*
   45.28 - *	Atari keyboard events manager, using hardware IKBD
   45.29 - *
   45.30 - *	Patrice Mandin
   45.31 - */
   45.32 -
   45.33 -/* Mint includes */
   45.34 -#include <mint/osbind.h>
   45.35 -
   45.36 -#include "../../events/SDL_sysevents.h"
   45.37 -#include "../../events/SDL_events_c.h"
   45.38 -
   45.39 -#include "SDL_atarikeys.h"
   45.40 -#include "SDL_atarievents_c.h"
   45.41 -#include "SDL_ikbdinterrupt_s.h"
   45.42 -
   45.43 -#define KEY_PRESSED		0xff
   45.44 -#define KEY_UNDEFINED	0x80
   45.45 -#define KEY_RELEASED	0x00
   45.46 -
   45.47 -static Uint16 atari_prevmouseb; /* save state of mouse buttons */
   45.48 -
   45.49 -void
   45.50 -AtariIkbd_InitOSKeymap(_THIS)
   45.51 -{
   45.52 -    SDL_memset(SDL_AtariIkbd_keyboard, KEY_UNDEFINED,
   45.53 -               sizeof(SDL_AtariIkbd_keyboard));
   45.54 -
   45.55 -    /* Now install our handler */
   45.56 -    SDL_AtariIkbd_mouseb = SDL_AtariIkbd_mousex = SDL_AtariIkbd_mousey = 0;
   45.57 -    atari_prevmouseb = 0;
   45.58 -
   45.59 -    Supexec(SDL_AtariIkbdInstall);
   45.60 -}
   45.61 -
   45.62 -static int
   45.63 -atari_GetButton(int button)
   45.64 -{
   45.65 -    switch (button) {
   45.66 -    case 0:
   45.67 -        return SDL_BUTTON_RIGHT;
   45.68 -        break;
   45.69 -    case 1:
   45.70 -    default:
   45.71 -        return SDL_BUTTON_LEFT;
   45.72 -        break;
   45.73 -    }
   45.74 -}
   45.75 -
   45.76 -void
   45.77 -AtariIkbd_PumpEvents(_THIS)
   45.78 -{
   45.79 -    int i;
   45.80 -    SDL_keysym keysym;
   45.81 -    int specialkeys;
   45.82 -
   45.83 -        /*--- Send keyboard events ---*/
   45.84 -
   45.85 -    /* Now generate events */
   45.86 -    for (i = 0; i < ATARIBIOS_MAXKEYS; i++) {
   45.87 -        /* Key pressed ? */
   45.88 -        if (SDL_AtariIkbd_keyboard[i] == KEY_PRESSED) {
   45.89 -            SDL_PrivateKeyboard(SDL_PRESSED,
   45.90 -                                SDL_Atari_TranslateKey(i, &keysym, SDL_TRUE));
   45.91 -            SDL_AtariIkbd_keyboard[i] = KEY_UNDEFINED;
   45.92 -        }
   45.93 -
   45.94 -        /* Key released ? */
   45.95 -        if (SDL_AtariIkbd_keyboard[i] == KEY_RELEASED) {
   45.96 -            SDL_PrivateKeyboard(SDL_RELEASED,
   45.97 -                                SDL_Atari_TranslateKey(i, &keysym,
   45.98 -                                                       SDL_FALSE));
   45.99 -            SDL_AtariIkbd_keyboard[i] = KEY_UNDEFINED;
  45.100 -        }
  45.101 -    }
  45.102 -
  45.103 -        /*--- Send mouse events ---*/
  45.104 -
  45.105 -    /* Mouse motion ? */
  45.106 -    if (SDL_AtariIkbd_mousex || SDL_AtariIkbd_mousey) {
  45.107 -        SDL_PrivateMouseMotion(0, 1, SDL_AtariIkbd_mousex,
  45.108 -                               SDL_AtariIkbd_mousey);
  45.109 -        SDL_AtariIkbd_mousex = SDL_AtariIkbd_mousey = 0;
  45.110 -    }
  45.111 -
  45.112 -    /* Mouse button ? */
  45.113 -    if (SDL_AtariIkbd_mouseb != atari_prevmouseb) {
  45.114 -        for (i = 0; i < 2; i++) {
  45.115 -            int curbutton, prevbutton;
  45.116 -
  45.117 -            curbutton = SDL_AtariIkbd_mouseb & (1 << i);
  45.118 -            prevbutton = atari_prevmouseb & (1 << i);
  45.119 -
  45.120 -            if (curbutton && !prevbutton) {
  45.121 -                SDL_PrivateMouseButton(SDL_PRESSED, atari_GetButton(i), 0, 0);
  45.122 -            }
  45.123 -            if (!curbutton && prevbutton) {
  45.124 -                SDL_PrivateMouseButton(SDL_RELEASED,
  45.125 -                                       atari_GetButton(i), 0, 0);
  45.126 -            }
  45.127 -        }
  45.128 -        atari_prevmouseb = SDL_AtariIkbd_mouseb;
  45.129 -    }
  45.130 -}
  45.131 -
  45.132 -void
  45.133 -AtariIkbd_ShutdownEvents(void)
  45.134 -{
  45.135 -    Supexec(SDL_AtariIkbdUninstall);
  45.136 -}
  45.137 -
  45.138 -/* vi: set ts=4 sw=4 expandtab: */
    46.1 --- a/src/video/ataricommon/SDL_ikbdevents_c.h	Sun Sep 20 04:13:23 2009 +0000
    46.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    46.3 @@ -1,40 +0,0 @@
    46.4 -/*
    46.5 -    SDL - Simple DirectMedia Layer
    46.6 -    Copyright (C) 1997-2009 Sam Lantinga
    46.7 -
    46.8 -    This library is free software; you can redistribute it and/or
    46.9 -    modify it under the terms of the GNU Lesser General Public
   46.10 -    License as published by the Free Software Foundation; either
   46.11 -    version 2.1 of the License, or (at your option) any later version.
   46.12 -
   46.13 -    This library is distributed in the hope that it will be useful,
   46.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   46.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   46.16 -    Lesser General Public License for more details.
   46.17 -
   46.18 -    You should have received a copy of the GNU Lesser General Public
   46.19 -    License along with this library; if not, write to the Free Software
   46.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   46.21 -
   46.22 -    Sam Lantinga
   46.23 -    slouken@libsdl.org
   46.24 -*/
   46.25 -#include "SDL_config.h"
   46.26 -
   46.27 -/*
   46.28 - *	Atari keyboard events manager, using hardware IKBD
   46.29 - *
   46.30 - *	Patrice Mandin
   46.31 - */
   46.32 -
   46.33 -#ifndef _SDL_ATARI_IKBDEVENTS_H_
   46.34 -#define _SDL_ATARI_IKBDEVENTS_H_
   46.35 -
   46.36 -#include "../SDL_sysvideo.h"
   46.37 -
   46.38 -extern void AtariIkbd_InitOSKeymap(_THIS);
   46.39 -extern void AtariIkbd_PumpEvents(_THIS);
   46.40 -extern void AtariIkbd_ShutdownEvents(void);
   46.41 -
   46.42 -#endif /* _SDL_ATARI_IKBDEVENTS_H_ */
   46.43 -/* vi: set ts=4 sw=4 expandtab: */
    47.1 --- a/src/video/ataricommon/SDL_ikbdinterrupt.S	Sun Sep 20 04:13:23 2009 +0000
    47.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    47.3 @@ -1,260 +0,0 @@
    47.4 -/*
    47.5 -    SDL - Simple DirectMedia Layer
    47.6 -    Copyright (C) 1997-2009 Sam Lantinga
    47.7 -
    47.8 -    This library is free software; you can redistribute it and/or
    47.9 -    modify it under the terms of the GNU Lesser General Public
   47.10 -    License as published by the Free Software Foundation; either
   47.11 -    version 2.1 of the License, or (at your option) any later version.
   47.12 -
   47.13 -    This library is distributed in the hope that it will be useful,
   47.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   47.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   47.16 -    Lesser General Public License for more details.
   47.17 -
   47.18 -    You should have received a copy of the GNU Lesser General Public
   47.19 -    License along with this library; if not, write to the Free Software
   47.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   47.21 -
   47.22 -    Sam Lantinga
   47.23 -    slouken@libsdl.org
   47.24 -*/
   47.25 -
   47.26 -/*
   47.27 - *	IKBD 6301 interrupt routine
   47.28 - *
   47.29 - *	Patrice Mandin
   47.30 - */
   47.31 -
   47.32 -	.text
   47.33 -
   47.34 -	.globl	_SDL_AtariIkbdInstall
   47.35 -	.globl	_SDL_AtariIkbdUninstall
   47.36 -
   47.37 -	.globl	_SDL_AtariIkbd_keyboard
   47.38 -	.globl	_SDL_AtariIkbd_mouseb
   47.39 -	.globl	_SDL_AtariIkbd_mousex
   47.40 -	.globl	_SDL_AtariIkbd_mousey
   47.41 -	.globl	_SDL_AtariIkbd_joystick
   47.42 -
   47.43 -	.globl	_SDL_AtariIkbd_enabled
   47.44 -
   47.45 -/*--- Install our IKBD vector ---*/
   47.46 -
   47.47 -_SDL_AtariIkbdInstall:
   47.48 -	moveml	d0-d1/a0-a1,sp@-
   47.49 -
   47.50 -	| Disable interrupts
   47.51 -
   47.52 -	movew	#0x2700,sr
   47.53 -
   47.54 -	| Save MFP registers used for keyboard
   47.55 -
   47.56 -	lea	0xfffffa00:w,a0
   47.57 -	btst	#6,a0@(0x09)
   47.58 -	sne		ikbd_ierb
   47.59 -	btst	#6,a0@(0x15)
   47.60 -	sne		ikbd_imrb
   47.61 -
   47.62 -	| Set our routine
   47.63 -
   47.64 -	movel	0x118:w,old_ikbd
   47.65 -	movel	#ikbd,0x118:w
   47.66 -	bset	#6,0xfffffa09:w	| IERB
   47.67 -	bset	#6,0xfffffa15:w	| IMRB
   47.68 -
   47.69 -	| Set mouse relative mode
   47.70 -
   47.71 -	moveb	#8,0xfffffc02:w
   47.72 -
   47.73 -	| Reenable interrupts
   47.74 -
   47.75 -	movew	#0x2300,sr
   47.76 -
   47.77 -	| Interrupts done
   47.78 -
   47.79 -	movew	#0xffff,_SDL_AtariIkbd_enabled
   47.80 -
   47.81 -	moveml	sp@+,d0-d1/a0-a1
   47.82 -	rts
   47.83 -
   47.84 -/*--- Uninstall our IKBD vector ---*/
   47.85 -
   47.86 -_SDL_AtariIkbdUninstall:
   47.87 -	movel	a0,sp@-
   47.88 -
   47.89 -	| Disable interrupts
   47.90 -
   47.91 -	movew	#0x2700,sr
   47.92 -
   47.93 -	| Restore previous MFP registers
   47.94 -
   47.95 -	lea	0xfffffa00:w,a0
   47.96 -
   47.97 -	bclr	#6,a0@(0x09)
   47.98 -	tstb	ikbd_ierb
   47.99 -	beqs	ikbd_restoreierb
  47.100 -	bset	#6,a0@(0x09)
  47.101 -ikbd_restoreierb:
  47.102 -
  47.103 -	bclr	#6,a0@(0x15)
  47.104 -	tstb	ikbd_imrb
  47.105 -	beqs	ikbd_restoreimrb
  47.106 -	bset	#6,a0@(0x15)