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預先感謝您!