libmsx
C library for MSX
Loading...
Searching...
No Matches
vdp.h File Reference

Data types and functions for VDP (Video Display Proccessor) access. More...

#include <assert.h>
#include <stdbool.h>
#include <stdint.h>
#include "io.h"
#include "vmem.h"
#include "vdp_unsafe.h"
#include "bios.h"
#include "workarea.h"
+ Include dependency graph for vdp.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  vdp_cmd
 Parameters for VDP commands. More...
 

Macros

#define VDP_H
 
#define RGB(r, g, b)    ((palette_t)((((g) & 7) << 8) | (((r) & 7) << 4) | ((b) & 7)))
 Constructs RGB color palette value.
 

Typedefs

typedef uint16_t palette_t
 Type for RGB color palette value.
 

Enumerations

enum  vdp_screen_mode {
  VDP_SCREEN_MODE_GRAPHIC_1 = 0 , VDP_SCREEN_MODE_TEXT_1 = 1 , VDP_SCREEN_MODE_MULTI_COLOR = 2 , VDP_SCREEN_MODE_GRAPHIC_2 = 3 ,
  VDP_SCREEN_MODE_GRAPHIC_3 = 4 , VDP_SCREEN_MODE_TEXT_2 = 5 , VDP_SCREEN_MODE_GRAPHIC_4 = 6 , VDP_SCREEN_MODE_GRAPHIC_5 = 7 ,
  VDP_SCREEN_MODE_GRAPHIC_6 = 8 , VDP_SCREEN_MODE_GRAPHIC_7 = 9
}
 Enumeration of VDP screen modes. More...
 
enum  vdp_screen_lines { VDP_SCREEN_LINES_192 = 0x00 , VDP_SCREEN_LINES_212 = 0x80 }
 Enumeration of VDP screen lines. More...
 
enum  vdp_sprite_size { VDP_SPRITE_SIZE_8x8 = 0 , VDP_SPRITE_SIZE_8x8_MAGNIFIED = 1 , VDP_SPRITE_SIZE_16x16 = 2 , VDP_SPRITE_SIZE_16x16_MAGNIFIED = 3 }
 Enumeration of VDP sprite size. More...
 
enum  vdp_yjk_mode { VDP_RGB = 0x00 , VDP_YJK = 0x08 , VDP_YJK_RGB = 0x18 }
 MSX2+ Enumeration of V9958 VDP's color space. More...
 
enum  vdp_cmd_logop {
  VDP_CMD_IMP = 0x00 , VDP_CMD_AND = 0x01 , VDP_CMD_OR = 0x02 , VDP_CMD_EOR = 0x03 ,
  VDP_CMD_XOR = VDP_CMD_EOR , VDP_CMD_NOT = 0x04 , VDP_CMD_TIMP = 0x08 , VDP_CMD_TAND = 0x09 ,
  VDP_CMD_TOR = 0x0a , VDP_CMD_TEOR = 0x0b , VDP_CMD_TXOR = VDP_CMD_TEOR , VDP_CMD_TNOT = 0x0c
}
 Enumeration of logical operation codes for VDP commands. More...
 
enum  vdp_cmd_dir { VDP_CMD_LRTB = (0 << 2) , VDP_CMD_RLTB = (1 << 2) , VDP_CMD_LRBT = (2 << 2) , VDP_CMD_RLBT = (3 << 2) }
 Enumeration of directions of rectangular operation for VDP commands. More...
 
enum  vdp_cmd_op {
  VDP_CMD_STOP = 0x00 , VDP_CMD_POINT = 0x40 , VDP_CMD_PSET = 0x50 , VDP_CMD_SRCH = 0x60 ,
  VDP_CMD_LINE = 0x70 , VDP_CMD_LMMV = 0x80 , VDP_CMD_LMMM = 0x90 , VDP_CMD_LMCM = 0xa0 ,
  VDP_CMD_LMMC = 0xb0 , VDP_CMD_HMMV = 0xc0 , VDP_CMD_HMMM = 0xd0 , VDP_CMD_YMMM = 0xe0 ,
  VDP_CMD_HMMC = 0xf0
}
 Enumeration of operation codes for VDP commands. More...
 

