VRAM: Difference between revisions
m (Memory map: sizes and zones) |
|||
Line 19: | Line 19: | ||
|'''Start''' | |'''Start''' | ||
|'''End''' | |'''End''' | ||
|'''Size''' | |||
|'''Zone''' | |||
|'''Description''' | |'''Description''' | ||
|- | |- | ||
|$0000 | |$0000 | ||
|$6FFF | |$6FFF | ||
|28KiB | |||
|rowspan=3|Lower | |||
|[[Sprites#SCB1|SCB1]] | |[[Sprites#SCB1|SCB1]] | ||
|- | |- | ||
|$7000 | |$7000 | ||
|$74FF | |$74FF | ||
|rowspan=2|4KiB | |||
|[[Fix layer|Fix map]] | |[[Fix layer|Fix map]] | ||
|- | |- | ||
Line 35: | Line 40: | ||
|$8000 | |$8000 | ||
|$81FF | |$81FF | ||
|512B | |||
|rowspan=5|Upper | |||
|[[Sprites#SCB2|SCB2]] | |[[Sprites#SCB2|SCB2]] | ||
|- | |- | ||
|$8200 | |$8200 | ||
|$83FF | |$83FF | ||
|512B | |||
|[[Sprites#SCB3|SCB3]] | |[[Sprites#SCB3|SCB3]] | ||
|- | |- | ||
|$8400 | |$8400 | ||
|$85FF | |$85FF | ||
|512B | |||
|[[Sprites#SCB4|SCB4]] | |[[Sprites#SCB4|SCB4]] | ||
|- | |- | ||
|$8600 | |$8600 | ||
|$867F | |$867F | ||
|128B | |||
|Sprite list for even scanlines | |Sprite list for even scanlines | ||
|- | |- | ||
|$8680 | |$8680 | ||
|$86FF | |$86FF | ||
|128B | |||
|Sprite list for odd scanlines | |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 the LSPC | 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 the [[LSPC]] needs to interleave a number of "access slots" per video line for the CPU between rendering steps. | ||
== Timing considerations == | == Timing considerations == |
Revision as of 12:18, 7 October 2016
VRAM stands for Video RAM.
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.
Access 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.
- REG_VRAMADDR ($3C0000) sets the VRAM address for the next read/write operation
- REG_VRAMRW ($3C0002) is the data read or to write
- REG_VRAMMOD ($3C0004) is the signed value added to the VRAM address after a write
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 | Size | Zone | Description |
$0000 | $6FFF | 28KiB | Lower | SCB1 |
$7000 | $74FF | 4KiB | Fix map | |
$7500 | $7FFF | Extension | ||
$8000 | $81FF | 512B | Upper | SCB2 |
$8200 | $83FF | 512B | SCB3 | |
$8400 | $85FF | 512B | SCB4 | |
$8600 | $867F | 128B | Sprite list for even scanlines | |
$8680 | $86FF | 128B | 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 the LSPC needs to interleave 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.