I'm struggling to understand exactly how the scrollplanes work on the Megadrive. Here's how I understand it, and hopefully I don't confuse you too much.
The screen is (for the purposes of this question) 40x28 cells in size, and this size is set by certain VDP registers. The scrollplanes are both 64x32 cells, and this size is set by a different set of VDP registers. The pattern tables for the scrollplanes are located in VRAM, at a location defined by yet more VDP registers.
My question is, if I draw a particular pattern to the scrollplane and then scroll it, what is it that actually moves? Is it the scrollplane or the tiles? If it's the scrollplane I'd expect behaviour to be undefined when the screen displays outside the scrollplane; if it's the tiles I'd expect scrolling too far to result in the data that the scrollplane contains being lost.
Furthermore, if it's the tiles that move then how do I set where the screen is on the scrollplane? I'd ideally like the 40x28 screen to be centred on the 64x32 scrollplane, so that there's a two-cell gap between the top and bottom of the scrollplane and the top and bottom of the screen respectively, and similarly a twelve-cell gap between the respective sides.
Idiot question (sorry!)
Moderator: BigEvilCorporation
-
- Very interested
- Posts: 2440
- Joined: Tue Dec 05, 2006 1:37 pm
- Location: Estonia, Rapla City
- Contact:
I might be incorrect:
* VDP reads data from the scrolldata
* then reads graphics according to data from scrolldata
* and then adds displacement (amount of scroll) to the graphics
* and displays the stuff that fits the screen
And the last result is: scrolldata remains unchanged
I hope it is not too confusing
* VDP reads data from the scrolldata
* then reads graphics according to data from scrolldata
* and then adds displacement (amount of scroll) to the graphics
* and displays the stuff that fits the screen
And the last result is: scrolldata remains unchanged
I hope it is not too confusing
Mida sa loed ? Nagunii aru ei saa
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
Re: Idiot question (sorry!)
As far as I know, the scrollplane moves, and it wraps around. I encountered this in the early making of my First Time Out demo, as I'd used a larger LOCAL H logo, and it wrapped around while scrolling. I can't speak for the VDP's internal operation, but that's the external result.Quickman wrote:My question is, if I draw a particular pattern to the scrollplane and then scroll it, what is it that actually moves? Is it the scrollplane or the tiles? If it's the scrollplane I'd expect behaviour to be undefined when the screen displays outside the scrollplane; if it's the tiles I'd expect scrolling too far to result in the data that the scrollplane contains being lost.
Just set your base scroll values appropriately, and you can do this. Increasing scroll values move the planes right and up, whereas decreasing values move the planes left and down.Quickman wrote:Furthermore, if it's the tiles that move then how do I set where the screen is on the scrollplane? I'd ideally like the 40x28 screen to be centred on the 64x32 scrollplane, so that there's a two-cell gap between the top and bottom of the scrollplane and the top and bottom of the screen respectively, and similarly a twelve-cell gap between the respective sides.
Planes are made of pointers to tiles, and they all reside in VRAM (the HScroll also, by the way).
The scroll datas are offset. On each line, the VDP reads the planes data, and fetches the needed tiles. Then, just before sending the line to the TV screen, line is shifted regarding the offset (HScroll data).
Nothing moves in VRAM.
The 40cell mode is the display screen. It can be 32 or 40 cell wide. The PAL/NTSC defines the display screen height : 28/30.
Besides this, the plane size can be 32x32, 32x64, 32x128, 64x32, 64x64 or 128x32. This size affect both A-plane and B-plane.
If you have a 64x32 plane, and a 40 display screen, only 40 cell-rows out of 64 are visible ; the 40 first left ones by default. If you set the H scroll to, let's say 112 (14 cell), you will see the rows from cell 50 to cell 64, then it wraps and you have cell 0 to cell 26. If you set the H scroll to 240 (30 cell), you will see from cell 0 to cell 6, then wraps from cell 0 to cell 6.
Here's a pic. Hope it helps :
The scroll datas are offset. On each line, the VDP reads the planes data, and fetches the needed tiles. Then, just before sending the line to the TV screen, line is shifted regarding the offset (HScroll data).
Nothing moves in VRAM.
The 40cell mode is the display screen. It can be 32 or 40 cell wide. The PAL/NTSC defines the display screen height : 28/30.
Besides this, the plane size can be 32x32, 32x64, 32x128, 64x32, 64x64 or 128x32. This size affect both A-plane and B-plane.
If you have a 64x32 plane, and a 40 display screen, only 40 cell-rows out of 64 are visible ; the 40 first left ones by default. If you set the H scroll to, let's say 112 (14 cell), you will see the rows from cell 50 to cell 64, then it wraps and you have cell 0 to cell 26. If you set the H scroll to 240 (30 cell), you will see from cell 0 to cell 6, then wraps from cell 0 to cell 6.
Here's a pic. Hope it helps :
Code: Select all
+----------------------------------------+
| Display Screen |
| |
|+----------------------------------------------------------------+
|| A-Plane 64x32 | |
|| | |
|| | |
|| | |
|| | |
|| | |
|| | |
|| | |
|| | |
|| | |
|| | |
|| | |
|| | |
|| | |
|| | |
|| | |
|| | |
|| | |
|| | |
|| | |
|| | |
|| | |
|| | |
|| | |
|| | |
+|---------------------------------------+ |
| |
| |
| |
| |
| |
| |
+----------------------------------------------------------------+
H scroll 64 (8 cell)
+----------------------------------------+
| Display Screen |
| |
|--------++--------------------------------------------------------+
| || A-Plane 64x32 | |
| || | |
| || | |
| || | |
| || | |
| || | |
| || | |
| || | |
| || | |
| || | |
| || | |
| || | |
| || | |
| || | |
| || | |
| || | |
| || | |
| || | |
| || | |
| || | |
| || | |
| || | |
| || | |
| || | |
| || | |
| || | |
| || | |
+--------||------------------------------+ |
|| |
|| |
|| |
|| |
--------++--------------------------------------------------------+