openMSX
Public Member Functions | Static Public Attributes | List of all members
openmsx::DisplayMode Class Reference

Represents a VDP display mode. More...

#include <DisplayMode.hh>

Public Member Functions

constexpr DisplayMode ()=default
 Create the initial display mode.
 
constexpr DisplayMode (byte reg0, byte reg1, byte reg25)
 Create a specific display mode.
 
constexpr DisplayMode updateReg25 (byte reg25) const
 
constexpr void reset ()
 Bring the display mode to its initial state.
 
constexpr bool operator== (const DisplayMode &) const =default
 Equals operator.
 
constexpr byte getByte () const
 Get the display mode as a byte: YAE YJK M5..M1 combined.
 
constexpr void setByte (byte mode_)
 Used for de-serialization.
 
constexpr byte getBase () const
 Get the base display mode as an integer: M5..M1 combined.
 
constexpr bool isV9938Mode () const
 Was this mode introduced by the V9938?
 
constexpr bool isTextMode () const
 Is the current mode a text mode? Text1 and Text2 are text modes.
 
constexpr bool isBitmapMode () const
 Is the current mode a bitmap mode? Graphic4 and higher are bitmap modes.
 
constexpr bool isPlanar () const
 Is VRAM "planar" in the current display mode? Graphic 6 and 7 spread their bytes over two VRAM ICs, such that the even bytes go to the first half of the address space and the odd bytes to the second half.
 
constexpr bool isSpriteNarrow () const
 Are sprite pixels narrow?
 
constexpr int getSpriteMode (bool isMSX1) const
 Get the sprite mode of this display mode.
 
constexpr unsigned getLineWidth () const
 Get number of pixels on a display line in this mode.
 

Static Public Attributes

static constexpr uint8_t GRAPHIC1 = 0x00
 
static constexpr uint8_t TEXT1 = 0x01
 
static constexpr uint8_t MULTICOLOR = 0x02
 
static constexpr uint8_t GRAPHIC2 = 0x04
 
static constexpr uint8_t TEXT1Q = 0x05
 
static constexpr uint8_t MULTIQ = 0x06
 
static constexpr uint8_t GRAPHIC3 = 0x08
 
static constexpr uint8_t TEXT2 = 0x09
 
static constexpr uint8_t GRAPHIC4 = 0x0C
 
static constexpr uint8_t GRAPHIC5 = 0x10
 
static constexpr uint8_t GRAPHIC6 = 0x14
 
static constexpr uint8_t GRAPHIC7 = 0x1C
 
static constexpr byte REG0_MASK = 0x0E
 Bits of VDP register 0 that encode part of the display mode.
 
static constexpr byte REG1_MASK = 0x18
 Bits of VDP register 1 that encode part of the display mode.
 
static constexpr byte REG25_MASK = 0x18
 Bits of VDP register 25 that encode part of the display mode.
 
static constexpr byte YJK = 0x20
 Encoding of YJK flag.
 
static constexpr byte YAE = 0x40
 Encoding of YAE flag.
 

Detailed Description

Represents a VDP display mode.

A display mode determines how bytes in the VRAM are converted to pixel colors. A display mode consists of a base mode with YJK filters on top. Only the V9958 supports YJK filters.

Definition at line 15 of file DisplayMode.hh.

Constructor & Destructor Documentation

◆ DisplayMode() [1/2]

constexpr openmsx::DisplayMode::DisplayMode ( )
constexprdefault

Create the initial display mode.

Referenced by reset(), and updateReg25().

◆ DisplayMode() [2/2]

constexpr openmsx::DisplayMode::DisplayMode ( byte  reg0,
byte  reg1,
byte  reg25 
)
inlineconstexpr

Create a specific display mode.

Parameters
reg0The contents of VDP register 0.
reg1The contents of VDP register 1.
reg25The contents of VDP register 25; on non-V9958 chips, pass 0.

Definition at line 64 of file DisplayMode.hh.

Member Function Documentation

◆ getBase()

constexpr byte openmsx::DisplayMode::getBase ( ) const
inlineconstexpr

Get the base display mode as an integer: M5..M1 combined.

If YJK is active, the base mode is the underlying display mode.

Returns
The integer representation of the base of this display mode, in the range [0..0x1F].

Definition at line 106 of file DisplayMode.hh.

