mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-01 16:35:20 +00:00
Prepare ARM support
svn-id: r12736
This commit is contained in:
parent
ef1b06d8b3
commit
6830942213
43
backends/PalmOS/Src/arm/ArmNative.h
Normal file
43
backends/PalmOS/Src/arm/ArmNative.h
Normal file
@ -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
|
60
backends/PalmOS/Src/arm/PNOMain.cpp
Normal file
60
backends/PalmOS/Src/arm/PNOMain.cpp
Normal file
@ -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);
|
||||
}
|
27
backends/PalmOS/Src/arm/copy_rect.cpp
Normal file
27
backends/PalmOS/Src/arm/copy_rect.cpp
Normal file
@ -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;
|
||||
}
|
30
backends/PalmOS/Src/arm/wide_landscape.cpp
Normal file
30
backends/PalmOS/Src/arm/wide_landscape.cpp
Normal file
@ -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;
|
||||
}
|
43
backends/PalmOS/Src/arm/wide_portrait.cpp
Normal file
43
backends/PalmOS/Src/arm/wide_portrait.cpp
Normal file
@ -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;
|
||||
}
|
@ -11,4 +11,4 @@ enum {
|
||||
extern UInt8 gFormEditMode;
|
||||
void EditGameFormDelete(Boolean direct);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
12
backends/PalmOS/Src/shared.h
Normal file
12
backends/PalmOS/Src/shared.h
Normal file
@ -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
|
Loading…
x
Reference in New Issue
Block a user