openMSX
Classes | Public Member Functions | Static Public Member Functions | List of all members
openmsx::V9990 Class Referencefinal

Implementation of the Yamaha V9990 VDP as used in the GFX9000 cartridge by Sunrise. More...

#include <V9990.hh>

Inheritance diagram for openmsx::V9990:
Inheritance graph
[legend]
Collaboration diagram for openmsx::V9990:
Collaboration graph
[legend]

Classes

struct  GetPaletteResult
 Get palette entry. More...
 

Public Member Functions

 V9990 (const DeviceConfig &config)
 
 ~V9990 () override
 
void powerUp (EmuTime::param time) override
 This method is called when MSX is powered up.
 
void reset (EmuTime::param time) override
 This method is called on reset.
 
byte readIO (word port, EmuTime::param time) override
 Read a byte from an IO port at a certain time from this device.
 
byte peekIO (word port, EmuTime::param time) const override
 Read a byte from a given IO port.
 
void writeIO (word port, byte value, EmuTime::param time) override
 Write a byte to a given IO port at a certain time to this device.
 
PostProcessorgetPostProcessor () const
 Used by Video9000 to be able to couple the VDP and V9990 output.
 
V9990VRAMgetVRAM ()
 Obtain a reference to the V9990's VRAM.
 
bool isInterlaced () const
 Get interlace status.
 
bool isEvenOddEnabled () const
 Get even/odd page alternation status.
 
bool getEvenOdd () const
 Is the even or odd field being displayed?
 
bool isDisplayEnabled () const
 Is the display enabled? Note this is simpler than the V99x8 version.
 
bool spritesEnabled () const
 Are sprites (cursors) enabled?
 
byte getPaletteOffset () const
 Get palette offset.
 
GetPaletteResult getPalette (int index) const
 
int getUCTicksThisFrame (EmuTime::param time) const
 Get the number of elapsed UC ticks in this frame.
 
bool isPalTiming () const
 Is PAL timing active? This setting is fixed at start of frame.
 
bool isOverScan () const
 Returns true iff in overscan mode.
 
bool isSuperimposing () const
 Should this frame be superimposed? This is a combination of bit 5 (YSE) in R#8 and the presence of an external video source (see setExternalVideoSource()).
 
void setExternalVideoSource (bool enable)
 Is there an external video source available to superimpose on.
 
unsigned getCursorYOffset () const
 In overscan mode the cursor position is still specified with 'normal' (non-overscan) y-coordinates.
 
V9990DisplayMode getDisplayMode () const
 Return the current display mode.
 
V9990ColorMode getColorMode () const
 Return the current color mode.
 
unsigned getColorDepth () const
 Return the amount of bits per pixels.
 
byte getBackDropColor () const
 Return the current back drop color.
 
unsigned getScrollAX () const
 Returns the X scroll offset for screen A of P1 and other modes.
 
unsigned getScrollAY () const
 Returns the Y scroll offset for screen A of P1 and other modes.
 
unsigned getScrollBX () const
 Returns the X scroll offset for screen B of P1 mode.
 
unsigned getScrollBY () const
 Returns the Y scroll offset for screen B of P1 mode.
 
unsigned getRollMask (unsigned maxMask) const
 Returns the vertical roll mask.
 
unsigned getImageWidth () const
 Return the image width.
 
unsigned getLineWidth () const
 Return the display width.
 
void cmdReady ()
 Command execution ready.
 
int getSpritePatternAddress (V9990DisplayMode m) const
 Return the sprite pattern table base address.
 
byte getSpritePaletteOffset () const
 return sprite palette offset
 
const V9990DisplayPeriodgetHorizontalTiming () const
 Get horizontal display timings.
 
int getLeftBorder () const
 Get the number of VDP clock-ticks between the start of the line and the end of the left border.
 
int getRightBorder () const
 Get the number of VDP clock-ticks between the start of the line and the end of the right border.
 
const V9990DisplayPeriodgetVerticalTiming () const
 Get vertical display timings.
 