Referenced by getSpriteMode(), isBitmapMode(), isTextMode(), openmsx::CharacterConverter::setDisplayMode(), openmsx::VDPCmdEngine::updateDisplayMode(), openmsx::PixelRenderer::updatePalette(), and updateReg25().

◆ getByte()

constexpr byte openmsx::DisplayMode::getByte ( ) const
inlineconstexpr

◆ getLineWidth()

constexpr unsigned openmsx::DisplayMode::getLineWidth ( ) const
inlineconstexpr

Get number of pixels on a display line in this mode.

Returns
512 for Text 2, Graphic 5 and 6, 256 for all other modes. TODO: Would it make more sense to treat Text 2 as 480 pixels?

Definition at line 179 of file DisplayMode.hh.

References GRAPHIC5, GRAPHIC6, and TEXT2.

Referenced by openmsx::SDLRasterizer::drawBorder(), openmsx::SDLRasterizer::drawDisplay(), and openmsx::SDLRasterizer::drawSprites().

◆ getSpriteMode()

constexpr int openmsx::DisplayMode::getSpriteMode ( bool  isMSX1) const
inlineconstexpr

Get the sprite mode of this display mode.

Returns
The current sprite mode: 0 means no sprites, 1 means sprite mode 1 (MSX1 display modes), 2 means sprite mode 2 (MSX2 display modes).

Definition at line 157 of file DisplayMode.hh.

References getBase(), GRAPHIC1, GRAPHIC2, GRAPHIC3, GRAPHIC4, GRAPHIC5, GRAPHIC6, GRAPHIC7, MULTICOLOR, MULTIQ, TEXT1, TEXT1Q, and TEXT2.

Referenced by openmsx::SDLRasterizer::drawSprites(), openmsx::VDP::spritesEnabled(), and openmsx::VDP::spritesEnabledFast().

◆ isBitmapMode()

constexpr bool openmsx::DisplayMode::isBitmapMode ( ) const
inlineconstexpr

Is the current mode a bitmap mode? Graphic4 and higher are bitmap modes.

Returns
True iff the current mode is a bitmap mode.

Definition at line 129 of file DisplayMode.hh.

References getBase().

Referenced by openmsx::SDLRasterizer::drawDisplay(), and openmsx::SDLRasterizer::setDisplayMode().

◆ isPlanar()

constexpr bool openmsx::DisplayMode::isPlanar ( ) const
inlineconstexpr

Is VRAM "planar" in the current display mode? Graphic 6 and 7 spread their bytes over two VRAM ICs, such that the even bytes go to the first half of the address space and the odd bytes to the second half.

Returns
True iff the current display mode has planar VRAM.

Definition at line 139 of file DisplayMode.hh.

Referenced by openmsx::SDLRasterizer::drawDisplay().

◆ isSpriteNarrow()

constexpr bool openmsx::DisplayMode::isSpriteNarrow ( ) const
inlineconstexpr

Are sprite pixels narrow?

Definition at line 146 of file DisplayMode.hh.

References GRAPHIC5.

◆ isTextMode()

constexpr bool openmsx::DisplayMode::isTextMode ( ) const
inlineconstexpr

Is the current mode a text mode? Text1 and Text2 are text modes.

Returns
True iff the current mode is a text mode.

Definition at line 121 of file DisplayMode.hh.

References getBase(), TEXT1, TEXT1Q, and TEXT2.

Referenced by openmsx::SDLRasterizer::drawDisplay(), openmsx::VDP::getLeftSprites(), openmsx::VDP::getRightBorder(), and openmsx::VDP::peekStatusReg().

◆ isV9938Mode()

constexpr bool openmsx::DisplayMode::isV9938Mode ( ) const
inlineconstexpr

Was this mode introduced by the V9938?

Returns
True iff the base of this mode only is available on V9938/58.

Definition at line 113 of file DisplayMode.hh.

◆ operator==()

constexpr bool openmsx::DisplayMode::operator== ( const DisplayMode ) const
constexprdefault

Equals operator.

◆ reset()

constexpr void openmsx::DisplayMode::reset ( )
inlineconstexpr

Bring the display mode to its initial state.

Definition at line 80 of file DisplayMode.hh.

References DisplayMode().

◆ setByte()

