VDP_MODE

VDP display modes

VDP_VERSION

VDP version enumaration

VRAM_SIZE

VRAM size enumaration

Helper
VDP_Initialize
void VDP_Initialize()

Initialize VDP module. [MSX1/2/2+/TR] Retreive BIOS initiale value.  This function is called automatically when VDP_SetMode is called if the macro VDP_AUTO_INIT equals 1.

VDP_GetVersion
u8 VDP_GetVersion() __naked

Get VDP version. [MSX1/2/2+/TR]

Return

VDP identifier (see VDP_VERSION).

VDP_ClearVRAM
void VDP_ClearVRAM()

Clear the VRAM content. [MSX1/2/2+/TR]

Screen mode
VDP_SetMode
void VDP_SetMode(
const u8 mode
)

Set screen mode. [MSX1/2/2+/TR]

Parameters
mode
const u8

The new screen mode to set (see VDP_MODE enumeration)

VDP_GetMode
inline u8 VDP_GetMode()

Get current screen mode. [MSX1/2/2+/TR]

Return

Current screen mode

VDP_IsBitmapMode
inline bool VDP_IsBitmapMode(
const u8 mode
)

Tell if the given screen mode is a bitmap mode (pattern/text mode otherwise). [MSX1/2/2+/TR]

Parameters
mode
const u8

VDP mode to set (see VDP_MODE enumeration)

Return

TRUE if the given screen mode is a bitmap mode, FALSE otherwise.

VDP_IsPatternMode
inline bool VDP_IsPatternMode(
const u8 mode
)

Tell if the given screen mode is a pattern/text mode (bitmap mode otherwise). [MSX1/2/2+/TR]

Parameters
mode
const u8

VDP mode to set (see VDP_MODE enumeration)

Return

TRUE if the given screen mode is a pattern/text mode, FALSE otherwise.

VDP_SetModeFlag
void VDP_SetModeFlag(
u8 flag
)

Set screen mode flag. [MSX1/2/2+/TR] VRAM tables address must be set to fit the new screen mode

Parameters
flag
u8

Screen binary flag

Direct access
VDP_RegWrite
void VDP_RegWrite(
u8 reg,
u8 value
) __PRESERVES(b, c, d, e, iyl, iyh)

Set register value. [MSX1/2/2+/TR]

Parameters
reg
u8

Register number

value
u8

Value to set

VDP_RegWriteBak
void VDP_RegWriteBak(
u8 reg,
u8 value
) __PRESERVES(d, e, iyl, iyh)

Set register value after backuping previous value. [MSX1/2/2+/TR]

Parameters
reg
u8

Register number

value
u8

Value to set

VDP_RegWriteBakMask
void VDP_RegWriteBakMask(
u8 idx,
u8 mask,
u8 value
)

Set register value after backuping previous value using mask. [MSX1/2/2+/TR]

Parameters
reg

Register number

mask
u8

Previous value reset mask

flag

Value to set

VDP_ReadDefaultStatus
u8 VDP_ReadDefaultStatus() __PRESERVES(b, c, d, e, h, l, iyl, iyh)

Read default S#0 register. [MSX1/2/2+/TR]

Return

Status register #0 value

VDP_ReadStatus
u8 VDP_ReadStatus(
u8 stat
) __PRESERVES(b, c, d, e, h, iyl, iyh)

Read a given status register then reset status register to default (0). [MSX2/2+/TR]

Parameters
stat
u8

Status register number (0-9)

Return

The given status register value

VDP_WriteVRAM_16K
void VDP_WriteVRAM_16K(
const u8* src,
u16 dest,
u16 count
)

Write data from RAM to VRAM. [MSX1/2/2+/TR]

Parameters
src
const u8*

Source data address in RAM

dest
u16

Destination address in VRAM (14bits address for 16KB VRAM)

count
u16

Number of byte to copy in VRAM. Note: A count of 0 mean 65536

VDP_FillVRAM_16K
void VDP_FillVRAM_16K(
u8 value,
u16 dest,
u16 count
)

Fill VRAM area with a given value. [MSX1/2/2+/TR] Use fast 16-bits loop (28 cc)

Parameters
value
u8

Byte value to copy in VRAM

dest
u16

Destination address in VRAM (14 bits address form 16 KB VRAM)

count
u16

Number of byte to copy in VRAM. Note: A count of 0 mean 65536

VDP_FastFillVRAM_16K
void VDP_FastFillVRAM_16K(
u8 value,
u16 dest,
u16 count
)

