Date: Wed, 01 Mar 2006 10:14:31 +0000
authorSam Lantinga <slouken@libsdl.org>
Thu, 02 Mar 2006 03:24:20 +0000
changeset 14591e8582152d44
parent 1458 bf8db2d92be1
child 1460 d79e6b0c2c19
Date: Wed, 01 Mar 2006 10:14:31 +0000
From: "alan buckley"
Subject: Re: Updating SDL for RISC OS

I've attached a zip file with three diffs to get SDL to build on RISC OS.

configure.in.diff and makedeps.sh.diff have been modified so that they
can build the assembler file in video/riscos. You may want to double
check these as I don't know a lot about unix shell programming.
(I've tested them cross-compiling on cygwin).

sdlsysthread.diff is the changes required to SDL_systhread.c for RISC
OS. As you suspected with these changes in place you can delete the
RISC OS specific threading code in thread/riscos.

I've also renamed SDL_riscosASM.s to SDL_riscosASM.S, but I'm never
quite sure how to rename files in CVS, so if you could to this it would
be appreciated.
build-scripts/makedep.sh
configure.in
src/thread/pthread/SDL_systhread.c
src/video/riscos/SDL_riscosASM.S
src/video/riscos/SDL_riscosASM.s
     1.1 --- a/build-scripts/makedep.sh	Thu Mar 02 03:18:21 2006 +0000
     1.2 +++ b/build-scripts/makedep.sh	Thu Mar 02 03:24:20 2006 +0000
     1.3 @@ -69,6 +69,12 @@
     1.4  
     1.5  __EOF__
     1.6          ;;
     1.7 +        S) cat >>${output}.new <<__EOF__
     1.8 +
     1.9 +	\$(LIBTOOL)  --mode=compile \$(CC) -c $src  -o \$@
    1.10 +
    1.11 +__EOF__
    1.12 +        ;;
    1.13          *)   echo "Unknown file extension: $ext";;
    1.14      esac
    1.15      echo "" >>${output}.new
     2.1 --- a/configure.in	Thu Mar 02 03:18:21 2006 +0000
     2.2 +++ b/configure.in	Thu Mar 02 03:24:20 2006 +0000
     2.3 @@ -2325,6 +2325,7 @@
     2.4          if test x$enable_video = xyes; then
     2.5              AC_DEFINE(SDL_VIDEO_DRIVER_RISCOS)
     2.6              SOURCES="$SOURCES $srcdir/src/video/riscos/*.c"
     2.7 +            SOURCES="$SOURCES $srcdir/src/video/riscos/*.S"
     2.8              have_video=yes
     2.9          fi
    2.10          # Set up files for the joystick library
    2.11 @@ -2388,6 +2389,7 @@
    2.12  OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.cc,$(objects)/\1.lo,g'`
    2.13  OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.m,$(objects)/\1.lo,g'`
    2.14  OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
    2.15 +OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.S,$(objects)/\1.lo,g'`
    2.16  
    2.17  SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.cc,$(objects)/\1.o,g'`
    2.18  SDLMAIN_OBJECTS=`echo $SDLMAIN_OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.m,$(objects)/\1.o,g'`
     3.1 --- a/src/thread/pthread/SDL_systhread.c	Thu Mar 02 03:18:21 2006 +0000
     3.2 +++ b/src/thread/pthread/SDL_systhread.c	Thu Mar 02 03:24:20 2006 +0000
     3.3 @@ -34,6 +34,13 @@
     3.4  	SIGVTALRM, SIGPROF, 0
     3.5  };
     3.6  
     3.7 +#ifdef __RISCOS__
     3.8 +/* RISC OS needs to know the main thread for
     3.9 + * it's timer and event processing. */
    3.10 +int riscos_using_threads = 0;
    3.11 +Uint32 riscos_main_thread = 0; /* Thread running events */
    3.12 +#endif
    3.13 + 
    3.14  
    3.15  static void *RunThread(void *data)
    3.16  {
    3.17 @@ -58,6 +65,14 @@
    3.18  		SDL_SetError("Not enough resources to create thread");
    3.19  		return(-1);
    3.20  	}
    3.21 +
    3.22 +#ifdef __RISCOS__
    3.23 +	if (riscos_using_threads == 0) {
    3.24 +		riscos_using_threads = 1;
    3.25 +		riscos_main_thread = SDL_ThreadID();
    3.26 +	}
    3.27 +#endif
    3.28 +
    3.29  	return(0);
    3.30  }
    3.31  
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/src/video/riscos/SDL_riscosASM.S	Thu Mar 02 03:24:20 2006 +0000
     4.3 @@ -0,0 +1,116 @@
     4.4 +;
     4.5 +;    SDL - Simple DirectMedia Layer
     4.6 +;    Copyright (C) 1997-2004 Sam Lantinga
     4.7 +;
     4.8 +;    This library is free software; you can redistribute it and/or
     4.9 +;    modify it under the terms of the GNU Library General Public
    4.10 +;    License as published by the Free Software Foundation; either
    4.11 +;    version 2 of the License, or (at your option) any later version.
    4.12 +;
    4.13 +;    This library is distributed in the hope that it will be useful,
    4.14 +;    but WITHOUT ANY WARRANTY; without even the implied warranty of
    4.15 +;    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    4.16 +;    Library General Public License for more details.
    4.17 +;
    4.18 +;    You should have received a copy of the GNU Library General Public
    4.19 +;    License along with this library; if not, write to the Free
    4.20 +;    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    4.21 +;
    4.22 +;    Sam Lantinga
    4.23 +;    slouken@libsdl.org
    4.24 +;
    4.25 +; Assembler routines for RISC OS display
    4.26 +;
    4.27 +
    4.28 +	AREA |C$$CODE|
    4.29 +
    4.30 +	EXPORT |RISCOS_Put32|
    4.31 +
    4.32 +; Display 32bpp to 32bpp, 1:1
    4.33 +;
    4.34 +; Code provided by Adrain Lees
    4.35 +;
    4.36 +; entry a1 -> destination
    4.37 +;       a2 =  dest width in pixels
    4.38 +;       a3 =  dest line length in bytes
    4.39 +;       a4 =  dest height in scanlines
    4.40 +;       arg5 -> source
    4.41 +;       arg6 =  byte offset from end of source line to start of next
    4.42 +
    4.43 +Arg5    *       10*4
    4.44 +Arg6    *       Arg5+4
    4.45 +
    4.46 +RISCOS_Put32    ROUT
    4.47 +                STMFD   sp!,{a2,v1-v6,sl,fp,lr}
    4.48 +                LDR     ip,[sp,#Arg5]
    4.49 +                MOV     lr,a1
    4.50 +                B       ucp64lp
    4.51 +
    4.52 +00              ;tail strip of 1-15 pixels
    4.53 +
    4.54 +                LDR     v1,[ip],#4
    4.55 +01              SUBS    a2,a2,#1
    4.56 +                STR     v1,[lr],#4
    4.57 +                LDRHI   v1,[ip],#4
    4.58 +                BHI     %01
    4.59 +                B       %02
    4.60 +
    4.61 +ucp64end        ADDS    a2,a2,#16
    4.62 +                BNE     %00
    4.63 +
    4.64 +02              SUBS    a4,a4,#1                ;height--
    4.65 +                LDRHI   v1,[sp,#Arg6]
    4.66 +                LDRHI   a2,[sp]                 ;reload width
    4.67 +                BLS     %03
    4.68 +
    4.69 +                ;move to start of next scanline
    4.70 +
    4.71 +                ADD     lr,a1,a3
    4.72 +                ADD     a1,a1,a3
    4.73 +                ADD     ip,ip,v1
    4.74 +
    4.75 +ucp64lp         SUBS    a2,a2,#16
    4.76 +                BLO     ucp64end
    4.77 +
    4.78 +                PLD     [ip,#64]
    4.79 +
    4.80 +                LDR     v1,[ip],#4
    4.81 +                LDR     v2,[ip],#4
    4.82 +                LDR     v3,[ip],#4
    4.83 +                LDR     v4,[ip],#4
    4.84 +                LDR     v5,[ip],#4
    4.85 +                LDR     v6,[ip],#4
    4.86 +                LDR     sl,[ip],#4
    4.87 +                LDR     fp,[ip],#4
    4.88 +                STR     v1,[lr],#4
    4.89 +                STR     v2,[lr],#4
    4.90 +                STR     v3,[lr],#4
    4.91 +                STR     v4,[lr],#4
    4.92 +                STR     v5,[lr],#4
    4.93 +                STR     v6,[lr],#4
    4.94 +                STR     sl,[lr],#4
    4.95 +                STR     fp,[lr],#4
    4.96 +
    4.97 +                PLD     [ip,#64]
    4.98 +
    4.99 +                LDR     v1,[ip],#4
   4.100 +                LDR     v2,[ip],#4
   4.101 +                LDR     v3,[ip],#4
   4.102 +                LDR     v4,[ip],#4
   4.103 +                LDR     v5,[ip],#4
   4.104 +                LDR     v6,[ip],#4
   4.105 +                LDR     sl,[ip],#4
   4.106 +                LDR     fp,[ip],#4
   4.107 +                STR     v1,[lr],#4
   4.108 +                STR     v2,[lr],#4
   4.109 +                STR     v3,[lr],#4
   4.110 +                STR     v4,[lr],#4
   4.111 +                STR     v5,[lr],#4
   4.112 +                STR     v6,[lr],#4
   4.113 +                STR     sl,[lr],#4
   4.114 +                STR     fp,[lr],#4
   4.115 +
   4.116 +                B       ucp64lp
   4.117 +
   4.118 +03              LDMFD   sp!,{a2,v1-v6,sl,fp,pc}
   4.119 +
     5.1 --- a/src/video/riscos/SDL_riscosASM.s	Thu Mar 02 03:18:21 2006 +0000
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,116 +0,0 @@
     5.4 -;
     5.5 -;    SDL - Simple DirectMedia Layer
     5.6 -;    Copyright (C) 1997-2004 Sam Lantinga
     5.7 -;
     5.8 -;    This library is free software; you can redistribute it and/or
     5.9 -;    modify it under the terms of the GNU Library General Public
    5.10 -;    License as published by the Free Software Foundation; either
    5.11 -;    version 2 of the License, or (at your option) any later version.
    5.12 -;
    5.13 -;    This library is distributed in the hope that it will be useful,
    5.14 -;    but WITHOUT ANY WARRANTY; without even the implied warranty of
    5.15 -;    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    5.16 -;    Library General Public License for more details.
    5.17 -;
    5.18 -;    You should have received a copy of the GNU Library General Public
    5.19 -;    License along with this library; if not, write to the Free
    5.20 -;    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    5.21 -;
    5.22 -;    Sam Lantinga
    5.23 -;    slouken@libsdl.org
    5.24 -;
    5.25 -; Assembler routines for RISC OS display
    5.26 -;
    5.27 -
    5.28 -	AREA |C$$CODE|
    5.29 -
    5.30 -	EXPORT |RISCOS_Put32|
    5.31 -
    5.32 -; Display 32bpp to 32bpp, 1:1
    5.33 -;
    5.34 -; Code provided by Adrain Lees
    5.35 -;
    5.36 -; entry a1 -> destination
    5.37 -;       a2 =  dest width in pixels
    5.38 -;       a3 =  dest line length in bytes
    5.39 -;       a4 =  dest height in scanlines
    5.40 -;       arg5 -> source
    5.41 -;       arg6 =  byte offset from end of source line to start of next
    5.42 -
    5.43 -Arg5    *       10*4
    5.44 -Arg6    *       Arg5+4
    5.45 -
    5.46 -RISCOS_Put32    ROUT
    5.47 -                STMFD   sp!,{a2,v1-v6,sl,fp,lr}
    5.48 -                LDR     ip,[sp,#Arg5]
    5.49 -                MOV     lr,a1
    5.50 -                B       ucp64lp
    5.51 -
    5.52 -00              ;tail strip of 1-15 pixels
    5.53 -
    5.54 -                LDR     v1,[ip],#4
    5.55 -01              SUBS    a2,a2,#1
    5.56 -                STR     v1,[lr],#4
    5.57 -                LDRHI   v1,[ip],#4
    5.58 -                BHI     %01
    5.59 -                B       %02
    5.60 -
    5.61 -ucp64end        ADDS    a2,a2,#16
    5.62 -                BNE     %00
    5.63 -
    5.64 -02              SUBS    a4,a4,#1                ;height--
    5.65 -                LDRHI   v1,[sp,#Arg6]
    5.66 -                LDRHI   a2,[sp]                 ;reload width
    5.67 -                BLS     %03
    5.68 -
    5.69 -                ;move to start of next scanline
    5.70 -
    5.71 -                ADD     lr,a1,a3
    5.72 -                ADD     a1,a1,a3
    5.73 -                ADD     ip,ip,v1
    5.74 -
    5.75 -ucp64lp         SUBS    a2,a2,#16
    5.76 -                BLO     ucp64end
    5.77 -
    5.78 -                PLD     [ip,#64]
    5.79 -
    5.80 -                LDR     v1,[ip],#4
    5.81 -                LDR     v2,[ip],#4
    5.82 -                LDR     v3,[ip],#4
    5.83 -                LDR     v4,[ip],#4
    5.84 -                LDR     v5,[ip],#4
    5.85 -                LDR     v6,[ip],#4
    5.86 -                LDR     sl,[ip],#4
    5.87 -                LDR     fp,[ip],#4
    5.88 -                STR     v1,[lr],#4
    5.89 -                STR     v2,[lr],#4
    5.90 -                STR     v3,[lr],#4
    5.91 -                STR     v4,[lr],#4
    5.92 -                STR     v5,[lr],#4
    5.93 -                STR     v6,[lr],#4
    5.94 -                STR     sl,[lr],#4
    5.95 -                STR     fp,[lr],#4
    5.96 -
    5.97 -                PLD     [ip,#64]
    5.98 -
    5.99 -                LDR     v1,[ip],#4
   5.100 -                LDR     v2,[ip],#4
   5.101 -                LDR     v3,[ip],#4
   5.102 -                LDR     v4,[ip],#4
   5.103 -                LDR     v5,[ip],#4
   5.104 -                LDR     v6,[ip],#4
   5.105 -                LDR     sl,[ip],#4
   5.106 -                LDR     fp,[ip],#4
   5.107 -                STR     v1,[lr],#4
   5.108 -                STR     v2,[lr],#4
   5.109 -                STR     v3,[lr],#4
   5.110 -                STR     v4,[lr],#4
   5.111 -                STR     v5,[lr],#4
   5.112 -                STR     v6,[lr],#4
   5.113 -                STR     sl,[lr],#4
   5.114 -                STR     fp,[lr],#4
   5.115 -
   5.116 -                B       ucp64lp
   5.117 -
   5.118 -03              LDMFD   sp!,{a2,v1-v6,sl,fp,pc}
   5.119 -