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]

Public Member Functions

 V9990 (const DeviceConfig &config)
 
 ~V9990 ()
 
void powerUp (EmuTime::param time) override
 This method is called when MSX is powered up. More...
 
void reset (EmuTime::param time) override
 This method is called on reset. More...
 
byte readIO (word port, EmuTime::param time) override
 Read a byte from an IO port at a certain time from this device. More...
 
byte peekIO (word port, EmuTime::param time) const override
 Read a byte from a given IO port. More...
 
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. More...
 
PostProcessorgetPostProcessor () const
 Used by Video9000 to be able to couple the VDP and V9990 output. More...
 
V9990VRAMgetVRAM ()
 Obtain a reference to the V9990's VRAM. More...
 
bool isInterlaced () const
 Get interlace status. More...
 
bool isEvenOddEnabled () const
 Get even/odd page alternation status. More...
 
bool getEvenOdd () const
 Is the even or odd field being displayed? More...
 
bool isDisplayEnabled () const
 Is the display enabled? Note this is simpler than the V99x8 version. More...
 
bool spritesEnabled () const
 Are sprites (cursors) enabled? More...
 
byte getPaletteOffset () const
 Get palette offset. More...
 
void getPalette (int index, byte &r, byte &g, byte &b, bool &ys) const
 Get palette entry. More...
 
int getUCTicksThisFrame (EmuTime::param time) const
 Get the number of elapsed UC ticks in this frame. More...
 
bool isPalTiming () const
 Is PAL timing active? This setting is fixed at start of frame. More...
 
bool isOverScan () const
 Returns true iff in overscan mode. More...
 
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()). More...
 
void setExternalVideoSource (bool enable)
 Is there an external video source available to superimpose on. More...
 
unsigned getCursorYOffset () const
 In overscan mode the cursor position is still specified with 'normal' (non-overscan) y-coordinates. More...
 
V9990DisplayMode getDisplayMode () const
 Return the current display mode. More...
 
V9990ColorMode getColorMode () const
 Return the current color mode. More...
 
unsigned getColorDepth () const
 Return the amount of bits per pixels. More...
 
byte getBackDropColor () const
 Return the current back drop color. More...
 
unsigned getScrollAX () const
 Returns the X scroll offset for screen A of P1 and other modes. More...
 
unsigned getScrollAY () const
 Returns the Y scroll offset for screen A of P1 and other modes. More...
 
unsigned getScrollBX () const
 Returns the X scroll offset for screen B of P1 mode. More...
 
unsigned getScrollBY () const
 Returns the Y scroll offset for screen B of P1 mode. More...
 
unsigned getRollMask (unsigned maxMask) const
 Returns the vertical roll mask. More...
 
unsigned getImageWidth () const
 Return the image width. More...
 
unsigned getLineWidth () const
 Return the display width. More...
 
void cmdReady ()
 Command execution ready. More...
 
int getSpritePatternAddress (V9990DisplayMode m) const
 Return the sprite pattern table base address. More...
 
byte getSpritePaletteOffset () const
 return sprite palette offset More...
 
const V9990DisplayPeriodgetHorizontalTiming () const
 Get horizontal display timings. More...
 
int getLeftBorder () const
 Get the number of VDP clockticks between the start of the line and the end of the left border. More...
 
int getRightBorder () const
 Get the number of VDP clockticks between the start of the line and the end of the right border. More...
 
const V9990DisplayPeriodgetVerticalTiming () const
 Get vertical display timings. More...
 
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
 
MSXDeviceoperator= (const MSXDevice &)=delete
 
virtual ~MSXDevice ()=0
 
const HardwareConfiggetHardwareConfig () const
 Returns the hardwareconfig this device belongs to. More...
 
void testRemove (Devices alreadyRemoved) const
 Checks whether this device can be removed (no other device has a reference to it). More...
 
virtual byte readIRQVector ()
 Gets IRQ vector used in IM2. More...
 
virtual void powerDown (EmuTime::param time)
 This method is called when MSX is powered down. More...
 
virtual std::string getName () const
 Returns a human-readable name for this device. More...
 
virtual void getNameList (TclObject &result) const
 Returns list of name(s) of this device. More...
 
void getDeviceInfo (TclObject &result) const
 Get device info. More...
 
void getVisibleMemRegion (unsigned &base, unsigned &size) const
 Returns the range where this device is visible in memory. More...
 