Fill VRAM area with a given value [MSX1/2/2+/TR] Use ultra fast 16-bits using 16 unrolled out loop (~14,9 cc)

Parameters
value
u8

Byte value to copy in VRAM

dest
u16

Destination address in VRAM (14 bits address form 16 KB VRAM)

count
u16

Nomber of byte to copy in VRAM. Note: A count of 0 mean 65536

VDP_ReadVRAM_16K
void VDP_ReadVRAM_16K(
u16 src,
u8* dest,
u16 count
)

Read data from VRAM to RAM. [MSX1/2/2+/TR]

Parameters
src
u16

Source address in VRAM (14bits address form 16KB VRAM)

dest
u8*

Desitation data address in RAM

count
u16

Number of byte to copy from VRAM. Note: A count of 0 mean 65536

VDP_Poke_16K
void VDP_Poke_16K(
u8 val,
u16 dest
) __PRESERVES(c, h, l, iyl, iyh)

Write a value to VRAM. [MSX1/2/2+/TR]

Parameters
val
u8

Value to write in VRAM

dest
u16

Desitation address in VRAM (14bits address form 16KB VRAM)

VDP_Peek_16K
u8 VDP_Peek_16K(
u16 src
) __PRESERVES(b, c, d, e, iyl, iyh)

Read a value from VRAM. [MSX1/2/2+/TR]

Parameters
src
u16

Source address in VRAM (14bits address form 16KB VRAM)

Return

Value read in VRAM

VDP_WriteVRAM_128K
void VDP_WriteVRAM_128K(
const u8* src,
u16 destLow,
u8 destHigh,
u16 count
)

Write data from RAM to VRAM. [MSX2/2+/TR]

Parameters
src
const u8*

Source data address in RAM

destLow
u16

Destination address in VRAM (16 LSB of 17-bits VRAM address)

destHigh
u8

Destination address in VRAM (1 MSB of 17-bits VRAM address)

count
u16

Nomber of byte to copy in VRAM. Note: A count of 0 mean 65536

VDP_FillVRAM_128K
void VDP_FillVRAM_128K(
u8 value,
u16 destLow,
u8 destHigh,
u16 count
)

Fill VRAM area with a given value. [MSX2/2+/TR]

Parameters
value
u8

Byte value to copy in VRAM

destLow
u16

Destination address in VRAM (16 LSB of 17-bits VRAM address)

destHigh
u8

Destination address in VRAM (1 MSB of 17-bits VRAM address)

count
u16

Nomber of byte to copy in VRAM. Note: A count of 0 mean 65536

VDP_ReadVRAM_128K
void VDP_ReadVRAM_128K(
u16 srcLow,
u8 srcHigh,
u8* dest,
u16 count
)

Read data from VRAM to RAM. [MSX2/2+/TR]

Parameters
srcLow
u16

Source address in VRAM (16 LSB of 17-bits VRAM address)

srcHigh
u8

Source address in VRAM (1 MSB of 17-bits VRAM address)

dest
u8*

Desitation data address in RAM

count
u16

Nomber of byte to copy from VRAM. Note: A count of 0 mean 65536

VDP_Poke_128K
void VDP_Poke_128K(
u8 val,
u16 destLow,
u8 destHigh
)

Write a value to VRAM. [MSX2/2+/TR]

Parameters
val
u8

Value to write in VRAM

destLow
u16

Destination address in VRAM (16 LSB of 17-bits VRAM address)

destHigh
u8

Destination address in VRAM (1 MSB of 17-bits VRAM address)

VDP_Peek_128K
u8 VDP_Peek_128K(
u16 srcLow,
u8 srcHigh
)

Read a value from VRAM. [MSX2/2+/TR]

Parameters
srcLow
u16

Source address in VRAM (16 LSB of 17-bits VRAM address)

srcHigh
u8

Source address in VRAM (1 MSB of 17-bits VRAM address)

Return

Value read in VRAM

Display setup
VDP_EnableDisplay
inline void VDP_EnableDisplay(
bool enable
)

Enable/disable screen display (register 1). [MSX1/2/2+/TR]

Parameters
enable
bool

TRUE to enable, FALSE to disable

VDP_EnableVBlank
inline void VDP_EnableVBlank(
bool enable
)

Enable/disable vertical interruption (register 1). [MSX1/2/2+/TR]

Parameters
enable
bool

TRUE to enable, FALSE to disable

VDP_SetColor
inline void VDP_SetColor(
u8 color
)

Set text and border default color (register 7). [MSX1/2/2+/TR]

