English Amiga Board

Go Back   English Amiga Board > Coders > Coders. General

Thread Tools
Old 13 May 2011, 22:34   #1
Zone Friend
Join Date: Apr 2006
Location: Gothenburg/Sweden
Age: 44
Posts: 275
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)
oRBIT is offline  
Old 16 May 2011, 02:55   #2
Registered User
Join Date: Nov 2006
Location: Stockholm, Sweden
Posts: 226
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)
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)
Kalms is offline  
Old 16 May 2011, 20:38   #3
dalton's Avatar
Join Date: Jun 2006
Location: Gothenburg / Sweden
Posts: 71
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.
dalton is offline  

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 92 17 November 2019 12:02
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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +2. The time now is 06:39.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Page generated in 0.06231 seconds with 13 queries