virtual byte readMem (word address, EmuTime::param time)
 Read a byte from a location at a certain time from this device. More...
 
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. More...
 
virtual const bytegetReadCacheLine (word start) const
 Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading. More...
 
virtual bytegetWriteCacheLine (word start) const
 Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing. More...
 
virtual byte peekMem (word address, EmuTime::param time) const
 Read a byte from a given memory location. More...
 
virtual void globalWrite (word address, byte value, EmuTime::param time)
 Global writes. More...
 
virtual void globalRead (word address, EmuTime::param time)
 Global reads. More...
 
void invalidateMemCache (word start, unsigned size)
 Invalidate CPU memory-mapping cache. More...
 
MSXMotherBoardgetMotherBoard () const
 Get the mother board this device belongs to. More...
 
const XMLElementgetDeviceConfig () const
 Get the configuration section for this device. More...
 
const DeviceConfiggetDeviceConfig2 () const
 
const DevicesgetReferences () const
 Get the device references that are specified for this device. More...
 
EmuTime::param getCurrentTime () const
 
MSXCPUgetCPU () const
 
MSXCPUInterfacegetCPUInterface () const
 
SchedulergetScheduler () const
 
CliCommgetCliComm () 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. More...
 

Additional Inherited Members

- Public Types inherited from openmsx::MSXDevice
using Devices = std::vector< MSXDevice * >
 
- Static Public Attributes inherited from openmsx::MSXDevice
static byte unmappedRead [0x10000]
 
static byte unmappedWrite [0x10000]
 
- Protected Member Functions inherited from openmsx::MSXDevice
 MSXDevice (const DeviceConfig &config, const std::string &name)
 Every MSXDevice has a config entry; this constructor gets some device properties from that config entry. More...
 
 MSXDevice (const DeviceConfig &config)
 
virtual void init ()
 
virtual void getExtraDeviceInfo (TclObject &result) const
 

Detailed Description

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

Definition at line 29 of file V9990.hh.

Constructor & Destructor Documentation

◆ V9990()

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

◆ ~V9990()

openmsx::V9990::~V9990 ( )

Definition at line 106 of file V9990.cc.

References openmsx::Display::detach().

Member Function Documentation

◆ cmdReady()

void openmsx::V9990::cmdReady ( )
inline

Command execution ready.

Definition at line 284 of file V9990.hh.

Referenced by openmsx::V9990CmdEngine::peekCmdData().

◆ getBackDropColor()

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

Return the current back drop color.

Returns
Index the color palette

Definition at line 212 of file V9990.hh.

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

◆ getBottomBorder()

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

Definition at line 337 of file V9990.hh.

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

Referenced by getPalette(), and 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 205 of file V9990.hh.

◆ getColorMode()

V9990ColorMode openmsx::V9990::getColorMode ( ) const

◆ 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 154 of file V9990.hh.

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

Referenced by openmsx::V9990SDLRasterizer< Pixel >::drawDisplay().

◆ 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 71 of file V9990.hh.

Referenced by openmsx::V9990SDLRasterizer< Pixel >::drawDisplay(), openmsx::V9990SDLRasterizer< Pixel >::frameEnd(), and openmsx::V9990PixelRenderer::frameStart().

◆ getHorizontalTiming()

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

Get horizontal display timings.

Definition at line 309 of file V9990.hh.

Referenced by openmsx::V9990SDLRasterizer< Pixel >::frameStart().

◆ getImageWidth()

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

◆ getLeftBorder()

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

Get the number of VDP clockticks between the start of the line and the end of the left border.

Definition at line 316 of file V9990.hh.

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

Referenced by openmsx::V9990PixelRenderer::frameEnd(), getRightBorder(), and peekIO().

◆ getLineWidth()

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

◆ getPalette()

void openmsx::V9990::getPalette ( int  index,
byte r,
byte g,
byte b,
bool &  ys 
) const

◆ getPaletteOffset()

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

Get palette offset.

Result is between 0..15.

Returns
palette offset

Definition at line 96 of file V9990.hh.

References getPalette().

Referenced by openmsx::V9990P1Converter< Pixel >::convertLine(), openmsx::V9990P2Converter< Pixel >::convertLine(), and openmsx::V9990BitmapConverter< Pixel >::V9990BitmapConverter().

◆ 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 111 of file V9990.cc.

Referenced by openmsx::Video9000::writeIO().

