Nemesis wrote:I'll check my notes, but I'm pretty sure the length of the write is as you'd expect, IE, if you setup a fill for 8 bytes, 8 bytes will end up filled with the desired fill value.
I agree but the question is: does the DATA port write that triggers DMA Fill counts as one of these bytes (at least the second part of the 16-bit write) ?
You would think it is because otherwise you would end up with N+1 or N+2 modified bytes (depending if the VRAM address is odd or even, as explained below).
I have a feeling the first fill byte probably gets written twice though, once by the normal word write, then getting overwritten with the same value by the first write in the DMA fill operation.
Well, it depends on the VRAM address and increment register value.
With an increment value of 1, writing to an even address would indeed get the odd address written twice. But with an odd address ($0001 for example), the first word would put LSB at $0000, MSB at $0001 then address would be incremented by 1 and fill starts at $0002, so no address got written "twice" in that case.
In that sence, it wouldn't really be "15 writes per line", more like "count+1 writes per fill", with the same access slots as any other write operation.
Yes, that's what I wanted to say.
Note that this would only be for CRAM and VSRAM though. I suspect when writing the documentation, the person doing it forgot that writes to VRAM are byte-wide, so the first write needs two slots to VRAM, making that "count+2 writes per fill".
This is speculation though. This is on my to-do list of things to test in hardware.
If I have time, I will try to test it myself, it's very easy actually, set a fixed length for DMA fill then read back VRAM and see how many bytes were modified.
In particular, I have no idea whether the VDP actually caches the fill byte for the entire operation, or whether it needs to read it back from VRAM periodically during the fill. It shouldn't need to, but I guess it probably depends on what was easier for the designers than anything else.
Easiest would probably to use the FIFO since it stores the 16-bit written value from which fill byte is coming.
Oh, also note that from previous hardware tests, I know that most emulators get DMA fill wrong in subtle ways, the most common being the byte order of the first write. All the official and unofficial documentation I've seen gets the byte order of the first write (IE, the word write that triggers the fill) the wrong way around. Contrary to what you may read and observe in other emulators, the same byteswapping rules apply for writing to odd/even addresses in VRAM with a write to trigger a DMA fill, as with any normal write to VRAM. Even Kega makes this mistake IIRC.
Yes, that's something I noticed too, both official doc and genvdp.txt are wrong or inaccurate.
However, it was properly implemented in genesis plus: the 16-bit write that triggers DMA fill is handled like any other DATA port write (MSB goes to address, LSB goes to address ^1 and address is incremented) then DMA Fill starts immediately. Only thing I need to figure is if MSB is always used as fill byte, or if LSB can be used too, depending on the even/odd address thing... the 1st post of this thread seems to indicate that LSB is used as fill data.