Parameters
color
u8

Defaut color (Format: [TXT:4|BG:4])

VDP_SetColor2
inline void VDP_SetColor2(
u8 bg,
u8 text
)

Set text and border default color (register 7). [MSX1/2/2+/TR]

Parameters
bg
u8

Background/border color (0~15)

text
u8

Text color (0~15)

VDP_EnableSprite
inline void VDP_EnableSprite(
u8 enable
)

Enable/disable sprite rendering (register 8). [MSX2/2+/TR]

Parameters
enable
u8

TRUE to enable, FALSE to disable

VDP_DisableSprite
inline void VDP_DisableSprite()

Disable sprite rendering (see VDP_EnableSprite). [MSX1/2/2+/TR]

VDP_EnableTransparency
inline void VDP_EnableTransparency(
u8 enable
)

Enable/disable color 0 transparency (register 8). [MSX2/2+/TR]

Parameters
enable
u8

TRUE to enable, FALSE to disable

VDP_EnableHBlank
inline void VDP_EnableHBlank(
bool enable
)

Enable/disable horizontal interruption (register 0). [MSX2/2+/TR]

Parameters
enable
bool

TRUE to enable, FALSE to disable

VDP_SetHBlankLine
inline void VDP_SetHBlankLine(
u8 line
)

Set the horizontal-blank interruption line (register 19). [MSX2/2+/TR]

Parameters
line
u8

Line number where the interruption will occure

VDP_SetVerticalOffset
inline void VDP_SetVerticalOffset(
u8 offset
)

Set the vertical rendering offset (register 23). [MSX2/2+/TR]

Parameters
offset
u8

Number of lines of offset from the top of the screen

VDP_SetAdjustOffset
void VDP_SetAdjustOffset(
u8 offset
)

Adjustment of the display location on the screen (register 18). [MSX2/2+/TR]

Parameters
offset
u8

Screen display position offset (MSB 4-bits: vertical offset, LSB 4-bits: horizontal offset)

VDP_SetAdjustOffsetXY
inline void VDP_SetAdjustOffsetXY(
i8 x,
i8 y
)

Adjustment of the display location on the screen (register 18). [MSX2/2+/TR]

Parameters
x
i8

Horizontal screen display position offset [-7:+8]

y
i8

Vertical screen display position offset [-7:+8]

VDP_SetGrayScale
inline void VDP_SetGrayScale(
bool enable
)

Enable/disable grayscale (register 8). [MSX2/2+/TR]

Parameters
enable
bool

TRUE to enable, FALSE to disable

VDP_FREQ

VDP frequency flags

VDP_SetFrequency
inline void VDP_SetFrequency(
u8 freq
)

Change VDP frequency (register 9). [MSX2/2+/TR]

Parameters
freq
u8

Can be 50 (VDP_FREQ_50HZ) or 60 Hz (VDP_FREQ_60HZ)

VDP_GetFrequency
inline u8 VDP_GetFrequency()

Change VDP frequency (register 9). [MSX2/2+/TR]

Return

Can be 50 (VDP_FREQ_50HZ) or 60 Hz (VDP_FREQ_60HZ)

VDP_LINE

VDP line flags

VDP_SetLineCount
inline void VDP_SetLineCount(
u8 lines
)

Set line count for the current screen mode (register 9). [MSX2/2+/TR]

Parameters
lines
u8

Can be VDP_LINE_192 or VDP_LINE_212

VDP_SetPageAlternance
inline void VDP_SetPageAlternance(
bool enable
)

Enable automatic page switch on even/odd frames. [MSX2/2+/TR]

Parameters
enable
bool

TRUE to enable, FALSE to disable

VDP_SetInterlace
inline void VDP_SetInterlace(
bool enable
)

Enable or disable interlace mode. [MSX2/2+/TR] Needs VDP_SetPageAlternance to be set to TRUE and VDP_SetPage to a odd value.

Parameters
enable
bool

TRUE to enable, FALSE to disable

VDP_FRAME

VDP render modes

VDP_SetFrameRender
inline void VDP_SetFrameRender(
u8 mode
)

Set the frame render mode. [MSX2/2+/TR]

Parameters
mode
u8

Can be VDP_FRAME_STATIC, VDP_FRAME_ALTERNANCE or VDP_FRAME_INTERLACE

VDP_SetPalette
void VDP_SetPalette(
const u8* pal
) __FASTCALL __PRESERVES(d, e, iyl, iyh)

Set a new color palette from index 1 to 15. [MSX2/2+/TR]

Parameters
pal
const u8*