Functions

uint8_t vdp_get_status (uint8_t reg)
 MSX Read from a VDP status register.
 
void vdp_set_control (uint8_t reg, uint8_t x)
 MSX Write to a VDP control register.
 
void vdp_write_control (uint8_t reg, void *src, uint8_t len)
 MSX2 Write to a series of VDP control registers.
 
void vdp_set_color (uint8_t c)
 MSX Set VDP color register.
 
void vdp_set_palette (uint8_t idx, const palette_t palette)
 MSX2 Write to a VDP palette register.
 
void vdp_write_palette (const palette_t palettes[16])
 MSX2 Write to a series of VDP palette registers.
 
void vdp_set_screen_mode (enum vdp_screen_mode mode)
 MSX Set VDP screen mode.
 
void vdp_set_screen_lines (enum vdp_screen_lines lines)
 MSX2 Set number of visible lines.
 
void vdp_set_visible (bool visible)
 MSX Show / hide screen.
 
uint8_t vdp_get_sprite_mode (void)
 MSX Get current sprite mode.
 
void vdp_set_sprite_size (enum vdp_sprite_size size)
 MSX Set sprite size.
 
void vdp_set_sprite_visible (bool visible)
 MSX2 Show / hide sprites.
 
void vdp_set_image_table (vmemptr_t table)
 MSX Set VRAM address of the pattern name table.
 
void vdp_set_pattern_table (vmemptr_t table)
 MSX Set VRAM address of the pattern generator table.
 
void vdp_set_color_table (vmemptr_t table)
 MSX Set VRAM address of the color table.
 
void vdp_set_sprite_pattern_table (vmemptr_t table)
 MSX Set VRAM address of the sprite pattern generator table.
 
void vdp_set_sprite_attribute_table (vmemptr_t table)
 MSX Set VRAM address of the sprite attribute table.
 
void vdp_set_adjust (int8_t x, int8_t y)
 MSX2 Set VDP display adjust register.
 
void vdp_set_vscroll (uint8_t y)
 MSX2 Set VDP vertical display offset register.
 
void vdp_set_hscroll (uint16_t x)
 MSX2+ Set VDP horizontal display offset register.
 
void vdp_set_hscroll_mask (bool enable)
 MSX2+ Enables/Disables the screen mask for the leftmost 8 pixels.
 
void vdp_set_hscroll_dual_page (bool enable)
 MSX2+ Enable/disable horizontal scrolling for two pages.
 
void vdp_set_yjk_mode (enum vdp_yjk_mode yjk)
 MSX2+ Set V9958 VDP's color space to RGB, YJK, or YJK/RGB.
 
bool vdp_cmd_is_running (void)
 MSX2 Tests if a VDP command is running.
 
void vdp_cmd_await (void)
 MSX2 Wait for the VDP command to finish.
 
void vdp_cmd_set_unrestricted (bool enable)
 MSX2+ Unristricts/Restricts availability of the VDP command for some screen modes.
 
void vdp_cmd_stop (void)
 MSX2 Executes VDP command "STOP" (stop the running VDP command).
 
uint8_t vdp_cmd_execute_POINT (uint16_t sx, uint16_t sy)
 MSX2 Executes VDP command "POINT" (Read color code at the given point).
 
void vdp_cmd_execute_PSET (uint16_t dx, uint16_t dy, uint8_t color, enum vdp_cmd_logop logop)
 MSX2 Executes VDP command "PSET" (Write color code at the given point).
 
bool vdp_cmd_execute_SRCH (uint16_t *ret, uint16_t sx, uint16_t sy, uint8_t color, uint8_t arg)
 MSX2 Executes VDP command "SRCH" (Search color code from the given point towards left/right).
 
