This site is no longer active and is available for archival purposes only. Registration and login is disabled.

Some help to optimize my new ATARI ST emu for PocketPC...


Postby schtruck » Oct 21, 2002 @ 10:46pm

so when i compil there is a problem.....

mem.c(176) : error C2296: '^' : illegal, left operand has type 'char *'
mem.c(205) : error C2296: '^' : illegal, left operand has type 'char *'
mem.c(222) : error C2296: '^' : illegal, left operand has type 'char *'

the compiler dont like we use ^ on char *

any idear?
schtruck
pm Member
 
Posts: 77
Joined: May 24, 2002 @ 5:29pm


Postby AndrewGower » Oct 21, 2002 @ 10:49pm

hmmm.. try casting addr to an int first

e.g

#define ReadB(addr) *(uint8*)((int)addr^1)

#define WriteB(addr,value) *(uint8*)((int)addr^1)=value
AndrewGower
pm Member
 
Posts: 16
Joined: Oct 19, 2002 @ 10:29am


Postby schtruck » Oct 21, 2002 @ 10:54pm

ok that has worked:

#define ReadB(addr) *(uint8*)((int)(addr)^1)

#define WriteB(addr,value) *(uint8*)((int)(addr)^1)=value
Last edited by schtruck on Oct 21, 2002 @ 10:56pm, edited 1 time in total.
schtruck
pm Member
 
Posts: 77
Joined: May 24, 2002 @ 5:29pm


Postby AndrewGower » Oct 21, 2002 @ 10:55pm

Last edited by AndrewGower on Oct 21, 2002 @ 10:59pm, edited 2 times in total.
AndrewGower
pm Member
 
Posts: 16
Joined: Oct 19, 2002 @ 10:29am


Postby AndrewGower » Oct 21, 2002 @ 10:56pm

AndrewGower
pm Member
 
Posts: 16
Joined: Oct 19, 2002 @ 10:29am


Postby schtruck » Oct 21, 2002 @ 10:59pm

schtruck
pm Member
 
Posts: 77
Joined: May 24, 2002 @ 5:29pm


Postby schtruck » Oct 22, 2002 @ 12:08pm

Yeah BYTES SWAP TRICK Work!!!

the problem was that ARM can only access 32 to Address divisible only by 4..... so here is what i did:

#ifdef BYTES_SWAP
#define ReadB(address) *(uint8*)((uint32)(address)^1)
#define WriteB(address,value) *(uint8*)((uint32)(address)^1)=value
#define ReadW(addr) *(uint16*)(addr)
#define WriteW(addr,value) *(uint16*)(addr)=value
#define ReadL(address) ((*(uint16*)(address))<<16)|(*(uint16*)(address+2))
#define WriteL(address,value) WriteW(address + 2, value); WriteW(address, value>> 16)
#else
#define ReadB(address) *((int8 *) (address))
#define ReadW(addr) ((*(uint16 *)(addr) << 8) | (*(uint16 *)(addr) >> 8))
#define ReadL(address) ((uint16) ReadW(address) << 16) | (uint16) ReadW((address) + 2)
#define WriteB(address,value) *((int8 *) (address)) = (value)
#define WriteW(addr,value) *((int16 *)(addr)) = ((((uint16)(value)) << 8) | (((uint16)(value)) >> 8))
#define WriteL(address,value) WriteW((address) + 2, value); WriteW(address, (value) >> 16)
#endif


and here is what the Compiler Generate:

; 197 : WriteB(address + membase, value);

