PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

New Cyclone 68K - 0.066

Spiderman seems playable, Ecco shows a bit of graphics, Sonic 1 jump fixed, Castlevania Bloodlines - quite a lot of stuff actually. here's the techincal bits

get it from you know where
http://www.finalburn.com/


What's New
----------
v0.0066
+ Fixed a stupid typo for exg (orr r10,r10, not orr r10,r8), which caused alignment
crashes on Strider

v0.0065
+ Fixed a problem with immediate values - they weren't being shifted up correctly for some
opcodes. Spiderman works, After Burner shows a bit of graphics.
+ Fixed a problem with EA:"110nnn" extension word. 32-bit offsets were being decoded as 8-bit
offsets by mistake. Castlevania Bloodlines seems fine now.
+ Added exg opcode
+ Fixed asr opcode (Sonic jumping left is fixed)
+ Fixed a problem with the carry bit in rol.b (Marble Madness)

v0.0064
+ Added rtr
+ Fixed addq/subq.l (all An opcodes are 32-bit) (Road Rash)
+ Fixed various little timings

v0.0063
+ Added link/unlk opcodes
+ Fixed various little timings
+ Fixed a problem with dbCC opcode being emitted at set opcodes
+ Improved long register access, the EA fetch now does ldr r0,[r7,r0,lsl #2] whenever
possible, saving 1 or 2 cycles on many opcodes, which should give a nice speed up.
+ May have fixed N flag on ext opcode?
+ Added dasm for link opcode.

v0.0062
* I was a bit too keen with the Arithmetic opcodes! Some of them should have been abcd,
exg and addx. Removed the incorrect opcodes, pending re-adding them as abcd, exg and addx.
+ Changed unknown opcodes to act as nops.
Not very technical, but fun - a few more games show more graphics ;)

v0.0060
+ Fixed divu (EA intro)
+ Added sf (set false) opcode - SOR2
* Todo: pea/link/unlk opcodes

v0.0059: Added remainder to divide opcodes.
For the end user, has PicoDrive been updated with these changes?
sponge wrote:For the end user, has PicoDrive been updated with these changes?


yep 0.011 uses 0.0066
Very impressive. I played the first stage of Sonic 2 and saw only a couple minor graphical glitches. Performance is very good, looks close to 30 FPS on an a716.

Dan East
Dan East wrote:Very impressive. I played the first stage of Sonic 2 and saw only a couple minor graphical glitches. Performance is very good, looks close to 30 FPS on an a716.

Dan East


Actually I wonder if you or anyone on the boards could help. I'm just profiling the core - on Pocket PC it runs from very good to very bad performance, and I been trying to track down why.

(Just to give you a back-story, execution happens in 60hz frames. If the emulator can exec the frame in less than 16.6ms, all is well since it can run real-time.)
Now I found PicoDrive on my 206mhz iPAQ 3630 PPC runs like this:

exec took 1.167 ms
exec took 1.166 ms
exec took 1.163 ms
exec took 1.168 ms

Ignore graphics which I haven't optimized yet.
As you can see, the exec is fine there, however it dips a LOT at other times:

exec took 2.210 ms
exec took 2.592 ms
exec took 4.973 ms
exec took 18.738 ms
exec took 20.586 ms
exec took 20.828 ms
exec took 21.986 ms
exec took 2.423 ms

This is when the display starts to chug.
Now at first I thought "oh dear I messed up an opcode", and went to find which opcode. However I couldn't find it. And stranger than that, sometimes the same opcode in the SAME location would take 1us and sometimes about 10000us.

Now the only thing I can thing of which explains this is memory. And that would also display why the GP32 doesn't seem to have this slowdown (even though it is slower, it will run at a constant 30fps fine). The GP32 probably has a flat 8MB address space, unlike the Pocket PC, which as I understand it is cached by the ARM.

So is it possible that this is what is going wrong? Maybe because the CPU core is about 500k in size, Pocket PC swaps the whole thing INTO the cache, and then when a 68000 routine (say) clears the whole of memory, it has to swap the 64k of Megadrive RAM back in.

So does this hold water? Could this be the cause of my performance problem? Could it be anything else?

If this is the problem, can anyone think things to help? Can I tell Pocket PC not to swap out RAM?
I have real doubts about the following suggestion... but it worked for someone else in another thread. Try..

Code:

SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_HIGHEST);


You can also SetPriorityClass for the process to be higher as well. Just make sure that you are calling GetMessage or Sleep in order to play nice with the others threads.