int getTopBorder () const
 
int getBottomBorder () const
 
unsigned getPriorityControlX () const
 
unsigned getPriorityControlY () const
 
template<typename Archive >
void serialize (Archive &ar, unsigned version)
 
- Public Member Functions inherited from openmsx::MSXDevice
 MSXDevice (const MSXDevice &)=delete
 
 MSXDevice (MSXDevice &&)=delete
 
MSXDeviceoperator= (const MSXDevice &)=delete
 
MSXDeviceoperator= (MSXDevice &&)=delete
 
virtual ~MSXDevice ()=0
 
const HardwareConfiggetHardwareConfig () const
 Returns the hardwareconfig this device belongs to.
 
void testRemove (std::span< const std::unique_ptr< MSXDevice > > removed) const
 Checks whether this device can be removed (no other device has a reference to it).
 
virtual byte readIRQVector ()
 Gets IRQ vector used in IM2.
 
virtual void powerDown (EmuTime::param time)
 This method is called when MSX is powered down.
 
virtual const std::string & getName () const
 Returns a human-readable name for this device.
 
virtual void getNameList (TclObject &result) const
 Returns list of name(s) of this device.
 
void getDeviceInfo (TclObject &result) const
 Get device info.
 
void getVisibleMemRegion (unsigned &base, unsigned &size) const
 Returns the range where this device is visible in memory.
 
virtual byte readMem (word address, EmuTime::param time)
 Read a byte from a location at a certain time from this device.
 
virtual void writeMem (word address, byte value, EmuTime::param time)
 Write a given byte to a given location at a certain time to this device.
 
virtual const bytegetReadCacheLine (word start) const
 Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading.
 
virtual bytegetWriteCacheLine (word start)
 Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
 
virtual byte peekMem (word address, EmuTime::param time) const
 Read a byte from a given memory location.
 
virtual void globalWrite (word address, byte value, EmuTime::param time)
 Global writes.
 
virtual void globalRead (word address, EmuTime::param time)
 Global reads.
 
void invalidateDeviceRWCache ()
 Calls MSXCPUInterface::invalidateXXCache() for the specific (part of) the slot that this device is located in.
 
void invalidateDeviceRCache ()
 
void invalidateDeviceWCache ()
 
void invalidateDeviceRWCache (unsigned start, unsigned size)
 
void invalidateDeviceRCache (unsigned start, unsigned size)
 
void invalidateDeviceWCache (unsigned start, unsigned size)
 
void fillDeviceRWCache (unsigned start, unsigned size, byte *rwData)
 Calls MSXCPUInterface::fillXXCache() for the specific (part of) the slot that this device is located in.
 
void fillDeviceRWCache (unsigned start, unsigned size, const byte *rData, byte *wData)
 
void fillDeviceRCache (unsigned start, unsigned size, const byte *rData)
 
void fillDeviceWCache (unsigned start, unsigned size, byte *wData)
 
MSXMotherBoardgetMotherBoard () const
 Get the mother board this device belongs to.
 
const XMLElementgetDeviceConfig () const
 Get the configuration section for this device.
 
const DeviceConfiggetDeviceConfig2 () const
 
const DevicesgetReferences () const
 Get the device references that are specified for this device.
 
EmuTime::param getCurrentTime () const
 
MSXCPUgetCPU () const
 
MSXCPUInterfacegetCPUInterface () const
 
SchedulergetScheduler () const
 
MSXCliCommgetCliComm () const
 
ReactorgetReactor () const
 
CommandControllergetCommandController () const
 
PluggingControllergetPluggingController () const
 
LedStatusgetLedStatus () const
 
template<typename Archive >
void serialize (Archive &ar, unsigned version)
 

Static Public Member Functions

static int UCtoX (int ticks, V9990DisplayMode mode)
 Convert UC ticks to V9990 pixel position on a line.
 

Additional Inherited Members

- Public Types inherited from openmsx::MSXDevice
using Devices = std::vector< MSXDevice * >
 
