openMSX
Classes | Public Member Functions | Public Attributes | List of all members
openmsx::VDPVRAM Class Reference

Manages VRAM contents and synchronizes the various users of the VRAM. More...

#include <VDPVRAM.hh>

Collaboration diagram for openmsx::VDPVRAM:
Collaboration graph
[legend]

Public Member Functions

 VDPVRAM (const VDPVRAM &)=delete
 
VDPVRAMoperator= (const VDPVRAM &)=delete
 
 VDPVRAM (VDP &vdp, unsigned size, EmuTime::param time)
 
void clear ()
 Initialize VRAM content to power-up state.
 
void sync (EmuTime::param time)
 Update VRAM state to specified moment in time.
 
void cmdWrite (unsigned address, byte value, EmuTime::param time)
 Write a byte from the command engine.
 
void cpuWrite (unsigned address, byte value, EmuTime::param time)
 Write a byte to VRAM through the CPU interface.
 
byte cpuRead (unsigned address, EmuTime::param time)
 Read a byte from VRAM though the CPU interface.
 
void updateDisplayMode (DisplayMode mode, bool cmdBit, EmuTime::param time)
 Used by the VDP to signal display mode changes.
 
void updateDisplayEnabled (bool enabled, EmuTime::param time)
 Used by the VDP to signal display enabled changes.
 
void updateSpritesEnabled (bool enabled, EmuTime::param time)
 Used by the VDP to signal sprites enabled changes.
 
void updateVRMode (bool mode, EmuTime::param time)
 Change between VR=0 and VR=1 mode.
 
void setRenderer (Renderer *renderer, EmuTime::param time)
 
unsigned getSize () const
 Returns the size of VRAM in bytes.
 
void setSpriteChecker (SpriteChecker *newSpriteChecker)
 Necessary because of circular dependencies.
 
void setCmdEngine (VDPCmdEngine *newCmdEngine)
 Necessary because of circular dependencies.
 
void change4k8kMapping (bool mapping8k)
 TMS99x8 VRAM can be mapped in two ways.
 
std::span< const uint8_t > getData () const
 Only used by debugger.
 
template<typename Archive >
void serialize (Archive &ar, unsigned version)
 

Public Attributes

VRAMWindow cmdReadWindow
 
VRAMWindow cmdWriteWindow
 
VRAMWindow nameTable
 
VRAMWindow colorTable
 
VRAMWindow patternTable
 
VRAMWindow bitmapVisibleWindow
 
VRAMWindow bitmapCacheWindow
 
VRAMWindow spriteAttribTable
 
VRAMWindow spritePatternTable
 

Detailed Description

Manages VRAM contents and synchronizes the various users of the VRAM.

VDPVRAM does not apply planar remapping to addresses, this is the responsibility of the caller.

Definition at line 396 of file VDPVRAM.hh.

Constructor & Destructor Documentation

◆ VDPVRAM() [1/2]

openmsx::VDPVRAM::VDPVRAM ( const VDPVRAM )
delete

◆ VDPVRAM() [2/2]

openmsx::VDPVRAM::VDPVRAM ( VDP vdp,
unsigned  size,
EmuTime::param  time 
)

Definition at line 103 of file VDPVRAM.cc.

References bitmapCacheWindow, and openmsx::VRAMWindow::setMask().

Member Function Documentation

◆ change4k8kMapping()

void openmsx::VDPVRAM::change4k8kMapping ( bool  mapping8k)

TMS99x8 VRAM can be mapped in two ways.

See implementation for more details.

Definition at line 234 of file VDPVRAM.cc.

References openmsx::Ram::begin(), ranges::copy(), and openmsx::Ram::end().

◆ clear()

void openmsx::VDPVRAM::clear ( )

Initialize VRAM content to power-up state.

Definition at line 131 of file VDPVRAM.cc.

References openmsx::Ram::clear(), ranges::fill(), openmsx::Ram::size(), and subspan().

◆ cmdWrite()

