openMSX
|
Implementation of the Yamaha V9990 VDP as used in the GFX9000 cartridge by Sunrise. More...
#include <V9990.hh>
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. | |
PostProcessor * | getPostProcessor () const |
Used by Video9000 to be able to couple the VDP and V9990 output. | |
V9990VRAM & | getVRAM () |
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 V9990DisplayPeriod & | getHorizontalTiming () 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 V9990DisplayPeriod & | getVerticalTiming () 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 | |
MSXDevice & | operator= (const MSXDevice &)=delete |
MSXDevice & | operator= (MSXDevice &&)=delete |
virtual | ~MSXDevice ()=0 |
const HardwareConfig & | getHardwareConfig () 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 byte * | getReadCacheLine (word start) const |
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading. | |
virtual byte * | getWriteCacheLine (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) |
MSXMotherBoard & | getMotherBoard () const |
Get the mother board this device belongs to. | |
const XMLElement & | getDeviceConfig () const |
Get the configuration section for this device. | |
const DeviceConfig & | getDeviceConfig2 () const |
const Devices & | getReferences () const |
Get the device references that are specified for this device. | |
EmuTime::param | getCurrentTime () const |
MSXCPU & | getCPU () const |
MSXCPUInterface & | getCPUInterface () const |
Scheduler & | getScheduler () const |
MSXCliComm & | getCliComm () const |
Reactor & | getReactor () const |
CommandController & | getCommandController () const |
PluggingController & | getPluggingController () const |
LedStatus & | getLedStatus () 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 |
|
explicit |
|
override |
Definition at line 105 of file V9990.cc.
References openmsx::Display::detach().
|
inline |
|
inline |
Return the current back drop color.
Definition at line 218 of file V9990.hh.
Referenced by openmsx::V9990P2Converter::convertLine(), openmsx::V9990P1Converter::convertLine(), and openmsx::V9990SDLRasterizer::drawBorder().
|
inline |
Definition at line 344 of file V9990.hh.
References openmsx::V9990DisplayPeriod::display, and getTopBorder().
Referenced by peekIO().
|
inline |
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().
|
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().
|
inline |
Return the current display mode.
Definition at line 196 of file V9990.hh.
Referenced by openmsx::V9990PixelRenderer::frameStart(), getLineWidth(), openmsx::V9990SDLRasterizer::reset(), and openmsx::V9990PixelRenderer::reset().
|
inline |
Is the even or odd field being displayed?
Definition at line 76 of file V9990.hh.
Referenced by openmsx::V9990SDLRasterizer::drawBxMode(), openmsx::V9990SDLRasterizer::frameEnd(), and openmsx::V9990PixelRenderer::frameStart().
|
inline |
Get horizontal display timings.
Definition at line 316 of file V9990.hh.
Referenced by openmsx::V9990SDLRasterizer::frameStart().
|
inline |
|
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().
|
inline |
Return the display width.
Definition at line 274 of file V9990.hh.
References openmsx::B0, openmsx::B1, openmsx::B2, openmsx::B3, openmsx::B4, openmsx::B5, openmsx::B6, openmsx::B7, getDisplayMode(), openmsx::P1, openmsx::P2, and UNREACHABLE.
Referenced by openmsx::V9990SDLRasterizer::drawBorder(), and openmsx::V9990SDLRasterizer::drawBxMode().
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().
|
inline |
Get palette offset.
Result is between [0..15] (this represents a logical number between [0..63] with lowest two bits always 0).
Definition at line 101 of file V9990.hh.
Referenced by openmsx::V9990P2Converter::convertLine(), and openmsx::V9990P1Converter::convertLine().
PostProcessor * openmsx::V9990::getPostProcessor | ( | ) | const |
|
inline |
Definition at line 348 of file V9990.hh.
References t.
Referenced by openmsx::V9990P1Converter::convertLine().
|
inline |
Definition at line 352 of file V9990.hh.
References t.
Referenced by openmsx::V9990P1Converter::convertLine().
|
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().
|
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().
|
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().
|
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().
|
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().
|
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().
|
inline |
return sprite palette offset
Definition at line 310 of file V9990.hh.
Referenced by openmsx::CursorInfo::CursorInfo().
|
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().
|
inline |
Definition at line 340 of file V9990.hh.
References openmsx::V9990DisplayPeriod::blank, and openmsx::V9990DisplayPeriod::border1.
Referenced by openmsx::V9990PixelRenderer::frameStart(), getBottomBorder(), and peekIO().
|
inline |
Get the number of elapsed UC ticks in this frame.
time | Point in emulated time. |
Definition at line 122 of file V9990.hh.
References openmsx::Clock< FREQ_NUM, FREQ_DENOM >::getTicksTill_fast().
Referenced by peekIO().
|
inline |
Get vertical display timings.
Definition at line 336 of file V9990.hh.
Referenced by openmsx::V9990SDLRasterizer::frameStart().
|
inline |
|
inline |
Is the display enabled? Note this is simpler than the V99x8 version.
Probably ok because V9990 doesn't have the same overscan trick (?)
Definition at line 85 of file V9990.hh.
Referenced by openmsx::V9990PixelRenderer::reset().
|
inline |
Get even/odd page alternation status.
Definition at line 69 of file V9990.hh.
Referenced by openmsx::V9990SDLRasterizer::drawBxMode(), openmsx::V9990PixelRenderer::frameEnd(), and openmsx::V9990PixelRenderer::frameStart().
|
inline |
Get interlace status.
Definition at line 62 of file V9990.hh.
Referenced by openmsx::CursorInfo::CursorInfo(), openmsx::V9990PixelRenderer::frameEnd(), openmsx::V9990SDLRasterizer::frameEnd(), and openmsx::V9990PixelRenderer::frameStart().
|
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().
|
inline |
Is PAL timing active? This setting is fixed at start of frame.
Definition at line 130 of file V9990.hh.
Referenced by getCursorYOffset().
|
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().
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().
|
overridevirtual |
This method is called when MSX is powered up.
The default implementation calls reset(), this is usually ok.
time | The 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().
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().
|
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().
void openmsx::V9990::serialize | ( | Archive & | ar, |
unsigned | version | ||
) |
Definition at line 892 of file V9990.cc.
References openmsx::MSXDevice::getCurrentTime(), openmsx::V9990VRAM::readVRAMCPU(), and openmsx::Schedulable::restoreOld().
|
inline |
|
inline |
Are sprites (cursors) enabled?
Definition at line 92 of file V9990.hh.
Referenced by openmsx::V9990SDLRasterizer::drawDisplay().
|
inlinestatic |
Convert UC ticks to V9990 pixel position on a line.
ticks | Nr of UC Ticks |
mode | Display mode |
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().
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().