#173876 - Pete_Lockwood - Thu May 06, 2010 1:34 am
Maybe a dumb question but I won't know without asking..
Got some sprite data, currently it's getting loaded into memory somewhere then copied to SPRITE_GFX[]
Is it possible to rig the linker to direct the DS to load this particular lump of data directly into SPRITE_GFX and skip the copying (plus save having a redundant copy of the data in memory)?
_________________
It's not an illusion, it just looks like one.
#173878 - headspin - Thu May 06, 2010 6:28 am
If you use DMA to copy the data it will be very fast anyway. There is also the benefit that you can DMA data to a single sprite to animate it thus saving precious OAM space for more sprites.
_________________
Warhawk DS | Manic Miner: The Lost Levels | The Detective Game
#173880 - Pete_Lockwood - Thu May 06, 2010 11:18 am
It's not a question of speed and there are no animations. It's just a waste that the same sprite data is in 2 locations in memory, that's all.
_________________
It's not an illusion, it just looks like one.
#173882 - sverx - Thu May 06, 2010 11:57 am
You mean you want that resource (you've got in your NDS file) loaded directly into VRAM without loading it to Main RAM? I don't think it's possibile, but I'll be happy to be wrong :D
(mmm... using a filesystem you can load data directly to a VRAM bank...)
#173884 - Pete_Lockwood - Thu May 06, 2010 1:10 pm
Yes, that's what I mean. Filesystem means you're distributing multiple files.
_________________
It's not an illusion, it just looks like one.
#173886 - elhobbs - Thu May 06, 2010 1:39 pm
I took a look at the ds_arm9.ld link script and the ds_arm9_crt0.s. It looks like in the case of code in the itcm section that it is put in main memory ewram section during compile and then the startup code in ds_arm9_crt0.s moves it to the itcm region. so I do not think that the linker can help remove the extra copy.
perhaps you could use the memory for something else after the sprites are loaded?
with libfat you definitely use multiple files. I thought filesystem appended the files directly to the nds file so that everything was self contained. I think it relies on argv support in the loader to get at the file system which the loader ignores.
#173887 - sverx - Thu May 06, 2010 3:15 pm
Pete_Lockwood wrote: |
Filesystem means you're distributing multiple files. |
Not, if you put the filesystem into the NDS file. Even if it is never a good idea, there are lots of problems and incompatibility.
#173891 - vuurrobin - Thu May 06, 2010 9:21 pm
IIRC, the entire nds file minus (a part of) the header and the embedded filesystem gets copied to the main ram (thus limiting it to 4mb) by the loader, before it gets copied to other parts and started. so I doubt it would be possible without using a custom loader (or even with one).
also keep in mind that the loader needs to be stored somewhere during loading. thats useally in vram...
if memory is a problem, then use the embedded filesystem with libfilesystem for readonly data like images.
_________________
my blog:
http://vuurrobin.100webcustomers.com/