void openmsx::VDPVRAM::cmdWrite ( unsigned  address,
byte  value,
EmuTime::param  time 
)
inline

Write a byte from the command engine.

Synchronisation with reads by the command engine is skipped. TODO: Replace by "cmdSync ; VRAMWindow::write". Note: "cmdSync", because it checks against read windows, unlike the other sync which checks against the cmd write window.

Definition at line 423 of file VDPVRAM.hh.

References openmsx::VDP::isInsideFrame().

Referenced by openmsx::ImpOp::operator()(), openmsx::AndOp::operator()(), openmsx::NotOp::operator()(), openmsx::OrOp::operator()(), and openmsx::XorOp::operator()().

◆ cpuRead()

byte openmsx::VDPVRAM::cpuRead ( unsigned  address,
EmuTime::param  time 
)
inline

Read a byte from VRAM though the CPU interface.

Parameters
addressThe address to read.
timeThe moment in emulated time this read occurs.
Returns
The VRAM contents at the specified address.

Definition at line 484 of file VDPVRAM.hh.

References cmdWriteWindow, openmsx::VRAMWindow::isInside(), openmsx::VDP::isInsideFrame(), openmsx::VDPCmdEngine::stealAccessSlot(), and openmsx::VDPCmdEngine::sync().

Referenced by openmsx::ADVram::readMem().

◆ cpuWrite()

void openmsx::VDPVRAM::cpuWrite ( unsigned  address,
byte  value,
EmuTime::param  time 
)
inline

Write a byte to VRAM through the CPU interface.

Parameters
addressThe address to write.
valueThe value to write.
timeThe moment in emulated time this write occurs.

Definition at line 448 of file VDPVRAM.hh.

References cmdReadWindow, cmdWriteWindow, openmsx::VRAMWindow::isInside(), openmsx::VDP::isInsideFrame(), openmsx::VDPCmdEngine::stealAccessSlot(), and openmsx::VDPCmdEngine::sync().

Referenced by openmsx::ADVram::writeMem().

◆ getData()

std::span< const uint8_t > openmsx::VDPVRAM::getData ( ) const
inline

Only used by debugger.

Definition at line 560 of file VDPVRAM.hh.

References openmsx::Ram::data(), and openmsx::Ram::size().

Referenced by openmsx::ImGuiCharacter::paint(), and openmsx::ImGuiSpriteViewer::paint().

◆ getSize()

unsigned openmsx::VDPVRAM::getSize ( ) const
inline

Returns the size of VRAM in bytes.

Definition at line 537 of file VDPVRAM.hh.

◆ operator=()

VDPVRAM & openmsx::VDPVRAM::operator= ( const VDPVRAM )
delete

◆ serialize()

template<typename Archive >
void openmsx::VDPVRAM::serialize ( Archive &  ar,
unsigned  version 
)

◆ setCmdEngine()

void openmsx::VDPVRAM::setCmdEngine ( VDPCmdEngine newCmdEngine)
inline

Necessary because of circular dependencies.

Definition at line 549 of file VDPVRAM.hh.

◆ setRenderer()

void openmsx::VDPVRAM::setRenderer ( Renderer renderer,
EmuTime::param  time 
)

◆ setSpriteChecker()

void openmsx::VDPVRAM::setSpriteChecker ( SpriteChecker newSpriteChecker)
inline

Necessary because of circular dependencies.

Definition at line 543 of file VDPVRAM.hh.

◆ sync()

void openmsx::VDPVRAM::sync ( EmuTime::param  time)
inline

Update VRAM state to specified moment in time.

Parameters
timeMoment in emulated time to update VRAM to. TODO: Replace this method by VRAMWindow::sync().

Definition at line 412 of file VDPVRAM.hh.

References openmsx::VDP::isInsideFrame(), and openmsx::VDPCmdEngine::sync().

Referenced by openmsx::SpriteChecker::sync().

◆ updateDisplayEnabled()

void openmsx::VDPVRAM::updateDisplayEnabled ( bool  enabled,
EmuTime::param  time 
)