void vdp_cmd_execute_LINE (uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint8_t color, enum vdp_cmd_logop logop)
 MSX2 Executes VDP command "LINE" (Draw line w/ logical operation).
 
bool vdp_cmd_read (uint8_t *ret)
 MSX2 Reads a value from VDP.
 
void vdp_cmd_execute_LMCM (uint16_t x, uint16_t y, uint16_t w, uint16_t h, enum vdp_cmd_dir dir)
 MSX2 Executes VDP command "LMCM" (VRAM to CPU logical transfer).
 
bool vdp_cmd_write (const uint8_t val)
 MSX2 Writes a value to VDP.
 
void vdp_cmd_execute_LMMC (uint16_t x, uint16_t y, uint16_t w, uint16_t h, enum vdp_cmd_dir dir, enum vdp_cmd_logop logop)
 MSX2 Executes VDP command "LMMC" (CPU to VRAM logical transfer).
 
void vdp_cmd_execute_HMMC (uint16_t x, uint16_t y, uint16_t w, uint16_t h, enum vdp_cmd_dir dir)
 MSX2 Executes VDP command "HMMC" (CPU to VRAM high speed transfer).
 
void vdp_cmd_execute_LMMV (uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint8_t color, enum vdp_cmd_logop logop)
 MSX2 Executes VDP command "LMMV" (fills rectangular area w/ logical operation).
 
void vdp_cmd_execute_LMMM (uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t x2, uint16_t y2, enum vdp_cmd_logop logop)
 MSX2 Executes VDP command "LMMM" (copy rectangular area w/ logical operation).
 
void vdp_cmd_execute_HMMV (uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint8_t color)
 MSX2 Executes VDP command "HMMV" (fills rectangular area).
 
void vdp_cmd_execute_HMMM (uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t x2, uint16_t y2)
 MSX2 Executes VDP command "HMMM" (copy rectangular area).
 
void vdp_cmd_execute_YMMM (uint16_t x, uint16_t y, uint16_t h, uint16_t y2, uint8_t dir)
 MSX2 Executes VDP command "YMMM" (copy rectangular area from VRAM to VRAM vertically).
 
void vdp_cmd_set_SX (struct vdp_cmd *c, uint16_t sx)
 MSX2 Set SX value (x-coordinate of the source point) for VDP commands.
 
void vdp_cmd_set_SY (struct vdp_cmd *c, uint16_t sy)
 MSX2 Set SY value (y-coordinate of the source point) for VDP commands.
 
void vdp_cmd_set_DX (struct vdp_cmd *c, uint16_t dx)
 MSX2 Set DX value (x-coordinate of the destination point) for VDP commands.
 
void vdp_cmd_set_DY (struct vdp_cmd *c, uint16_t dy)
 MSX2 Set DY value (y-coordinate of the destination point) for VDP commands.
 
void vdp_cmd_set_NX (struct vdp_cmd *c, uint16_t nx)
 MSX2 Set NX value (width) for VDP commands.
 
void vdp_cmd_set_NY (struct vdp_cmd *c, uint16_t ny)
 MSX2 Set NY value (height) for VDP commands.
 
void vdp_cmd_set_CLR (struct vdp_cmd *c, uint8_t clr)
 MSX2 Set CLR value (color) for VDP commands.
 
void vdp_cmd_set_ARG (struct vdp_cmd *c, uint8_t arg)
 MSX2 Set ARG value (DIX, DIY, etc.) for VDP commands.
 
void vdp_cmd_set_logop (struct vdp_cmd *c, enum vdp_cmd_logop logop)
 MSX2 Set a logical operation code for VDP commands.
 
void vdp_cmd_execute (const struct vdp_cmd *c, enum vdp_cmd_op opcode)
 MSX2 Executes a VDP command.
 

Detailed Description

Data types and functions for VDP (Video Display Proccessor) access.

Definition in file vdp.h.

Macro Definition Documentation

◆ VDP_H

#define VDP_H

Definition at line 24 of file vdp.h.