2
我在GBA中编写游戏以获得乐趣,并希望使用模式4.我最近在模式3中创建了一个游戏,其中的dma非常简单。如果我想在屏幕上绘制图像,dma结构是否会相同?这里是我有:在模式4中使用DMA GBA Linux
/*
* 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;
}
我觉得这是不使用模式4,但使用模式3.我已经看过了关于如何修改我的代码,以便它可以工作在模式4预先感谢您!