- Static Public Attributes inherited from openmsx::MSXDevice
static std::array< byte, 0x10000 > unmappedRead
 
static std::array< byte, 0x10000 > unmappedWrite
 
- Protected Member Functions inherited from openmsx::MSXDevice
 MSXDevice (const DeviceConfig &config, std::string_view name)
 Every MSXDevice has a config entry; this constructor gets some device properties from that config entry.
 
 MSXDevice (const DeviceConfig &config)
 
virtual void init ()
 
virtual unsigned getBaseSizeAlignment () const
 The 'base' and 'size' attribute values need to be at least aligned to CacheLine::SIZE.
 
virtual bool allowUnaligned () const
 By default we don't allow unaligned <mem> specifications in the config file.
 
virtual void getExtraDeviceInfo (TclObject &result) const
 
byte getPrimarySlot () const
 
- Protected Attributes inherited from openmsx::MSXDevice
std::string deviceName
 

Detailed Description

Implementation of the Yamaha V9990 VDP as used in the GFX9000 cartridge by Sunrise.

Definition at line 34 of file V9990.hh.

Constructor & Destructor Documentation

◆ V9990()

openmsx::V9990::V9990 ( const DeviceConfig config)
explicit

Definition at line 54 of file V9990.cc.

◆ ~V9990()

openmsx::V9990::~V9990 ( )
override

Definition at line 105 of file V9990.cc.

References openmsx::Display::detach().

Member Function Documentation

◆ cmdReady()

void openmsx::V9990::cmdReady ( )
inline

Command execution ready.

Definition at line 291 of file V9990.hh.

◆ getBackDropColor()

byte openmsx::V9990::getBackDropColor ( ) const
inline

Return the current back drop color.

Returns
Index the color palette

Definition at line 218 of file V9990.hh.

Referenced by openmsx::V9990P2Converter::convertLine(), openmsx::V9990P1Converter::convertLine(), and openmsx::V9990SDLRasterizer::drawBorder().

◆ getBottomBorder()

int openmsx::V9990::getBottomBorder ( ) const
inline

Definition at line 344 of file V9990.hh.

References openmsx::V9990DisplayPeriod::display, and getTopBorder().

Referenced by peekIO().

◆ getColorDepth()

unsigned openmsx::V9990::getColorDepth ( ) const
inline

Return the amount of bits per pixels.

Result is only meaningful for Bx modes.

Returns
Bpp 0 -> 2bpp 1 -> 4bpp 2 -> 8bpp 3 -> 16bpp

Definition at line 211 of file V9990.hh.

◆ getColorMode()

V9990ColorMode openmsx::V9990::getColorMode ( ) const

Return the current color mode.

Definition at line 804 of file V9990.cc.

References getColorMode().

Referenced by getColorMode(), openmsx::V9990SDLRasterizer::reset(), and openmsx::V9990PixelRenderer::reset().

◆ getCursorYOffset()

unsigned openmsx::V9990::getCursorYOffset ( ) const
inline

In overscan mode the cursor position is still specified with 'normal' (non-overscan) y-coordinates.

This method returns the offset between those two coord-systems.

Definition at line 159 of file V9990.hh.

References openmsx::V9990DisplayTiming::displayNTSC_MCLK, openmsx::V9990DisplayTiming::displayPAL_MCLK, isOverScan(), and isPalTiming().

Referenced by openmsx::V9990SDLRasterizer::drawBxMode().

◆ getDisplayMode()

V9990DisplayMode openmsx::V9990::getDisplayMode ( ) const
inline

◆ getEvenOdd()

bool openmsx::V9990::getEvenOdd ( ) const
inline

Is the even or odd field being displayed?

Returns
True iff the odd lines should be displayed.

Definition at line 76 of file V9990.hh.

Referenced by openmsx::V9990SDLRasterizer::drawBxMode(), openmsx::V9990SDLRasterizer::frameEnd(), and openmsx::V9990PixelRenderer::frameStart().

◆ getHorizontalTiming()

