VDP related function. More...
#include <types.h>
Go to the source code of this file.
Defines | |
#define | REG_NULL 0 |
Use to set a vdp register to 0. | |
#define | REG0_HVCOUNTER 0x2 |
Stop HV counter. | |
#define | REG0_BASE 0x4 |
Base for REG0. | |
#define | REG0_HINT 0x10 |
Enable HINT. | |
#define | REG1_BASE 0x4 |
Base for REG1. | |
#define | REG1_PAL 0x8 |
Enable PAL mode. | |
#define | REG1_DMA 0x10 |
Enable DMA. | |
#define | REG1_VINT 0x20 |
Enable VINT. | |
#define | REG1_DISPLAY 0x40 |
Enable DISPLAY. | |
#define | REG2_PLANEA(addr) ((addr & 0xE000) >> 10) |
Set PLANEA address. | |
#define | REG3_WINDOW(addr) ((addr & 0xF800) >> 10) |
Set WINDOW address. | |
#define | REG4_PLANEB(addr) ((addr & 0xE000) >> 13) |
Set PLANEB address. | |
#define | REG5_SPRITE(addr) ((addr & 0xFE00) >> 9) |
Set SPRITE address. | |
#define | REG7_PAL(pal) ((pal & 0x3) << 4) |
Select the palette pal for the bg color. | |
#define | REG7_COLOR(color) (color & 0xF) |
Select the color color for the bg color. | |
#define | REG11_HFULL 0x0 |
Set horizontal full scroll mode. | |
#define | REG11_H1CELL 0x2 |
Set horizontal 1 cell scroll mode. | |
#define | REG11_H1LINE 0x3 |
Set horizontal 1 line scroll mode. | |
#define | REG11_VFULL 0x0 |
Set vertical full scroll mode. | |
#define | REG11_V2CELL 0x4 |
Set vertical 2 cell scroll mode. | |
#define | REG11_EINT 0x8 |
Enable external interupt. | |
#define | REG12_40CELL 0x81 |
Set 40 cell mode. | |
#define | REG12_SHADOW 0x8 |
Enable Shadow/Highlight. | |
#define | REG12_INTERLACE 0x2 |
Select interlace mode. | |
#define | REG12_DINTERLACE 0x6 |
Select double interlace mode. | |
#define | REG13_HSCROLL(addr) ((addr & 0xFC00) >> 10) |
Set HSCROLL address. | |
#define | REG15_AUTOINC(x) x |
Set VDP autoinc to x. | |
#define | REG16_32X32 0x0 |
Set scroll size to 32x32. | |
#define | REG16_32X64 0x10 |
Set scroll size to 32x64. | |
#define | REG16_32X128 0x30 |
Set scroll size to 32x128. | |
#define | REG16_64X32 0x1 |
Set scroll size to 64x32. | |
#define | REG16_64X64 0x11 |
Set scroll size to 64x64. | |
#define | REG16_64X128 0x31 |
64x128 | |
#define | REG16_128X32 0x3 |
Set scroll size to 128x32. | |
#define | REG16_128X64 0x13 |
Set scroll size to 128x64. | |
#define | REG16_128X128 0x33 |
Set scroll size to 128x128. | |
#define | SPRITE_SIZE_8X8 (0x0 << 8) |
Set sprite size to 8x8. | |
#define | SPRITE_SIZE_8X16 (0x1 << 8) |
Set sprite size to 8x16. | |
#define | SPRITE_SIZE_8X24 (0x2 << 8) |
Set sprite size to 8x24. | |
#define | SPRITE_SIZE_8X32 (0x3 << 8) |
Set sprite size to 8x32. | |
#define | SPRITE_SIZE_16X8 (0x4 << 8) |
Set sprite size to 16x8. | |
#define | SPRITE_SIZE_16X16 (0x5 << 8) |
Set sprite size to 16x16. | |
#define | SPRITE_SIZE_16X24 (0x6 << 8) |
Set sprite size to 16x24. | |
#define | SPRITE_SIZE_16X32 (0x7 << 8) |
Set sprite size to 16x32. | |
#define | SPRITE_SIZE_24X8 (0x8 << 8) |
Set sprite size to 24x8. | |
#define | SPRITE_SIZE_24X16 (0x9 << 8) |
Set sprite size to 24x16. | |
#define | SPRITE_SIZE_24X24 (0xA << 8) |
Set sprite size to 24x24. | |
#define | SPRITE_SIZE_24X32 (0xB << 8) |
Set sprite size to 24x32. | |
#define | SPRITE_SIZE_32X8 (0xC << 8) |
Set sprite size to 32x8. | |
#define | SPRITE_SIZE_32X16 (0xD << 8) |
Set sprite size to 32x16. | |
#define | SPRITE_SIZE_32X24 (0xE << 8) |
Set sprite size to 32x24. | |
#define | SPRITE_SIZE_32X32 (0xF << 8) |
Set sprite size to 32x32. | |
#define | CRAM_WRITE 0x3 |
Set write access to CRAM. | |
#define | CRAM_READ 0x8 |
Set read access to CRAM. | |
#define | VRAM_WRITE 0x1 |
Set write access to VRAM. | |
#define | VRAM_READ 0x0 |
Set read access to VRAM. | |
#define | VSRAM_WRITE 0x5 |
Set write access to VSRAM. | |
#define | VSRAM_READ 0x4 |
Set read access to VSRAM. | |
#define | DMA_TO_VRAM 0x1 |
Set destination to VRAM for DMA. | |
#define | DMA_TO_CRAM 0x3 |
Set destination to CRAM for DMA. | |
#define | DMA_TO_VSRAM 0x5 |
Set destination to VSRAM for DMA. | |
#define | VDP_BUILD_TILE(n, vflip, hflip, pal, shadow) (n | (vflip << 11) | (hflip << 12) | (pal << 13) | (shadow << 15)) |
Build a tile definition. | |
Functions | |
void | vdp_pointto (u32 addr, u8 access) |
Set the VDP address to addr in the correct region and access mode. | |
void | vdp_setreg (u32 reg, u32 data) |
Set a VDP register. | |
void | vdp_write (u16 data) |
Write 16bits to the VDP. | |
void | vdp_write16 (u16 data) |
Write 16bits to the VDP. | |
void | vdp_write32 (u32 data) |
Write 16bits to the VDP. | |
void | vdp_writetocram (u8 size, const void *src, u8 dst) |
Write a palette in the VDP. | |
void | vdp_writetovram (u16 size, const void *from, u16 dst) |
Write size byte of data from *src. | |
void | vdp_writetovsram (u16 size, const void *from, u16 dst) |
Write size byte of data from *src. | |
void | vdp_dma (u16 size, const void *from, u16 dst, u8 region) |
Write size byte of data from *src to dst using the DMA. | |
void | vdp_dmafill (u16 size, u16 dst, u16 data) |
Fill size byte with data to dst using the DMA. | |
void | vdp_waitdma (void) |
Wait for dma completion. | |
void | vdp_clrvram (void) |
Clear the VDP VRAM. | |
void | vdp_clrvsram (void) |
Clear the VDP VSRAM. | |
void | vdp_waitvsync (void) |
Wait for the next VBLANK. |
VDP related function.
#define VDP_BUILD_TILE | ( | n, | |||
vflip, | |||||
hflip, | |||||
pal, | |||||
shadow | ) | (n | (vflip << 11) | (hflip << 12) | (pal << 13) | (shadow << 15)) |
Build a tile definition.
Build a tile definition with n = tilenumber vflip = flip the tile verticaly hflip = flip the tile horizontaly pal = palette to use shadow = enable shadow
void vdp_clrvram | ( | void | ) |
Clear the VDP VRAM.
You have to set the autoinc register (#15) to 2 before calling this function
void vdp_clrvsram | ( | void | ) |
Clear the VDP VSRAM.
You have to set the autoinc register (#15) to 2 before calling this function
Write size byte of data from *src to dst using the DMA.
size | The amount of data to write in byte | |
from | The address of the data to write | |
dst | The destination address in VDP | |
region | The destination RAM in VDP (VRAM, CRAM or VSRAM) |
Fill size byte with data to dst using the DMA.
size | The amount of data to write in byte | |
dst | The destination address in VDP | |
data | The data to fill |
Set the VDP address to addr in the correct region and access mode.
addr | the address to point to | |
access | the region and access type |
Set a VDP register.
reg | The register number | |
data | The register data |
void vdp_write | ( | u16 | data | ) |
Write 16bits to the VDP.
data | Data to write |
void vdp_write16 | ( | u16 | data | ) |
Write 16bits to the VDP.
data | Data to write |
void vdp_write32 | ( | u32 | data | ) |
Write 16bits to the VDP.
data | Data to write |
Write a palette in the VDP.
size | The amount of data to write in byte | |
src | The address of the data to write | |
dst | The destination address in CRAM |
Write size byte of data from *src.
size | The amount of data to write in byte | |
from | The address of the data to write | |
dst | The destination address in VRAM |