constexpr void openmsx::DisplayMode::setByte ( byte  mode_)
inlineconstexpr

Used for de-serialization.

Definition at line 97 of file DisplayMode.hh.

Referenced by openmsx::VDP::serialize().

◆ updateReg25()

constexpr DisplayMode openmsx::DisplayMode::updateReg25 ( byte  reg25) const
inlineconstexpr

Definition at line 73 of file DisplayMode.hh.

References DisplayMode(), and getBase().

Member Data Documentation

◆ GRAPHIC1

constexpr uint8_t openmsx::DisplayMode::GRAPHIC1 = 0x00
staticconstexpr

Definition at line 26 of file DisplayMode.hh.

Referenced by openmsx::CharacterConverter::convertLine(), and getSpriteMode().

◆ GRAPHIC2

constexpr uint8_t openmsx::DisplayMode::GRAPHIC2 = 0x04
staticconstexpr

Definition at line 29 of file DisplayMode.hh.

Referenced by openmsx::CharacterConverter::convertLine(), and getSpriteMode().

◆ GRAPHIC3

constexpr uint8_t openmsx::DisplayMode::GRAPHIC3 = 0x08
staticconstexpr

Definition at line 32 of file DisplayMode.hh.

Referenced by openmsx::CharacterConverter::convertLine(), and getSpriteMode().

◆ GRAPHIC4

constexpr uint8_t openmsx::DisplayMode::GRAPHIC4 = 0x0C
staticconstexpr

◆ GRAPHIC5

constexpr uint8_t openmsx::DisplayMode::GRAPHIC5 = 0x10
staticconstexpr

◆ GRAPHIC6

constexpr uint8_t openmsx::DisplayMode::GRAPHIC6 = 0x14
staticconstexpr

◆ GRAPHIC7

constexpr uint8_t openmsx::DisplayMode::GRAPHIC7 = 0x1C
staticconstexpr

◆ MULTICOLOR

constexpr uint8_t openmsx::DisplayMode::MULTICOLOR = 0x02
staticconstexpr

Definition at line 28 of file DisplayMode.hh.

Referenced by openmsx::CharacterConverter::convertLine(), and getSpriteMode().

◆ MULTIQ

constexpr uint8_t openmsx::DisplayMode::MULTIQ = 0x06
staticconstexpr

Definition at line 31 of file DisplayMode.hh.

Referenced by openmsx::CharacterConverter::convertLine(), and getSpriteMode().

◆ REG0_MASK

constexpr byte openmsx::DisplayMode::REG0_MASK = 0x0E
staticconstexpr

Bits of VDP register 0 that encode part of the display mode.

Definition at line 40 of file DisplayMode.hh.

Referenced by openmsx::VDP::changeRegister().

◆ REG1_MASK

constexpr byte openmsx::DisplayMode::REG1_MASK = 0x18
staticconstexpr

Bits of VDP register 1 that encode part of the display mode.

Definition at line 43 of file DisplayMode.hh.

Referenced by openmsx::VDP::changeRegister().

◆ REG25_MASK

constexpr byte openmsx::DisplayMode::REG25_MASK = 0x18
staticconstexpr

Bits of VDP register 25 that encode part of the display mode.

Definition at line 46 of file DisplayMode.hh.

Referenced by openmsx::VDP::changeRegister().

◆ TEXT1

constexpr uint8_t openmsx::DisplayMode::TEXT1 = 0x01
staticconstexpr

◆ TEXT1Q

constexpr uint8_t openmsx::DisplayMode::TEXT1Q = 0x05
staticconstexpr

◆ TEXT2

constexpr uint8_t openmsx::DisplayMode::TEXT2 = 0x09
staticconstexpr

◆ YAE

constexpr byte openmsx::DisplayMode::YAE = 0x40
staticconstexpr

Encoding of YAE flag.

Definition at line 52 of file DisplayMode.hh.

Referenced by openmsx::BitmapConverter::convertLine(), and openmsx::BitmapConverter::convertLinePlanar().

◆ YJK

constexpr byte openmsx::DisplayMode::YJK = 0x20
staticconstexpr

Encoding of YJK flag.

Definition at line 49 of file DisplayMode.hh.

Referenced by openmsx::BitmapConverter::convertLine(), and openmsx::BitmapConverter::convertLinePlanar().


The documentation for this class was generated from the following file: