13 May 2011, 22:34 | #1 |
Zone Friend
Join Date: Apr 2006
Location: Gothenburg/Sweden
Age: 48
Posts: 344
|
Can it be faster?
I've been browsing to my old emulator code for optimization-possibilites. I'm moving alot of data back and forth and found this code below as an example. It's purpose is to move one character tile (8x8 chunky pixels) to it's destination screen (256x240), both located in FastRAM.
Is there a more clever way of doing this? move.l (a5)+,(a0) move.l (a5)+,256*0+4(a0) move.l (a5)+,256*1+0(a0) move.l (a5)+,256*1+4(a0) move.l (a5)+,256*2+0(a0) move.l (a5)+,256*2+4(a0) move.l (a5)+,256*3+0(a0) move.l (a5)+,256*3+4(a0) move.l (a5)+,256*4+0(a0) move.l (a5)+,256*4+4(a0) move.l (a5)+,256*5+0(a0) move.l (a5)+,256*5+4(a0) move.l (a5)+,256*6+0(a0) move.l (a5)+,256*6+4(a0) move.l (a5)+,256*7+0(a0) move.l (a5)+,256*7+4(a0) |
16 May 2011, 02:55 | #2 |
Registered User
Join Date: Nov 2006
Location: Stockholm, Sweden
Posts: 237
|
The copying operation itself is probably fairly fast the way that you've written it. Depending on the platform it might be slightly quicker to read 2-4 longwords into registers and then write them out, instead of doing read+write moves each time.
However, consider asking yourself some architectural questions. 1) could you change the code such that it writes directly to the chunkybuffer instead? (so you don't need the copying step at all) or 2) can you have the chunkybuffer scrambled such that each 8x8 tile is stored sequentially in memory, and use a custom c2p routine which does de-scrambling inline? (If you are intending to do any further processing of the chunkybuffer - like drawing software sprites into it - then this option is probably a no-go) |
16 May 2011, 20:38 | #3 |
tulou
Join Date: Jun 2006
Location: Gothenburg / Sweden
Posts: 88
|
I'm probably stretching it a bit far, but maybe if the char you are copying is planar, you could do without chunky conversion altogether. You'd probably need an equal amount of writes (only .b), but the amount of data could me smaller so you get better cache hit ratios.
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
mpega.library faster than itself | meynaf | Coders. General | 95 | 05 November 2021 19:54 |
How to run Another world faster :) | Vollldo | support.Games | 9 | 02 November 2012 16:15 |
Getting WinFellow to run faster | Narf the Mouse | support.WinFellow | 0 | 11 August 2010 07:04 |
Chipram 3x faster? | oRBIT | Coders. General | 10 | 20 July 2010 02:13 |
Faster Emu | Radgam | support.WinUAE | 3 | 27 February 2003 17:16 |
|
|