Sign Up
Romhack.me connects you to ROM Hackers around the world.

Swi 0xB/0xC & Swi 0x11/0x12


0 Votes
Baitot
Posted May 18, 2014 by Baitot
Category: ASM
Total Views: 874

Hi,

There is little time, I was looking for a "swi LZ77".
I found two commands: the 0x11 and 0x12 swi. Someone could enlighten me on the difference between these two commands ?
For the swi 0xB and 0xC, I've the same problem.

All Answers



1 Vote
daniilS
Posted May 18, 2014 by daniilS

Swi 0x11 is for the WRAM, swi 0x12 is for the VRAM. Swi 0xB works in units of 4 bytes or 2 bytes, swi 0xC in units of 32 bytes. http://nocash.emubase.de/gbatek.htm#biosfunctions


0 Votes
ipatix
Posted May 25, 2014 by ipatix

Just due to curiosity:
Is there a reason to use SWI 0xC instead of DMA 3?


0 Votes
SBird
Posted May 25, 2014 by SBird

The DMA (Direct Memory Acess) does work on hardware base and therefore I reckon that you cannot determine exactly when your data block will be at its designated destination. However it is fast, generally said: DMA > SWI(Bios) > IRAM > ROM executed code.(Speed wise)


0 Votes
ipatix
Posted May 25, 2014 by ipatix

The GBATEK says that the CPU is paused during DMA transfers so I suppose the data transfer will be finished right when the CPU remumes execution and therefore there is no need to care about timing problems.


0 Votes
SBird
Posted May 25, 2014 by SBird

As far as I can remember the DMA ist a consistant process (Which makes it perfect for things like the palette buffer that exists in nearly every pokemon game on the GBA), and taking that into account you will run into timing issues, which means you should use memcopy or cpuset as its called for single-time operations.