const V9990DisplayPeriod & openmsx::V9990::getHorizontalTiming ( ) const
inline

Get horizontal display timings.

Definition at line 316 of file V9990.hh.

Referenced by openmsx::V9990SDLRasterizer::frameStart().

◆ getImageWidth()

unsigned openmsx::V9990::getImageWidth ( ) const
inline

Return the image width.

Definition at line 261 of file V9990.hh.

◆ getLeftBorder()

int openmsx::V9990::getLeftBorder ( ) const
inline

Get the number of VDP clock-ticks between the start of the line and the end of the left border.

Definition at line 323 of file V9990.hh.

References openmsx::V9990DisplayPeriod::blank, and openmsx::V9990DisplayPeriod::border1.

Referenced by getRightBorder(), and peekIO().

◆ getLineWidth()

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

◆ getPalette()

V9990::GetPaletteResult openmsx::V9990::getPalette ( int  index) const

Definition at line 685 of file V9990.cc.

References g, and isSuperimposing().

Referenced by openmsx::V9990SDLRasterizer::resetPalette().

◆ getPaletteOffset()

byte openmsx::V9990::getPaletteOffset ( ) const
inline

Get palette offset.

Result is between [0..15] (this represents a logical number between [0..63] with lowest two bits always 0).

Returns
palette offset

Definition at line 101 of file V9990.hh.

Referenced by openmsx::V9990P2Converter::convertLine(), and openmsx::V9990P1Converter::convertLine().

◆ getPostProcessor()

PostProcessor * openmsx::V9990::getPostProcessor ( ) const

Used by Video9000 to be able to couple the VDP and V9990 output.

Can return nullptr in case of renderer=none. This value can change over the lifetime of the V9990 object (on renderer switch).

Definition at line 110 of file V9990.cc.

◆ getPriorityControlX()

unsigned openmsx::V9990::getPriorityControlX ( ) const
inline

Definition at line 348 of file V9990.hh.

References t.

Referenced by openmsx::V9990P1Converter::convertLine().

◆ getPriorityControlY()

unsigned openmsx::V9990::getPriorityControlY ( ) const
inline

Definition at line 352 of file V9990.hh.

References t.

Referenced by openmsx::V9990P1Converter::convertLine().

◆ getRightBorder()

int openmsx::V9990::getRightBorder ( ) const
inline

Get the number of VDP clock-ticks between the start of the line and the end of the right border.

Definition at line 330 of file V9990.hh.

References openmsx::V9990DisplayPeriod::display, and getLeftBorder().

Referenced by peekIO().

◆ getRollMask()

unsigned openmsx::V9990::getRollMask ( unsigned  maxMask) const
inline

Returns the vertical roll mask.

Definition at line 248 of file V9990.hh.

References t.

Referenced by openmsx::V9990P2Converter::convertLine(), openmsx::V9990P1Converter::convertLine(), and openmsx::V9990SDLRasterizer::drawBxMode().

◆ getScrollAX()

unsigned openmsx::V9990::getScrollAX ( ) const
inline

Returns the X scroll offset for screen A of P1 and other modes.

Definition at line 224 of file V9990.hh.

Referenced by openmsx::V9990P2Converter::convertLine(), openmsx::V9990P1Converter::convertLine(), and openmsx::V9990SDLRasterizer::drawBxMode().

◆ getScrollAY()

unsigned openmsx::V9990::getScrollAY ( ) const
inline

Returns the Y scroll offset for screen A of P1 and other modes.

Definition at line 230 of file V9990.hh.

Referenced by openmsx::V9990P2Converter::convertLine(), openmsx::V9990P1Converter::convertLine(), and openmsx::V9990SDLRasterizer::drawBxMode().

◆ getScrollBX()

unsigned openmsx::V9990::getScrollBX ( ) const
inline

Returns the X scroll offset for screen B of P1 mode.

Definition at line 236 of file V9990.hh.

Referenced by openmsx::V9990P1Converter::convertLine().

◆ getScrollBY()

unsigned openmsx::V9990::getScrollBY ( ) const
inline

