VRAM: Difference between revisions

From NeoGeo Development Wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 3: Line 3:
[[File:Aes_cxk5814.jpg|thumb|One of two CXK5814 2KiB RAM chips used for the upper zone of the VRAM ($8000~$87FF) on a AES system]]
[[File:Aes_cxk5814.jpg|thumb|One of two CXK5814 2KiB RAM chips used for the upper zone of the VRAM ($8000~$87FF) on a AES system]]


The NeoGeo has 68KiB (physically 64KiB + 4KiB, called lower and upper, or slow and fast) of VRAM organised as 16 bits words, which is used to store [[Sprites|sprite]] attributes, the [[fix layer]] tile map and sprite priority buffers for video rendering. Contrary to other systems, the VRAM here '''does not contain actual graphics'''.
The NeoGeo has 68KiB (physically 64KiB + 4KiB, respectively called lower and upper, or slow and fast) of VRAM accessible as 16 bits words, which is used to store [[Sprites|sprite]] attributes, the [[fix layer]] tile map and sprite lists for video rendering. Contrary to other systems, the VRAM here '''does not contain actual graphics'''.


Acces to VRAM is done through 3 [[Memory mapped registers]] handled by the [[GPU]], it isn't mapped in the [[68k]] address space. Every VRAM address points to a word, not a byte.
Acces to VRAM is done through 3 [[Memory mapped registers]] handled by the [[GPU]], it isn't mapped in the [[68k]] address space. Every VRAM address points to a word, not a byte.
Line 11: Line 11:
* {{Reg|REG_VRAMMOD ($3C0004)}} is the signed value added to the VRAM address after a write
* {{Reg|REG_VRAMMOD ($3C0004)}} is the signed value added to the VRAM address after a write


SNK specifies that the address register should be set directly instead of using auto-incrementation when changing between VRAM zones ($0000~$7FFF to/from $8000~$FFFF). This is because the adder is only 15 bit and not 16.
The original SNK documentation specifies that the address register should be set directly instead of using {{Reg|REG_VRAMMOD}} when crossing VRAM zones ($0000~$7FFF to/from $8000~$FFFF). This is probably because the GPU's internal adder is 15 bit only.


== Memory map ==
== Memory map ==
Line 55: Line 55:
|}
|}


VRAM can be modified at any time, even during active display.
Even if VRAM can be modified at any time (even during active display), since it is not dual-ported, some timing restrictions have to be met in order to avoid skipping writes or reading data too early after setting the address. This is because LSPC allocates a number of "access slots" per video line for the CPU between rendering steps.


== Timing considerations ==
== Timing considerations ==
The following timings are given to be 100% sure that no read or write to VRAM will fail. It is possible to sometimes shorten them with extreme guessing methods on the CPU side, but it's practically useless.


After a write:
After a write:
Line 63: Line 65:
*An address change should be made after at least 16 cycles.
*An address change should be made after at least 16 cycles.


After an address change, reads should be made after at least 16 cycles.
After an address change, reads should be made after at least 16 CPU cycles.


Note that these timings only affect the VRAM access, and not the LSPC registers.
Note that these timings only affect the VRAM access, and not the other LSPC registers.


[[Category:Video system]]
[[Category:Video system]]

Revision as of 15:42, 1 October 2015

VRAM stand for Video RAM.

File:Aes cxk5814.jpg
One of two CXK5814 2KiB RAM chips used for the upper zone of the VRAM ($8000~$87FF) on a AES system

The NeoGeo has 68KiB (physically 64KiB + 4KiB, respectively called lower and upper, or slow and fast) of VRAM accessible as 16 bits words, which is used to store sprite attributes, the fix layer tile map and sprite lists for video rendering. Contrary to other systems, the VRAM here does not contain actual graphics.

Acces to VRAM is done through 3 Memory mapped registers handled by the GPU, it isn't mapped in the 68k address space. Every VRAM address points to a word, not a byte.

The original SNK documentation specifies that the address register should be set directly instead of using REG_VRAMMOD when crossing VRAM zones ($0000~$7FFF to/from $8000~$FFFF). This is probably because the GPU's internal adder is 15 bit only.

Memory map

Start End Description
$0000 $6FFF SCB1
$7000 $74FF Fix map
$7500 $7FFF Extension
$8000 $81FF SCB2
$8200 $83FF SCB3
$8400 $85FF SCB4
$8600 $867F Sprite list for even scanlines
$8680 $86FF Sprite list for odd scanlines

Even if VRAM can be modified at any time (even during active display), since it is not dual-ported, some timing restrictions have to be met in order to avoid skipping writes or reading data too early after setting the address. This is because LSPC allocates a number of "access slots" per video line for the CPU between rendering steps.

Timing considerations

The following timings are given to be 100% sure that no read or write to VRAM will fail. It is possible to sometimes shorten them with extreme guessing methods on the CPU side, but it's practically useless.

After a write:

  • Another write should be made after at least 12 cycles.
  • An address change should be made after at least 16 cycles.

After an address change, reads should be made after at least 16 CPU cycles.

Note that these timings only affect the VRAM access, and not the other LSPC registers.