diff options
author | Chris Apers | 2004-05-25 13:44:22 +0000 |
---|---|---|
committer | Chris Apers | 2004-05-25 13:44:22 +0000 |
commit | bbd13e5d91c04383cf63d3cd70517e6b4bae8e3b (patch) | |
tree | 3f9e5441eea914646a26709074423599d8ce983f /backends/PalmOS/Src | |
parent | 662ead7dcc78e594bcdb2888927c7ebccc97cda6 (diff) | |
download | scummvm-rg350-bbd13e5d91c04383cf63d3cd70517e6b4bae8e3b.tar.gz scummvm-rg350-bbd13e5d91c04383cf63d3cd70517e6b4bae8e3b.tar.bz2 scummvm-rg350-bbd13e5d91c04383cf63d3cd70517e6b4bae8e3b.zip |
New ARM functions (sound, copyrect, wide display)
svn-id: r13871
Diffstat (limited to 'backends/PalmOS/Src')
-rw-r--r-- | backends/PalmOS/Src/arm/ArmNative.h | 65 | ||||
-rw-r--r-- | backends/PalmOS/Src/arm/PNOMain.cpp | 75 | ||||
-rw-r--r-- | backends/PalmOS/Src/arm/copy_rect.cpp | 21 | ||||
-rw-r--r-- | backends/PalmOS/Src/arm/copy_rect.h | 11 | ||||
-rw-r--r-- | backends/PalmOS/Src/arm/pa1_snd.cpp | 1 | ||||
-rw-r--r-- | backends/PalmOS/Src/arm/pa1_snd.h | 10 | ||||
-rw-r--r-- | backends/PalmOS/Src/arm/stream_snd.cpp | 1 | ||||
-rw-r--r-- | backends/PalmOS/Src/arm/stream_snd.h | 11 | ||||
-rw-r--r-- | backends/PalmOS/Src/arm/wide_ls.cpp | 23 | ||||
-rw-r--r-- | backends/PalmOS/Src/arm/wide_ls.h | 11 | ||||
-rw-r--r-- | backends/PalmOS/Src/arm/wide_pt.cpp | 37 | ||||
-rw-r--r-- | backends/PalmOS/Src/arm/wide_pt.h | 11 |
12 files changed, 203 insertions, 74 deletions
diff --git a/backends/PalmOS/Src/arm/ArmNative.h b/backends/PalmOS/Src/arm/ArmNative.h index 5f58ab59ad..502752648b 100644 --- a/backends/PalmOS/Src/arm/ArmNative.h +++ b/backends/PalmOS/Src/arm/ArmNative.h @@ -1,43 +1,68 @@ #ifndef _ARMNATIVE_H_ #define _ARMNATIVE_H_ +#include "PNOLoader.h" + #ifdef WIN32 #include "testing/SimNative.h" #include "testing/oscalls.h" #endif -// functions -typedef unsigned long (*PnoProc)(void *userData68KP); +//#define DISABLE_ARM +//#define DEBUG_ARM + +// rsrc +enum { + ARM_PA1SND = 1, + ARM_STREAMSND, + ARM_OWIDELS, + ARM_OWIDEPT, + ARM_OCOPYRECT +}; + +#define TRUE 1 +#define FALSE 0 + +// types +typedef struct { + void *srcP; + void *dstP; + UInt32 length; +} ARMPa1SndType, *ARMPa1SndPtr; + +typedef struct { + void *proc; + void *param; -#define DECLARE(x) unsigned long x(void *userData68KP); + void *handle; // sound handle + UInt32 size; // buffer size + UInt32 slot; + UInt32 active, // is the sound handler active + set, // is the buffer filled + wait; // do we need to wait for sound completion + void *dataP, // main buffer + *tmpP; // tmp buffer (convertion) +} SoundDataType; typedef struct { - UInt32 func; void *dst; void *src; - -} DataOSysWideType , *DataOSysWidePtr; +} OSysWideType , *OSysWidePtr; typedef struct { - UInt32 func; void *dst; const void *buf; UInt32 pitch, _offScreenPitch; UInt32 w, h; -} DataOSysCopyRectType, *DataOSysCopyRectPtr; +} OSysCopyType, *OSysCopyPtr; -DECLARE(OSystem_PALMOS_update_screen__wide_portrait) -DECLARE(OSystem_PALMOS_update_screen__wide_landscape) -DECLARE(OSystem_PALMOS_copyRectToScreen) +// calls +MemPtr _PceInit(DmResID resID); +UInt32 _PceCall(void *armP, void *userDataP); +void _PceFree(void *armP); -// rsrc -#define ARMCODE_1 1000 - -// function indexes -enum { - kOSysWidePortrait = 0, - kOSysWideLandscape, - kOSysCopyRect -}; +MemPtr _PnoInit(DmResID resID, PnoDescriptor *pnoP); +UInt32 _PnoCall(PnoDescriptor *pnoP, void *userDataP); +void _PnoFree(PnoDescriptor *pnoP, MemPtr armP); #endif
\ No newline at end of file diff --git a/backends/PalmOS/Src/arm/PNOMain.cpp b/backends/PalmOS/Src/arm/PNOMain.cpp index a38682c5e1..54569b2502 100644 --- a/backends/PalmOS/Src/arm/PNOMain.cpp +++ b/backends/PalmOS/Src/arm/PNOMain.cpp @@ -5,56 +5,47 @@ // "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 +// ------------------------ + +extern "C" +unsigned long PNO_Main( + const void *emulStateP, + void *userData68KP, + Call68KFuncType *call68KFuncP); 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_copyRectToScreen - }; -*/ -#ifndef WIN32 + unsigned long retVal = 0; + +#ifdef COMPILE_PACE // 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); +#ifdef COMPILE_PA1SND + ARMPa1SndPtr userData = (ARMPa1SndPtr)userData68KP; + pcm2adpcm ( (Int16 *)ReadUnaligned32(&(userData->srcP)), + (UInt8 *)ReadUnaligned32(&(userData->dstP)), + ReadUnaligned32(&(userData->length)) + ); +#endif + +#ifdef COMPILE_STREAMSND + retVal = (unsigned long)sndCallback; +#endif + +#ifdef COMPILE_OWIDELS + O_WideLandscape(userData68KP); +#endif - switch (run) { - case 0: - OSystem_PALMOS_update_screen__wide_portrait(userData68KP); - break; - case 1: - OSystem_PALMOS_update_screen__wide_landscape(userData68KP); - break; - } +#ifdef COMPILE_OWIDEPT + O_WidePortrait(userData68KP); +#endif + +#ifdef COMPILE_OCOPYRECT + O_CopyRectToScreen(userData68KP); +#endif - return 0; -// return call[run](userData68KP); + return retVal; } diff --git a/backends/PalmOS/Src/arm/copy_rect.cpp b/backends/PalmOS/Src/arm/copy_rect.cpp index 64aa1df69c..c6a634f48c 100644 --- a/backends/PalmOS/Src/arm/copy_rect.cpp +++ b/backends/PalmOS/Src/arm/copy_rect.cpp @@ -1,17 +1,16 @@ -#include "PACEInterfaceLib.h" #include "ArmNative.h" #include "endianutils.h" #include "../shared.h" -unsigned long OSystem_PALMOS_copy_rect(void *userData68KP) { - UInt8* dataP = (UInt8 *)userData68KP; +void O_CopyRectToScreen(void *userData68KP) { + OSysCopyPtr dataP = (OSysCopyType *)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 + UInt8 *dst = (UInt8 *)ReadUnaligned32(&(dataP->dst)); + UInt8 *buf = (UInt8 *)ReadUnaligned32(&(dataP->buf)); + UInt32 pitch = ReadUnaligned32(&(dataP->pitch)); + UInt32 _offScreenPitch = ReadUnaligned32(&(dataP->_offScreenPitch)); + UInt32 w = ReadUnaligned32(&(dataP->w)); + UInt32 h = ReadUnaligned32(&(dataP->h)); if (_offScreenPitch == pitch && pitch == w) { MemMove(dst, buf, h * w); @@ -22,6 +21,4 @@ unsigned long OSystem_PALMOS_copy_rect(void *userData68KP) { buf += pitch; } while (--h); } - - return 0; -}
\ No newline at end of file +} diff --git a/backends/PalmOS/Src/arm/copy_rect.h b/backends/PalmOS/Src/arm/copy_rect.h new file mode 100644 index 0000000000..b869e64368 --- /dev/null +++ b/backends/PalmOS/Src/arm/copy_rect.h @@ -0,0 +1,11 @@ +#ifndef __WIDE_LS_H__ +#define __WIDE_LS_H__ + +#include <PalmOS.h> + +#define COMPILE_OCOPYRECT +#define COMPILE_PACE + +void O_CopyRectToScreen(void *userData68KP); + +#endif
\ No newline at end of file diff --git a/backends/PalmOS/Src/arm/pa1_snd.cpp b/backends/PalmOS/Src/arm/pa1_snd.cpp new file mode 100644 index 0000000000..5bd6ea2d4b --- /dev/null +++ b/backends/PalmOS/Src/arm/pa1_snd.cpp @@ -0,0 +1 @@ +#include "snd_pa1.cpp"
\ No newline at end of file diff --git a/backends/PalmOS/Src/arm/pa1_snd.h b/backends/PalmOS/Src/arm/pa1_snd.h new file mode 100644 index 0000000000..9d7f1f3c0d --- /dev/null +++ b/backends/PalmOS/Src/arm/pa1_snd.h @@ -0,0 +1,10 @@ +#ifndef __PA1_SND_H__ +#define __PA1_SND_H__ + +#include <PalmOS.h> + +#define COMPILE_PA1SND + +void pcm2adpcm(Int16 *src, UInt8 *dst, UInt32 length); + +#endif
\ No newline at end of file diff --git a/backends/PalmOS/Src/arm/stream_snd.cpp b/backends/PalmOS/Src/arm/stream_snd.cpp new file mode 100644 index 0000000000..8ddcaca055 --- /dev/null +++ b/backends/PalmOS/Src/arm/stream_snd.cpp @@ -0,0 +1 @@ +#include "snd_stream.cpp"
\ No newline at end of file diff --git a/backends/PalmOS/Src/arm/stream_snd.h b/backends/PalmOS/Src/arm/stream_snd.h new file mode 100644 index 0000000000..9867dbbdb2 --- /dev/null +++ b/backends/PalmOS/Src/arm/stream_snd.h @@ -0,0 +1,11 @@ +#ifndef __PA1_SND_H__ +#define __PA1_SND_H__ + +#include <PalmOS.h> + +#define COMPILE_STREAMSND +#define COMPILE_PACE + +Err sndCallback(void* UserDataP, SndStreamRef stream, void* bufferP, UInt32 *bufferSizeP); + +#endif
\ No newline at end of file diff --git a/backends/PalmOS/Src/arm/wide_ls.cpp b/backends/PalmOS/Src/arm/wide_ls.cpp new file mode 100644 index 0000000000..da748ab86c --- /dev/null +++ b/backends/PalmOS/Src/arm/wide_ls.cpp @@ -0,0 +1,23 @@ +#include "ArmNative.h" +#include "endianutils.h" +#include "../shared.h" + +void O_WideLandscape(void *userData68KP) { + OSysWidePtr dataP = (OSysWideType *)userData68KP; + + Coord x, y; + UInt8 *dst = (UInt8 *)ReadUnaligned32(&(dataP->dst)); + UInt8 *src = (UInt8 *)ReadUnaligned32(&(dataP->src)); + + for (y = 0; y < WIDE_HALF_HEIGHT; y++) { + // draw 2 lines + for (x = 0; x < WIDE_FULL_WIDTH; x++) { + *dst++ = *src++; + *dst++ = *src; + *dst++ = *src++; + } + // copy the second to the next line + MemMove(dst, dst - 480, 480); + dst += 480; + } +} diff --git a/backends/PalmOS/Src/arm/wide_ls.h b/backends/PalmOS/Src/arm/wide_ls.h new file mode 100644 index 0000000000..eb42b624ea --- /dev/null +++ b/backends/PalmOS/Src/arm/wide_ls.h @@ -0,0 +1,11 @@ +#ifndef __WIDE_LS_H__ +#define __WIDE_LS_H__ + +#include <PalmOS.h> + +#define COMPILE_OWIDELS +#define COMPILE_PACE + +void O_WideLandscape(void *userData68KP); + +#endif
\ No newline at end of file diff --git a/backends/PalmOS/Src/arm/wide_pt.cpp b/backends/PalmOS/Src/arm/wide_pt.cpp new file mode 100644 index 0000000000..007bfa3481 --- /dev/null +++ b/backends/PalmOS/Src/arm/wide_pt.cpp @@ -0,0 +1,37 @@ +#include "ArmNative.h" +#include "endianutils.h" +#include "../shared.h" + +void O_WidePortrait(void *userData68KP) { + OSysWidePtr dataP = (OSysWideType *)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; + } +}
\ No newline at end of file diff --git a/backends/PalmOS/Src/arm/wide_pt.h b/backends/PalmOS/Src/arm/wide_pt.h new file mode 100644 index 0000000000..4ac4b4fb12 --- /dev/null +++ b/backends/PalmOS/Src/arm/wide_pt.h @@ -0,0 +1,11 @@ +#ifndef __WIDE_PT_H__ +#define __WIDE_PT_H__ + +#include <PalmOS.h> + +#define COMPILE_OWIDEPT +#define COMPILE_PACE + +void O_WidePortrait(void *userData68KP); + +#endif
\ No newline at end of file |