Again, I think your memory idea is closer to the truth, however, someone just had a similar problem and the solution was changing the thread priority.

Cheers,

rcp
unlike the Pocket PC, which as I understand it is cached by the ARM.

I'm not sure what you mean by that. You mean the GP32 just has 8MB flat and no memory management unit, whereas the PocketPC manages the physical/virtual contexts?

So is it possible that this is what is going wrong? Maybe because the CPU core is about 500k in size, Pocket PC swaps the whole thing INTO the cache, and then when a 68000 routine (say) clears the whole of memory, it has to swap the 64k of Megadrive RAM back in.

So does this hold water?


Mmmh. The GP32 has the same architecture as the StrongARM/XScale (separate instruction and data caches of around 16KB each). I presume that the only difference really is that the Pocket PC operating system does context switching whereas whatever the GP32 OS is is unlikely to (as it is heavily biased towards single tasking).

Try rcp's suggestion.
The GP32 probably has a flat 8MB address space, unlike the Pocket PC, which as I understand it is cached by the ARM.


The PocketPC has virtual memory, which is not neccesarily cached. Virtual memory has no performance penalty since its managed by the MMU.
A completely different thing is cache. You may have a (slight) performance penalty compared to a completely uncashed design if you have poor data reuse in cache. That mostly holds for streaming data. When you allocate memory (ie. using VirtualAlloc) you can decide if you want chached or uncashed pages. This way you can avoid, that data with no reuse pollute your cash.
I am sure, that a cache gives you much better performance in most cases. So it is likely there is another problem.
refractor wrote:
unlike the Pocket PC, which as I understand it is cached by the ARM.

I'm not sure what you mean by that. You mean the GP32 just has 8MB flat and no memory management unit, whereas the PocketPC manages the physical/virtual contexts?

So is it possible that this is what is going wrong? Maybe because the CPU core is about 500k in size, Pocket PC swaps the whole thing INTO the cache, and then when a 68000 routine (say) clears the whole of memory, it has to swap the 64k of Megadrive RAM back in.

So does this hold water?


Mmmh. The GP32 has the same architecture as the StrongARM/XScale (separate instruction and data caches of around 16KB each). I presume that the only difference really is that the Pocket PC operating system does context switching whereas whatever the GP32 OS is is unlikely to (as it is heavily biased towards single tasking).

Try rcp's suggestion.



Doesn't the GP32 have a different ARM variant - namely the ARM9 instead of the StrongARM? Is there a difference in terms of cache/caching algorithms that you know of?


[Regarding rcp's idea, I don't think it is multi-tasking related, for a number of reasons, however I will try tonight and let you know.]

Other than that... I'm fresh out of ideas...... I'm going to switch to profiling Cyclone on the GP32 I think (even though the USB is a bit of a pain), for sanities sake ;)
Tala wrote:
The GP32 probably has a flat 8MB address space, unlike the Pocket PC, which as I understand it is cached by the ARM.


The PocketPC has virtual memory, which is not neccesarily cached. Virtual memory has no performance penalty since its managed by the MMU.
A completely different thing is cache. You may have a (slight) performance penalty compared to a completely uncashed design if you have poor data reuse in cache. That mostly holds for streaming data. When you allocate memory (ie. using VirtualAlloc) you can decide if you want chached or uncashed pages. This way you can avoid, that data with no reuse pollute your cash.
I am sure, that a cache gives you much better performance in most cases. So it is likely there is another problem.


Thing is, what do you think I should put uncached (if anything)?

The 64k of Megadrive RAM, or the 500k of 68000 emulator code?
Doesn't the GP32 have a different ARM variant - namely the ARM9 instead of the StrongARM?


Yes. Doesn't matter much. Both are ARMv4 variants with Harvard caches.

Is there a difference in terms of cache/caching algorithms that you know of?


The ARM9 TRM says it's round-robin or pseudo-random (configurable). StrongARM is round-robin. The ARM9 seems to have more in the way of lock-down facilities, but if you're not explicitly using it then that's not the problem.

Thing is, what do you think I should put uncached (if anything)?

The 64k of Megadrive RAM, or the 500k of 68000 emulator code?

Remember that those two are using different caches. The Megadrive RAM will go through the data cache, and the 500k code will go through the instruction cache (though if you're generating it on the fly it may go through both).

If you have some small look-up tables that would like to live in the data cache (used within the emulation code), it might be worth trying the Megadrive RAM uncached... but really it depends how you're accessing that. If it's random-access of words then leave it uncached. If you're often accessing contiguous words within that area (I suspect that's the case) then obviously the cache is going to help.

