#9729 - jenswa - Fri Aug 15, 2003 2:21 pm
I am using this code to load a map into a text background, but does not seem to work.
The probem has something to do with the declarations of the variables.
REG_DM3SAD = (u8) l1;
REG_DM3DAD = (u8) ScreenMem0;
REG_DM3CNT = (32*32) | DMA_32NOW;
DMA_32NOW (DMA_ENABLE | DMA_TIMING_IMMEDIATE | DMA_32)
DMA_ENABLE 0x80000000
DMA_TIMING_IMMEDIATE 0x00000000
DMA_32 0x04000000
const u8 l1[ 32 * 32 ] = {contains list of number}
u16* ScreenMem0 = (u16*)0x6000000;
The problem has something to do with u8, chaning u8 in u32 or u16 doesn't work for me.
Any suggestions?
Thanx
Jenswa
_________________
It seems this wasn't lost after all.
#9732 - antysix - Fri Aug 15, 2003 2:40 pm
The map entry for text backgrounds is sixteen bit: (from the CowBite docs)
F E D C B A 9 8 7 6 5 4 3 2 1 0
L L L L V H T T T T T T T T T T
0-9 (T) = The tile number
A (H) = If this bit is set, the tile is flipped horizontally left to right.
B (V) = If this bit is set, the tile is flipped vertically upside down.
C-F (L) = Palette number
But you say converting your u8 array to u16 doesn't work for you, so I actually don't know what you're doing wrong.
_________________
Currently playing: NGC: Metroid Prime
GBA: Golden Sun: The Lost Age
Currently developping: Project ~ [ Phail ]
#9734 - niltsair - Fri Aug 15, 2003 3:29 pm
jenswa wrote: |
REG_DM3SAD = (u8) l1;
REG_DM3DAD = (u8) ScreenMem0;
REG_DM3CNT = (32*32) | DMA_32NOW; |
Dma take the source and destination address, and not the real value directly. This, by chunk of 16 or 32bits. You could try this instead :
Code: |
u32 ToTransfer;
ToTransfer = 0x0101; //(will result in a square of vertical lines of color 0 and transparent, given in 256colors palette mode)
REG_DM3SAD = (u32) &ToTransfer;
REG_DM3DAD = (u32) &ScreenMem0;
REG_DM3CNT = (32*32)/4 | DMA_32NOW; //I'm assuming you want to transfer a 32x32 block. since it's a 32bits transfer, 4pixels get copied at a time, thus the '/4' |
#9739 - jenswa - Fri Aug 15, 2003 5:27 pm
Yeah i'll try that with the division by four.
_________________
It seems this wasn't lost after all.
#9744 - jenswa - Fri Aug 15, 2003 10:00 pm
fixed the problem,
code should be 32x32/2 instead of 32x32, even better is a fixed value (no division or muliplying, saves speed :P) 512
and the main problem was with const u8 for the map, the map editor i uses does this automatically,
so i assumed this was ok, well it's NOT, it should be cons u16, then it all works.
Thanks for your help.
Jenswa
_________________
It seems this wasn't lost after all.
#9747 - niltsair - Fri Aug 15, 2003 10:33 pm
Small not, "32x32/2" take the same time as "512" because your compiler actually convert it that way itself. No slow down in your gba program.
#9757 - antysix - Sat Aug 16, 2003 11:20 am
Quote: |
and the main problem was with const u8 for the map, the map editor i uses does this automatically,
so i assumed this was ok, well it's NOT, it should be cons u16, then it all works.
|
The map entry for rotational backgrounds IS 8 bit, so the map editor you use is only suitable for rotational backgrounds.
_________________
Currently playing: NGC: Metroid Prime
GBA: Golden Sun: The Lost Age
Currently developping: Project ~ [ Phail ]
#9765 - jenswa - Sat Aug 16, 2003 7:48 pm
Yeah well,
i am glad i figured that out,
but ehmm is there any difference between the drawing of a
rotational background and a text background?
Quote: |
"32x32/2" take the same time as "512" |
I should have read the article better.
_________________
It seems this wasn't lost after all.