Address of the palette in RAM (table of 15 * 2 bytes) Format: [0:5|green:3|0|red:3|0|blue:3]

VDP_SetPaletteEntry
void VDP_SetPaletteEntry(
u8 index,
u16 color
)

Set a given color entry in the palette. [MSX2/2+/TR]

Parameters
index
u8

Index of the palette entry (0-15)

color
u16

16 bits color value (@see RGB16 macro) Format: [0:5|green:3|0|red:3|0|blue:3]

VDP_SetDefaultPalette
void VDP_SetDefaultPalette()

Reset the default MSX2 palette. [MSX2/2+/TR]

VDP_SetMSX1Palette
void VDP_SetMSX1Palette()

Reset the default MSX1 palette. [MSX2/2+/TR]

VDP_YJK

YJK modes

VDP_SetYJK
inline void VDP_SetYJK(
u8 mode
)

Set YJK mode. [MSX2+/TR].  See VDP_YJK enum.

Parameters
mode
u8

YJK mode (can be VDP_YJK_OFF, VDP_YJK_ON or VDP_YJK_YAE)

VDP_ExpendCommand
inline void VDP_ExpendCommand(
u8 enable
)

Enables the VDP commands for screens 0 to 4 (register 25). [MSX2+/TR]

Parameters
enable
u8

TRUE to enable, FALSE to disable

VDP_EnableMask
inline void VDP_EnableMask(
u8 enable
)

Allows to hide the first 8 vertical lines at left of screen (register 25). [MSX2+/TR]

Parameters
enable
u8

TRUE to enable, FALSE to disable

VDP_SetHorizontalOffset
void VDP_SetHorizontalOffset(
u16 offset
)

Set the horizontal rendeing offset. [MSX2+/TR]

Parameters
offset
u16

Screen horizontal offset (9-bits value in pixel)

VDP_SetHorizontalMode
inline void VDP_SetHorizontalMode(
u8 mode
)

Set horizontal scrolling to occurs on a single page or two pages (register 25). [MSX2+/TR]

Parameters
mode
u8

Can be VDP_HSCROLL_SINGLE or VDP_HSCROLL_DOUBLE

VRAM tables address
VDP_SetLayoutTable
void VDP_SetLayoutTable(
VADDR addr
)

Set layout table VRAM address. [MSX1/2/2+/TR]

Parameters
addr
VADDR

VRAM address where to put the table (u16 for 14-bits address and u32 for 17-bits)

VDP_SetLayoutTableEx
inline void VDP_SetLayoutTableEx(
VADDR addr,
u8 r2
)

Set layout table VRAM address. [MSX1/2/2+/TR]

VDP_SetColorTable
void VDP_SetColorTable(
VADDR addr
)

Set color table VRAM address. [MSX1/2/2+/TR]

Parameters
addr
VADDR

VRAM address where to put the table (u16 for 14-bits address and u32 for 17-bits)

VDP_SetColorTableEx
inline void VDP_SetColorTableEx(
VADDR addr,
u8 r3,
u8 r10
)

Set color table VRAM address. [MSX1/2/2+/TR]

VDP_SetPatternTable
void VDP_SetPatternTable(
VADDR addr
)

Set pattern table VRAM address. [MSX1/2/2+/TR]

Parameters
addr
VADDR

VRAM address where to put the table (u16 for 14-bits address and u32 for 17-bits)

VDP_SetPatternTableEx
inline void VDP_SetPatternTableEx(
VADDR addr,
u8 r4
)

Set pattern table VRAM address. [MSX1/2/2+/TR]

VDP_SetSpriteAttributeTable
void VDP_SetSpriteAttributeTable(
VADDR addr
)

Set sprite attribute table address. [MSX1/2/2+/TR]

Parameters
addr
VADDR

VRAM address where to put the table (u16 for 14-bits address and u32 for 17-bits)

VDP_SetSpriteAttributeTableEx
inline void VDP_SetSpriteAttributeTableEx(
VADDR addr,
u8 r5,
u8 r11
)

Set sprite attribute table address. [MSX1/2/2+/TR]

VDP_SetSpritePatternTable
void VDP_SetSpritePatternTable(
VADDR addr
)

Set sprite pattern table address. [MSX1/2/2+/TR]

Parameters
addr
VADDR

VRAM address where to put the table (u16 for 14-bits address and u32 for 17-bits)

VDP_SetSpritePatternTableEx
inline void VDP_SetSpritePatternTableEx(
VADDR addr,
u8 r6
)