Used by the VDP to signal display enabled changes.

Both the regular border start/end and forced blanking by clearing the display enable bit are considered display enabled changes.

Parameters
enabledThe new display enabled state.
timeThe moment in emulated time this change occurs.

Definition at line 152 of file VDPVRAM.cc.

References openmsx::VDP::isInsideFrame(), openmsx::VDPCmdEngine::sync(), openmsx::SpriteChecker::updateDisplayEnabled(), and openmsx::Renderer::updateDisplayEnabled().

◆ updateDisplayMode()

void openmsx::VDPVRAM::updateDisplayMode ( DisplayMode  mode,
bool  cmdBit,
EmuTime::param  time 
)

Used by the VDP to signal display mode changes.

VDPVRAM will inform the Renderer, command engine and the sprite checker of this change. TODO: Does this belong in VDPVRAM?

Parameters
modeThe new display mode.
cmdBitAre VDP commands allowed in non-bitmap mode.
timeThe moment in emulated time this change occurs.

Definition at line 144 of file VDPVRAM.cc.

References openmsx::VDP::isInsideFrame(), openmsx::VDPCmdEngine::updateDisplayMode(), openmsx::SpriteChecker::updateDisplayMode(), and openmsx::Renderer::updateDisplayMode().

◆ updateSpritesEnabled()

void openmsx::VDPVRAM::updateSpritesEnabled ( bool  enabled,
EmuTime::param  time 
)

Used by the VDP to signal sprites enabled changes.

Parameters
enabledThe new sprites enabled state.
timeThe moment in emulated time this change occurs.

Definition at line 160 of file VDPVRAM.cc.

References openmsx::VDP::isInsideFrame(), openmsx::VDPCmdEngine::sync(), openmsx::SpriteChecker::updateSpritesEnabled(), and openmsx::Renderer::updateSpritesEnabled().

◆ updateVRMode()

void openmsx::VDPVRAM::updateVRMode ( bool  mode,
EmuTime::param  time 
)

Change between VR=0 and VR=1 mode.

Parameters
modefalse->VR=0 true->VR=1
timeThe moment in emulated time this change occurs.

Definition at line 198 of file VDPVRAM.cc.

References xrange().

Member Data Documentation

◆ bitmapCacheWindow

VRAMWindow openmsx::VDPVRAM::bitmapCacheWindow

Definition at line 689 of file VDPVRAM.hh.

Referenced by serialize(), and VDPVRAM().

◆ bitmapVisibleWindow

VRAMWindow openmsx::VDPVRAM::bitmapVisibleWindow

Definition at line 688 of file VDPVRAM.hh.

Referenced by serialize(), and setRenderer().

◆ cmdReadWindow

VRAMWindow openmsx::VDPVRAM::cmdReadWindow

◆ cmdWriteWindow

VRAMWindow openmsx::VDPVRAM::cmdWriteWindow

Definition at line 684 of file VDPVRAM.hh.

Referenced by cpuRead(), cpuWrite(), and serialize().

◆ colorTable

VRAMWindow openmsx::VDPVRAM::colorTable

Definition at line 686 of file VDPVRAM.hh.

Referenced by serialize().

◆ nameTable

VRAMWindow openmsx::VDPVRAM::nameTable

Definition at line 685 of file VDPVRAM.hh.

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

◆ patternTable

VRAMWindow openmsx::VDPVRAM::patternTable

Definition at line 687 of file VDPVRAM.hh.

Referenced by serialize().

◆ spriteAttribTable

VRAMWindow openmsx::VDPVRAM::spriteAttribTable

Definition at line 690 of file VDPVRAM.hh.

Referenced by serialize(), and openmsx::SpriteChecker::SpriteChecker().

◆ spritePatternTable

VRAMWindow openmsx::VDPVRAM::spritePatternTable

Definition at line 691 of file VDPVRAM.hh.

Referenced by serialize(), and openmsx::SpriteChecker::SpriteChecker().


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