Understanding VDP
Moderators: BigEvilCorporation, Mask of Destiny
Understanding VDP
Reading the documentation of Nemesis I understand that VDP access to VRAM are divided in slots. There are slots called "external slots access".
When performing DMA The DMA use these slots to access VRAM?
There is a link between these slots and the VDP FIFO?
I work actually on a VDP core at slot level and i would like understanding exactly how it works internally to have a good code design.
Thanks for your help.
When performing DMA The DMA use these slots to access VRAM?
There is a link between these slots and the VDP FIFO?
I work actually on a VDP core at slot level and i would like understanding exactly how it works internally to have a good code design.
Thanks for your help.
-
- Very interested
- Posts: 616
- Joined: Thu Nov 30, 2006 6:30 am
So generally speaking, everything the VDP does is organized around a unit of 4 cycles of its current clock (MCLK/4 or MCLK/5 depending on the video mode with some switching between the two during hsync for H40 mode). In 4 cycles, the VDP can either read 4 consecutive bytes from the serial port, read or write a single byte using the parallel port or do a refresh operation. Any 4 cycle period (a slot in other words) that is not be used by the VDP for rendering or refresh is available for servicing external requests from the 68K. These are called an external slot in Nemesis' documentation.
Normal writes and 68K -> VRAM DMA transfers go through the FIFO. DMA fills don't go through the FIFO, but use the FIFO as a value source for the fill. Additionally, the write that triggers the fill goes through as a normal write. DMA copies do not interact with the FIFO at all, but do use the same external slots as other accesses.
Normal writes and 68K -> VRAM DMA transfers go through the FIFO. DMA fills don't go through the FIFO, but use the FIFO as a value source for the fill. Additionally, the write that triggers the fill goes through as a normal write. DMA copies do not interact with the FIFO at all, but do use the same external slots as other accesses.
Thanks for this informations !
I would need more details about how the FIFO is filled.
For example when i write data to VRAM :
1) Data is writed to data port
2) The FIFO is immediately written with this data?
3) Next external slot the VDP take the data from FIFO and write to VRAM
If my step 2) is correct what happen if i write another adress before the external access slot occurs? My data will be written to the new adress?
This example will help me to understand internal design of the chip
I would need more details about how the FIFO is filled.
For example when i write data to VRAM :
1) Data is writed to data port
2) The FIFO is immediately written with this data?
3) Next external slot the VDP take the data from FIFO and write to VRAM
If my step 2) is correct what happen if i write another adress before the external access slot occurs? My data will be written to the new adress?
This example will help me to understand internal design of the chip
-
- Very interested
- Posts: 616
- Joined: Thu Nov 30, 2006 6:30 am
My investigations suggest there is a latency of 2 or 3 slots between when a value is read from the 68K's bus to when it can be written to VRAM. It's not clear if this is on the entry to the FIFO or exit.mickagame wrote: 2) The FIFO is immediately written with this data?
3) Next external slot the VDP take the data from FIFO and write to VRAM
An entry in the FIFO not only contains the word to be written, but a copy of the internal address register and cd register from the time when the write was added to the FIFO.mickagame wrote: If my step 2) is correct what happen if i write another adress before the external access slot occurs? My data will be written to the new adress?
-
- Very interested
- Posts: 746
- Joined: Sat Dec 15, 2007 7:49 am
- Location: Kazakhstan, Pavlodar
-
- Very interested
- Posts: 616
- Joined: Thu Nov 30, 2006 6:30 am
So I haven't had a chance to confirm this myself, but according to Nemesis the VDP has a basic prefetch mechanism for reads (which makes a lot of sense). Once you setup a read through the control port, the first unused external slot will fetch the requested word into an internal latch and mark a flag that the data is available. If you attempt to read and this flag is not set, the 68K will be forced to wait (via DTACK) until the data is available. AFAIK, you are correct in that FIFO writes take precedence over reads.
One consequence of the above, is that if you setup a write and then try to read the 68K will hang until the machine is reset.
One consequence of the above, is that if you setup a write and then try to read the 68K will hang until the machine is reset.
-
- Very interested
- Posts: 616
- Joined: Thu Nov 30, 2006 6:30 am