Set sprite pattern table address. [MSX1/2/2+/TR]

VDP_GetLayoutTable
inline VADDR VDP_GetLayoutTable()

Get address of the Pattern Layout Table (Name)

Return

VRAM address of the table (u16 for 14-bits address and u32 for 17-bits)

VDP_GetColorTable
inline VADDR VDP_GetColorTable()

Get address of the Color Table

Return

VRAM address of the table (u16 for 14-bits address and u32 for 17-bits)

VDP_GetPatternTable
inline VADDR VDP_GetPatternTable()

Get address of the Pattern Generator Table

Return

VRAM address of the table (u16 for 14-bits address and u32 for 17-bits)

VDP_GetSpriteAttributeTable
inline VADDR VDP_GetSpriteAttributeTable()

Get address of the Sprite Attribute Table

Return

VRAM address of the table (u16 for 14-bits address and u32 for 17-bits)

VDP_GetSpritePatternTable
inline VADDR VDP_GetSpritePatternTable()

Get address of the Sprite Pattern Generator Table

Return

VRAM address of the table (u16 for 14-bits address and u32 for 17-bits)

VDP_GetSpriteColorTable
inline VADDR VDP_GetSpriteColorTable()

Get address of the Sprite Color Table

Return

VRAM address of the table (u16 for 14-bits address and u32 for 17-bits)

VDP_SetPage
void VDP_SetPage(
u8 page
)

Set current VRAM page. [MSX2/2+/TR]

Parameters
page
u8

Page number to set

Sprite
VDP_SetSpriteFlag
inline void VDP_SetSpriteFlag(
u8 flag
)

Set sprite rendering parameters. [MSX1/2/2+/TR]

Parameters
flag
u8

Sprite flag to be set. Can be a combination of: VDP_SPRITE_SIZE_8 (Use 8x8 sprite size) VDP_SPRITE_SIZE_16 (Use 16x16 sprite size) VDP_SPRITE_SCALE_1 (Normal size of the sprite; 1 dot = 1 px) VDP_SPRITE_SCALE_2 (Double the size of the sprite; 1 dot = 2 px)

VDP_SetSpriteTables
inline void VDP_SetSpriteTables(
VADDR patAddr,
VADDR attAddr
)

Set sprite tables address. [MSX1/2/2+/TR]

Parameters
pattern

Sprite pattern table address

attrib

Sprite attribute table address

VDP_LoadSpritePattern
void VDP_LoadSpritePattern(
const u8* addr,
u8 index,
u8 count
)

Load sprite pattern data into VRAM. [MSX1/2/2+/TR]

Parameters
addr
const u8*

Source address for sprite patterns (in RAM/ROM).

index
u8

Index of the first VRAM sprite pattern to copy to (in 16x16 mode, only multiple of 4 can be used).

count
u8

Number of patterns to copy (8x8 mode use 1 per sprite shape, while 16x16 mode use 4).

VDP_SetSpriteSM1
void VDP_SetSpriteSM1(
u8 index,
u8 x,
u8 y,
u8 shape,
u8 color
)

Set sprite attribute for Sprite Mode 1. [MSX1/2/2+/TR]

Parameters
index
u8

Sprite index in the attribute table

x
u8

Initial X screen coordinate

y
u8

Initial Y screen coordinate

shape
u8

Sprite pattern index (in 16x16 mode, only multiple of 4 can be used)

color
u8

Sprite color (LSB 4-bits) + optional EC flag (VDP_SPRITE_EC)

VDP_SetSprite
void VDP_SetSprite(
u8 index,
u8 x,
u8 y,
u8 shape
)

Set sprite attribute for Sprite Mode 2. [MSX2/2+/TR]

Parameters
index
u8

Sprite index in the attribute table

x
u8

Initial X screen coordinate

y
u8

Initial Y screen coordinate

shape
u8

Sprite pattern index (in 16x16 mode, only multiple of 4 can be used)

VDP_SetSpriteExMultiColor
void VDP_SetSpriteExMultiColor(
u8 index,
u8 x,
u8 y,
u8 shape,
const u8* ram
)

Set sprite attribute for Sprite Mode 2 and fill color table with color data. [MSX2/2+/TR]

Parameters
index
u8

Sprite index in the attribute table

x
u8

Initial X screen coordinate

y
u8

Initial Y screen coordinate

shape
u8

Sprite pattern index (in 16x16 mode, only multiple of 4 can be used)

ram
const u8*

Address to a 16 bytes buffer that determine the sprite colors (1 byte = 1 line).  With this function, you must provide a 16 bytes buffer even for 8x8 size mode.

