openMSX
VDP.hh
Go to the documentation of this file.
1 #ifndef VDP_HH
2 #define VDP_HH
3 
4 #include "MSXDevice.hh"
5 #include "Schedulable.hh"
7 #include "SimpleDebuggable.hh"
8 #include "TclCallback.hh"
9 #include "InfoTopic.hh"
10 #include "IRQHelper.hh"
11 #include "Clock.hh"
12 #include "DisplayMode.hh"
13 #include "Observer.hh"
14 #include "openmsx.hh"
15 #include <memory>
16 
17 namespace openmsx {
18 
19 class PostProcessor;
20 class Renderer;
21 class VDPCmdEngine;
22 class VDPVRAM;
23 class SpriteChecker;
24 class Display;
25 class RawFrame;
26 class Setting;
27 template<typename> class EnumSetting;
28 namespace VDPAccessSlots {
29  enum Delta : int;
30  class Calculator;
31 }
32 
58 class VDP final : public MSXDevice, private VideoSystemChangeListener
59  , private Observer<Setting>
60 {
61 public:
64  static const int TICKS_PER_SECOND = 3579545 * 6; // 21.5MHz;
66 
69  static const int TICKS_PER_LINE = 1368;
70 
71  explicit VDP(const DeviceConfig& config);
72  ~VDP();
73 
74  void powerUp(EmuTime::param time) override;
75  void reset(EmuTime::param time) override;
76  byte readIO(word port, EmuTime::param time) override;
77  byte peekIO(word port, EmuTime::param time) const override;
78  void writeIO(word port, byte value, EmuTime::param time) override;
79 
85 
90  inline bool isMSX1VDP() const {
91  return (version & VM_MSX1) != 0;
92  }
93 
97  inline bool isVDPwithPALonly() const {
98  return (version & VM_PAL) != 0;
99  }
100 
104  inline bool vdpLacksMirroring() const {
105  return (version & VM_NO_MIRRORING) != 0;
106  }
107 
111  inline bool vdpHasPatColMirroring() const {
112  return (version & VM_PALCOL_MIRRORING) != 0;
113  }
114 
118  inline bool isVDPwithVRAMremapping() const {
119  return (version & VM_VRAM_REMAPPING) != 0;
120  }
121 
125  inline bool hasToshibaPalette() const {
126  return (version & VM_TOSHIBA_PALETTE) != 0;
127  }
128 
132  inline bool hasYJK() const {
133  return (version & VM_YJK) != 0;
134  }
135 
139  inline DisplayMode getDisplayMode() const {
140  return displayMode;
141  }
142 
145  inline VDPVRAM& getVRAM() {
146  return *vram;
147  }
148 
153  inline const RawFrame* isSuperimposing() const {
154  // Note that bit 0 of r#0 has no effect on an V9938 or higher,
155  // but this bit is masked out. Also note that on an MSX1, if
156  // bit 0 of r#0 is enabled and there is no external video
157  // source, then we lose sync.
158  // Also note that because this property is fixed per frame we
159  // cannot (re)calculate it from register values.
160  return superimposing;
161  }
162 
166  return *spriteChecker;
167  }
168 
172  inline bool getTransparency() const {
173  return (controlRegs[8] & 0x20) == 0;
174  }
175 
179  inline int getForegroundColor() const {
180  return controlRegs[7] >> 4;
181  }
182 
191  inline int getBackgroundColor() const {
192  byte reg7 = controlRegs[7];
193  if (displayMode.getByte() == DisplayMode::GRAPHIC7) {
194  return reg7;
195  } else {
196  return reg7 & 0x0F;
197  }
198  }
199 
203  inline int getBlinkForegroundColor() const {
204  return controlRegs[12] >> 4;
205  }
206 
210  inline int getBlinkBackgroundColor() const {
211  return controlRegs[12] & 0x0F;
212  }
213 
217  inline bool getBlinkState() const {
218  return blinkState;
219  }
220 
226  inline word getPalette(int index) const {
227  return palette[index];
228  }
229 
235  inline bool isDisplayEnabled() const {
236  return isDisplayArea && displayEnabled;
237  }
238 
243  inline bool spritesEnabled() const {
244  return displayEnabled &&
245  (displayMode.getSpriteMode(isMSX1VDP()) != 0) &&
246  ((controlRegs[8] & 0x02) == 0x00);
247  }
248 
252  inline bool spritesEnabledFast() const {
253  assert(displayMode.getSpriteMode(isMSX1VDP()) != 0);
254  return displayEnabled && ((controlRegs[8] & 0x02) == 0x00);
255  }
256 
260  inline bool spritesEnabledRegister() const {
261  return (controlRegs[8] & 0x02) == 0x00;
262  }
263 
267  inline byte getVerticalScroll() const {
268  return controlRegs[23];
269  }
270 
276  inline byte getHorizontalScrollLow() const {
277  return controlRegs[27];
278  }
279 
285  inline byte getHorizontalScrollHigh() const {
286  return controlRegs[26];
287  }
288 
294  inline bool isBorderMasked() const {
295  return (controlRegs[25] & 0x02) != 0;
296  }
297 
304  inline bool isMultiPageScrolling() const {
305  return (controlRegs[25] & 0x01) && (controlRegs[2] & 0x20);
306  }
307 
312  inline int getLineZero() const {
313  return displayStart / TICKS_PER_LINE;
314  }
315 
320  inline bool isPalTiming() const {
321  return palTiming;
322  }
323 
331  inline bool isInterlaced() const {
332  return interlaced;
333  }
334 
346  inline bool isEvenOddEnabled() const {
347  return (controlRegs[9] & 4) != 0;
348  }
349 
353  inline bool getEvenOdd() const {
354  return (statusReg2 & 2) != 0;
355  }
356 
367  inline int getEvenOddMask() const {
368  // TODO: Verify which page is displayed on even fields.
369  return (((~controlRegs[9] & 4) << 6) | ((statusReg2 & 2) << 7)) &
370  (!blinkState << 8);
371  }
372 
376  inline int getTicksThisFrame(EmuTime::param time) const {
377  return frameStartTime.getTicksTill_fast(time);
378  }
379 
381  return frameStartTime.getTime();
382  }
383 
386  inline int getSpriteSize() const {
387  return ((controlRegs[1] & 2) << 2) + 8;
388  }
389 
392  inline bool isSpriteMag() const {
393  return controlRegs[1] & 1;
394  }
395 
399  inline bool getCmdBit() const {
400  return (controlRegs[25] & 0x40) != 0;
401  }
402 
405  inline int getTicksPerFrame() const {
406  return palTiming ? TICKS_PER_LINE * 313 : TICKS_PER_LINE * 262;
407  }
408 
418  inline bool isInsideFrame(EmuTime::param time) const {
419  return time >= frameStartTime.getTime() &&
421  }
422 
426  inline int getHorizontalAdjust() const {
427  return horizontalAdjust;
428  }
429 
437  inline int getLeftSprites() const {
438  return 100 + 102 + 56
439  + (horizontalAdjust - 7) * 4
440  + (displayMode.isTextMode() ? 36 : 0);
441  }
442 
448  inline int getLeftBorder() const {
449  return getLeftSprites() + (isBorderMasked() ? 8 * 4 : 0);
450  }
451 
455  inline int getRightBorder() const {
456  return getLeftSprites()
457  + (displayMode.isTextMode() ? 960 : 1024);
458  }
459 
465  inline int getLeftBackground() const {
466  return getLeftSprites() + getHorizontalScrollLow() * 4;
467  }
468 
472  byte getStatusReg0() const { return statusReg0; }
473 
482  void setSpriteStatus(byte value)
483  {
484  statusReg0 = (statusReg0 & 0x80) | (value & 0x7F);
485  }
486 
490  bool getVRMode() const {
491  return (controlRegs[8] & 8) != 0;
492  }
493 
496  void setExternalVideoSource(const RawFrame* externalSource) {
497  externalVideo = externalSource;
498  }
499 
502  bool getBrokenCmdTiming() const {
503  return brokenCmdTiming;
504  }
505 
509 
520  EmuTime::param time, EmuTime::param limit) const;
521 
523  bool cpuAccessScheduled() const {
524  return pendingCpuAccess; // pendingSyncPoint(CPU_VRAM_ACCESS)
525  }
526 
527  template<typename Archive>
528  void serialize(Archive& ar, unsigned version);
529 
530 private:
531  void initTables();
532 
533  // VdpVersion bitmasks
534  static const unsigned VM_MSX1 = 1; // set-> MSX1, unset-> MSX2 or MSX2+
535  static const unsigned VM_PAL = 2; // set-> fixed PAL, unset-> fixed NTSC or switchable
536  static const unsigned VM_NO_MIRRORING = 4; // set-> no (screen2) mirroring
537  static const unsigned VM_PALCOL_MIRRORING = 8; // set-> pattern/color-table mirroring
538  static const unsigned VM_VRAM_REMAPPING = 16; // set-> 4k,8/16k VRAM remapping
539  static const unsigned VM_TOSHIBA_PALETTE = 32; // set-> has Toshiba palette
540  static const unsigned VM_YJK = 64; // set-> has YJK (MSX2+)
541 
543  enum VdpVersion {
548  TMS99X8A = VM_MSX1 | VM_PALCOL_MIRRORING | VM_VRAM_REMAPPING,
549 
551  TMS9929A = VM_MSX1 | VM_PALCOL_MIRRORING | VM_VRAM_REMAPPING | VM_PAL,
552 
554  TMS9129 = VM_MSX1 | VM_PAL,
555 
557  TMS91X8 = VM_MSX1,
558 
560  T6950PAL = VM_MSX1 | VM_TOSHIBA_PALETTE | VM_NO_MIRRORING | VM_PAL,
561 
563  T6950NTSC = VM_MSX1 | VM_TOSHIBA_PALETTE | VM_NO_MIRRORING,
564 
566  T7937APAL = VM_MSX1 | VM_TOSHIBA_PALETTE | VM_PAL,
567 
569  T7937ANTSC = VM_MSX1 | VM_TOSHIBA_PALETTE,
570 
572  V9938 = 0,
573 
575  V9958 = VM_YJK,
576  };
577 
578  struct SyncBase : public Schedulable {
579  SyncBase(VDP& vdp_) : Schedulable(vdp_.getScheduler()), vdp(vdp_) {}
580  VDP& vdp;
581  friend class VDP;
582  };
583 
584  struct SyncVSync : public SyncBase {
585  SyncVSync(VDP& vdp) : SyncBase(vdp) {}
586  virtual void executeUntil(EmuTime::param time) { vdp.execVSync(time); }
587  } syncVSync;
588 
589  struct SyncDisplayStart : public SyncBase {
590  SyncDisplayStart(VDP& vdp) : SyncBase(vdp) {}
591  virtual void executeUntil(EmuTime::param time) { vdp.execDisplayStart(time); }
592  } syncDisplayStart;
593 
594  struct SyncVScan : public SyncBase {
595  SyncVScan(VDP& vdp) : SyncBase(vdp) {}
596  virtual void executeUntil(EmuTime::param time) { vdp.execVScan(time); }
597  } syncVScan;
598 
599  struct SyncHScan : public SyncBase {
600  SyncHScan(VDP& vdp) : SyncBase(vdp) {}
601  virtual void executeUntil(EmuTime::param /*time*/) { vdp.execHScan(); }
602  } syncHScan;
603 
604  struct SyncHorAdjust : public SyncBase {
605  SyncHorAdjust(VDP& vdp) : SyncBase(vdp) {}
606  virtual void executeUntil(EmuTime::param time) { vdp.execHorAdjust(time); }
607  } syncHorAdjust;
608 
609  struct SyncSetMode : public SyncBase {
610  SyncSetMode(VDP& vdp) : SyncBase(vdp) {}
611  virtual void executeUntil(EmuTime::param time) { vdp.execSetMode(time); }
612  } syncSetMode;
613 
614  struct SyncSetBlank : public SyncBase {
615  SyncSetBlank(VDP& vdp) : SyncBase(vdp) {}
616  virtual void executeUntil(EmuTime::param time) { vdp.execSetBlank(time); }
617  } syncSetBlank;
618 
619  struct SyncCpuVramAccess : public SyncBase {
620  SyncCpuVramAccess(VDP& vdp) : SyncBase(vdp) {}
621  virtual void executeUntil(EmuTime::param time) { vdp.execCpuVramAccess(time); }
622  } syncCpuVramAccess;
623 
624  void execVSync(EmuTime::param time);
625  void execDisplayStart(EmuTime::param time);
626  void execVScan(EmuTime::param time);
627  void execHScan();
628  void execHorAdjust(EmuTime::param time);
629  void execSetMode(EmuTime::param time);
630  void execSetBlank(EmuTime::param time);
631  void execCpuVramAccess(EmuTime::param time);
632 
643  static const int LINE_COUNT_RESET_TICKS = 15 * TICKS_PER_LINE;
644 
648  inline int getNumberOfLines() const {
649  return controlRegs[9] & 0x80 ? 212 : 192;
650  }
651 
661  inline bool getHR(int ticksThisFrame) const {
662  // Note: These constants are located inside this function because
663  // GCC 4.0.x won't link if they are in the class scope.
667  static const int HBLANK_LEN_TXT = 404;
671  static const int HBLANK_LEN_GFX = 312;
672  return
673  ( ticksThisFrame + TICKS_PER_LINE - getRightBorder()
674  ) % TICKS_PER_LINE
675  < (displayMode.isTextMode() ? HBLANK_LEN_TXT : HBLANK_LEN_GFX);
676  }
677 
678  // VideoSystemChangeListener interface:
679  void preVideoSystemChange() override;
680  void postVideoSystemChange() override;
681 
686  void resetInit();
687 
692  void resetMasks(EmuTime::param time);
693 
697  void frameStart(EmuTime::param time);
698 
706  void scheduleDisplayStart(EmuTime::param time);
707 
713  void scheduleVScan(EmuTime::param time);
714 
720  void scheduleHScan(EmuTime::param time);
721 
724  void vramWrite(byte value, EmuTime::param time);
725 
728  byte vramRead(EmuTime::param time);
729 
731  void scheduleCpuVramAccess(bool isRead, byte write, EmuTime::param time);
732  void executeCpuVramAccess(EmuTime::param time);
733 
736  byte peekStatusReg(byte reg, EmuTime::param time) const;
737  byte readStatusReg(byte reg, EmuTime::param time);
738 
741  void changeRegister(byte reg, byte val, EmuTime::param time);
742 
745  void syncAtNextLine(SyncBase& type, EmuTime::param time);
746 
749  void createRenderer();
750 
754  void updateNameBase(EmuTime::param time);
755 
759  void updateColorBase(EmuTime::param time);
760 
764  void updatePatternBase(EmuTime::param time);
765 
769  void updateSpriteAttributeBase(EmuTime::param time);
770 
774  void updateSpritePatternBase(EmuTime::param time);
775 
779  void updateDisplayMode(DisplayMode newMode, EmuTime::param time);
780 
787  void setPalette(int index, word grb, EmuTime::param time);
788 
789  // Observer<Setting>
790  void update(const Setting& setting) override;
791 
792 private:
793  Display& display;
794  EnumSetting<bool>& cmdTiming;
795  EnumSetting<bool>& tooFastAccess;
796 
797  class RegDebug final : public SimpleDebuggable {
798  public:
799  explicit RegDebug(VDP& vdp);
800  byte read(unsigned address) override;
801  void write(unsigned address, byte value, EmuTime::param time) override;
802  private:
803  VDP& vdp;
804  } vdpRegDebug;
805 
806  class StatusRegDebug final : public SimpleDebuggable {
807  public:
808  explicit StatusRegDebug(VDP& vdp);
809  byte read(unsigned address, EmuTime::param time) override;
810  private:
811  VDP& vdp;
812  } vdpStatusRegDebug;
813 
814  class PaletteDebug final : public SimpleDebuggable {
815  public:
816  explicit PaletteDebug(VDP& vdp);
817  byte read(unsigned address) override;
818  void write(unsigned address, byte value, EmuTime::param time) override;
819  private:
820  VDP& vdp;
821  } vdpPaletteDebug;
822 
823  class VRAMPointerDebug final : public SimpleDebuggable {
824  public:
825  explicit VRAMPointerDebug(VDP& vdp);
826  byte read(unsigned address) override;
827  void write(unsigned address, byte value, EmuTime::param time) override;
828  private:
829  VDP& vdp;
830  } vramPointerDebug;
831 
832  class Info : public InfoTopic {
833  public:
834  void execute(array_ref<TclObject> tokens,
835  TclObject& result) const override;
836  std::string help(const std::vector<std::string>& tokens) const override;
837  virtual int calc(const EmuTime& time) const = 0;
838  protected:
839  Info(VDP& vdp_, const std::string& name, std::string helpText_);
840  VDP& vdp;
841  const std::string helpText;
842  };
843 
844  struct FrameCountInfo final : Info {
845  FrameCountInfo(VDP& vdp);
846  int calc(const EmuTime& time) const override;
847  } frameCountInfo;
848 
849  struct CycleInFrameInfo final : Info {
850  CycleInFrameInfo(VDP& vdp);
851  int calc(const EmuTime& time) const override;
852  } cycleInFrameInfo;
853 
854  struct LineInFrameInfo final : Info {
855  LineInFrameInfo(VDP& vdp);
856  int calc(const EmuTime& time) const override;
857  } lineInFrameInfo;
858 
859  struct CycleInLineInfo final : Info {
860  CycleInLineInfo(VDP& vdp);
861  int calc(const EmuTime& time) const override;
862  } cycleInLineInfo;
863 
864  struct MsxYPosInfo final : Info {
865  MsxYPosInfo(VDP& vdp);
866  int calc(const EmuTime& time) const override;
867  } msxYPosInfo;
868 
869  struct MsxX256PosInfo final : Info {
870  MsxX256PosInfo(VDP& vdp);
871  int calc(const EmuTime& time) const override;
872  } msxX256PosInfo;
873 
874  struct MsxX512PosInfo final : Info {
875  MsxX512PosInfo(VDP& vdp);
876  int calc(const EmuTime& time) const override;
877  } msxX512PosInfo;
878 
881  std::unique_ptr<Renderer> renderer;
882 
885  std::unique_ptr<VDPCmdEngine> cmdEngine;
886 
889  std::unique_ptr<SpriteChecker> spriteChecker;
890 
893  std::unique_ptr<VDPVRAM> vram;
894 
898  const RawFrame* externalVideo;
899 
905  const RawFrame* superimposing;
906 
909  VDPClock frameStartTime;
910 
913  OptionalIRQHelper irqVertical;
914 
917  OptionalIRQHelper irqHorizontal;
918 
921  EmuTime displayStartSyncTime;
922 
925  EmuTime vScanSyncTime;
926 
929  EmuTime hScanSyncTime;
930 
931  TclCallback tooFastCallback;
932 
935  VdpVersion version;
936 
942  int frameCount;
943 
946  int displayStart;
947 
951  int horizontalScanOffset;
952 
956  int horizontalAdjust;
957 
960  byte controlRegs[32];
961 
966  int controlRegMask;
967 
974  byte controlValueMasks[32];
975 
979  int blinkCount;
980 
984  int vramPointer;
985 
988  word palette[16];
989 
992  bool isDisplayArea;
993 
999  bool palTiming;
1000 
1004  bool interlaced;
1005 
1010  byte statusReg0;
1011 
1017  byte statusReg1;
1018 
1023  byte statusReg2;
1024 
1027  bool blinkState;
1028 
1031  byte dataLatch;
1032 
1035  bool registerDataStored;
1036 
1039  bool paletteDataStored;
1040 
1048  byte cpuVramData;
1049 
1053  bool cpuVramReqIsRead;
1054  bool pendingCpuAccess; // always equal to pendingSyncPoint(CPU_VRAM_ACCESS)
1055 
1059  bool cpuExtendedVram;
1060 
1066  DisplayMode displayMode;
1067 
1072  bool displayEnabled;
1073 
1077  bool warningPrinted;
1078 
1080  bool brokenCmdTiming;
1081  bool allowTooFastAccess;
1082 };
1084 
1085 } // namespace openmsx
1086 
1087 #endif
int getBlinkBackgroundColor() const
Gets the current blinking color for blinking text.
Definition: VDP.hh:210
bool isInsideFrame(EmuTime::param time) const
Is the given timestamp inside the current frame? Mainly useful for debugging, because relevant timest...
Definition: VDP.hh:418
int getBlinkForegroundColor() const
Gets the current blinking color for blinking text.
Definition: VDP.hh:203
bool isBorderMasked() const
Gets the current border mask setting.
Definition: VDP.hh:294
bool isEvenOddEnabled() const
Get even/odd page alternation status.
Definition: VDP.hh:346
bool vdpHasPatColMirroring() const
Is this a VDP that has pattern/colortable mirroring?
Definition: VDP.hh:111
void setSpriteStatus(byte value)
Should only be used by SpriteChecker.
Definition: VDP.hh:482
bool spritesEnabled() const
Are sprites enabled?
Definition: VDP.hh:243
int getHorizontalAdjust() const
This is a combination of the (horizontal) set adjust register and the YJK-mode bit.
Definition: VDP.hh:426
void powerUp(EmuTime::param time) override
This method is called when MSX is powered up.
Definition: VDP.cc:256
static const int TICKS_PER_LINE
Number of VDP clock ticks per line.
Definition: VDP.hh:69
SpriteChecker & getSpriteChecker()
Get the sprite checker for this VDP.
Definition: VDP.hh:165
bool isMultiPageScrolling() const
Is multi page scrolling enabled? It is considered enabled if both the multi page scrolling flag is en...
Definition: VDP.hh:304
bool vdpLacksMirroring() const
Is this a VDP that lacks mirroring?
Definition: VDP.hh:104
VDPAccessSlots::Calculator getAccessSlotCalculator(EmuTime::param time, EmuTime::param limit) const
Same as getAccessSlot(), but it can be much faster for repeated calls, e.g.
Definition: VDP.cc:767
DisplayMode getDisplayMode() const
Get the display mode the VDP is in.
Definition: VDP.hh:139
int getRightBorder() const
Gets the number of VDP clockticks between start of line and the start of the right border...
Definition: VDP.hh:455
int getSpriteMode(bool isMSX1) const
Get the sprite mode of this display mode.
Definition: DisplayMode.hh:176
int getTicksPerFrame() const
Gets the number of VDP clockticks (21MHz) per frame.
Definition: VDP.hh:405
int getLeftSprites() const
Gets the number of VDP clockticks between start of line and the start of the sprite plane...
Definition: VDP.hh:437
Represents a VDP display mode.
Definition: DisplayMode.hh:14
byte getVerticalScroll() const
Gets the current vertical scroll (line displayed at Y=0).
Definition: VDP.hh:267
const EmuTime & param
Definition: EmuTime.hh:20
byte getHorizontalScrollHigh() const
Gets the current horizontal scroll higher bits.
Definition: VDP.hh:285
int getLeftBackground() const
Gets the number of VDP clockticks between start of line and the time when the background pixel with X...
Definition: VDP.hh:465
const RawFrame * isSuperimposing() const
Are we currently superimposing? In case of superimpose, returns a pointer to the to-be-superimposed f...
Definition: VDP.hh:153
bool hasToshibaPalette() const
Is this a VDP with a Toshiba palette?
Definition: VDP.hh:125
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.
Definition: VDP.cc:554
void serialize(Archive &ar, unsigned version)
Definition: VDP.cc:1549
byte readIO(word port, EmuTime::param time) override
Read a byte from an IO port at a certain time from this device.
Definition: VDP.cc:856
EmuTime::param getFrameStartTime() const
Definition: VDP.hh:380
bool getCmdBit() const
Are commands possible in non Graphic modes? (V9958 only)
Definition: VDP.hh:399
bool getBlinkState() const
Gets the current blink state.
Definition: VDP.hh:217
int getEvenOddMask() const
Expresses the state of even/odd page interchange in a mask on the line number.
Definition: VDP.hh:367
bool isInterlaced() const
Get interlace status.
Definition: VDP.hh:331
bool isSpriteMag() const
Are sprites magnified?
Definition: VDP.hh:392
A video frame as output by the VDP scanline conversion unit, before any postprocessing filters are ap...
Definition: RawFrame.hh:25
This class implements a subset of the proposal for std::array_ref (proposed for the next c++ standard...
Definition: array_ref.hh:19
SERIALIZE_CLASS_VERSION(CassettePlayer, 2)
bool isTextMode() const
Is the current mode a text mode? Text1 and Text2 are text modes.
Definition: DisplayMode.hh:138
int getForegroundColor() const
Gets the current foreground color.
Definition: VDP.hh:179
bool isVDPwithPALonly() const
Is this a VDP only capable of PAL?
Definition: VDP.hh:97
byte getStatusReg0() const
Should only be used by SpriteChecker.
Definition: VDP.hh:472
bool getTransparency() const
Gets the current transparency setting.
Definition: VDP.hh:172
bool isDisplayEnabled() const
Is the display enabled? Both the regular border and forced blanking by clearing the display enable bi...
Definition: VDP.hh:235
bool isMSX1VDP() const
Is this an MSX1 VDP?
Definition: VDP.hh:90
int getSpriteSize() const
Gets the sprite size in pixels (8/16).
Definition: VDP.hh:386
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX...
Definition: MSXDevice.hh:32
PostProcessor * getPostProcessor() const
Used by Video9000 to be able to couple the VDP and V9990 output.
Definition: VDP.cc:185
VDP(const DeviceConfig &config)
Definition: VDP.cc:45
unsigned char byte
8 bit unsigned integer
Definition: openmsx.hh:25
bool getEvenOdd() const
Is the even or odd field being displayed?
Definition: VDP.hh:353
byte getByte() const
Get the dispay mode as a byte: YAE YJK M5..M1 combined.
Definition: DisplayMode.hh:109
bool getBrokenCmdTiming() const
Value of the cmdTiming setting, true means commands have infinite speed.
Definition: VDP.hh:502
virtual byte read(unsigned address, EmuTime::param time)
VDP-VRAM access slot calculator, meant to be used in the inner loops of the VDPCmdEngine commands...
EmuTime getAccessSlot(EmuTime::param time, VDPAccessSlots::Delta delta) const
Get the earliest access slot that is at least 'delta' cycles in the future.
Definition: VDP.cc:761
byte read(unsigned address) override
bool isVDPwithVRAMremapping() const
Does this VDP have VRAM remapping when switching from 4k to 8/16k mode?
Definition: VDP.hh:118
Unified implementation of MSX Video Display Processors (VDPs).
Definition: VDP.hh:58
Abstract base class for post processors.
int getTicksThisFrame(EmuTime::param time) const
Gets the number of VDP clock ticks (21MHz) elapsed between a given time and the start of this frame...
Definition: VDP.hh:376
byte getHorizontalScrollLow() const
Gets the current horizontal scroll lower bits.
Definition: VDP.hh:276
bool cpuAccessScheduled() const
Is there a CPU-VRAM access scheduled.
Definition: VDP.hh:523
bool isPalTiming() const
Is PAL timing active? This setting is fixed at start of frame.
Definition: VDP.hh:320
static const int TICKS_PER_SECOND
Number of VDP clock ticks per second.
Definition: VDP.hh:64
bool hasYJK() const
Does this VDP support YJK display?
Definition: VDP.hh:132
void write(unsigned address, byte value) override
byte peekIO(word port, EmuTime::param time) const override
Read a byte from a given IO port.
Definition: VDP.cc:876
Manages VRAM contents and synchronises the various users of the VRAM.
Definition: VDPVRAM.hh:382
int getLineZero() const
Get the absolute line number of display line zero.
Definition: VDP.hh:312
bool spritesEnabledRegister() const
Still faster variant (just looks at the sprite-enabled-bit).
Definition: VDP.hh:260
Generic Gang-of-Four Observer class, templatized edition.
Definition: Observer.hh:9
bool getVRMode() const
Returns current VR mode.
Definition: VDP.hh:490
word getPalette(int index) const
Gets a palette entry.
Definition: VDP.hh:226
IntHelper< OptionalIRQ > OptionalIRQHelper
Definition: IRQHelper.hh:119
Scheduler & getScheduler() const
Definition: MSXDevice.cc:148
bool spritesEnabledFast() const
Same as spritesEnabled(), but may only be called in sprite mode 1 or 2.
Definition: VDP.hh:252
void setExternalVideoSource(const RawFrame *externalSource)
Enable superimposing.
Definition: VDP.hh:496
VDPVRAM & getVRAM()
Get the VRAM object for this VDP.
Definition: VDP.hh:145
Clock< TICKS_PER_SECOND > VDPClock
Definition: VDP.hh:65
void reset(EmuTime::param time) override
This method is called on reset.
Definition: VDP.cc:262
int getLeftBorder() const
Gets the number of VDP clockticks between start of line and the end of the left border.
Definition: VDP.hh:448
int getBackgroundColor() const
Gets the current background color.
Definition: VDP.hh:191
unsigned short word
16 bit unsigned integer
Definition: openmsx.hh:28