aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Watts2007-07-10 20:20:50 +0000
committerRobin Watts2007-07-10 20:20:50 +0000
commitb1feb9c65c715862d70b25cfa4e37df3a912cac5 (patch)
tree35044ef853787c2de285f8fc0fce8a05b4ef80fa
parent6e77abc07f20736fe7d50d3f3f3211839c630b53 (diff)
downloadscummvm-rg350-b1feb9c65c715862d70b25cfa4e37df3a912cac5.tar.gz
scummvm-rg350-b1feb9c65c715862d70b25cfa4e37df3a912cac5.tar.bz2
scummvm-rg350-b1feb9c65c715862d70b25cfa4e37df3a912cac5.zip
This commit adds a new build define USE_ARM_GFX_ASM (and sets it for the WinCE
and DS builds). This causes the scumm engines graphics code to call ARM routines to do drawStripToScreen and copy8col. These routines were originally written for the DS port, and have now been made available to any other ARM device out there that wants them. I've tested this change on WinCE, but can't test it on the DS as I don't have one. We know that the routines work there though. svn-id: r28016
-rw-r--r--backends/platform/ds/arm9/makefile3
-rw-r--r--backends/platform/wince/Makefile18
-rw-r--r--engines/scumm/gfx.cpp29
-rwxr-xr-xengines/scumm/gfxARM.s120
-rw-r--r--engines/scumm/module.mk5
5 files changed, 155 insertions, 20 deletions
diff --git a/backends/platform/ds/arm9/makefile b/backends/platform/ds/arm9/makefile
index c9ca5467f3..7c93cc8b05 100644
--- a/backends/platform/ds/arm9/makefile
+++ b/backends/platform/ds/arm9/makefile
@@ -41,7 +41,7 @@ VPATH = $(srcdir)
ARM = 1
ifdef DS_BUILD_A
- DEFINES = -DDS_SCUMM_BUILD -DDS_BUILD_A
+ DEFINES = -DDS_SCUMM_BUILD -DDS_BUILD_A -DUSE_ARM_GFX_ASM
LOGO = logoa.bmp
DISABLE_HE = 1
#DISABLE_SCUMM = 1
@@ -60,6 +60,7 @@ ifdef DS_BUILD_A
DISABLE_TOUCHE = 1
DISABLE_PARALLACTION = 1
DISABLE_CRUISE = 1
+ USE_ARM_GFX_ASM = 1
BUILD=scummvm-A
endif
diff --git a/backends/platform/wince/Makefile b/backends/platform/wince/Makefile
index a4b4fa4f12..03db1a5317 100644
--- a/backends/platform/wince/Makefile
+++ b/backends/platform/wince/Makefile
@@ -52,6 +52,7 @@ USE_ZLIB = 1
#DISABLE_HQ_SCALERS = 1
USE_ARM_SOUND_ASM = 1
USE_ARM_SMUSH_ASM = 1
+USE_ARM_GFX_ASM = 1
########################################################################
@@ -85,10 +86,6 @@ DEFINES += -DNONSTANDARD_PORT
DEFINES += -DWIN32
DEFINES += -D__stdcall= -Dcdecl= -D__cdecl__= -D__cdecl= -Wno-multichar
-ifdef WINCE_DEBUG_BUILD
-DEFINES += -DDEBUG -DUSE_WINDBG -g
-endif
-
INCLUDES := -I$(srcdir) -I. -I$(srcdir)/engines -Imissing/gcc -Ilibs/include -Ilibs/include/sdl -ICEgui -ICEkeys -I$(wince_gcc_root)/include
CFLAGS := -O3 -march=armv4 -mtune=xscale
@@ -98,6 +95,11 @@ CXXFLAGS := $(CFLAGS)
LDFLAGS := -Llibs/lib -L$(wince_gcc_root)/lib
LIBS := -lSDL
+ifdef WINCE_DEBUG_BUILD
+DEFINES += -DDEBUG -DUSE_WINDBG -g
+LDFLAGS += -debug
+endif
+
ifdef USE_ZLIB
DEFINES += -DUSE_ZLIB
LIBS += -lzlib
@@ -129,8 +131,12 @@ DEFINES += -DUSE_FLAC
LIBS += -lFLAC
endif
-ifdef USE_ARM_SMUSH
-DEFINES += -DUSE_ARM_SMUSH
+ifdef USE_ARM_SMUSH_ASM
+DEFINES += -DUSE_ARM_SMUSH_ASM
+endif
+
+ifdef USE_ARM_GFX_ASM
+DEFINES += -DUSE_ARM_GFX_ASM
endif
LIBS += --entry WinMainCRTStartup
diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp
index d21a77ea56..4e7276f2d0 100644
--- a/engines/scumm/gfx.cpp
+++ b/engines/scumm/gfx.cpp
@@ -35,9 +35,12 @@
#include "scumm/usage_bits.h"
#include "scumm/he/wiz_he.h"
#include "scumm/util.h"
-#ifdef __DS__
-#include "blitters.h"
-#endif
+
+#ifdef USE_ARM_GFX_ASM
+extern "C" void DrawStripToScreenARM(int height, int width, byte const* text, byte const* src, byte* dst,
+ int vsPitch, int vmScreenWidth, int textSurfacePitch);
+extern "C" void Copy8ColARM(byte* dst, int dstPitch, const byte* src, int height);
+#endif /* USE_ARM_GFX_ASM */
namespace Scumm {
@@ -610,8 +613,8 @@ void ScummEngine::drawStripToScreen(VirtScreen *vs, int x, int width, int top, i
// (b) RLE encode the _textSurface row-wise. This is an improved variant of (a),
// but also more complicated to implement, and incurs a bigger overhead when
// writing to the text surface.
-#ifdef __DS__
- DS::asmDrawStripToScreen(height, width, text, src, dst, vs->pitch, width, _textSurface.pitch);
+#ifdef ARM_USE_GFX_ASM
+ DrawStripToScreenARM(height, width, text, src, dst, vs->pitch, width, _textSurface.pitch);
#else
for (int h = 0; h < height * m; ++h) {
for (int w = 0; w < width * m; ++w) {
@@ -625,7 +628,6 @@ void ScummEngine::drawStripToScreen(VirtScreen *vs, int x, int width, int top, i
text += _textSurface.pitch - width * m;
}
#endif
-
src = _compositeBuf;
pitch = width;
@@ -1064,11 +1066,14 @@ static void fill(byte *dst, int dstPitch, byte color, int w, int h) {
}
}
+#ifdef ARM_USE_GFX_ASM
+
+#define copy8Col(A,B,C,D) copy8ColARM(A,B,C,D)
+
+#else
+
static void copy8Col(byte *dst, int dstPitch, const byte *src, int height) {
-#ifndef __DS__
-
-
do {
#if defined(SCUMM_NEED_ALIGNMENT)
memcpy(dst, src, 8);
@@ -1079,12 +1084,10 @@ static void copy8Col(byte *dst, int dstPitch, const byte *src, int height) {
dst += dstPitch;
src += dstPitch;
} while (--height);
-#else
- DS::asmCopy8Col(dst, dstPitch, src, height);
-#endif
-
}
+#endif /* ARM_USE_GFX_ASM */
+
static void clear8Col(byte *dst, int dstPitch, int height) {
do {
#if defined(SCUMM_NEED_ALIGNMENT)
diff --git a/engines/scumm/gfxARM.s b/engines/scumm/gfxARM.s
new file mode 100755
index 0000000000..fa2457fb29
--- /dev/null
+++ b/engines/scumm/gfxARM.s
@@ -0,0 +1,120 @@
+@ ScummVM Scumm Interpreter
+@ Copyright (C) 2007 The ScummVM project
+@
+@ This program is free software@ you can redistribute it and/or
+@ modify it under the terms of the GNU General Public License
+@ as published by the Free Software Foundation@ either version 2
+@ of the License, or (at your option) any later version.
+@
+@ This program is distributed in the hope that it will be useful,
+@ but WITHOUT ANY WARRANTY; without even the implied warranty of
+@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+@ GNU General Public License for more details.
+@
+@ You should have received a copy of the GNU General Public License
+@ along with this program@ if not, write to the Free Software
+@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+@
+@ $URL: $
+@ $Id: $
+@
+@ @author Robin Watts (robin@wss.co.uk)
+
+ .text
+
+ .global asmDrawStripToScreen
+
+ @ ARM implementation of asmDrawStripToScreen.
+ @
+ @ C prototype would be:
+ @
+ @ extern "C" void asmDrawStripToScreen(int height,
+ @ int width,
+ @ byte const *text,
+ @ byte const *src,
+ @ byte *dst,
+ @ int vsPitch,
+ @ int vsScreenWidth,
+ @ int textSurfacePitch);
+ @
+ @ In addition, we assume that text, src and dst are all word (4 byte)
+ @ aligned. This is the same assumption that the old 'inline' version
+ @ made.
+asmDrawStripToScreen:
+ @ r0 = height
+ @ r1 = width
+ @ r2 = text
+ @ r3 = src
+ MOV r12,r13
+ STMFD r13!,{r4-r7,r9-r11,R14}
+ LDMIA r12,{r4,r5,r6,r7}
+ @ r4 = dst
+ @ r5 = vsPitch
+ @ r6 = vmScreenWidth
+ @ r7 = textSurfacePitch
+
+ CMP r0,#0 @ If height<=0
+ MOVLE r0,#1 @ height=1
+ CMP r1,#4 @ If width<4
+ BLT end @ return
+
+ @ Width &= ~4 ? What's that about then? Width &= ~3 I could have
+ @ understood...
+ BIC r1,r1,#4
+
+ SUB r5,r5,r1 @ vsPitch -= width
+ SUB r6,r6,r1 @ vmScreenWidth -= width
+ SUB r7,r7,r1 @ textSurfacePitch -= width
+ MOV r10,#253
+ ORR r10,r10,r10,LSL #8
+ ORR r10,r10,r10,LSL #16 @ r10 = mask
+yLoop:
+ MOV r14,r1 @ r14 = width
+xLoop:
+ LDR r12,[r2],#4 @ r12 = [text]
+ LDR r11,[r3],#4 @ r11 = [src]
+ CMP r12,r10
+ BNE singleByteCompare
+ SUBS r14,r14,#4
+ STR r11,[r4], #4 @ r4 = [dst]
+ BGT xLoop
+
+ ADD r2,r2,r7 @ text += textSurfacePitch
+ ADD r3,r3,r5 @ src += vsPitch
+ ADD r4,r4,r6 @ dst += vmScreenWidth
+ SUBS r0,r0,#1
+ BGT yLoop
+ LDMFD r13!,{r4-r7,r9-r11,PC}
+
+singleByteCompare:
+ MOV r9,r12,LSR #24 @ r9 = 1st byte of [text]
+ CMP r9,r10,LSR #24 @ if (r9 == mask)
+ MOVEQ r9,r11,LSR #24 @ r9 = 1st byte of [src]
+ ORR r12,r9,r12,LSL #8 @ r12 = combine r9 and r12
+
+ MOV r9,r12,LSR #24 @ r9 = 1st byte of [text]
+ CMP r9,r10,LSR #24 @ if (r9 == mask)
+ MOVEQ r9,r11,LSR #24 @ r9 = 1st byte of [src]
+ ORR r12,r9,r12,LSL #8 @ r12 = combine r9 and r12
+
+ MOV r9,r12,LSR #24 @ r9 = 1st byte of [text]
+ CMP r9,r10,LSR #24 @ if (r9 == mask)
+ MOVEQ r9,r11,LSR #24 @ r9 = 1st byte of [src]
+ ORR r12,r9,r12,LSL #8 @ r12 = combine r9 and r12
+
+ MOV r9,r12,LSR #24 @ r9 = 1st byte of [text]
+ CMP r9,r10,LSR #24 @ if (r9 == mask)
+ MOVEQ r9,r11,LSR #24 @ r9 = 1st byte of [src]
+ ORR r12,r9,r12,LSL #8 @ r12 = combine r9 and r12
+
+ STR r12,[r4],#4
+ SUBS r14,r14,#4
+ BGT xLoop
+
+ ADD r2,r2,r7 @ text += textSurfacePitch
+ ADD r3,r3,r5 @ src += vsPitch
+ ADD r4,r4,r6 @ dst += vmScreenWidth
+ SUBS r0,r0,#1
+ BGT yLoop
+end:
+ LDMFD r13!,{r4-r7,r9-r11,PC}
diff --git a/engines/scumm/module.mk b/engines/scumm/module.mk
index d8ef669410..a340f564b3 100644
--- a/engines/scumm/module.mk
+++ b/engines/scumm/module.mk
@@ -90,6 +90,11 @@ endif
endif
+ifdef USE_ARM_GFX_ASM
+MODULE_OBJS += \
+ gfxARM.o
+endif
+
ifndef DISABLE_HE
MODULE_OBJS += \
he/animation_he.o \