DevKitPro Upgrade, AmigaGuideDS and Double Buffering

More on the same subject. I’ve upgraded to the latest DevKitPro, and that has caused problems. In order to get the latest versions of PALib and DevKitPro working together, load up the “PA_Motion.h” file and make the amendments below:

  • Comment out line 23 (reads “motion_init();“);
  • Change line 29 from “return motion_init();” to “return false;”.

This means hat you can’t use the motion functions any more, but I don’t have a motion card to use with them so it doesn’t bother me. Back to double-buffering and AmigaGuideDS. As I’m now copying chunks of memory around within a single block of VRAM, I can’t use double-buffering any more. This occurred to me after I’d re-written the scrolling routines and found that it was so fast I didn’t need double-buffering anyway. One thing that did briefly stump me was the behaviour of DMA_Copy() when working with 8-bit screens. I was using this code to wipe a single row of pixels:

DMA_Copy(Blank, PA_DrawBg[0], 256, DMA_16NOW);

However, the routine was wiping out two rows of pixels instead of one. I eventually remembered that the DS can’t address its VRAM in 8-bit mode - it only works in 16-bit or 32-bit mode. 8-bit pixels are, therefore, wedged into 16-bit values in pairs. In the function call above I’m telling the DS to erase 256 16-bit values, or 512 bytes. What I needed to do was erase 128 16-bit values, or 256 bytes:

DMA_Copy(Blank, PA_DrawBg[0], 128, DMA_16NOW);