I am programming a game in GBA for fun and want to use mode 4. I have recently created a game in mode 3 and the dma for it was quite simple. Would the dma structure be same if I wanted to draw an image onto the screen? Here is what I have:
/*
* A function that will draw an arbitrary sized image * onto the screen (with DMA).
* @param r row to draw the image
* @param c column to draw the image
* @param width width of the image
* @param height height of the image
* @param image Pointer to the first element of the image. */
void drawImageInMode4(int r, int c, int width, int height, const u16* image)
{
for(int i = 0; i < height; i++){
DMA[3].src = image + OFFSET(i,0,width);
//offset calculates the offset of pixel to screen
DMA[3].dst = VIDEOBUFFER + OFFSET(r+i,c,240);
DMA[3].cnt = DMA_ON | width;
}
I feel like this is not using mode 4 but using mode 3. I have looked up on how to modify my code so it could work in mode 4. Thank you in advance!