I'd still suspect the thread priority more than cache-thrashing.
Pejo Software - Per · 26 Apr 2004, 10:50 UTC
rcp wrote:You can also SetPriorityClass for the process to be higher as well.


Scheduling in Windows CE is done on threads only. I don't even think SetPriorityClass is available.
Another difference compared to desktop Windows is that threads with high priority will always run before threads with lower priority, thread priority will never change dynamicly (except for priority inversion).
gee, glad to know that now *before* I ran into that problem. In the desktop world, I generally set my class to be a higher priority and don't hit the actual thread. I found that bumping the class up a level was better than trying to bump the thread up several levels.

Thanks again for noting the difference, as I am *sure* that would have gotten me sooner or later. :)

Cheers,

rcp
fdave,

What speed is the gp32 cpu running at and hows the framerate?

I am wondering because I was thinking it would be nice to write up a symbian 60 port because I would love to play genesis games on my n-gage.
Fantastic job Dave! Games that work - work with no perceivable performance hit on my Ipaq 1940. Everything runs perfectly smooth!

Is there a chance that you would put a switch to also enable cropped, non-shrinked screen resolution? It works nice for many games, even though the left and right portion is cropped, and it looks much nicer that way :)
subbie wrote:fdave,

What speed is the gp32 cpu running at and hows the framerate?

I am wondering because I was thinking it would be nice to write up a symbian 60 port because I would love to play genesis games on my n-gage.


The games are *more* than fullspeed at frameskip 1 on the GP32, which means about 30-50fps depending on the game. that is with the ARM running at 156mhz.

Actually the overhead now is graphics rendering, so I'm working on optmising that part of PicoDrive now

A Series 60 port would be great!
Are you using PocketHAL instead of GAPI for the PPC builds? If not then you can pick up at least a few more FPS on most devices just by using it for your direct screen access.

Dan East
fdave":290urmgq]

Oh just hearing that makes me giggly like a school girl.

I have been working on a symbian 60 port of neopop for a while but it's giving me a headake since the entire core & z80 core are in C and not optimised at all. So I have been having so much problems with fixing allignment bugs in the memory.

I think it would be great to take a month break and try getting this ported over. (big genesis/megadrive fan here).
hi there subbie buddy ;)

hey dave,
your pico is really great, keep up the awsome work that only you can make.
no doubt one of the best ever since cps2 era ;)
impressive!! finally someone who appoaches genesis emulation :) the current pocket pc genesis emulators are not quite perfect and i hope yours will change that ;) actually i wonder if it is too early to ask - will there be z80 emulation soon? how cool would sonic be with full sound!! :)
dex909 wrote:impressive!! finally someone who appoaches genesis emulation :) the current pocket pc genesis emulators are not quite perfect and i hope yours will change that ;) actually i wonder if it is too early to ask - will there be z80 emulation soon? how cool would sonic be with full sound!! :)


Possibly, but not for a while, I am concentrating on 68000, since I have heard some people may not be using the core because they don't feel it is very accurate. If that's true, I'd like to get the core at least as accurate as the existing 68000 emulators for other platforms to dismiss that fear.

By the way, I did some more meaningful performance tests of Cyclone 68000. Without graphics, the 132mhz GP32 is capable of running a (7.67mhz) Megadrive at 200 fps, or over 3x speed.
To put that another way each 16.6ms frame of Megadrive execution can be achieved in about 5ms. This leaves 11.6ms to render the graphics for each frame in order to run without any frame skipping.

Currently PicoDrive doesn't achieve this (each graphics render takes about 20ms).
:( well, this is of course nice, and i thank you for making this FOR FREE (many people seem to always forget that!) but it is just another emulator that i can not touch :-( because i just can not "play" a game without sound. well, it is the same with fpsece or morphgear (which is fine WITHOUT sound). i can not play the games on those emulators :( well, i hope you will finish this other issues soon (next weeks maybe?), not next year or so like all other emulators. but anyway it is GREAT that you do all this :) the work is awesome! please please continue!!
mik356ua · 27 Mar 2005, 22:22 UTC — where is the sound???
hey men! i've tryed picodrive on my ipaq 1940 recently. everything is great but one problem. i got no sound in any game! gapi is installed. i played many games with the same result. is there any decision of this problem!?
The emulator does not support sound at this time.

Dan East