◆ getPriorityControlX()

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

Definition at line 341 of file V9990.hh.

Referenced by openmsx::V9990P1Converter< Pixel >::convertLine().

◆ getPriorityControlY()

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

◆ getRightBorder()

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

Get the number of VDP clockticks between the start of the line and the end of the right border.

Definition at line 323 of file V9990.hh.

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

Referenced by openmsx::V9990PixelRenderer::frameEnd(), and peekIO().

◆ getRollMask()

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

◆ getScrollAX()

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

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

Definition at line 218 of file V9990.hh.

Referenced by openmsx::V9990P1Converter< Pixel >::convertLine(), openmsx::V9990P2Converter< Pixel >::convertLine(), and openmsx::V9990SDLRasterizer< Pixel >::drawDisplay().

◆ getScrollAY()

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

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

Definition at line 224 of file V9990.hh.

Referenced by openmsx::V9990P1Converter< Pixel >::convertLine(), openmsx::V9990P2Converter< Pixel >::convertLine(), and openmsx::V9990SDLRasterizer< Pixel >::drawDisplay().

◆ getScrollBX()

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

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

Definition at line 230 of file V9990.hh.

Referenced by openmsx::V9990P1Converter< Pixel >::convertLine().

◆ getScrollBY()

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

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

Definition at line 236 of file V9990.hh.

Referenced by openmsx::V9990P1Converter< Pixel >::convertLine().

◆ getSpritePaletteOffset()

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

return sprite palette offset

Definition at line 303 of file V9990.hh.

Referenced by openmsx::V9990BitmapConverter< Pixel >::setColorMode().

◆ getSpritePatternAddress()

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

Return the sprite pattern table base address.

Definition at line 290 of file V9990.hh.

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

◆ 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 117 of file V9990.hh.

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

Referenced by openmsx::V9990PixelRenderer::frameEnd(), and peekIO().

◆ getVerticalTiming()

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

Get vertical display timings.

Definition at line 329 of file V9990.hh.

Referenced by openmsx::V9990SDLRasterizer< Pixel >::frameStart().

◆ getVRAM()

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

Obtain a reference to the V9990's VRAM.

Definition at line 50 of file V9990.hh.

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

◆ 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 80 of file V9990.hh.

Referenced by openmsx::V9990PixelRenderer::reset(), and writeIO().

◆ 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 64 of file V9990.hh.

Referenced by openmsx::V9990SDLRasterizer< Pixel >::drawDisplay(), 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 57 of file V9990.hh.

Referenced by openmsx::V9990PixelRenderer::frameEnd(), openmsx::V9990SDLRasterizer< Pixel >::frameEnd(), and openmsx::V9990PixelRenderer::frameStart().

◆ isOverScan()

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

Returns true iff in overscan mode.

Definition at line 131 of file V9990.hh.

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

Referenced by openmsx::V9990SDLRasterizer< Pixel >::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 125 of file V9990.hh.

Referenced by openmsx::V9990PixelRenderer::frameEnd(), getCursorYOffset(), and getPalette().

◆ 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 141 of file V9990.hh.

Referenced by getPalette(), openmsx::V9990SDLRasterizer< Pixel >::setPalette(), and openmsx::V9990BitmapConverter< Pixel >::V9990BitmapConverter().

◆ 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 save 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 223 of file V9990.cc.

References getBottomBorder(), getLeftBorder(), getRightBorder(), getTopBorder(), getUCTicksThisFrame(), 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 120 of file V9990.cc.

References reset().

Referenced by V9990().

◆ 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 peekIO().

◆ 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 126 of file V9990.cc.

References 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 146 of file V9990.hh.

Referenced by openmsx::Video9000::writeIO().

◆ spritesEnabled()

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

Are sprites (cursors) enabled?

Returns
true iff enabled

Definition at line 87 of file V9990.hh.

Referenced by openmsx::V9990SDLRasterizer< Pixel >::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 169 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< Pixel >::drawBorder(), and openmsx::V9990SDLRasterizer< Pixel >::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 286 of file V9990.cc.

References getColorMode(), openmsx::MSXDevice::getCurrentTime(), getDisplayMode(), openmsx::MSXDevice::getMotherBoard(), openmsx::MSXDevice::getName(), isDisplayEnabled(), and openmsx::IntHelper< SOURCE >::reset().

Referenced by reset().


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