[Scummvm-cvs-logs] CVS: scummvm/backends/PalmOS/Src/arm ArmNative.h,NONE,1.1 PNOMain.cpp,NONE,1.1 copy_rect.cpp,NONE,1.1 wide_landscape.cpp,NONE,1.1 wide_portrait.cpp,NONE,1.1
Chris Apers
chrilith at users.sourceforge.net
Thu Feb 5 06:05:23 CET 2004
Update of /cvsroot/scummvm/scummvm/backends/PalmOS/Src/arm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18588/arm
Added Files:
ArmNative.h PNOMain.cpp copy_rect.cpp wide_landscape.cpp
wide_portrait.cpp
Log Message:
Prepare ARM support
--- NEW FILE: ArmNative.h ---
#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
--- NEW FILE: PNOMain.cpp ---
#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);
}
--- NEW FILE: copy_rect.cpp ---
#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;
}
--- NEW FILE: wide_landscape.cpp ---
#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;
}
--- NEW FILE: wide_portrait.cpp ---
#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;
}
More information about the Scummvm-git-logs
mailing list