krabob
Member |
It happened that I experimented with AGA sprites a lot recently, and now I understand completely why once can have some unwanted sprites at some moment: I thought "Sprite DMA" bit in DMACON (bit 5) was a enable/disable sprite switch, it is not:
the Sprite DMA bit switch 2 ways of setting the sprites: with the DMA, or "manualy" (CPU or copperlist ). DMA is the most common way and can completely do 64 pixels wide AGA sprites and manages vertical multiplexing easily. "manual" seems tricky. (and only 16 bits of bitmaps seems to be managed, not good for AGA sprites.)
With Sprite DMA bit on, the display and DMA look at 8 pointers at adress in $dff000+ $120 (sprpt), if any pointer is empty, no sprite. Else you can point to chip mem data (aligned to 2,4, or 8 according to their FMODE) where there are 2 words (each distant of 2 4 or 8, it takes a sprite line.) that are uglily scrambled with X/Y sprite start position and sprite Height, then bitmaps are following, then it finish with one control line again that allows to reuse the sprite in a more low position (or not, then 0 on the last line)
The thing is, sprite DMA mode actually unscramble what it reads in sprite memory, to copy them during display in *OTHER* active sprite adress: SPRxPOS, SPRxCTL, SPRxDATA,SPRxDATB (DATA and DATB being the 2 planes of bitmap of each sprites...)
Without sprite DMA enabled, you can still enable sprites, by writing yourself SPRxPOS, SPRxCTL, SPRxDATA,SPRxDATB, a big copperlist could do that. in that case, you have to rewrite the bitmap yourself for each lines ! Plus, there is the following law: "Writing to the DatA buffer enables (arms) the sprite. Writing to the SPRxCTL registers disables the sprite."
So, this means:
1.there are 2 different ways to disable sprites: with sprite DMA and setting sprpt (2 words per sprites) to 0, or with sprite DMA off by setting SPRxCTL (1 word per sprite) to 0
2. when sprite DMA is on and sprites are running on, you can still do horizontal multiplexing with SPRxPOS, and even manage some sort of parallax scrolling with sprites. ( I simply mean, changing horizontal position per line, or reseting a sprite that appeared to the left at the right twice or more during horizontal scanning )
|