llvm-mos-sdk
Classes | Macros | Functions
vdc.h File Reference
#include <stdbool.h>
#include <stdint.h>
Include dependency graph for vdc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  vdc_sprite_t
 

Macros

#define VDC_SPRITE_COLOR(n)   ((n))
 
#define VDC_SPRITE_COLOR_MASK   (0xF)
 
#define VDC_SPRITE_BG   0
 
#define VDC_SPRITE_FG   (0x1 << 7)
 
#define VDC_SPRITE_WIDTH_16   0
 
#define VDC_SPRITE_WIDTH_32   (0x1 << 8)
 
#define VDC_SPRITE_WIDTH_MASK   (0x1 << 8)
 
#define VDC_SPRITE_HEIGHT_16   0
 
#define VDC_SPRITE_HEIGHT_32   (0x1 << 12)
 
#define VDC_SPRITE_HEIGHT_64   (0x3 << 12)
 
#define VDC_SPRITE_HEIGHT_MASK   (0x3 << 12)
 
#define VDC_SPRITE_FLIP_X   (0x1 << 11)
 
#define VDC_SPRITE_FLIP_Y   (0x1 << 15)
 

Functions

uint16_t pce_vdc_peek (uint8_t index)
 Read a value from the VDC port. More...
 
void pce_vdc_poke (uint8_t index, uint16_t data)
 Write a value to the VDC port. More...
 
void pce_vdc_set_copy_word (void)
 Set the VDC's copy method to copy every word. More...
 
void pce_vdc_set_copy_row (void)
 Set the VDC's copy method to copy every row. Alias for pce_vdc_set_copy_word . More...
 
void pce_vdc_set_copy_32_words (void)
 Set the VDC's copy method to copy every 32nd word. More...
 
void pce_vdc_set_copy_column_32 (void)
 Set the VDC's copy method to copy every column for a 32-wide display. Alias for pce_vdc_set_copy_32_words . More...
 
void pce_vdc_set_copy_64_words (void)
 Set the VDC's copy method to copy every 64th word. More...
 
void pce_vdc_set_copy_column_64 (void)
 Set the VDC's copy method to copy every column for a 64-wide display. Alias for pce_vdc_set_copy_64_words . More...
 
void pce_vdc_set_copy_128_words (void)
 Set the VDC's copy method to copy every 128th word. More...
 
void pce_vdc_set_copy_column_128 (void)
 Set the VDC's copy method to copy every column for a 128-wide display. Alias for pce_vdc_set_copy_128_words . More...
 
void pce_vdc_copy_to_vram (uint16_t dest, const void *source, uint16_t length)
 Copy data from RAM to VRAM. More...
 
void pce_vdc_copy_from_vram (void *dest, uint16_t source, uint16_t length)
 Copy data from VRAM to RAM. More...
 
void pce_vdc_dma_start (uint8_t mode, uint16_t source, uint16_t dest, uint16_t length)
 Start a DMA operation on the VDC. More...
 
bool pce_vdc_dma_finished (void)
 Check if the DMA operation has finished. More...
 
void pce_vdc_set_width_tiles (uint8_t tiles, uint8_t vce_flags)
 Set the VDC width, in tiles. More...
 
void pce_vdc_set_width (uint16_t pixels, uint8_t vce_flags)
 
void pce_vdc_set_height (uint8_t lines)
 Set the VDC height, in raster lines. More...
 
void pce_vdc_set_resolution (uint16_t width_pixels, uint8_t height_pixels, uint8_t vce_flags)
 
void pce_vdc_bg_set_size (uint8_t value)
 Set the VDC background size. More...
 
void pce_vdc_sprite_set_table_start (uint16_t loc)
 Set the sprite attribute table location. More...
 
void pce_vdc_enable (uint8_t value)
 Enable VDC control flags. More...
 
void pce_vdc_disable (uint8_t value)
 Disable VDC control flags. More...
 
void pce_vdc_bg_enable (void)
 Enable the background layer. More...
 
void pce_vdc_bg_disable (void)
 Disable the background layer. More...
 
void pce_vdc_sprite_enable (void)
 Enable the sprite layer. More...
 
void pce_vdc_sprite_disable (void)
 Disable the sprite layer. More...
 
void pce_vdc_irq_scanline_enable (void)
 Enable the scanline IRQ. More...
 
void pce_vdc_irq_scanline_disable (void)
 Disable the scanline IRQ. More...
 
void pce_vdc_irq_sprite_collide_enable (void)
 Enable the sprite collision IRQ. More...
 
void pce_vdc_irq_sprite_collide_disable (void)
 Disable the sprite collision IRQ. More...
 
void pce_vdc_irq_sprite_overflow_enable (void)
 Enable the sprite overflow IRQ. More...
 
void pce_vdc_irq_sprite_overflow_disable (void)
 Disable the sprite overflow IRQ. More...
 
void pce_vdc_irq_vblank_enable (void)
 Enable the veritcal blank IRQ. More...
 
void pce_vdc_irq_vblank_disable (void)
 Disable the veritcal blank IRQ. More...
 