ldr r2, [pc, #0x10] ; pc+8+16 = 00000018
ldr r2, [r2]
add r3, r2, r0
eor r3, r3, #1
strb r1, [r3]

; 203 : WriteW(address + membase, value);

ldr r2, [pc, #8] ; pc+8+8 = 00000010
ldr r2, [r2]
strh r1, [r2, +r0]

; 209 : WriteL(address + membase, value);

ldr r2, [pc, #0x18] ; pc+8+24 = 00000024
ldr r3, [r2]
add r3, r3, r0
strh r1, [r3, #2]
mov r3, r1, lsr #16
ldr r1, [r2]
strh r3, [r1, +r0]


; 214 : return ReadB(address + membase);

ldr r1, [pc, #0x10] ; pc+8+16 = 00000018
ldr r1, [r1]
add r3, r1, r0
eor r3, r3, #1
ldrb r0, [r3]

; 219 : return ReadW(address + membase);

ldr r1, [pc, #8] ; pc+8+8 = 00000010
ldr r1, [r1]
ldrh r0, [r1, +r0]


; 224 : return ReadL(address + membase);

ldr r1, [pc, #0x14] ; pc+8+20 = 0000001C
ldr r1, [r1]
add r2, r1, r0
ldrh r3, [r2, #2]
ldrh r2, [r1, +r0]
orr r0, r3, r2, lsl #16


not so bad :)

let me test Game now to see How that boost....
schtruck
pm Member
 
Posts: 77
Joined: May 24, 2002 @ 5:29pm


Postby schtruck » Oct 22, 2002 @ 12:11pm

Hey andrew could you Adapt you Draw Routine for Bytes SWAP please.
schtruck
pm Member
 
Posts: 77
Joined: May 24, 2002 @ 5:29pm


Postby schtruck » Oct 22, 2002 @ 3:02pm

schtruck
pm Member
 
Posts: 77
Joined: May 24, 2002 @ 5:29pm


Postby Guest » Oct 22, 2002 @ 3:15pm

I presume you just changed the last 8 lines to

*--line_o1 = bigpal[((r4>>8)&240)+((r3>>12)&15)];
*--line_o1 = bigpal[((r2>>8)&240)+((r0>>12)&15)];
*--line_o1 = bigpal[(r4>>4)&240)+((r3>>8)&15);
*--line_o1 = bigpal[((r2>>4)&240)+((r0>>8)&15)];
*--line_o1 = bigpal[(r4&240)+((r3>>4)&15)];
*--line_o1 = bigpal[(r2&240)+((r0>>4)&15)];
*--line_o1 = bigpal[((r4<<4)&240)+(r3&15)];
*--line_o1 = bigpal[((r2<<4)&240)+(r0&15)];

and left the rest the same?
Guest
 


Postby Phantom » Oct 22, 2002 @ 9:42pm

Give me some good data and
I will give you the world
User avatar
Phantom
pm Insider
 
Posts: 913
Joined: Feb 21, 2001 @ 8:14am
Location: Houten, Netherlands


Postby Wickie » Oct 24, 2002 @ 10:46am

Wickie
Der kleine Wikinger aus Flake

“Wenn weder gejammert noch geprahlt wurde, grölte man Piratenlieder.
In dieser Atmosphäre wuchs ich auf.”
-- Käpt´n Blaubär
User avatar
Wickie
pm Member
 
Posts: 32
Joined: Sep 2, 2002 @ 8:37pm
Location: Mülheim (Germany)


Postby Phantom » Oct 31, 2002 @ 1:11pm

Give me some good data and
I will give you the world
User avatar
Phantom
pm Insider
 
Posts: 913
Joined: Feb 21, 2001 @ 8:14am
Location: Houten, Netherlands


Postby schtruck » Nov 1, 2002 @ 12:45am

What i can say i that i'm curently preparing a Site for CastCe (the name of this ATARI ST emulator ).

Emu is being very interresting..... Andrew Gower has joined the project and is curently hardly working to optimize it and make Exact Timing to improve Compatibility.

For Now the Emulator is Fast enought (full speed) for most Game, but we expect more to Add sound....

Btw, when Emu Will be ready (hope soon, less then 2 weeks), but sound will be add later..
Just a little List of Best game curently compatible and full speed:
Dongeon Master,Xenon 1 & 2, SpeedBall,Pang, Beach Volley, Ivanhoe, R-type, Ghost& Goblin, Buggy Boy, and many others..
The Site will Start with Some Shots of this Emu running those game and more.... hope very soon.

Believe Me , that worth the Wait......
this is the Best Emu i saw on PocketPC.....

Schtruck.
schtruck
pm Member
 
Posts: 77
Joined: May 24, 2002 @ 5:29pm


Postby Phantom » Nov 1, 2002 @ 9:57am

OK, thanks for the info. Hey, we here at Overloaded have lots of devices; if you want us to test the emu on some of them, just let me know.
Give me some good data and
I will give you the world
User avatar
Phantom
pm Insider
 
Posts: 913
Joined: Feb 21, 2001 @ 8:14am
Location: Houten, Netherlands


PreviousNext

Return to Windows Mobile


Sort


Forum Description

A discussion forum for mobile device developers on the Windows Mobile platform. Any platform specific topics are welcome.

Moderators:

Dan East, sponge, Digby, David Horn, Kevin Gelso, RICoder

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron