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 "outer.hh"
16 #include <memory>
17 
18 namespace openmsx {
19 
20 class PostProcessor;
21 class Renderer;
22 class VDPCmdEngine;
23 class VDPVRAM;
24 class SpriteChecker;
25 class Display;
26 class RawFrame;
27 class Setting;
28 template<typename> class EnumSetting;
29 namespace VDPAccessSlots {
30  enum Delta : int;
31  class Calculator;
32 }
33 
59 class VDP final : public MSXDevice, private VideoSystemChangeListener
60  , private Observer<Setting>
61 {
62 public:
65  static const int TICKS_PER_SECOND = 3579545 * 6; // 21.5MHz;
67 
70  static const int TICKS_PER_LINE = 1368;
71 
72  explicit VDP(const DeviceConfig& config);
73  ~VDP();
74 
75  void powerUp(EmuTime::param time) override;
76  void reset(EmuTime::param time) override;
77  byte readIO(word port, EmuTime::param time) override;
78  byte peekIO(word port, EmuTime::param time) const override;
79  void writeIO(word port, byte value, EmuTime::param time) override;
80 
86 
91  inline bool isMSX1VDP() const {
92  return (version & VM_MSX1) != 0;
93  }
94 
98  inline bool isVDPwithPALonly() const {
99  return (version & VM_PAL) != 0;
100  }
101 
105  inline bool vdpLacksMirroring() const {
106  return (version & VM_NO_MIRRORING) != 0;
107  }
108 
112  inline bool vdpHasPatColMirroring() const {
113  return (version & VM_PALCOL_MIRRORING) != 0;
114  }
115 
119  inline bool isVDPwithVRAMremapping() const {
120  return (version & VM_VRAM_REMAPPING) != 0;
121  }
122 
126  inline bool hasToshibaPalette() const {
127  return (version & VM_TOSHIBA_PALETTE) != 0;
128  }
129 
133  inline bool hasYJK() const {
134  return (version & VM_YJK) != 0;
135  }
136 
140  inline DisplayMode getDisplayMode() const {
141  return displayMode;
142  }
143 
146  inline VDPVRAM& getVRAM() {
147  return *vram;
148  }
149 
154  inline const RawFrame* isSuperimposing() const {
155  // Note that bit 0 of r#0 has no effect on an V9938 or higher,
156  // but this bit is masked out. Also note that on an MSX1, if
157  // bit 0 of r#0 is enabled and there is no external video
158  // source, then we lose sync.
159  // Also note that because this property is fixed per frame we
160  // cannot (re)calculate it from register values.
161  return superimposing;
162  }
163 
167  return *spriteChecker;
168  }
169 
173  inline bool getTransparency() const {
174  return (controlRegs[8] & 0x20) == 0;
175  }
176 
180  inline int getForegroundColor() const {
181  return controlRegs[7] >> 4;
182  }
183 
192  inline int getBackgroundColor() const {
193  byte reg7 = controlRegs[7];
194  if (displayMode.getByte() == DisplayMode::GRAPHIC7) {
195  return reg7;
196  } else {
197  return reg7 & 0x0F;
198  }
199  }
200 
204  inline int getBlinkForegroundColor() const {
205  return controlRegs[12] >> 4;
206  }
207 
211  inline int getBlinkBackgroundColor() const {
212  return controlRegs[12] & 0x0F;
213  }
214 
218  inline bool getBlinkState() const {
219  return blinkState;
220  }
221 
227  inline word getPalette(int index) const {
228  return palette[index];
229  }
230 
236  inline bool isDisplayEnabled() const {
237  return isDisplayArea && displayEnabled;
238  }
239 
244  inline bool spritesEnabled() const {
245  return displayEnabled &&
246  (displayMode.getSpriteMode(isMSX1VDP()) != 0) &&
247  ((controlRegs[8] & 0x02) == 0x00);
248  }
249 
253  inline bool spritesEnabledFast() const {
254  assert(displayMode.getSpriteMode(isMSX1VDP()) != 0);
255  return displayEnabled && ((controlRegs[8] & 0x02) == 0x00);
256  }
257 
261  inline bool spritesEnabledRegister() const {
262  return (controlRegs[8] & 0x02) == 0x00;
263  }
264 
268  inline byte getVerticalScroll() const {
269  return controlRegs[23];
270  }
271 
277  inline byte getHorizontalScrollLow() const {
278  return controlRegs[27];
279  }
280 
286  inline byte getHorizontalScrollHigh() const {
287  return controlRegs[26];
288  }
289 
295  inline bool isBorderMasked() const {
296  return (controlRegs[25] & 0x02) != 0;
297  }
298 
305  inline bool isMultiPageScrolling() const {
306  return (controlRegs[25] & 0x01) && (controlRegs[2] & 0x20);
307  }
308 
313  inline int getLineZero() const {
314  return displayStart / TICKS_PER_LINE;
315  }
316 
321  inline bool isPalTiming() const {
322  return palTiming;
323  }
324 
332  inline bool isInterlaced() const {
333  return interlaced;
334  }
335 
347  inline bool isEvenOddEnabled() const {
348  return (controlRegs[9] & 4) != 0;
349  }
350 
354  inline bool getEvenOdd() const {
355  return (statusReg2 & 2) != 0;
356  }
357 
368  inline int getEvenOddMask() const {
369  // TODO: Verify which page is displayed on even fields.
370  return (((~controlRegs[9] & 4) << 6) | ((statusReg2 & 2) << 7)) &
371  (!blinkState << 8);
372  }
373 
377  inline int getTicksThisFrame(EmuTime::param time) const {
378  return frameStartTime.getTicksTill_fast(time);
379  }
380 
382  return frameStartTime.getTime();
383  }
384 
387  inline int getSpriteSize() const {
388  return ((controlRegs[1] & 2) << 2) + 8;
389  }
390 
393  inline bool isSpriteMag() const {
394  return controlRegs[1] & 1;
395  }
396 
400  inline bool getCmdBit() const {
401  return (controlRegs[25] & 0x40) != 0;
402  }
403 
406  inline int getTicksPerFrame() const {
407  return palTiming ? TICKS_PER_LINE * 313 : TICKS_PER_LINE * 262;
408  }
409 
419  inline bool isInsideFrame(EmuTime::param time) const {
420  return time >= frameStartTime.getTime() &&
422  }
423 
427  inline int getHorizontalAdjust() const {
428  return horizontalAdjust;
429  }
430 
438  inline int getLeftSprites() const {
439  return 100 + 102 + 56
440  + (horizontalAdjust - 7) * 4
441  + (displayMode.isTextMode() ? 36 : 0);
442  }
443 
449  inline int getLeftBorder() const {
450  return getLeftSprites() + (isBorderMasked() ? 8 * 4 : 0);
451  }
452 
456  inline int getRightBorder() const {
457  return getLeftSprites()
458  + (displayMode.isTextMode() ? 960 : 1024);
459  }
460 
466  inline int getLeftBackground() const {
467  return getLeftSprites() + getHorizontalScrollLow() * 4;
468  }
469 
473  byte getStatusReg0() const { return statusReg0; }
474 
483  void setSpriteStatus(byte value)
484  {
485  statusReg0 = (statusReg0 & 0x80) | (value & 0x7F);
486  }
487 
491  bool getVRMode() const {
492  return (controlRegs[8] & 8) != 0;
493  }
494 
497  void setExternalVideoSource(const RawFrame* externalSource) {
498  externalVideo = externalSource;
499  }
500 
503  bool getBrokenCmdTiming() const {
504  return brokenCmdTiming;
505  }
506 
510 
521  EmuTime::param time, EmuTime::param limit) const;
522 
524  bool cpuAccessScheduled() const {
525  return pendingCpuAccess; // pendingSyncPoint(CPU_VRAM_ACCESS)
526  }
527 
528  template<typename Archive>
529  void serialize(Archive& ar, unsigned version);
530 
531 private:
532  void initTables();
533 
534  // VdpVersion bitmasks
535  static const unsigned VM_MSX1 = 1; // set-> MSX1, unset-> MSX2 or MSX2+
536  static const unsigned VM_PAL = 2; // set-> fixed PAL, unset-> fixed NTSC or switchable
537  static const unsigned VM_NO_MIRRORING = 4; // set-> no (screen2) mirroring
538  static const unsigned VM_PALCOL_MIRRORING = 8; // set-> pattern/color-table mirroring
539  static const unsigned VM_VRAM_REMAPPING = 16; // set-> 4k,8/16k VRAM remapping
540  static const unsigned VM_TOSHIBA_PALETTE = 32; // set-> has Toshiba palette
541  static const unsigned VM_YJK = 64; // set-> has YJK (MSX2+)
542 
544  enum VdpVersion {
549  TMS99X8A = VM_MSX1 | VM_PALCOL_MIRRORING | VM_VRAM_REMAPPING,
550 
552  TMS9929A = VM_MSX1 | VM_PALCOL_MIRRORING | VM_VRAM_REMAPPING | VM_PAL,
553 
555  TMS9129 = VM_MSX1 | VM_PAL,
556 
558  TMS91X8 = VM_MSX1,
559 
561  T6950PAL = VM_MSX1 | VM_TOSHIBA_PALETTE | VM_NO_MIRRORING | VM_PAL,
562 
564  T6950NTSC = VM_MSX1 | VM_TOSHIBA_PALETTE | VM_NO_MIRRORING,
565 
567  T7937APAL = VM_MSX1 | VM_TOSHIBA_PALETTE | VM_PAL,
568 
570  T7937ANTSC = VM_MSX1 | VM_TOSHIBA_PALETTE,
571 
573  V9938 = 0,
574 
576  V9958 = VM_YJK,
577  };
578 
579  struct SyncBase : public Schedulable {
580  SyncBase(VDP& vdp_) : Schedulable(vdp_.getScheduler()) {}
581  friend class VDP;
582  };
583 
584  struct SyncVSync : public SyncBase {
585  SyncVSync(VDP& vdp) : SyncBase(vdp) {}
586  void executeUntil(EmuTime::param time) override {
587  auto& vdp = OUTER(VDP, syncVSync);
588  vdp.execVSync(time);
589  }
590  } syncVSync;
591 
592  struct SyncDisplayStart : public SyncBase {
593  SyncDisplayStart(VDP& vdp) : SyncBase(vdp) {}
594  void executeUntil(EmuTime::param time) override {
595  auto& vdp = OUTER(VDP, syncDisplayStart);
596  vdp.execDisplayStart(time);
597  }
598  } syncDisplayStart;
599 
600  struct SyncVScan : public SyncBase {
601  SyncVScan(VDP& vdp) : SyncBase(vdp) {}
602  void executeUntil(EmuTime::param time) override {
603  auto& vdp = OUTER(VDP, syncVScan);
604  vdp.execVScan(time);
605  }
606  } syncVScan;
607 
608  struct SyncHScan : public SyncBase {
609  SyncHScan(VDP& vdp) : SyncBase(vdp) {}
610  void executeUntil(EmuTime::param /*time*/) override {
611  auto& vdp = OUTER(VDP, syncHScan);
612  vdp.execHScan();
613  }
614  } syncHScan;
615 
616  struct SyncHorAdjust : public SyncBase {
617  SyncHorAdjust(VDP& vdp) : SyncBase(vdp) {}
618  void executeUntil(EmuTime::param time) override {
619  auto& vdp = OUTER(VDP, syncHorAdjust);
620  vdp.execHorAdjust(time);
621  }
622  } syncHorAdjust;
623 
624  struct SyncSetMode : public SyncBase {
625  SyncSetMode(VDP& vdp) : SyncBase(vdp) {}
626  void executeUntil(EmuTime::param time) override {
627  auto& vdp = OUTER(VDP, syncSetMode);
628  vdp.execSetMode(time);
629  }
630  } syncSetMode;
631 
632  struct SyncSetBlank : public SyncBase {
633  SyncSetBlank(VDP& vdp) : SyncBase(vdp) {}
634  void executeUntil(EmuTime::param time) override {
635  auto& vdp = OUTER(VDP, syncSetBlank);
636  vdp.execSetBlank(time);
637  }
638  } syncSetBlank;
639 
640  struct SyncCpuVramAccess : public SyncBase {
641  SyncCpuVramAccess(VDP& vdp) : SyncBase(vdp) {}
642  void executeUntil(EmuTime::param time) override {
643  auto& vdp = OUTER(VDP, syncCpuVramAccess);
644  vdp.execCpuVramAccess(time);
645  }
646  } syncCpuVramAccess;
647 
648  void execVSync(EmuTime::param time);
649  void execDisplayStart(EmuTime::param time);
650  void execVScan(EmuTime::param time);
651  void execHScan();
652  void execHorAdjust(EmuTime::param time);
653  void execSetMode(EmuTime::param time);
654  void execSetBlank(EmuTime::param time);
655  void execCpuVramAccess(EmuTime::param time);
656 
667  static const int LINE_COUNT_RESET_TICKS = 15 * TICKS_PER_LINE;
668 
672  inline int getNumberOfLines() const {
673  return controlRegs[9] & 0x80 ? 212 : 192;
674  }
675 
685  inline bool getHR(int ticksThisFrame) const {
686  // Note: These constants are located inside this function because
687  // GCC 4.0.x won't link if they are in the class scope.
691  static const int HBLANK_LEN_TXT = 404;
695  static const int HBLANK_LEN_GFX = 312;
696  return
697  ( ticksThisFrame + TICKS_PER_LINE - getRightBorder()
698  ) % TICKS_PER_LINE
699  < (displayMode.isTextMode() ? HBLANK_LEN_TXT : HBLANK_LEN_GFX);
700  }
701 
702  // VideoSystemChangeListener interface:
703  void preVideoSystemChange() override;
704  void postVideoSystemChange() override;
705 
710  void resetInit();
711 
716  void resetMasks(EmuTime::param time);
717 
721  void frameStart(EmuTime::param time);
722 
730  void scheduleDisplayStart(EmuTime::param time);
731 
737  void scheduleVScan(EmuTime::param time);
738 
744  void scheduleHScan(EmuTime::param time);
745 
748  void vramWrite(byte value, EmuTime::param time);
749 
752  byte vramRead(EmuTime::param time);
753 
755  void scheduleCpuVramAccess(bool isRead, byte write, EmuTime::param time);
756  void executeCpuVramAccess(EmuTime::param time);
757 
760  byte peekStatusReg(byte reg, EmuTime::param time) const;
761  byte readStatusReg(byte reg, EmuTime::param time);
762 
765  void changeRegister(byte reg, byte val, EmuTime::param time);
766 
769  void syncAtNextLine(SyncBase& type, EmuTime::param time);
770 
773  void createRenderer();
774 
778  void updateNameBase(EmuTime::param time);
779 
783  void updateColorBase(EmuTime::param time);
784 
788  void updatePatternBase(EmuTime::param time);
789 
793  void updateSpriteAttributeBase(EmuTime::param time);
794 
798  void updateSpritePatternBase(EmuTime::param time);
799 
803  void updateDisplayMode(DisplayMode newMode, EmuTime::param time);
804 
811  void setPalette(int index, word grb, EmuTime::param time);
812 
813  // Observer<Setting>
814  void update(const Setting& setting) override;
815 
816 private:
817  Display& display;
818  EnumSetting<bool>& cmdTiming;
819  EnumSetting<bool>& tooFastAccess;
820 
821  struct RegDebug final : SimpleDebuggable {
822  explicit RegDebug(VDP& vdp);
823  byte read(unsigned address) override;
824  void write(unsigned address, byte value, EmuTime::param time) override;
825  } vdpRegDebug;
826 
827  struct StatusRegDebug final : SimpleDebuggable {
828  explicit StatusRegDebug(VDP& vdp);
829  byte read(unsigned address, EmuTime::param time) override;
830  } vdpStatusRegDebug;
831 
832  struct PaletteDebug final : SimpleDebuggable {
833  explicit PaletteDebug(VDP& vdp);
834  byte read(unsigned address) override;
835  void write(unsigned address, byte value, EmuTime::param time) override;
836  } vdpPaletteDebug;
837 
838  struct VRAMPointerDebug final : SimpleDebuggable {
839  explicit VRAMPointerDebug(VDP& vdp);
840  byte read(unsigned address) override;
841  void write(unsigned address, byte value, EmuTime::param time) override;
842  } vramPointerDebug;
843 
844  class Info : public InfoTopic {
845  public:
846  void execute(array_ref<TclObject> tokens,
847  TclObject& result) const override;
848  std::string help(const std::vector<std::string>& tokens) const override;
849  virtual int calc(const EmuTime& time) const = 0;
850  protected:
851  Info(VDP& vdp_, const std::string& name, std::string helpText_);
852  VDP& vdp;
853  const std::string helpText;
854  };
855 
856  struct FrameCountInfo final : Info {
857  FrameCountInfo(VDP& vdp);
858  int calc(const EmuTime& time) const override;
859  } frameCountInfo;
860 
861  struct CycleInFrameInfo final : Info {
862  CycleInFrameInfo(VDP& vdp);
863  int calc(const EmuTime& time) const override;
864  } cycleInFrameInfo;
865 
866  struct LineInFrameInfo final : Info {
867  LineInFrameInfo(VDP& vdp);
868  int calc(const EmuTime& time) const override;
869  } lineInFrameInfo;
870 
871  struct CycleInLineInfo final : Info {
872  CycleInLineInfo(VDP& vdp);
873  int calc(const EmuTime& time) const override;
874  } cycleInLineInfo;
875 
876  struct MsxYPosInfo final : Info {
877  MsxYPosInfo(VDP& vdp);
878  int calc(const EmuTime& time) const override;
879  } msxYPosInfo;
880 
881  struct MsxX256PosInfo final : Info {
882  MsxX256PosInfo(VDP& vdp);
883  int calc(const EmuTime& time) const override;
884  } msxX256PosInfo;
885 
886  struct MsxX512PosInfo final : Info {
887  MsxX512PosInfo(VDP& vdp);
888  int calc(const EmuTime& time) const override;
889  } msxX512PosInfo;
890 
893  std::unique_ptr<Renderer> renderer;
894 
897  std::unique_ptr<VDPCmdEngine> cmdEngine;
898 
901  std::unique_ptr<SpriteChecker> spriteChecker;
902 
905  std::unique_ptr<VDPVRAM> vram;
906 
910  const RawFrame* externalVideo;
911 
917  const RawFrame* superimposing;
918 
921  VDPClock frameStartTime;
922 
925  OptionalIRQHelper irqVertical;
926 
929  OptionalIRQHelper irqHorizontal;
930 
933  EmuTime displayStartSyncTime;
934 
937  EmuTime vScanSyncTime;
938 
941  EmuTime hScanSyncTime;
942 
943  TclCallback tooFastCallback;
944 
947  VdpVersion version;
948 
954  int frameCount;
955 
958  int displayStart;
959 
963  int horizontalScanOffset;
964 
968  int horizontalAdjust;
969 
972  byte controlRegs[32];
973 
978  int controlRegMask;
979 
986  byte controlValueMasks[32];
987 
991  int blinkCount;
992 
996  int vramPointer;
997 
1000  word palette[16];
1001 
1004  bool isDisplayArea;
1005 
1011  bool palTiming;
1012 
1016  bool interlaced;
1017 
1022  byte statusReg0;
1023 
1029  byte statusReg1;
1030 
1035  byte statusReg2;
1036 
1039  bool blinkState;
1040 
1043  byte dataLatch;
1044 
1047  bool registerDataStored;
1048 
1051  bool paletteDataStored;
1052 
1060  byte cpuVramData;
1061 
1065  bool cpuVramReqIsRead;
1066  bool pendingCpuAccess; // always equal to pendingSyncPoint(CPU_VRAM_ACCESS)
1067 
1071  bool cpuExtendedVram;
1072 
1078  DisplayMode displayMode;
1079 
1084  bool displayEnabled;
1085 
1089  bool warningPrinted;
1090 
1092  bool brokenCmdTiming;
1093  bool allowTooFastAccess;
1094 };
1096 
1097 } // namespace openmsx
1098 
1099 #endif
int getBlinkBackgroundColor() const
Gets the current blinking color for blinking text.
Definition: VDP.hh:211
bool isInsideFrame(EmuTime::param time) const
Is the given timestamp inside the current frame? Mainly useful for debugging, because relevant timest...
Definition: VDP.hh:419
int getBlinkForegroundColor() const
Gets the current blinking color for blinking text.
Definition: VDP.hh:204
bool isBorderMasked() const
Gets the current border mask setting.
Definition: VDP.hh:295
bool isEvenOddEnabled() const
Get even/odd page alternation status.
Definition: VDP.hh:347
bool vdpHasPatColMirroring() const
Is this a VDP that has pattern/colortable mirroring?
Definition: VDP.hh:112
void setSpriteStatus(byte value)
Should only be used by SpriteChecker.
Definition: VDP.hh:483
bool spritesEnabled() const
Are sprites enabled?
Definition: VDP.hh:244
int getHorizontalAdjust() const
This is a combination of the (horizontal) set adjust register and the YJK-mode bit.
Definition: VDP.hh:427
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:70
SpriteChecker & getSpriteChecker()
Get the sprite checker for this VDP.
Definition: VDP.hh:166
bool isMultiPageScrolling() const
Is multi page scrolling enabled? It is considered enabled if both the multi page scrolling flag is en...
Definition: VDP.hh:305
bool vdpLacksMirroring() const
Is this a VDP that lacks mirroring?
Definition: VDP.hh:105
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:140
int getRightBorder() const
Gets the number of VDP clockticks between start of line and the start of the right border...
Definition: VDP.hh:456
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:406
int getLeftSprites() const
Gets the number of VDP clockticks between start of line and the start of the sprite plane...
Definition: VDP.hh:438
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:268
const EmuTime & param
Definition: EmuTime.hh:20
byte getHorizontalScrollHigh() const
Gets the current horizontal scroll higher bits.
Definition: VDP.hh:286
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:466
const RawFrame * isSuperimposing() const
Are we currently superimposing? In case of superimpose, returns a pointer to the to-be-superimposed f...
Definition: VDP.hh:154
bool hasToshibaPalette() const
Is this a VDP with a Toshiba palette?
Definition: VDP.hh:126
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:1552
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:381
bool getCmdBit() const
Are commands possible in non Graphic modes? (V9958 only)
Definition: VDP.hh:400
bool getBlinkState() const
Gets the current blink state.
Definition: VDP.hh:218
int getEvenOddMask() const
Expresses the state of even/odd page interchange in a mask on the line number.
Definition: VDP.hh:368
bool isInterlaced() const
Get interlace status.
Definition: VDP.hh:332
bool isSpriteMag() const
Are sprites magnified?
Definition: VDP.hh:393
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:180
bool isVDPwithPALonly() const
Is this a VDP only capable of PAL?
Definition: VDP.hh:98
byte getStatusReg0() const
Should only be used by SpriteChecker.
Definition: VDP.hh:473
bool getTransparency() const
Gets the current transparency setting.
Definition: VDP.hh:173
bool isDisplayEnabled() const
Is the display enabled? Both the regular border and forced blanking by clearing the display enable bi...
Definition: VDP.hh:236
bool isMSX1VDP() const
Is this an MSX1 VDP?
Definition: VDP.hh:91
int getSpriteSize() const
Gets the sprite size in pixels (8/16).
Definition: VDP.hh:387
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:354
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:503
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:119
Unified implementation of MSX Video Display Processors (VDPs).
Definition: VDP.hh:59
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:377
byte getHorizontalScrollLow() const
Gets the current horizontal scroll lower bits.
Definition: VDP.hh:277
EmuTime::param getTime() const
Gets the time at which the last clock tick occurred.
Definition: Clock.hh:46
bool cpuAccessScheduled() const
Is there a CPU-VRAM access scheduled.
Definition: VDP.hh:524
bool isPalTiming() const
Is PAL timing active? This setting is fixed at start of frame.
Definition: VDP.hh:321
static const int TICKS_PER_SECOND
Number of VDP clock ticks per second.
Definition: VDP.hh:65
bool hasYJK() const
Does this VDP support YJK display?
Definition: VDP.hh:133
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:313
unsigned getTicksTill_fast(EmuTime::param e) const
Same as above, only faster, Though the time interval may not be too large.
Definition: Clock.hh:70
bool spritesEnabledRegister() const
Still faster variant (just looks at the sprite-enabled-bit).
Definition: VDP.hh:261
Generic Gang-of-Four Observer class, templatized edition.
Definition: Observer.hh:9
#define OUTER(type, member)
Definition: outer.hh:38
bool getVRMode() const
Returns current VR mode.
Definition: VDP.hh:491
word getPalette(int index) const
Gets a palette entry.
Definition: VDP.hh:227
IntHelper< OptionalIRQ > OptionalIRQHelper
Definition: IRQHelper.hh:125
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:253
void setExternalVideoSource(const RawFrame *externalSource)
Enable superimposing.
Definition: VDP.hh:497
VDPVRAM & getVRAM()
Get the VRAM object for this VDP.
Definition: VDP.hh:146
Clock< TICKS_PER_SECOND > VDPClock
Definition: VDP.hh:66
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:449
int getBackgroundColor() const
Gets the current background color.
Definition: VDP.hh:192
unsigned short word
16 bit unsigned integer
Definition: openmsx.hh:28