bool pce_sgx_detect (void)
 SuperGrafx: Check for presence. More...
 
void pce_sgx_vdc_init (void)
 SuperGrafx: Initialize the second VDC. More...
 
void pce_sgx_vdc1_set (void)
 SuperGrafx: Set the VDC1 as the current VDC for pce_vdc functions. More...
 
void pce_sgx_vdc2_set (void)
 SuperGrafx: Set the VDC2 as the current VDC for pce_vdc functions. More...
 
void pce_sgx_vdc_set (uint8_t id)
 SuperGrafx: Set the specified VDC as the current VDC for pce_vdc functions. More...
 
volatile uint8_t * pce_sgx_vdc_get_index (void)
 SuperGrafx: Get the current VDC's index port location. More...
 
volatile uint16_t * pce_sgx_vdc_get_data (void)
 SuperGrafx: Get the current VDC's data port location. More...
 

Detailed Description

Functionality related to the VDC.

Macro Definition Documentation

◆ VDC_SPRITE_BG

#define VDC_SPRITE_BG   0

◆ VDC_SPRITE_COLOR

#define VDC_SPRITE_COLOR (   n)    ((n))

◆ VDC_SPRITE_COLOR_MASK

#define VDC_SPRITE_COLOR_MASK   (0xF)

◆ VDC_SPRITE_FG

#define VDC_SPRITE_FG   (0x1 << 7)

◆ VDC_SPRITE_FLIP_X

#define VDC_SPRITE_FLIP_X   (0x1 << 11)

◆ VDC_SPRITE_FLIP_Y

#define VDC_SPRITE_FLIP_Y   (0x1 << 15)

◆ VDC_SPRITE_HEIGHT_16

#define VDC_SPRITE_HEIGHT_16   0

◆ VDC_SPRITE_HEIGHT_32

#define VDC_SPRITE_HEIGHT_32   (0x1 << 12)

◆ VDC_SPRITE_HEIGHT_64

#define VDC_SPRITE_HEIGHT_64   (0x3 << 12)

◆ VDC_SPRITE_HEIGHT_MASK

#define VDC_SPRITE_HEIGHT_MASK   (0x3 << 12)

◆ VDC_SPRITE_WIDTH_16

#define VDC_SPRITE_WIDTH_16   0

◆ VDC_SPRITE_WIDTH_32

#define VDC_SPRITE_WIDTH_32   (0x1 << 8)

◆ VDC_SPRITE_WIDTH_MASK

#define VDC_SPRITE_WIDTH_MASK   (0x1 << 8)

Function Documentation

◆ pce_sgx_detect()

bool pce_sgx_detect ( void  )

SuperGrafx: Check for presence.

May cause minor graphical glitches if not called during VBlank. xz *

Returns
true The SuperGrafx is present.

◆ pce_sgx_vdc1_set()

void pce_sgx_vdc1_set ( void  )

SuperGrafx: Set the VDC1 as the current VDC for pce_vdc functions.

◆ pce_sgx_vdc2_set()

void pce_sgx_vdc2_set ( void  )

SuperGrafx: Set the VDC2 as the current VDC for pce_vdc functions.

◆ pce_sgx_vdc_get_data()

volatile uint16_t* pce_sgx_vdc_get_data ( void  )

SuperGrafx: Get the current VDC's data port location.

◆ pce_sgx_vdc_get_index()

volatile uint8_t* pce_sgx_vdc_get_index ( void  )

SuperGrafx: Get the current VDC's index port location.

◆ pce_sgx_vdc_init()

void pce_sgx_vdc_init ( void  )

SuperGrafx: Initialize the second VDC.

This function must be called if you plan on using pce_sgx_vdc* methods.

◆ pce_sgx_vdc_set()

void pce_sgx_vdc_set ( uint8_t  id)

SuperGrafx: Set the specified VDC as the current VDC for pce_vdc functions.

◆ pce_vdc_bg_disable()

void pce_vdc_bg_disable ( void  )

Disable the background layer.

◆ pce_vdc_bg_enable()

void pce_vdc_bg_enable ( void  )

Enable the background layer.

◆ pce_vdc_bg_set_size()

void pce_vdc_bg_set_size ( uint8_t  value)

Set the VDC background size.

Parameters
valueVDC_BG_SIZE_*

◆ pce_vdc_copy_from_vram()

void pce_vdc_copy_from_vram ( void *  dest,
uint16_t  source,
uint16_t  length 
)

Copy data from VRAM to RAM.

Parameters
destDestination memory address.
sourceSource memory address, in words.
lengthThe length, in bytes.

◆ pce_vdc_copy_to_vram()

void pce_vdc_copy_to_vram ( uint16_t  dest,
const void *  source,
uint16_t  length 
)

Copy data from RAM to VRAM.

Parameters
destDestination memory address, in words.
sourceSource memory address.
lengthThe length, in bytes.

◆ pce_vdc_disable()

void pce_vdc_disable ( uint8_t  value)

Disable VDC control flags.