Returns the Y scroll offset for screen B of P1 mode.

Definition at line 242 of file V9990.hh.

Referenced by openmsx::V9990P1Converter::convertLine().

◆ getSpritePaletteOffset()

byte openmsx::V9990::getSpritePaletteOffset ( ) const
inline

return sprite palette offset

Definition at line 310 of file V9990.hh.

Referenced by openmsx::CursorInfo::CursorInfo().

◆ getSpritePatternAddress()

int openmsx::V9990::getSpritePatternAddress ( V9990DisplayMode  m) const
inline

Return the sprite pattern table base address.

Definition at line 297 of file V9990.hh.

References openmsx::P1, and openmsx::P2.

Referenced by openmsx::V9990P2Converter::convertLine(), and openmsx::V9990P1Converter::convertLine().

◆ getTopBorder()

int openmsx::V9990::getTopBorder ( ) const
inline

◆ getUCTicksThisFrame()

int openmsx::V9990::getUCTicksThisFrame ( EmuTime::param  time) const
inline

Get the number of elapsed UC ticks in this frame.

Parameters
timePoint in emulated time.
Returns
Number of UC ticks.

Definition at line 122 of file V9990.hh.

References openmsx::Clock< FREQ_NUM, FREQ_DENOM >::getTicksTill_fast().

Referenced by peekIO().

◆ getVerticalTiming()

const V9990DisplayPeriod & openmsx::V9990::getVerticalTiming ( ) const
inline

Get vertical display timings.

Definition at line 336 of file V9990.hh.

Referenced by openmsx::V9990SDLRasterizer::frameStart().

◆ getVRAM()

V9990VRAM & openmsx::V9990::getVRAM ( )
inline

Obtain a reference to the V9990's VRAM.

Definition at line 55 of file V9990.hh.

◆ isDisplayEnabled()

bool openmsx::V9990::isDisplayEnabled ( ) const
inline

Is the display enabled? Note this is simpler than the V99x8 version.

Probably ok because V9990 doesn't have the same overscan trick (?)

Returns
true iff enabled

Definition at line 85 of file V9990.hh.

Referenced by openmsx::V9990PixelRenderer::reset().

◆ isEvenOddEnabled()

bool openmsx::V9990::isEvenOddEnabled ( ) const
inline

Get even/odd page alternation status.

Returns
True iff even/odd page alternation is enabled.

Definition at line 69 of file V9990.hh.

Referenced by openmsx::V9990SDLRasterizer::drawBxMode(), openmsx::V9990PixelRenderer::frameEnd(), and openmsx::V9990PixelRenderer::frameStart().

◆ isInterlaced()

bool openmsx::V9990::isInterlaced ( ) const
inline

Get interlace status.

Returns
True iff interlace is enabled.

Definition at line 62 of file V9990.hh.

Referenced by openmsx::CursorInfo::CursorInfo(), openmsx::V9990PixelRenderer::frameEnd(), openmsx::V9990SDLRasterizer::frameEnd(), and openmsx::V9990PixelRenderer::frameStart().

◆ isOverScan()

bool openmsx::V9990::isOverScan ( ) const
inline

Returns true iff in overscan mode.

Definition at line 136 of file V9990.hh.

References openmsx::B0, openmsx::B2, and openmsx::B4.

Referenced by openmsx::V9990SDLRasterizer::drawBorder(), and getCursorYOffset().

◆ isPalTiming()

bool openmsx::V9990::isPalTiming ( ) const
inline

Is PAL timing active? This setting is fixed at start of frame.

Returns
True if PAL timing, false if NTSC timing.

Definition at line 130 of file V9990.hh.

Referenced by getCursorYOffset().

◆ isSuperimposing()

bool openmsx::V9990::isSuperimposing ( ) const
inline

Should this frame be superimposed? This is a combination of bit 5 (YSE) in R#8 and the presence of an external video source (see setExternalVideoSource()).

Though because this property only changes once per frame we can't directly calculate it like that.

