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 #include <array>
18 
19 namespace openmsx {
20 
21 class PostProcessor;
22 class Renderer;
23 class VDPCmdEngine;
24 class VDPVRAM;
25 class MSXCPU;
26 class SpriteChecker;
27 class Display;
28 class RawFrame;
29 class Setting;
30 template<typename> class EnumSetting;
31 namespace VDPAccessSlots {
32  enum Delta : int;
33  class Calculator;
34 }
35 
61 class VDP final : public MSXDevice, private VideoSystemChangeListener
62  , private Observer<Setting>
63 {
64 public:
67  static constexpr int TICKS_PER_SECOND = 3579545 * 6; // 21.5MHz;
69 
72  static constexpr int TICKS_PER_LINE = 1368;
73 
74  explicit VDP(const DeviceConfig& config);
75  ~VDP() override;
76 
77  void powerUp(EmuTime::param time) override;
78  void reset(EmuTime::param time) override;
79  byte readIO(word port, EmuTime::param time) override;
80  byte peekIO(word port, EmuTime::param time) const override;
81  void writeIO(word port, byte value, EmuTime::param time) override;
82 
87  PostProcessor* getPostProcessor() const;
88 
93  inline bool isMSX1VDP() const {
94  return (version & VM_MSX1) != 0;
95  }
96 
100  inline bool isVDPwithPALonly() const {
101  return (version & VM_PAL) != 0;
102  }
103 
107  inline bool vdpLacksMirroring() const {
108  return (version & VM_NO_MIRRORING) != 0;
109  }
110 
114  inline bool vdpHasPatColMirroring() const {
115  return (version & VM_PALCOL_MIRRORING) != 0;
116  }
117 
121  inline bool isVDPwithVRAMremapping() const {
122  return (version & VM_VRAM_REMAPPING) != 0;
123  }
124 
128  inline bool hasYJK() const {
129  return (version & VM_YJK) != 0;
130  }
131 
136  std::array<std::array<uint8_t, 3>, 16> getMSX1Palette() const;
137 
141  inline DisplayMode getDisplayMode() const {
142  return displayMode;
143  }
144 
147  inline VDPVRAM& getVRAM() {
148  return *vram;
149  }
150 
155  inline const RawFrame* isSuperimposing() const {
156  // Note that bit 0 of r#0 has no effect on an V9938 or higher,
157  // but this bit is masked out. Also note that on an MSX1, if
158  // bit 0 of r#0 is enabled and there is no external video
159  // source, then we lose sync.
160  // Also note that because this property is fixed per frame we
161  // cannot (re)calculate it from register values.
162  return superimposing;
163  }
164 
168  return *spriteChecker;
169  }
170 
174  inline bool getTransparency() const {
175  return (controlRegs[8] & 0x20) == 0;
176  }
177 
181  inline int getForegroundColor() const {
182  return controlRegs[7] >> 4;
183  }
184 
193  inline int getBackgroundColor() const {
194  byte reg7 = controlRegs[7];
195  if (displayMode.getByte() == DisplayMode::GRAPHIC7) {
196  return reg7;
197  } else {
198  return reg7 & 0x0F;
199  }
200  }
201 
205  inline int getBlinkForegroundColor() const {
206  return controlRegs[12] >> 4;
207  }
208 
212  inline int getBlinkBackgroundColor() const {
213  return controlRegs[12] & 0x0F;
214  }
215 
219  inline bool getBlinkState() const {
220  return blinkState;
221  }
222 
228  inline word getPalette(int index) const {
229  return palette[index];
230  }
231 
237  inline bool isDisplayEnabled() const {
238  return isDisplayArea && displayEnabled;
239  }
240 
245  inline bool spritesEnabled() const {
246  return displayEnabled &&
247  (displayMode.getSpriteMode(isMSX1VDP()) != 0) &&
248  ((controlRegs[8] & 0x02) == 0x00);
249  }
250 
254  inline bool spritesEnabledFast() const {
255  assert(displayMode.getSpriteMode(isMSX1VDP()) != 0);
256  return displayEnabled && ((controlRegs[8] & 0x02) == 0x00);
257  }
258 
262  inline bool spritesEnabledRegister() const {
263  return (controlRegs[8] & 0x02) == 0x00;
264  }
265 
269  inline byte getVerticalScroll() const {
270  return controlRegs[23];
271  }
272 
278  inline byte getHorizontalScrollLow() const {
279  return controlRegs[27];
280  }
281 
287  inline byte getHorizontalScrollHigh() const {
288  return controlRegs[26];
289  }
290 
296  inline bool isBorderMasked() const {
297  return (controlRegs[25] & 0x02) != 0;
298  }
299 
306  inline bool isMultiPageScrolling() const {
307  return (controlRegs[25] & 0x01) && (controlRegs[2] & 0x20);
308  }
309 
314  inline int getLineZero() const {
315  return displayStart / TICKS_PER_LINE;
316  }
317 
322  inline bool isPalTiming() const {
323  return palTiming;
324  }
325 
333  inline bool isInterlaced() const {
334  return interlaced;
335  }
336 
347  inline bool isFastBlinkEnabled() const {
348  return (controlRegs[1] & 4) != 0;
349  }
350 
362  inline bool isEvenOddEnabled() const {
363  if (isFastBlinkEnabled()) return false;
364  return (controlRegs[9] & 4) != 0;
365  }
366 
370  inline bool getEvenOdd() const {
371  return (statusReg2 & 2) != 0;
372  }
373 
385  inline int getEvenOddMask() const {
386  // TODO: Verify which page is displayed on even fields.
387  assert(!isFastBlinkEnabled());
388  return (((~controlRegs[9] & 4) << 6) | ((statusReg2 & 2) << 7)) &
389  (!blinkState << 8);
390  }
391 
398  inline int getEvenOddMask(int line) const {
399  if (isFastBlinkEnabled()) {
400  // EO and IL not considered in this mode
401  auto p = calculateLineBlinkState(line);
402  return (p.first) << 8;
403  } else {
404  return getEvenOddMask();
405  }
406  }
407 
412  inline std::pair<bool, int> calculateLineBlinkState(unsigned line) const {
413  assert(isFastBlinkEnabled());
414 
415  if (blinkCount == 0) { // not changing
416  return {blinkState, blinkCount};
417  }
418 
419  unsigned evenLen = ((controlRegs[13] >> 4) & 0x0F) * 10;
420  unsigned oddLen = ((controlRegs[13] >> 0) & 0x0F) * 10;
421  unsigned totalLen = evenLen + oddLen;
422  assert(totalLen != 0); // because this implies 'blinkCount == 0'
423  line %= totalLen; // reduce double flips
424 
425  bool resultState = blinkState; // initial guess, adjusted later
426  if (blinkState) {
427  // We start in the 'even' period -> check first for
428  // even/odd transition, next for odd/even
429  } else {
430  // We start in the 'odd' period -> do the opposite
431  std::swap(evenLen, oddLen);
432  }
433  int newCount = blinkCount - line;
434  if (newCount <= 0) {
435  // switch even->odd (or odd->even)
436  resultState = !resultState;
437  newCount += oddLen;
438  if (newCount <= 0) {
439  // switch odd->even (or even->odd)
440  resultState = !resultState;
441  newCount += evenLen;
442  assert(newCount > 0);
443  }
444  }
445  return {resultState, newCount};
446  }
447 
451  inline int getTicksThisFrame(EmuTime::param time) const {
452  return frameStartTime.getTicksTill_fast(time);
453  }
454 
455  inline EmuTime::param getFrameStartTime() const {
456  return frameStartTime.getTime();
457  }
458 
461  inline int getSpriteSize() const {
462  return ((controlRegs[1] & 2) << 2) + 8;
463  }
464 
467  inline bool isSpriteMag() const {
468  return controlRegs[1] & 1;
469  }
470 
474  inline bool getCmdBit() const {
475  return (controlRegs[25] & 0x40) != 0;
476  }
477 
480  inline int getLinesPerFrame() const {
481  return palTiming ? 313 : 262;
482  }
483 
486  inline int getTicksPerFrame() const {
487  return getLinesPerFrame() * TICKS_PER_LINE;
488  }
489 
499  inline bool isInsideFrame(EmuTime::param time) const {
500  return time >= frameStartTime.getTime() &&
501  getTicksThisFrame(time) <= getTicksPerFrame();
502  }
503 
507  inline int getHorizontalAdjust() const {
508  return horizontalAdjust;
509  }
510 
518  inline int getLeftSprites() const {
519  return 100 + 102 + 56
520  + (horizontalAdjust - 7) * 4
521  + (displayMode.isTextMode() ? 36 : 0);
522  }
523 
529  inline int getLeftBorder() const {
530  return getLeftSprites() + (isBorderMasked() ? 8 * 4 : 0);
531  }
532 
536  inline int getRightBorder() const {
537  return getLeftSprites()
538  + (displayMode.isTextMode() ? 960 : 1024);
539  }
540 
546  inline int getLeftBackground() const {
547  return getLeftSprites() + getHorizontalScrollLow() * 4;
548  }
549 
553  byte getStatusReg0() const { return statusReg0; }
554 
563  void setSpriteStatus(byte value)
564  {
565  statusReg0 = (statusReg0 & 0x80) | (value & 0x7F);
566  }
567 
571  bool getVRMode() const {
572  return (controlRegs[8] & 8) != 0;
573  }
574 
577  void setExternalVideoSource(const RawFrame* externalSource) {
578  externalVideo = externalSource;
579  }
580 
583  bool getBrokenCmdTiming() const {
584  return brokenCmdTiming;
585  }
586 
589  EmuTime getAccessSlot(EmuTime::param time, VDPAccessSlots::Delta delta) const;
590 
600  VDPAccessSlots::Calculator getAccessSlotCalculator(
601  EmuTime::param time, EmuTime::param limit) const;
602 
620  void scheduleCmdSync(EmuTime t) {
621  auto now = getCurrentTime();
622  if (t <= now) {
623  // The largest amount of VDP cycles between 'progress'
624  // in command emulation:
625  // - worst case the LMMM takes 120+64 cycles to fully process one pixel
626  // - the largest gap between access slots is 70 cycles
627  // - but if we're unlucky the CPU steals that slot
628  int LARGEST_STALL = 184 + 2 * 70;
629 
630  t = now + VDPClock::duration(LARGEST_STALL);
631  }
632  syncCmdDone.setSyncPoint(t);
633  }
634 
635  template<typename Archive>
636  void serialize(Archive& ar, unsigned version);
637 
638 private:
639  void initTables();
640 
641  // VdpVersion bitmasks
642  static constexpr unsigned VM_MSX1 = 1; // set-> MSX1, unset-> MSX2 or MSX2+
643  static constexpr unsigned VM_PAL = 2; // set-> fixed PAL, unset-> fixed NTSC or switchable
644  static constexpr unsigned VM_NO_MIRRORING = 4; // set-> no (screen2) mirroring
645  static constexpr unsigned VM_PALCOL_MIRRORING = 8; // set-> pattern/color-table mirroring
646  static constexpr unsigned VM_VRAM_REMAPPING = 16; // set-> 4k,8/16k VRAM remapping
647  static constexpr unsigned VM_TOSHIBA_PALETTE = 32; // set-> has Toshiba palette
648  static constexpr unsigned VM_YJK = 64; // set-> has YJK (MSX2+)
649 
651  enum VdpVersion {
656  TMS99X8A = VM_MSX1 | VM_PALCOL_MIRRORING | VM_VRAM_REMAPPING,
657 
659  TMS9929A = VM_MSX1 | VM_PALCOL_MIRRORING | VM_VRAM_REMAPPING | VM_PAL,
660 
662  TMS9129 = VM_MSX1 | VM_PAL,
663 
665  TMS91X8 = VM_MSX1,
666 
668  T6950PAL = VM_MSX1 | VM_TOSHIBA_PALETTE | VM_NO_MIRRORING | VM_PAL,
669 
671  T6950NTSC = VM_MSX1 | VM_TOSHIBA_PALETTE | VM_NO_MIRRORING,
672 
674  T7937APAL = VM_MSX1 | VM_TOSHIBA_PALETTE | VM_PAL,
675 
677  T7937ANTSC = VM_MSX1 | VM_TOSHIBA_PALETTE,
678 
680  V9938 = 0,
681 
683  V9958 = VM_YJK,
684  };
685 
686  struct SyncBase : public Schedulable {
687  explicit SyncBase(VDP& vdp_) : Schedulable(vdp_.getScheduler()) {}
691  protected:
692  ~SyncBase() = default;
693  };
694 
695  struct SyncVSync final : public SyncBase {
696  explicit SyncVSync(VDP& vdp) : SyncBase(vdp) {}
697  void executeUntil(EmuTime::param time) override {
698  auto& vdp = OUTER(VDP, syncVSync);
699  vdp.execVSync(time);
700  }
701  } syncVSync;
702 
703  struct SyncDisplayStart final : public SyncBase {
704  explicit SyncDisplayStart(VDP& vdp) : SyncBase(vdp) {}
705  void executeUntil(EmuTime::param time) override {
706  auto& vdp = OUTER(VDP, syncDisplayStart);
707  vdp.execDisplayStart(time);
708  }
709  } syncDisplayStart;
710 
711  struct SyncVScan final : public SyncBase {
712  explicit SyncVScan(VDP& vdp) : SyncBase(vdp) {}
713  void executeUntil(EmuTime::param time) override {
714  auto& vdp = OUTER(VDP, syncVScan);
715  vdp.execVScan(time);
716  }
717  } syncVScan;
718 
719  struct SyncHScan final : public SyncBase {
720  explicit SyncHScan(VDP& vdp) : SyncBase(vdp) {}
721  void executeUntil(EmuTime::param /*time*/) override {
722  auto& vdp = OUTER(VDP, syncHScan);
723  vdp.execHScan();
724  }
725  } syncHScan;
726 
727  struct SyncHorAdjust final : public SyncBase {
728  explicit SyncHorAdjust(VDP& vdp) : SyncBase(vdp) {}
729  void executeUntil(EmuTime::param time) override {
730  auto& vdp = OUTER(VDP, syncHorAdjust);
731  vdp.execHorAdjust(time);
732  }
733  } syncHorAdjust;
734 
735  struct SyncSetMode final : public SyncBase {
736  explicit SyncSetMode(VDP& vdp) : SyncBase(vdp) {}
737  void executeUntil(EmuTime::param time) override {
738  auto& vdp = OUTER(VDP, syncSetMode);
739  vdp.execSetMode(time);
740  }
741  } syncSetMode;
742 
743  struct SyncSetBlank final : public SyncBase {
744  explicit SyncSetBlank(VDP& vdp) : SyncBase(vdp) {}
745  void executeUntil(EmuTime::param time) override {
746  auto& vdp = OUTER(VDP, syncSetBlank);
747  vdp.execSetBlank(time);
748  }
749  } syncSetBlank;
750 
751  struct SyncCpuVramAccess final : public SyncBase {
752  explicit SyncCpuVramAccess(VDP& vdp) : SyncBase(vdp) {}
753  void executeUntil(EmuTime::param time) override {
754  auto& vdp = OUTER(VDP, syncCpuVramAccess);
755  vdp.execCpuVramAccess(time);
756  }
757  } syncCpuVramAccess;
758 
759  struct SyncCmdDone final : public SyncBase {
760  explicit SyncCmdDone(VDP& vdp) : SyncBase(vdp) {}
761  void executeUntil(EmuTime::param time) override {
762  auto& vdp = OUTER(VDP, syncCmdDone);
763  vdp.execSyncCmdDone(time);
764  }
765  } syncCmdDone;
766 
767  void execVSync(EmuTime::param time);
768  void execDisplayStart(EmuTime::param time);
769  void execVScan(EmuTime::param time);
770  void execHScan();
771  void execHorAdjust(EmuTime::param time);
772  void execSetMode(EmuTime::param time);
773  void execSetBlank(EmuTime::param time);
774  void execCpuVramAccess(EmuTime::param time);
775  void execSyncCmdDone(EmuTime::param time);
776 
780  inline int getNumberOfLines() const {
781  return controlRegs[9] & 0x80 ? 212 : 192;
782  }
783 
787  int getVerticalAdjust() const {
788  return (controlRegs[18] >> 4) ^ 0x07;
789  }
790 
800  inline bool getHR(int ticksThisFrame) const {
801  // Note: These constants are located inside this function because
802  // GCC 4.0.x won't link if they are in the class scope.
806  static constexpr int HBLANK_LEN_TXT = 404;
810  static constexpr int HBLANK_LEN_GFX = 312;
811  return
812  ( ticksThisFrame + TICKS_PER_LINE - getRightBorder()
813  ) % TICKS_PER_LINE
814  < (displayMode.isTextMode() ? HBLANK_LEN_TXT : HBLANK_LEN_GFX);
815  }
816 
817  // VideoSystemChangeListener interface:
818  void preVideoSystemChange() override;
819  void postVideoSystemChange() override;
820 
825  void resetInit();
826 
831  void resetMasks(EmuTime::param time);
832 
836  void frameStart(EmuTime::param time);
837 
845  void scheduleDisplayStart(EmuTime::param time);
846 
852  void scheduleVScan(EmuTime::param time);
853 
859  void scheduleHScan(EmuTime::param time);
860 
863  void vramWrite(byte value, EmuTime::param time);
864 
867  byte vramRead(EmuTime::param time);
868 
870  void scheduleCpuVramAccess(bool isRead, byte write, EmuTime::param time);
871  void executeCpuVramAccess(EmuTime::param time);
872 
875  byte peekStatusReg(byte reg, EmuTime::param time) const;
876  byte readStatusReg(byte reg, EmuTime::param time);
877 
880  void changeRegister(byte reg, byte val, EmuTime::param time);
881 
884  void syncAtNextLine(SyncBase& type, EmuTime::param time);
885 
888  void createRenderer();
889 
893  void updateNameBase(EmuTime::param time);
894 
898  void updateColorBase(EmuTime::param time);
899 
903  void updatePatternBase(EmuTime::param time);
904 
908  void updateSpriteAttributeBase(EmuTime::param time);
909 
913  void updateSpritePatternBase(EmuTime::param time);
914 
918  void updateDisplayMode(DisplayMode newMode, bool cmdBit, EmuTime::param time);
919 
926  void setPalette(int index, word grb, EmuTime::param time);
927 
928  // Observer<Setting>
929  void update(const Setting& setting) override;
930 
931 private:
932  Display& display;
933  EnumSetting<bool>& cmdTiming;
934  EnumSetting<bool>& tooFastAccess;
935 
936  struct RegDebug final : SimpleDebuggable {
937  explicit RegDebug(VDP& vdp);
938  byte read(unsigned address) override;
939  void write(unsigned address, byte value, EmuTime::param time) override;
940  } vdpRegDebug;
941 
942  struct StatusRegDebug final : SimpleDebuggable {
943  explicit StatusRegDebug(VDP& vdp);
944  byte read(unsigned address, EmuTime::param time) override;
945  } vdpStatusRegDebug;
946 
947  struct PaletteDebug final : SimpleDebuggable {
948  explicit PaletteDebug(VDP& vdp);
949  byte read(unsigned address) override;
950  void write(unsigned address, byte value, EmuTime::param time) override;
951  } vdpPaletteDebug;
952 
953  struct VRAMPointerDebug final : SimpleDebuggable {
954  explicit VRAMPointerDebug(VDP& vdp);
955  byte read(unsigned address) override;
956  void write(unsigned address, byte value, EmuTime::param time) override;
957  } vramPointerDebug;
958 
959  class Info : public InfoTopic {
960  public:
961  void execute(span<const TclObject> tokens,
962  TclObject& result) const override;
963  std::string help(const std::vector<std::string>& tokens) const override;
964  virtual int calc(const EmuTime& time) const = 0;
965  protected:
966  Info(VDP& vdp_, const std::string& name, std::string helpText_);
967  ~Info() = default;
968  VDP& vdp;
969  const std::string helpText;
970  };
971 
972  struct FrameCountInfo final : Info {
973  explicit FrameCountInfo(VDP& vdp);
974  int calc(const EmuTime& time) const override;
975  } frameCountInfo;
976 
977  struct CycleInFrameInfo final : Info {
978  explicit CycleInFrameInfo(VDP& vdp);
979  int calc(const EmuTime& time) const override;
980  } cycleInFrameInfo;
981 
982  struct LineInFrameInfo final : Info {
983  explicit LineInFrameInfo(VDP& vdp);
984  int calc(const EmuTime& time) const override;
985  } lineInFrameInfo;
986 
987  struct CycleInLineInfo final : Info {
988  explicit CycleInLineInfo(VDP& vdp);
989  int calc(const EmuTime& time) const override;
990  } cycleInLineInfo;
991 
992  struct MsxYPosInfo final : Info {
993  explicit MsxYPosInfo(VDP& vdp);
994  int calc(const EmuTime& time) const override;
995  } msxYPosInfo;
996 
997  struct MsxX256PosInfo final : Info {
998  explicit MsxX256PosInfo(VDP& vdp);
999  int calc(const EmuTime& time) const override;
1000  } msxX256PosInfo;
1001 
1002  struct MsxX512PosInfo final : Info {
1003  explicit MsxX512PosInfo(VDP& vdp);
1004  int calc(const EmuTime& time) const override;
1005  } msxX512PosInfo;
1006 
1009  std::unique_ptr<Renderer> renderer;
1010 
1013  std::unique_ptr<VDPCmdEngine> cmdEngine;
1014 
1017  std::unique_ptr<SpriteChecker> spriteChecker;
1018 
1021  std::unique_ptr<VDPVRAM> vram;
1022 
1026  const RawFrame* externalVideo;
1027 
1033  const RawFrame* superimposing;
1034 
1037  VDPClock frameStartTime;
1038 
1041  OptionalIRQHelper irqVertical;
1042 
1045  OptionalIRQHelper irqHorizontal;
1046 
1049  EmuTime displayStartSyncTime;
1050 
1053  EmuTime vScanSyncTime;
1054 
1057  EmuTime hScanSyncTime;
1058 
1059  TclCallback tooFastCallback;
1060 
1063  VdpVersion version;
1064 
1069  int saturationPr;
1070 
1075  int saturationPb;
1076 
1082  int frameCount;
1083 
1086  int displayStart;
1087 
1091  int horizontalScanOffset;
1092 
1096  int horizontalAdjust;
1097 
1100  byte controlRegs[32];
1101 
1106  int controlRegMask;
1107 
1114  byte controlValueMasks[32];
1115 
1119  int blinkCount;
1120 
1124  int vramPointer;
1125 
1128  word palette[16];
1129 
1132  bool isDisplayArea;
1133 
1139  bool palTiming;
1140 
1144  bool interlaced;
1145 
1150  byte statusReg0;
1151 
1157  byte statusReg1;
1158 
1163  byte statusReg2;
1164 
1167  bool blinkState;
1168 
1171  byte dataLatch;
1172 
1175  bool registerDataStored;
1176 
1179  bool paletteDataStored;
1180 
1188  byte cpuVramData;
1189 
1193  bool cpuVramReqIsRead;
1194  bool pendingCpuAccess; // always equal to pendingSyncPoint(CPU_VRAM_ACCESS)
1195 
1199  bool cpuExtendedVram;
1200 
1206  DisplayMode displayMode;
1207 
1212  bool displayEnabled;
1213 
1217  bool warningPrinted;
1218 
1220  bool brokenCmdTiming;
1221  bool allowTooFastAccess;
1222 
1224  MSXCPU& cpu;
1225  const byte fixedVDPIOdelayCycles;
1226 };
1228 
1229 } // namespace openmsx
1230 
1231 #endif
bool isMultiPageScrolling() const
Is multi page scrolling enabled? It is considered enabled if both the multi page scrolling flag is en...
Definition: VDP.hh:306
bool pendingSyncPoint() const
Definition: Schedulable.cc:38
word getPalette(int index) const
Gets a palette entry.
Definition: VDP.hh:228
int getBlinkBackgroundColor() const
Gets the current blinking color for blinking text.
Definition: VDP.hh:212
bool getEvenOdd() const
Is the even or odd field being displayed?
Definition: VDP.hh:370
int getEvenOddMask(int line) const
Similar to the above getEvenOddMask() method, but can also be called when &#39;isFastBlinkEnabled() == tr...
Definition: VDP.hh:398
bool spritesEnabledRegister() const
Still faster variant (just looks at the sprite-enabled-bit).
Definition: VDP.hh:262
void setSpriteStatus(byte value)
Should only be used by SpriteChecker.
Definition: VDP.hh:563
Represents the output window/screen of openMSX.
Definition: Display.hh:31
EmuTime::param getFrameStartTime() const
Definition: VDP.hh:455
SpriteChecker & getSpriteChecker()
Get the sprite checker for this VDP.
Definition: VDP.hh:167
bool getBrokenCmdTiming() const
Value of the cmdTiming setting, true means commands have infinite speed.
Definition: VDP.hh:583
Definition: span.hh:34
void scheduleCmdSync(EmuTime t)
Only used when there are commandExecuting-probe listeners.
Definition: VDP.hh:620
int getLeftBorder() const
Gets the number of VDP clockticks between start of line and the end of the left border.
Definition: VDP.hh:529
uint8_t byte
8 bit unsigned integer
Definition: openmsx.hh:26
DisplayMode getDisplayMode() const
Get the display mode the VDP is in.
Definition: VDP.hh:141
bool isPalTiming() const
Is PAL timing active? This setting is fixed at start of frame.
Definition: VDP.hh:322
EmuTime getAccessSlot(EmuTime::param frame_, EmuTime::param time, Delta delta, const VDP &vdp)
Return the time of the next available access slot that is at least &#39;delta&#39; cycles later than &#39;time&#39;...
int getLineZero() const
Get the absolute line number of display line zero.
Definition: VDP.hh:314
int getEvenOddMask() const
Expresses the state of even/odd page interchange in a mask on the line number.
Definition: VDP.hh:385
byte getHorizontalScrollLow() const
Gets the current horizontal scroll lower bits.
Definition: VDP.hh:278
bool isVDPwithVRAMremapping() const
Does this VDP have VRAM remapping when switching from 4k to 8/16k mode?
Definition: VDP.hh:121
Represents a VDP display mode.
Definition: DisplayMode.hh:14
int getHorizontalAdjust() const
This is a combination of the (horizontal) set adjust register and the YJK-mode bit.
Definition: VDP.hh:507
bool isEvenOddEnabled() const
Get even/odd page alternation status.
Definition: VDP.hh:362
std::pair< bool, int > calculateLineBlinkState(unsigned line) const
Calculates what &#39;blinkState&#39; and &#39;blinkCount&#39; would be at a specific line.
Definition: VDP.hh:412
byte getVerticalScroll() const
Gets the current vertical scroll (line displayed at Y=0).
Definition: VDP.hh:269
bool hasYJK() const
Does this VDP support YJK display?
Definition: VDP.hh:128
int getBackgroundColor() const
Gets the current background color.
Definition: VDP.hh:193
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:546
byte getHorizontalScrollHigh() const
Gets the current horizontal scroll higher bits.
Definition: VDP.hh:287
bool isBorderMasked() const
Gets the current border mask setting.
Definition: VDP.hh:296
bool isVDPwithPALonly() const
Is this a VDP only capable of PAL?
Definition: VDP.hh:100
Every class that wants to get scheduled at some point must inherit from this class.
Definition: Schedulable.hh:33
A video frame as output by the VDP scanline conversion unit, before any postprocessing filters are ap...
Definition: RawFrame.hh:25
int getForegroundColor() const
Gets the current foreground color.
Definition: VDP.hh:181
unique_ptr< Renderer > createRenderer(VDP &vdp, Display &display)
Create the Renderer selected by the current renderer setting.
SERIALIZE_CLASS_VERSION(CassettePlayer, 2)
bool vdpLacksMirroring() const
Is this a VDP that lacks mirroring?
Definition: VDP.hh:107
bool vdpHasPatColMirroring() const
Is this a VDP that has pattern/colortable mirroring?
Definition: VDP.hh:114
int getTicksPerFrame() const
Gets the number of VDP clockticks (21MHz) per frame.
Definition: VDP.hh:486
int getLinesPerFrame() const
Gets the number of lines per frame.
Definition: VDP.hh:480
bool getBlinkState() const
Gets the current blink state.
Definition: VDP.hh:219
int getLeftSprites() const
Gets the number of VDP clockticks between start of line and the start of the sprite plane...
Definition: VDP.hh:518
bool getTransparency() const
Gets the current transparency setting.
Definition: VDP.hh:174
bool isInsideFrame(EmuTime::param time) const
Is the given timestamp inside the current frame? Mainly useful for debugging, because relevant timest...
Definition: VDP.hh:499
bool isMSX1VDP() const
Is this an MSX1 VDP?
Definition: VDP.hh:93
bool isSpriteMag() const
Are sprites magnified?
Definition: VDP.hh:467
const RawFrame * isSuperimposing() const
Are we currently superimposing? In case of superimpose, returns a pointer to the to-be-superimposed f...
Definition: VDP.hh:155
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:31
int getSpriteSize() const
Gets the sprite size in pixels (8/16).
Definition: VDP.hh:461
bool spritesEnabled() const
Are sprites enabled?
Definition: VDP.hh:245
Scheduler & getScheduler() const
Definition: MSXDevice.cc:141
VDP-VRAM access slot calculator, meant to be used in the inner loops of the VDPCmdEngine commands...
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29
byte getStatusReg0() const
Should only be used by SpriteChecker.
Definition: VDP.hh:553
Unified implementation of MSX Video Display Processors (VDPs).
Definition: VDP.hh:61
Abstract base class for post processors.
bool spritesEnabledFast() const
Same as spritesEnabled(), but may only be called in sprite mode 1 or 2.
Definition: VDP.hh:254
bool isFastBlinkEnabled() const
Get &#39;fast-blink&#39; status.
Definition: VDP.hh:347
Manages VRAM contents and synchronises the various users of the VRAM.
Definition: VDPVRAM.hh:384
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:451
bool getCmdBit() const
Are commands possible in non Graphic modes? (V9958 only)
Definition: VDP.hh:474
Generic Gang-of-Four Observer class, templatized edition.
Definition: Observer.hh:9
#define OUTER(type, member)
Definition: outer.hh:38
bool isDisplayEnabled() const
Is the display enabled? Both the regular border and forced blanking by clearing the display enable bi...
Definition: VDP.hh:237
bool isInterlaced() const
Get interlace status.
Definition: VDP.hh:333
void setSyncPoint(EmuTime::param timestamp)
Definition: Schedulable.cc:23
int getBlinkForegroundColor() const
Gets the current blinking color for blinking text.
Definition: VDP.hh:205
TclObject t
int getRightBorder() const
Gets the number of VDP clockticks between start of line and the start of the right border...
Definition: VDP.hh:536
void setExternalVideoSource(const RawFrame *externalSource)
Enable superimposing.
Definition: VDP.hh:577
void serialize(Archive &ar, T &t, unsigned version)
bool getVRMode() const
Returns current VR mode.
Definition: VDP.hh:571
VDPVRAM & getVRAM()
Get the VRAM object for this VDP.
Definition: VDP.hh:147