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

Represents a VDP display mode. More...

#include <DisplayMode.hh>

Public Types

enum  {
  GRAPHIC1 = 0x00, TEXT1 = 0x01, MULTICOLOR = 0x02, GRAPHIC2 = 0x04,
  TEXT1Q = 0x05, MULTIQ = 0x06, GRAPHIC3 = 0x08, TEXT2 = 0x09,
  GRAPHIC4 = 0x0C, GRAPHIC5 = 0x10, GRAPHIC6 = 0x14, GRAPHIC7 = 0x1C
}
 

Public Member Functions

 DisplayMode ()
 Create the initial display mode. More...
 
 DisplayMode (byte reg0, byte reg1, byte reg25)
 Create a specific display mode. More...
 
DisplayMode updateReg25 (byte reg25) const
 
void reset ()
 Bring the display mode to its initial state. More...
 
bool operator== (const DisplayMode &otherMode) const
 Equals operator. More...
 
bool operator!= (const DisplayMode &otherMode) const
 Does-not-equal operator. More...
 
byte getByte () const
 Get the dispay mode as a byte: YAE YJK M5..M1 combined. More...
 
void setByte (byte mode_)
 Used for de-serialization. More...
 
byte getBase () const
 Get the base dispay mode as an integer: M5..M1 combined. More...
 
bool isV9938Mode () const
 Was this mode introduced by the V9938? More...
 
bool isTextMode () const
 Is the current mode a text mode? Text1 and Text2 are text modes. More...
 
bool isBitmapMode () const
 Is the current mode a bitmap mode? Graphic4 and higher are bitmap modes. More...
 
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. More...
 
bool isSpriteNarrow () const
 Are sprite pixels narrow? More...
 
int getSpriteMode (bool isMSX1) const
 Get the sprite mode of this display mode. More...
 
unsigned getLineWidth () const
 Get number of pixels on a display line in this mode. More...
 

Static Public Attributes

static const byte REG0_MASK = 0x0E
 Bits of VDP register 0 that encode part of the display mode. More...
 
static const byte REG1_MASK = 0x18
 Bits of VDP register 1 that encode part of the display mode. More...
 
static const byte REG25_MASK = 0x18
 Bits of VDP register 25 that encode part of the display mode. More...
 
static const byte YJK = 0x20
 Encoding of YJK flag. More...
 
static const byte YAE = 0x40
 Encoding of YAE flag. More...
 

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 14 of file DisplayMode.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
GRAPHIC1 
TEXT1 
MULTICOLOR 
GRAPHIC2 
TEXT1Q 
MULTIQ 
GRAPHIC3 
TEXT2 
GRAPHIC4 
GRAPHIC5 
GRAPHIC6 
GRAPHIC7 

Definition at line 25 of file DisplayMode.hh.

Constructor & Destructor Documentation

◆ DisplayMode() [1/2]

openmsx::DisplayMode::DisplayMode ( )
inline

Create the initial display mode.

Definition at line 57 of file DisplayMode.hh.

References reset().

Referenced by updateReg25().

◆ DisplayMode() [2/2]

openmsx::DisplayMode::DisplayMode ( byte  reg0,
byte  reg1,
byte  reg25 
)
inline

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 67 of file DisplayMode.hh.

Member Function Documentation

◆ getBase()

byte openmsx::DisplayMode::getBase ( ) const
inline

Get the base dispay 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 116 of file DisplayMode.hh.

Referenced by getSpriteMode(), isBitmapMode(), isTextMode(), openmsx::VDP::peekIO(), openmsx::CharacterConverter< Pixel >::setDisplayMode(), openmsx::SDLRasterizer< Pixel >::setTransparency(), openmsx::VDPCmdEngine::updateDisplayMode(), openmsx::PixelRenderer::updatePalette(), updateReg25(), and openmsx::PixelRenderer::updateSpritesEnabled().

◆ getByte()

byte openmsx::DisplayMode::getByte ( ) const
inline

◆ getLineWidth()

unsigned openmsx::DisplayMode::getLineWidth ( ) const
inline

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 192 of file DisplayMode.hh.

References GRAPHIC5, GRAPHIC6, and TEXT2.

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

◆ getSpriteMode()

int openmsx::DisplayMode::getSpriteMode ( bool  isMSX1) const
inline

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 170 of file DisplayMode.hh.

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

Referenced by openmsx::SDLRasterizer< Pixel >::drawSprites(), openmsx::VDP::peekIO(), and openmsx::SpriteChecker::updateWindow().

◆ isBitmapMode()

bool openmsx::DisplayMode::isBitmapMode ( ) const
inline

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 142 of file DisplayMode.hh.

References getBase().

Referenced by openmsx::SDLRasterizer< Pixel >::drawDisplay(), openmsx::VDP::peekIO(), and openmsx::SDLRasterizer< Pixel >::setDisplayMode().

◆ isPlanar()

bool openmsx::DisplayMode::isPlanar ( ) const
inline

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 152 of file DisplayMode.hh.

Referenced by openmsx::SDLRasterizer< Pixel >::drawDisplay(), openmsx::VDP::peekIO(), and openmsx::SpriteChecker::updateWindow().

◆ isSpriteNarrow()

bool openmsx::DisplayMode::isSpriteNarrow ( ) const
inline

Are sprite pixels narrow?

Definition at line 159 of file DisplayMode.hh.

References GRAPHIC5.

◆ isTextMode()

bool openmsx::DisplayMode::isTextMode ( ) const
inline

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 131 of file DisplayMode.hh.

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

Referenced by openmsx::SDLRasterizer< Pixel >::drawDisplay(), openmsx::VDP::getAccessSlotCalculator(), and openmsx::VDP::peekIO().

◆ isV9938Mode()

bool openmsx::DisplayMode::isV9938Mode ( ) const
inline

Was this mode introduced by the V9938?

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

Definition at line 123 of file DisplayMode.hh.

◆ operator!=()

bool openmsx::DisplayMode::operator!= ( const DisplayMode otherMode) const
inline

Does-not-equal operator.

Definition at line 94 of file DisplayMode.hh.

◆ operator==()

bool openmsx::DisplayMode::operator== ( const DisplayMode otherMode) const
inline

Equals operator.

Definition at line 88 of file DisplayMode.hh.

◆ reset()

void openmsx::DisplayMode::reset ( )
inline

Bring the display mode to its initial state.

Definition at line 82 of file DisplayMode.hh.

Referenced by DisplayMode(), and openmsx::VDP::getPostProcessor().

◆ setByte()

void openmsx::DisplayMode::setByte ( byte  mode_)
inline

Used for de-serialization.

Definition at line 107 of file DisplayMode.hh.

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

◆ updateReg25()

DisplayMode openmsx::DisplayMode::updateReg25 ( byte  reg25) const
inline

Definition at line 75 of file DisplayMode.hh.

References DisplayMode(), and getBase().

Member Data Documentation

◆ REG0_MASK

const byte openmsx::DisplayMode::REG0_MASK = 0x0E
static

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

Definition at line 41 of file DisplayMode.hh.

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

◆ REG1_MASK

const byte openmsx::DisplayMode::REG1_MASK = 0x18
static

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

Definition at line 44 of file DisplayMode.hh.

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

◆ REG25_MASK

const byte openmsx::DisplayMode::REG25_MASK = 0x18
static

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

Definition at line 47 of file DisplayMode.hh.

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

◆ YAE

const byte openmsx::DisplayMode::YAE = 0x40
static

◆ YJK

const byte openmsx::DisplayMode::YJK = 0x20
static

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