VDP_SetSpriteExUniColor
void VDP_SetSpriteExUniColor(
u8 index,
u8 x,
u8 y,
u8 shape,
u8 color
)

Set sprite attribute for Sprite Mode 2 and fill color table with unique color. [MSX2/2+/TR]

Parameters
index
u8

Sprite index in the attribute table

x
u8

Initial X screen coordinate.

y
u8

Initial Y screen coordinate.

shape
u8

Sprite pattern index (in 16x16 mode, only multiple of 4 can be used).

color
u8

Sprite color (LSB 4-bits) + optional EC, CC & IC flags.  (this color is used for the all 8/16 lines of the sprite).

VDP_SetSpritePosition
void VDP_SetSpritePosition(
u8 index,
u8 x,
u8 y
)

Update sprite position. [MSX1/2/2+/TR]

Parameters
index
u8

Sprite index in the attribute table.

x
u8

Initial X screen coordinate.

y
u8

Initial Y screen coordinate.

VDP_SetSpritePositionX
void VDP_SetSpritePositionX(
u8 index,
u8 x
)

Update sprite position X. [MSX1/2/2+/TR]

Parameters
index
u8

Sprite index in the attribute table.

x
u8

Initial X screen coordinate.

VDP_SetSpritePositionY
void VDP_SetSpritePositionY(
u8 index,
u8 y
)

Update sprite position Y. [MSX1/2/2+/TR]

Parameters
index
u8

Sprite index in the attribute table.

y
u8

Initial Y screen coordinate.

VDP_SetSpritePattern
void VDP_SetSpritePattern(
u8 index,
u8 shape
)

Update sprite pattern. [MSX1/2/2+/TR]

Parameters
index
u8

Sprite index in the attribute table.

shape
u8

Sprite pattern index (in 16x16 mode, only multiple of 4 can be used).

VDP_SetSpriteColorSM1
void VDP_SetSpriteColorSM1(
u8 index,
u8 color
)

Update sprite pattern (Sprite Mode 1). [MSX1/2/2+/TR]

Parameters
index
u8

Sprite index in the attribute table

color
u8

Sprite color (LSB 4-bits) + optional EC flag (see <VDP_SPRITE_EC>)

VDP_SetSpriteUniColor
void VDP_SetSpriteUniColor(
u8 index,
u8 color
)

Update sprite color (Uni-color). [MSX2/2+/TR]

Parameters
index
u8

Sprite index in the attribute table

color
u8

Sprite color (LSB 4-bits) + optional EC, CC & IC flags (this color is used for the all 8 lines of the sprite)

VDP_SetSpriteMultiColor
void VDP_SetSpriteMultiColor(
u8 index,
const u8* ram
)

Update sprite color (Multi-color). [MSX2/2+/TR]

Parameters
index
u8

Sprite index in the attribute table

ram
const u8*

Address to a 16 bytes buffer that determine the sprite colors (1 byte = 1 line).  With this function, you must provide a 16 bytes buffer even for 8x8 size mode.

VDP_SetSpriteData
void VDP_SetSpriteData(
u8 index,
const u8* data
)

Set sprite data for Sprite Mode 2. [MSX2/2+/TR]

Parameters
index
u8

Sprite index in the attribute table

data
const u8*

Address to a 3 bytes data buffer including sprite position and shape

VDP_DisableSpritesFrom
void VDP_DisableSpritesFrom(
u8 index
)

Disable all sprites from a given index. [MSX1/2/2+/TR]

This function use VDP magic Y coordinate to disable the given sprite and all the following one.  If the given sprite Y coordinate is modified to another value, it will be active again and so, the following sprites too.

Parameters
index
u8

Disable sprite rendering starting from this sprite index

VDP_HideSprite
inline void VDP_HideSprite(
u8 index
)

