next up previous contents
Next: BIOS Fonts (biosfont.c) Up: Hardware Abstraction Layer: DC Previous: Hardware Abstraction Layer: DC   Contents

Subsections

Basic Video (video.c)

The basic video subsystem of libdream is designed to facilitate frame buffer setup and access. It does not handle 3D acceleration, that is handled in the ``TA'' module. The basic usage of the video system is to call vid_init with the desired parameters, and then use one of the ``vram'' pointers to access video memory.

The following variables and functions are available in basic video:

uint32 *vram_l

Pointer to video memory (0xa5000000) as a 32-bit unsigned integer array. Use this to access video memory when in RGB888 mode, or when copying large regions (not recommended =).

uint32 *vram_s

Similar to vram_l, but accesses as a 16-bit unsigned integer array. Use this to access video memory when in RGB555 or RGB565 mode.

int vram_config

Stores the first parameter to vid_init, which is the pixel format.

int vram_size

Stores the total size (in pixels) of one page of video frame buffer.

int vid_cable_type

Stores the cable_type parameter to the video init function below.

int vid_check_cable()

Checks and returns the attached video cable type; the three constants matching the return values are CT_VGA, CT_RGB, and CT_COMPOSITE.

int vid_init(int cable_type, int disp_mode, int pixel_mode)

Does full frame buffer initialization with the requested cable type, display mode, and pixel mode. You should pass the return value from vid_check_cable() as the first parameter. dc_setup() does this for you. disp_mode constants are DM_320x240, DM_640x480 and DM_800x608. pixel_mode constants are PM_RGB555, PM_RGB565, and PM_RGB888.

void vid_set_start(uint32 start)

Set the ``start address'' register, which governs where in the frame buffer the output picture comes from. This can be used for ``double buffering'', but it will most commonly be used during 3D acceleration.

void vid_border_color(int r, int g, int b)

Set the border color. The border is the area outside the standard viewing area. On NTSC this is mostly above and below the picture. I'm not sure what it is on PAL. Generally unless you're doing some odd debugging you'll want to set this to black (vid_init does this for you).

void vid_clear(int r, int g, int b)

Clears the first page of frame buffer based on the current video mode, with the given color. This is most useful when using frame buffer access, not 3D access.

void vid_empty()

Clear the entirety of video memory using zeros. This is done using longwords so it's fairly quick. Once again, mainly used with 3D setup.

void vid_waitvbl()

Wait for a vertical blank period. Vertical blank is the period between the time that the scan beam reaches the bottom of the screen and the time that it reaches the top and starts drawing again. This is relevant because this is the best time to draw to the frame buffer without causing ``tearing'' or other artifacts. It's also generally when you want to switch start addresses.


next up previous contents
Next: BIOS Fonts (biosfont.c) Up: Hardware Abstraction Layer: DC Previous: Hardware Abstraction Layer: DC   Contents
Dan Potter 2002-07-29