DMA fills with auto-increment result in stray byte at the start
Posted: Thu Jan 02, 2025 1:44 pm
To perform a DMA fill you need to set up the VDP registers appropriately first, then perform a word write to the VDP data port containing the value you want to fill with. The problem is that this write to the data port is treated as a regular VDP data write of 16-bits (not eight) which messes up the alignment.
For example, if you want to write the value 0xFF and have a gap of one byte between each write (auto-increment is set to 2) then what you actually get is:
FF FF 00 FF 00 FF 00 FF 00 FF etc.
This means you have to subtract one byte from the destination address, then go back and fix the stray 0xFF afterwards. Is there a way to avoid this behaviour (i.e. make the write to the data port not be treated as a normal write)?
For example, if you want to write the value 0xFF and have a gap of one byte between each write (auto-increment is set to 2) then what you actually get is:
FF FF 00 FF 00 FF 00 FF 00 FF etc.
This means you have to subtract one byte from the destination address, then go back and fix the stray 0xFF afterwards. Is there a way to avoid this behaviour (i.e. make the write to the data port not be treated as a normal write)?