Definition at line 146 of file V9990.hh.

Referenced by getPalette(), and openmsx::V9990SDLRasterizer::resetPalette().

◆ peekIO()

byte openmsx::V9990::peekIO ( word  port,
EmuTime::param  time 
) const
overridevirtual

Read a byte from a given IO port.

Reading via this method has no side effects (doesn't change the device status). If safe reading is not possible this method returns 0xFF. This method is not used by the emulation. It can however be used by a debugger. The default implementation just returns 0xFF.

Reimplemented from openmsx::MSXDevice.

Definition at line 222 of file V9990.cc.

References getBottomBorder(), getLeftBorder(), getRightBorder(), openmsx::V9990CmdEngine::getStatus(), getTopBorder(), getUCTicksThisFrame(), openmsx::V9990CmdEngine::peekCmdData(), and openmsx::V9990DisplayTiming::UC_TICKS_PER_LINE.

Referenced by readIO().

◆ powerUp()

void openmsx::V9990::powerUp ( EmuTime::param  time)
overridevirtual

This method is called when MSX is powered up.

The default implementation calls reset(), this is usually ok.

Parameters
timeThe moment in time the power up occurs.

Reimplemented from openmsx::MSXDevice.

Definition at line 119 of file V9990.cc.

References openmsx::V9990VRAM::clear(), and reset().

◆ readIO()

byte openmsx::V9990::readIO ( word  port,
EmuTime::param  time 
)
overridevirtual

Read a byte from an IO port at a certain time from this device.

The default implementation returns 255.

Reimplemented from openmsx::MSXDevice.

Definition at line 161 of file V9990.cc.

References openmsx::V9990CmdEngine::getCmdData(), peekIO(), and openmsx::V9990VRAM::readVRAMCPU().

◆ reset()

void openmsx::V9990::reset ( EmuTime::param  time)
overridevirtual

This method is called on reset.

Default implementation does nothing.

Reimplemented from openmsx::MSXDevice.

Definition at line 125 of file V9990.cc.

References ranges::fill(), openmsx::V9990CmdEngine::reset(), openmsx::V9990CmdEngine::sync(), and writeIO().

Referenced by powerUp().

◆ serialize()

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

◆ setExternalVideoSource()

void openmsx::V9990::setExternalVideoSource ( bool  enable)
inline

Is there an external video source available to superimpose on.

Definition at line 151 of file V9990.hh.

◆ spritesEnabled()

bool openmsx::V9990::spritesEnabled ( ) const
inline

Are sprites (cursors) enabled?

Returns
true iff enabled

Definition at line 92 of file V9990.hh.

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

◆ UCtoX()

static int openmsx::V9990::UCtoX ( int  ticks,
V9990DisplayMode  mode 
)
inlinestatic

Convert UC ticks to V9990 pixel position on a line.

Parameters
ticksNr of UC Ticks
modeDisplay mode
Returns
Pixel position TODO: Move this to V9990DisplayTiming??

Definition at line 174 of file V9990.hh.

References openmsx::B0, openmsx::B1, openmsx::B2, openmsx::B3, openmsx::B4, openmsx::B5, openmsx::B6, openmsx::B7, openmsx::P1, openmsx::P2, and openmsx::V9990DisplayTiming::UC_TICKS_PER_LINE.

Referenced by openmsx::V9990SDLRasterizer::drawBorder(), and openmsx::V9990SDLRasterizer::drawDisplay().

◆ writeIO()

void openmsx::V9990::writeIO ( word  port,
byte  value,
EmuTime::param  time 
)
overridevirtual

Write a byte to a given IO port at a certain time to this device.

The default implementation ignores the write (does nothing)

Reimplemented from openmsx::MSXDevice.

Definition at line 275 of file V9990.cc.

References openmsx::IntHelper< SOURCE >::reset(), openmsx::V9990CmdEngine::setCmdData(), writeIO(), openmsx::V9990VRAM::writeVRAMCPU(), and xrange().

Referenced by reset(), and writeIO().


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