Hide a given sprite (don't disable following sprites). [MSX1/2/2+/TR]

This function simply put the given sprite off (bellow) the screen.

Parameters
index
u8

Index of the sprite to hide

VDP_HideAllSprites
inline void VDP_HideAllSprites()

Hide all sprite sprite. [MSX1/2/2+/TR]

This function simply put the sprites off (bellow) the screen.

Parameters
index

Index of the sprite to hide

Blink

Blink feature for Text 2 mode

VDP_SetBlinkColor
inline void VDP_SetBlinkColor(
u8 color
)

Set text and border blink color (R#12). [MSX2/2+/TR]

Parameters
color
u8

Defaut color (Format: [TXT:4|BG:4])

VDP_SetBlinkColor2
inline void VDP_SetBlinkColor2(
u8 bg,
u8 text
)

Set text and border blink color (R#12). [MSX2/2+/TR]

Parameters
bg
u8

Background/border color (0~15)

text
u8

Text color (0~15)

VDP_SetBlinkTime
inline void VDP_SetBlinkTime(
u8 time
)

Set blink time for the both defined colors (R#13). [MSX2/2+/TR]

Parameters
time
u8

Display time (Format: [EVEN:4|ODD:4])

VDP_SetBlinkTime2
inline void VDP_SetBlinkTime2(
u8 even,
u8 odd
)

Set blink time for the both defined colors (R#13). [MSX2/2+/TR] Check <VDP_BLINK_TIME> enumeration for correspondance between value and time in miliseconds

Parameters
even
u8

Display time for even page / default color (0~15)

odd
u8

Display time for odd page / blink color (0~15)

VDP_SetInfiniteBlink
inline void VDP_SetInfiniteBlink()

Set blink timer to always display alternative color (R#13). [MSX2/2+/TR]

VDP_CleanBlinkScreen
inline void VDP_CleanBlinkScreen()

Clean blink attribute on the whole screen. [MSX2/2+/TR]

VDP_SetBlinkScreen
inline void VDP_SetBlinkScreen()

Set blink attribute on the whole screen. [MSX2/2+/TR]

VDP_SetBlinkLine
inline void VDP_SetBlinkLine(
u8 y
)

Set blink attribute on the given screen line. [MSX2/2+/TR]

Parameters
y
u8

Line number (0 to 23, or 27 if <VDP_LINE_212> is set)

VDP_SetBlinkChunk
inline void VDP_SetBlinkChunk(
u8 x,
u8 y
)

Set blink attribute for a the given screen chunk. [MSX2/2+/TR] A screen 'chunk' is a block of 8 consecutive tiles starting at a x-coordinate multiple of 8 column number (0, 8, 16, etc.)

Parameters
x
u8

Column number (0 to 79)

y
u8

Row number (0 to 23, or 27 if <VDP_LINE_212> is set)

VDP_SetBlinkChunkMask
inline void VDP_SetBlinkChunkMask(
u8 x,
u8 y,
u8 mask
)

Set blink attribute mask for a the given screen chunk. [MSX2/2+/TR] A screen 'chunk' is a block of 8 consecutive tiles starting at a x-coordinate multiple of 8 column number (0, 8, 16, etc.)

Parameters
x
u8

Column number (0 to 79)

y
u8

Row number (0 to 23, or 27 if <VDP_LINE_212> is set)

mask
u8

Chunk mask (1 bit is equal to 1 tile; bit #0 is the left most tile)

VDP_SetBlinkChunkX
inline void VDP_SetBlinkChunkX(
u8 x,
u8 y,
u8 num
)

Set blink attribute for a the given number of chunk. [MSX2/2+/TR] A screen 'chunk' is a block of 8 consecutive tiles starting at a x-coordinate multiple of 8 column number (0, 8, 16, etc.)

Parameters
x
u8

Column number (0 to 79)

y
u8

Row number (0 to 23, or 27 if <VDP_LINE_212> is set)

VDP_SetBlinkTile
void VDP_SetBlinkTile(
u8 x,
u8 y
)

Set blink attribute for a the given screen tile. [MSX2/2+/TR]

Parameters
x
u8

Column number (0 to 79)

y
u8

Row number (0 to 23, or 27 if <VDP_LINE_212> is set)

GM2

Graph mode 2 & 3 specific functions

VDP_FillScreen_GM2
inline void VDP_FillScreen_GM2(
u8 value
)

Fill the full screen with a given pattern value. [MSX1/2/2+/TR]

Parameters
value
u8

Pattern index to fill In G2/G3 modes, the same index can define different pattern in the 3 vertical sections

VDP_Poke_GM2
inline void VDP_Poke_GM2(
u8 x,
u8 y,
u8 value
)

Set a GM cell value from x/y coordinate

VDP_Peek_GM2
inline u8 VDP_Peek_GM2(
u8 x,
u8 y
)

Get a GM cell value from x/y coordinate

VDP_LoadPattern_GM2
void VDP_LoadPattern_GM2(
const u8* src,
u8 count,
u8 offset
)

Load tile patterns in all 3 screen sections. [MSX1/2/2+/TR]

Parameters
src
const u8*

Address of data buffer to copy to VRAM

count
u8

Number of pattern to copy. Note: A count of 0 mean 256

offset
u8

Pattern index from which to copy data

VDP_LoadColor_GM2
void VDP_LoadColor_GM2(
const u8* src,
u8 count,
u8 offset
)

Load tile colors in all 3 screen sections. [MSX1/2/2+/TR]

Parameters
src
const u8*

Address of data buffer to copy to VRAM

count
u8

Number of pattern to copy. Note: A count of 0 mean 256

offset
u8

Pattern index from which to copy data

VDP_LoadBankPattern_GM2
inline void VDP_LoadBankPattern_GM2(
const u8* src,
u8 count,
u8 bank,
u8 offset
)

Load tile patterns in a given screen section (bank). [MSX1/2/2+/TR]

Parameters
src
const u8*

Address of data buffer to copy to VRAM

count
u8

Number of pattern to copy. Note: A count of 0 mean 256

bank
u8

Screen section number (bank) from 0 (up) to 2 (bottom). On MSX2 or higher, a 4th bank is accessible via vertical scrolling

offset
u8

Pattern index from which to copy data

VDP_LoadBankColor_GM2
inline void VDP_LoadBankColor_GM2(
const u8* src,
u8 count,
u8 bank,
u8 offset
)

Load tile colors in a given screen section (bank). [MSX1/2/2+/TR]

Parameters
src
const u8*

Address of data buffer to copy to VRAM

count
u8

Number of pattern to copy. Note: A count of 0 mean 256

bank
u8

Screen section number (bank) from 0 (up) to 2 (bottom). On MSX2 or higher, a 4th bank is accessible via vertical scrolling

offset
u8

Pattern index from which to copy data

VDP_WriteLayout_GM2
void VDP_WriteLayout_GM2(
const u8* src,
u8 dx,
u8 dy,
u8 nx,
u8 ny
)

Copy patterns layout to a given rectangle. [MSX1/2/2+/TR]

Parameters
src
const u8*

Address of data buffer to copy to VRAM

dx
u8

Destination starting X position

dy
u8

Destination starting Y position

dx
u8

Destination width

dy
u8

Destination height

VDP_FillLayout_GM2
void VDP_FillLayout_GM2(
u8 value,
u8 dx,
u8 dy,
u8 nx,
u8 ny
)

Fill a rectangle with a given value. [MSX1/2/2+/TR]

Parameters
value
u8

Pattern index to fill

dx
u8

Destination starting X position

dy
u8

Destination starting Y position

dx
u8

Destination width

dy
u8

Destination height

VDP_GetColorTable_GM2
inline VADDR VDP_GetColorTable_GM2(
u8 bank
)

Get address of the Color Table of the given GM2 tilset bank (0-2)

Return

VRAM address of the table (u16 for 14-bits address and u32 for 17-bits)

VDP_GetPatternTable_GM2
inline VADDR VDP_GetPatternTable_GM2(
u8 bank
)

Get address of the Pattern Generator Table of the given GM2 tilset bank (0-2)

Return

VRAM address of the table (u16 for 14-bits address and u32 for 17-bits)

Command

VDP commands wrapper functions

VDP_CommandWait
void VDP_CommandWait() __PRESERVES(b, c, d, e, h, l, iyl, iyh)

Wait for previous VDP command to be finished. [MSX2/2+/TR]

VPD_CommandSetupR32
void VPD_CommandSetupR32()

Send VDP command (form registres 32 to 46). [MSX2/2+/TR]

VPD_CommandSetupR36
void VPD_CommandSetupR36()

Send VDP command (form registres 36 to 46). [MSX2/2+/TR]

VPD_CommandWriteLoop
void VPD_CommandWriteLoop(
const u8* addr
) __FASTCALL __PRESERVES(b, d, e, iyl, iyh)

Write to VRAM command loop. [MSX2/2+/TR]

Parameters
addr
const u8*

Address of the source buffer

VPD_CommandReadLoop
void VPD_CommandReadLoop(
u8* addr
) __FASTCALL

Read to VRAM command loop. [MSX2/2+/TR]

Parameters
addr
u8*

Address of the destination buffer (in RAM)

VDP_CommandCustomR32
void VDP_CommandCustomR32(
const struct VDP_Command* data
)

Send VDP custom command through buffer (form registres 32 to 46). [MSX2/2+/TR]

VDP_CommandCustomR36
void VDP_CommandCustomR36(
const struct VDP_Command36* data
)

Send VDP custom command through buffer (form registres 36 to 46). [MSX2/2+/TR]