Parameters
valueControl flags.

◆ pce_vdc_dma_finished()

bool pce_vdc_dma_finished ( void  )

Check if the DMA operation has finished.

◆ pce_vdc_dma_start()

void pce_vdc_dma_start ( uint8_t  mode,
uint16_t  source,
uint16_t  dest,
uint16_t  length 
)

Start a DMA operation on the VDC.

Parameters
modeThe DMA mode.
sourceSource address in VRAM.
destDestination address in VRAM.
lengthLength, in bytes.

◆ pce_vdc_enable()

void pce_vdc_enable ( uint8_t  value)

Enable VDC control flags.

Parameters
valueControl flags.

◆ pce_vdc_irq_scanline_disable()

void pce_vdc_irq_scanline_disable ( void  )

Disable the scanline IRQ.

◆ pce_vdc_irq_scanline_enable()

void pce_vdc_irq_scanline_enable ( void  )

Enable the scanline IRQ.

◆ pce_vdc_irq_sprite_collide_disable()

void pce_vdc_irq_sprite_collide_disable ( void  )

Disable the sprite collision IRQ.

◆ pce_vdc_irq_sprite_collide_enable()

void pce_vdc_irq_sprite_collide_enable ( void  )

Enable the sprite collision IRQ.

◆ pce_vdc_irq_sprite_overflow_disable()

void pce_vdc_irq_sprite_overflow_disable ( void  )

Disable the sprite overflow IRQ.

◆ pce_vdc_irq_sprite_overflow_enable()

void pce_vdc_irq_sprite_overflow_enable ( void  )

Enable the sprite overflow IRQ.

◆ pce_vdc_irq_vblank_disable()

void pce_vdc_irq_vblank_disable ( void  )

Disable the veritcal blank IRQ.

◆ pce_vdc_irq_vblank_enable()

void pce_vdc_irq_vblank_enable ( void  )

Enable the veritcal blank IRQ.

◆ pce_vdc_peek()

uint16_t pce_vdc_peek ( uint8_t  index)

Read a value from the VDC port.

Parameters
indexRegister to read.
Returns
uint16_t Value read.

◆ pce_vdc_poke()

void pce_vdc_poke ( uint8_t  index,
uint16_t  data 
)

Write a value to the VDC port.

Parameters
indexRegister to write.
dataValue to write.

◆ pce_vdc_set_copy_128_words()

void pce_vdc_set_copy_128_words ( void  )

Set the VDC's copy method to copy every 128th word.

◆ pce_vdc_set_copy_32_words()

void pce_vdc_set_copy_32_words ( void  )

Set the VDC's copy method to copy every 32nd word.

◆ pce_vdc_set_copy_64_words()

void pce_vdc_set_copy_64_words ( void  )

Set the VDC's copy method to copy every 64th word.

◆ pce_vdc_set_copy_column_128()

void pce_vdc_set_copy_column_128 ( void  )

Set the VDC's copy method to copy every column for a 128-wide display. Alias for pce_vdc_set_copy_128_words .

◆ pce_vdc_set_copy_column_32()

void pce_vdc_set_copy_column_32 ( void  )

Set the VDC's copy method to copy every column for a 32-wide display. Alias for pce_vdc_set_copy_32_words .

◆ pce_vdc_set_copy_column_64()

void pce_vdc_set_copy_column_64 ( void  )

Set the VDC's copy method to copy every column for a 64-wide display. Alias for pce_vdc_set_copy_64_words .

◆ pce_vdc_set_copy_row()

void pce_vdc_set_copy_row ( void  )

Set the VDC's copy method to copy every row. Alias for pce_vdc_set_copy_word .

◆ pce_vdc_set_copy_word()

void pce_vdc_set_copy_word ( void  )

Set the VDC's copy method to copy every word.

◆ pce_vdc_set_height()

void pce_vdc_set_height ( uint8_t  lines)

Set the VDC height, in raster lines.

Parameters
linesThe number of raster lines.

◆ pce_vdc_set_resolution()

void pce_vdc_set_resolution ( uint16_t  width_pixels,
uint8_t  height_pixels,
uint8_t  vce_flags 
)

◆ pce_vdc_set_width()

void pce_vdc_set_width ( uint16_t  pixels,
uint8_t  vce_flags 
)

◆ pce_vdc_set_width_tiles()

void pce_vdc_set_width_tiles ( uint8_t  tiles,
uint8_t  vce_flags 
)

Set the VDC width, in tiles.

Parameters
tilesThe number of tiles.
vce_flagsVCE control register configuration:
  • VCE_FIELD_ODD
  • VCE_COLORBURST_OFF

◆ pce_vdc_sprite_disable()

void pce_vdc_sprite_disable ( void  )

Disable the sprite layer.

◆ pce_vdc_sprite_enable()

void pce_vdc_sprite_enable ( void  )

Enable the sprite layer.

◆ pce_vdc_sprite_set_table_start()

void pce_vdc_sprite_set_table_start ( uint16_t  loc)

Set the sprite attribute table location.

Parameters
locLocation.