DMA Fill with autoinc 128

For anything related to VDP (plane, color, sprite, tiles)

Moderators: BigEvilCorporation, Mask of Destiny

Post Reply
Manveru
Very interested
Posts: 85
Joined: Wed Sep 05, 2012 3:30 pm

DMA Fill with autoinc 128

Post by Manveru » Thu Jul 11, 2019 1:43 pm

Hello mates. I think what i wanted to do is not possible due to how DMA Fill works, but i want to ask you before definitely discard that idea.

I want to clear an image in a plane, column by column. Then my first thought was to do a DMA Fill of 0s from the corresponding plane nametable pattern coordinates. The plane width is 64, so i tried with autoinc 128. The result was that the first map pattern both bytes are 0, and then at the next rows of the column only the lsb of the map turns to 0, keeping palette index, priority and else. All this process is in map pattern units, so it always use even memory positions.

After reading some DMA fill in this forum, i think the DMA Fill just writes the msb of the fill value in the lsb of the words after the initial one. That's what seems to happend in my tests, but i do not know if somehow that behavior can be changed to let us use DMA Fill for clearing plane columns like we can clear plane rows.

Thanks.
The man who moves a mountain begins by carrying away small stones. Confucius, 551-479 BC

Miquel
Very interested
Posts: 514
Joined: Sat Jul 30, 2016 12:33 am

Re: DMA Fill with autoinc 128

Post by Miquel » Thu Jul 11, 2019 3:53 pm

See official documentation for an explanation; see SGDK code implementation for a solution.

Fill basically works only with bytes when transferring, so both bytes of the map have to be the same; this will only work if you intend to use the very first tile as a substitute with all flags to 0 (everything is 0), the day you want to use another tile, or another flag configuration, you will need another technique. Perhaps you should find more adaptable solutions.

Also doing 2 Fills is possible, but you need to do a few tricks because some bytes will be overwritten.

Thinking more of aesthetics usually the way to go when changing screen is a fade-in/fade-out for several reasons like sprites and scrolling. But if you are producing a demo with a 100% controlled environment then will be more appealing to just do a few tiles per frame instead of the full column.
HELP. Spanish TVs are brain washing people to be hostile to me.

Manveru
Very interested
Posts: 85
Joined: Wed Sep 05, 2012 3:30 pm

Re: DMA Fill with autoinc 128

Post by Manveru » Thu Jul 11, 2019 4:58 pm

Miquel wrote:
Thu Jul 11, 2019 3:53 pm
See official documentation for an explanation; see SGDK code implementation for a solution.

Fill basically works only with bytes when transferring, so both bytes of the map have to be the same; this will only work if you intend to use the very first tile as a substitute with all flags to 0 (everything is 0), the day you want to use another tile, or another flag configuration, you will need another technique. Perhaps you should find more adaptable solutions.

Also doing 2 Fills is possible, but you need to do a few tricks because some bytes will be overwritten.

Thinking more of aesthetics usually the way to go when changing screen is a fade-in/fade-out for several reasons like sprites and scrolling. But if you are producing a demo with a 100% controlled environment then will be more appealing to just do a few tiles per frame instead of the full column.
Thanks for your answer.

The official doc is a bit confusing and incomplete, and i learned from SGDK and i know how fill works for loading an operation and i had it implemented.
I read the big DMA tutorial from nemesis i think, and some other threads about DMA filling in this forum. The idea is to turn 0 all the maps in a nametable column, but only the first one has its both bytes to 0. After that, only the lsb of the map is turned to 0, because i think fill only turns to 0 the lsb. In the official doc i see in the autoinc 2 example that both bytes are overwritten with the fill bytes values, but it does not happend...

The obvious solution is having a map array in ROM, all = 0, and send them all with a regular DMA write with autoinc 128 to the right namespace position, but i was just trying to understand if i can do that with DMA fill.
The man who moves a mountain begins by carrying away small stones. Confucius, 551-479 BC

Miquel
Very interested
Posts: 514
Joined: Sat Jul 30, 2016 12:33 am

Re: DMA Fill with autoinc 128

Post by Miquel » Thu Jul 11, 2019 6:40 pm

I believe you should set the auto-increment to 1 to write 2 consecutive bytes.

If my remembering works well, DmaFill operations works only with bytes, despite you should introduce this byte twice in the vpd (this is only for odd and even addresses).

In your case 2 DmaFill's will do the job.
HELP. Spanish TVs are brain washing people to be hostile to me.

Post Reply