aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Apers2004-02-05 14:02:24 +0000
committerChris Apers2004-02-05 14:02:24 +0000
commit6830942213e4ad02ab895f34d1f547341c3aa81c (patch)
tree0ceb33ac50d0152c45df4fcd9e90177052c97cdb
parentef1b06d8b36997e8572557d112cbd452c1136b96 (diff)
downloadscummvm-rg350-6830942213e4ad02ab895f34d1f547341c3aa81c.tar.gz
scummvm-rg350-6830942213e4ad02ab895f34d1f547341c3aa81c.tar.bz2
scummvm-rg350-6830942213e4ad02ab895f34d1f547341c3aa81c.zip
Prepare ARM support
svn-id: r12736
-rw-r--r--backends/PalmOS/Src/arm/ArmNative.h43
-rw-r--r--backends/PalmOS/Src/arm/PNOMain.cpp60
-rw-r--r--backends/PalmOS/Src/arm/copy_rect.cpp27
-rw-r--r--backends/PalmOS/Src/arm/wide_landscape.cpp30
-rw-r--r--backends/PalmOS/Src/arm/wide_portrait.cpp43
-rw-r--r--backends/PalmOS/Src/forms/formEditGame.h2
-rw-r--r--backends/PalmOS/Src/shared.h12
7 files changed, 216 insertions, 1 deletions
diff --git a/backends/PalmOS/Src/arm/ArmNative.h b/backends/PalmOS/Src/arm/ArmNative.h
new file mode 100644
index 0000000000..2a85104b97
--- /dev/null
+++ b/backends/PalmOS/Src/arm/ArmNative.h
@@ -0,0 +1,43 @@
+#ifndef _ARMNATIVE_H_
+#define _ARMNATIVE_H_
+
+#ifdef WIN32
+ #include "testing/SimNative.h"
+ #include "testing/oscalls.h"
+#endif
+
+// functions
+typedef unsigned long (*PnoProc)(void *userData68KP);
+
+#define DECLARE(x) unsigned long x(void *userData68KP);
+
+typedef struct {
+ UInt32 func;
+ void *dst;
+ void *src;
+
+} DataOSysWideType , *DataOSysWidePtr;
+
+typedef struct {
+ UInt32 func;
+ void *dst;
+ const void *buf;
+ UInt32 pitch, _offScreenPitch;
+ UInt32 w, h;
+} DataOSysCopyRectType, *DataOSysCopyRectPtr;
+
+DECLARE(OSystem_PALMOS_update_screen__wide_portrait)
+DECLARE(OSystem_PALMOS_update_screen__wide_landscape)
+DECLARE(OSystem_PALMOS_copy_rect)
+
+// rsrc
+#define ARMCODE_1 1000
+
+// function indexes
+enum {
+ kOSysWidePortrait = 0,
+ kOSysWideLandscape,
+ kOSysCopyRect
+};
+
+#endif \ No newline at end of file
diff --git a/backends/PalmOS/Src/arm/PNOMain.cpp b/backends/PalmOS/Src/arm/PNOMain.cpp
new file mode 100644
index 0000000000..6fc59e0000
--- /dev/null
+++ b/backends/PalmOS/Src/arm/PNOMain.cpp
@@ -0,0 +1,60 @@
+#include "PACEInterfaceLib.h"
+#include "ArmNative.h"
+
+// Linker still looks for ARMlet_Main as entry point, but the
+// "ARMlet" name is now officially discouraged. Compare an
+// contrast to "PilotMain" for 68K applications.
+#define PNO_Main ARMlet_Main
+// entry point
+extern "C"
+unsigned long PNO_Main(const void *emulStateP, void *userData68KP, Call68KFuncType *call68KFuncP);
+
+#ifndef WIN32
+
+#pragma thumb off
+asm void * __ARMlet_Take_Func_Addr__(void *f)
+{
+ sub r0, r0, r10 // 0 convert pointer to zero-based address
+ ldr r12, [pc, #8] // 4 load zero-based address of this routine plus offset into r12
+ sub r12, pc, r12 // 8 compute start of PNO by subtracting this from PC
+ add r0, r0, r12 // 12 add PNO start to function pointer
+ bx lr // 16 return to caller
+ dcd __ARMlet_Take_Func_Addr__ + 16 // 20
+}
+#pragma thumb reset
+
+#else
+#define __ARMlet_Take_Func_Addr__(x) x
+#endif
+
+unsigned long PNO_Main(const void *emulStateP, void *userData68KP, Call68KFuncType *call68KFuncP) {
+/* const PnoProc call[] = {
+ (PnoProc)__ARMlet_Take_Func_Addr__(OSystem_PALMOS_update_screen__wide_portrait),
+ (PnoProc)__ARMlet_Take_Func_Addr__(OSystem_PALMOS_update_screen__wide_landscape),
+ //OSystem_PALMOS_copy_rect
+ };
+*/
+#ifndef WIN32
+ // needed before making any OS calls using the
+ // PACEInterface library
+ InitPACEInterface(emulStateP, call68KFuncP);
+#else
+ global.call68KFuncP = call68KFuncP;
+ global.emulStateP = emulStateP;
+ global.userData68KP = userData68KP;
+#endif
+
+ UInt32 run = ByteSwap32(*(UInt32 *)userData68KP);
+
+ switch (run) {
+ case 0:
+ OSystem_PALMOS_update_screen__wide_portrait(userData68KP);
+ break;
+ case 1:
+ OSystem_PALMOS_update_screen__wide_landscape(userData68KP);
+ break;
+ }
+
+ return 0;
+// return call[run](userData68KP);
+}
diff --git a/backends/PalmOS/Src/arm/copy_rect.cpp b/backends/PalmOS/Src/arm/copy_rect.cpp
new file mode 100644
index 0000000000..64aa1df69c
--- /dev/null
+++ b/backends/PalmOS/Src/arm/copy_rect.cpp
@@ -0,0 +1,27 @@
+#include "PACEInterfaceLib.h"
+#include "ArmNative.h"
+#include "endianutils.h"
+#include "../shared.h"
+
+unsigned long OSystem_PALMOS_copy_rect(void *userData68KP) {
+ UInt8* dataP = (UInt8 *)userData68KP;
+
+ UInt8 *dst = (UInt8 *)ReadUnaligned32(dataP + 2); // ->dst
+ UInt8 *buf = (UInt8 *)ReadUnaligned32(dataP + 6); // ->buf
+ UInt32 pitch = ReadUnaligned32(dataP + 10); // ->pitch
+ UInt32 _offScreenPitch = ReadUnaligned32(dataP + 14); // ->_offScreenPitch
+ UInt32 w = ReadUnaligned32(dataP + 18); // ->w
+ UInt32 h = ReadUnaligned32(dataP + 22); // ->h
+
+ if (_offScreenPitch == pitch && pitch == w) {
+ MemMove(dst, buf, h * w);
+ } else {
+ do {
+ MemMove(dst, buf, w);
+ dst += _offScreenPitch;
+ buf += pitch;
+ } while (--h);
+ }
+
+ return 0;
+} \ No newline at end of file
diff --git a/backends/PalmOS/Src/arm/wide_landscape.cpp b/backends/PalmOS/Src/arm/wide_landscape.cpp
new file mode 100644
index 0000000000..8590c8cd0e
--- /dev/null
+++ b/backends/PalmOS/Src/arm/wide_landscape.cpp
@@ -0,0 +1,30 @@
+#include "PACEInterfaceLib.h"
+#include "ArmNative.h"
+#include "endianutils.h"
+#include "../shared.h"
+
+unsigned long OSystem_PALMOS_update_screen__wide_landscape(void *userData68KP) {
+ DataOSysWidePtr dataP = (DataOSysWideType *)userData68KP;
+
+ Coord x, y;
+ UInt8 *dst = (UInt8 *)ReadUnaligned32(&(dataP->dst));
+ UInt8 *src = (UInt8 *)ReadUnaligned32(&(dataP->src));
+
+ for (y = 0; y < WIDE_HALF_HEIGHT; y++) {
+ for (x = 0; x < WIDE_HALF_WIDTH; x++) {
+ *dst++ = *src++;
+ *dst++ = *src;
+ *dst++ = *src++;
+ }
+ for (x = 0; x < WIDE_HALF_WIDTH; x++) {
+ *dst++ = *src++;
+ *dst++ = *src;
+ *dst++ = *src++;
+ }
+
+ MemMove(dst, dst - 480, 480);
+ dst += 480;
+ }
+
+ return 0;
+}
diff --git a/backends/PalmOS/Src/arm/wide_portrait.cpp b/backends/PalmOS/Src/arm/wide_portrait.cpp
new file mode 100644
index 0000000000..7e4213137e
--- /dev/null
+++ b/backends/PalmOS/Src/arm/wide_portrait.cpp
@@ -0,0 +1,43 @@
+#include "PACEInterfaceLib.h"
+#include "ArmNative.h"
+#include "endianutils.h"
+#include "../shared.h"
+
+unsigned long OSystem_PALMOS_update_screen__wide_portrait(void *userData68KP) {
+ DataOSysWidePtr dataP = (DataOSysWideType *)userData68KP;
+
+ Coord x, y;
+ UInt8 *dst = (UInt8 *)ReadUnaligned32(&(dataP->dst));
+ UInt8 *src1 = (UInt8 *)ReadUnaligned32(&(dataP->src));
+ UInt8 *src2 = src1;
+
+ for (x = 0; x < WIDE_HALF_WIDTH; x++)
+ {
+ for (y = 0; y < WIDE_HALF_HEIGHT; y++)
+ {
+ *dst++ = *src1;
+ src1 += WIDE_PITCH;
+ *dst++ = *src1;
+ *dst++ = *src1;
+ src1 += WIDE_PITCH;
+ }
+ src1 = --src2;
+ dst += 20; // we draw 200pix scaled to 1.5 = 300, screen width=320, so next is 20
+
+ for (y = 0; y < WIDE_HALF_HEIGHT; y++)
+ {
+ *dst++ = *src1;
+ src1 += WIDE_PITCH;
+ *dst++ = *src1;
+ *dst++ = *src1;
+ src1 += WIDE_PITCH;
+ }
+ src1 = --src2;
+ dst += 20;
+
+ MemMove(dst, dst - WIDE_PITCH, 300); // 300 = 200 x 1.5
+ dst += WIDE_PITCH;
+ }
+
+ return 0;
+} \ No newline at end of file
diff --git a/backends/PalmOS/Src/forms/formEditGame.h b/backends/PalmOS/Src/forms/formEditGame.h
index ae29f872ac..b5936ed6ec 100644
--- a/backends/PalmOS/Src/forms/formEditGame.h
+++ b/backends/PalmOS/Src/forms/formEditGame.h
@@ -11,4 +11,4 @@ enum {
extern UInt8 gFormEditMode;
void EditGameFormDelete(Boolean direct);
-#endif \ No newline at end of file
+#endif
diff --git a/backends/PalmOS/Src/shared.h b/backends/PalmOS/Src/shared.h
new file mode 100644
index 0000000000..b6581f3465
--- /dev/null
+++ b/backends/PalmOS/Src/shared.h
@@ -0,0 +1,12 @@
+#ifndef _SHARED_H_
+#define _SHARED_H_
+
+// OSystem : wide display
+// consider ony 480x320 screens
+// only avalaible for 320x200 games, so use values instead of vars
+#define WIDE_PITCH 320 // pitch in portrait mode
+#define WIDE_HALF_WIDTH 160 // 320 / 2
+#define WIDE_HALF_HEIGHT 100 // 200 / 2
+
+
+#endif \ No newline at end of file