|
|
From Sonic Retro
SCHG:VDP Documentation/General/RegistersFrom Sonic Retro
$00 - Mode Set Register No. 1
$01 - Mode Set Register No. 2
Combining bits 7 (TMS9918 mode) and 2 (SMS mode) has no effect. $02 - Pattern Name Table Address for Scroll ABits 5-3 of this register correspond to bits A15-A13 of the name table address for plane A. $03 - Pattern Name Table Address for WindowBits 5-1 of this register correspond to bits A15-A11 of the name table address for the window. In 40-cell mode, A11 is always forced to zero. $04 - Pattern Name Table Address for Scroll BBits 2-0 of this register correspond to bits A15-A13 of the name table address for plane B. $05 - Sprite Attribute Table Base AddressBits 6-0 of this register correspond to bits A15-A09 of the sprite attribute table. In 40-cell mode, A09 is always forced to zero. $07 - Backdrop ColorBits 5-0 of this register select a palette entry to be used as the backdrop color. The backdrop color is displayed in the following places:
Note that even though the first palette entry on each row cannot be used by any patterns, these entries can be used for the backdrop color. $0A - H Interrupt RegisterBits 7-0 specify the value to be loaded in the counter; for complete details see the "Interrupts" section. $0B - Mode Set Register No. 3
$0C - Mode Set Register No. 4
$0D - H Scroll Data Table Base AddressBits 5-0 of this register correspond to bits A15-A10 of the horizontal scroll data table address. $0F - Auto Increment DataBits 7-0 specify the value to be added to the VDP's address register after every read or write to the data port. A setting of zero means the address register is not incremented. $10 - Scroll Size
$11 - Window H Position
The WHP field defines the horizontal range of the window, in units of two cells (16 pixels). Setting the WHP field to zero disables the window. Any nonzero value indicates how many 2-cell columns wide the window plane is (0=no window, 1=2 cells, 2=4 cells, 3=6 cells, etc.). When RIGT=0, the window is shown from column zero to the column specified by the WHP field. For instance, if RIGT=0 and WHP=4, the window is displayed on columns zero up to (and including) column seven. When RIGT=1, the window is shown from the column specified in the WHP field up to the last column in the display meaning column 31 or 39 depending on the screen width setting. For instance, if RIGT=1 and WHP=4, the window is displayed on columns eight up to (and including) column 31 or 39. Having WHP set to zero and RIGT=1 is a legal setting; it means the window is shown from column zero up to the last column in the display, meaning the entire line is taken up by the window plane. There is a bug in the window processing. This occurs when the window is showing partially on the left side of the screen, specifically when the VDP is drawing the 2-cell column from plane A that immediately proceeds the last column the window was drawn on (i.e. WHP+1). If the lower four bits of the horizontal scroll value for the current scan line are zero, then the name table attribute data for the current column are fetched correctly. If the lower four bits of the horizontal scroll value for the current scan line are nonzero, the name table attribute data are fetched from next column (WHP+2). In effect, you'll have N columns of the window plane, 1 column that has identical patterns as the next column, then the remainder of the display is drawn correctly. Here's a diagram to illustrate this: w = window tiles abc = tile columns D3-D0 of scroll value == 0 wwwwwwwwwwwwwwwwaabbccddeeffgghh D3-D0 of scroll value != 0 wwwwwwwwwwwwwwwwbbbbccddeeffgghh This register can be modified with changes taking effect immediately at any point in the display frame. Plane A is not shown in any column where plane W is shown; they cannot overlap. $12 - Window V Position
If the current scanline does not fall within the range specified by register $12, then register $11 determines where the window is shown for the remainder of the display. The WVP field defines the vertical range of the window, in units of eight lines. Setting the WVP field to zero disables the window. Any nonzero value indicates a vertical range for the window to appear in. (0=no window, 1=lines 0-$7, 2= lines 0-$F, 3= lines 0-$17, etc.) When DOWN=0, the window is shown from line zero to the line specified by the WVP field. For instance, if DOWN=0 and WVP=4, the window is displayed on lines zero up to (and including) line $1F. When DOWN=1, the window is shown from the line specified in the WVP field up to the last line in the display. For instance, if DOWN=1 and WVP=4, the window is displayed on lines $1F up to (and including) the last line in the display. Having WVP set to zero and DOWN=1 is a legal setting; it means the window is shown from line zero up to the last line in the display, meaning the entire screen is taken up by the window plane. Plane A is not shown in any line where plane W is shown; they cannot overlap. $13 - DMA Length Counter Low
This is the low byte for the DMA length counter. If you wanted to transfer $1234 words using DMA, you would write $34 to this register. $14 - DMA Length Counter High
This is the high byte for the DMA length counter. If you wanted to transfer $1234 words using DMA, you would write $12 to this register. $15 - DMA Source Address Low
This is the low byte for the DMA source address. It contains bits 1-8 of the source address. (Bit 0 is ignored, since only word transfers are allowed, and word transfers must be aligned.) $16 - DMA Source Address Mid
This is the middle byte for the DMA source address. It contains bits 9-16 of the source address. $17 - DMA Source Address High
This is the high byte for the DMA source address. It contains bits 17-22 of the source address, plus two DMA mode bits.
|
