| e8555c89 Andy McCall |
1 |
#ifndef VDP_HH |
| 2 |
#define VDP_HH |
| 3 |
|
| 4 |
#include "DisplayMode.hh" |
| 5 |
#include "VideoSystemChangeListener.hh" |
| 6 |
#include "gl_vec.hh" |
| 7 |
|
| 8 |
#include "Clock.hh" |
| 9 |
#include "EnumSetting.hh" |
| 10 |
#include "IRQHelper.hh" |
| 11 |
#include "InfoTopic.hh" |
| 12 |
#include "MSXDevice.hh" |
| 13 |
#include "Schedulable.hh" |
| 14 |
#include "SimpleDebuggable.hh" |
| 15 |
#include "TclCallback.hh" |
| 16 |
|
| 17 |
#include "Observer.hh" |
| 18 |
#include "narrow.hh" |
| 19 |
#include "outer.hh" |
| 20 |
|
| 21 |
#include <array> |
| 22 |
#include <cstdint> |
| 23 |
#include <memory> |
| 24 |
|
| 25 |
namespace openmsx { |
| 26 |
|
| 27 |
class PostProcessor; |
| 28 |
class Renderer; |
| 29 |
class VDPCmdEngine; |
| 30 |
class VDPVRAM; |
| 31 |
class MSXCPU; |
| 32 |
class SpriteChecker; |
| 33 |
class Display; |
| 34 |
class RawFrame; |
| 35 |
class Setting; |
| 36 |
namespace VDPAccessSlots { |
| 37 |
enum class Delta : int; |
| 38 |
class Calculator; |
| 39 |
} |
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
class VDP final : public MSXDevice, private VideoSystemChangeListener |
| 67 |
, private Observer<Setting> |
| 68 |
{ |
| 69 |
public: |
| 70 |
|
| 71 |
|
| 72 |
static constexpr int TICKS_PER_SECOND = 3579545 * 6; |
| 73 |
using VDPClock = Clock<TICKS_PER_SECOND>; |
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
static constexpr int TICKS_PER_LINE = 1368; |
| 78 |
|
| 79 |
|
| 80 |
static constexpr int PAL_LINES = 313; |
| 81 |
static constexpr int NTSC_LINES = 262; |
| 82 |
static constexpr int NUM_LINES_MAX = std::max(PAL_LINES, NTSC_LINES); |
| 83 |
|
| 84 |
explicit VDP(const DeviceConfig& config); |
| 85 |
~VDP() override; |
| 86 |
|
| 87 |
void powerUp(EmuTime time) override; |
| 88 |
void reset(EmuTime time) override; |
| 89 |
[[nodiscard]] uint8_t readIO(uint16_t port, EmuTime time) override; |
| 90 |
[[nodiscard]] uint8_t peekIO(uint16_t port, EmuTime time) const override; |
| 91 |
void writeIO(uint16_t port, uint8_t value, EmuTime time) override; |
| 92 |
|
| 93 |
void getExtraDeviceInfo(TclObject& result) const override; |
| 94 |
[[nodiscard]] std::string_view getVersionString() const; |
| 95 |
|
| 96 |
[[nodiscard]] uint8_t peekRegister(unsigned address, EmuTime time) const; |
| 97 |
[[nodiscard]] uint8_t peekStatusReg(uint8_t reg, EmuTime time) const; |
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
void changeRegister(uint8_t reg, uint8_t val, EmuTime time); |
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
[[nodiscard]] PostProcessor* getPostProcessor() const; |
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
[[nodiscard]] bool isMSX1VDP() const { |
| 115 |
return (version & VM_MSX1) != 0; |
| 116 |
} |
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
[[nodiscard]] bool isVDPwithPALonly() const { |
| 122 |
return (version & VM_PAL) != 0; |
| 123 |
} |
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
[[nodiscard]] bool vdpLacksMirroring() const { |
| 129 |
return (version & VM_NO_MIRRORING) != 0; |
| 130 |
} |
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
[[nodiscard]] bool vdpHasPatColMirroring() const { |
| 136 |
return (version & VM_PALCOL_MIRRORING) != 0; |
| 137 |
} |
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
[[nodiscard]] bool isVDPwithVRAMremapping() const { |
| 143 |
return (version & VM_VRAM_REMAPPING) != 0; |
| 144 |
} |
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
[[nodiscard]] bool hasYJK() const { |
| 150 |
return (version & VM_YJK) != 0; |
| 151 |
} |
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
[[nodiscard]] std::array<std::array<uint8_t, 3>, 16> getMSX1Palette() const; |
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
[[nodiscard]] DisplayMode getDisplayMode() const { |
| 163 |
return displayMode; |
| 164 |
} |
| 165 |
|
| 166 |
|
| 167 |
|
| 168 |
[[nodiscard]] VDPVRAM& getVRAM() { |
| 169 |
return *vram; |
| 170 |
} |
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
[[nodiscard]] const RawFrame* isSuperimposing() const { |
| 177 |
|
| 178 |
|
| 179 |
|
| 180 |
|
| 181 |
|
| 182 |
|
| 183 |
return superimposing; |
| 184 |
} |
| 185 |
|
| 186 |
|
| 187 |
|
| 188 |
[[nodiscard]] SpriteChecker& getSpriteChecker() { |
| 189 |
return *spriteChecker; |
| 190 |
} |
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
|
| 195 |
[[nodiscard]] bool getTransparency() const { |
| 196 |
return (controlRegs[8] & 0x20) == 0; |
| 197 |
} |
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
[[nodiscard]] bool canSpriteColor0Collide() const { |
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
return isMSX1VDP() || !getTransparency(); |
| 208 |
} |
| 209 |
|
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
[[nodiscard]] int getForegroundColor() const { |
| 214 |
return controlRegs[7] >> 4; |
| 215 |
} |
| 216 |
|
| 217 |
|
| 218 |
|
| 219 |
|
| 220 |
|
| 221 |
|
| 222 |
|
| 223 |
|
| 224 |
|
| 225 |
[[nodiscard]] uint8_t getRawBackgroundColor() const { |
| 226 |
return controlRegs[7]; |
| 227 |
} |
| 228 |
[[nodiscard]] uint8_t getBackgroundColor() const { |
| 229 |
uint8_t reg7 = controlRegs[7]; |
| 230 |
if (displayMode.getByte() == DisplayMode::GRAPHIC7) { |
| 231 |
return reg7; |
| 232 |
} else { |
| 233 |
return reg7 & 0x0F; |
| 234 |
} |
| 235 |
} |
| 236 |
|
| 237 |
|
| 238 |
|
| 239 |
|
| 240 |
[[nodiscard]] int getBlinkForegroundColor() const { |
| 241 |
return controlRegs[12] >> 4; |
| 242 |
} |
| 243 |
|
| 244 |
|
| 245 |
|
| 246 |
|
| 247 |
[[nodiscard]] int getBlinkBackgroundColor() const { |
| 248 |
return controlRegs[12] & 0x0F; |
| 249 |
} |
| 250 |
|
| 251 |
|
| 252 |
|
| 253 |
|
| 254 |
[[nodiscard]] bool getBlinkState(int line) const { |
| 255 |
if (isFastBlinkEnabled()) { |
| 256 |
return calculateLineBlinkState(line).state; |
| 257 |
} else { |
| 258 |
return blinkState; |
| 259 |
} |
| 260 |
} |
| 261 |
|
| 262 |
|
| 263 |
[[nodiscard]] int getPatternTableBase() const { |
| 264 |
return controlRegs[4] << 11; |
| 265 |
} |
| 266 |
|
| 267 |
[[nodiscard]] int getColorTableBase() const { |
| 268 |
return (controlRegs[10] << 14) | (controlRegs[3] << 6); |
| 269 |
} |
| 270 |
|
| 271 |
[[nodiscard]] int getNameTableBase() const { |
| 272 |
return controlRegs[2] << 10; |
| 273 |
} |
| 274 |
|
| 275 |
[[nodiscard]] int getSpritePatternTableBase() const { |
| 276 |
return controlRegs[6] << 11; |
| 277 |
} |
| 278 |
|
| 279 |
[[nodiscard]] int getSpriteAttributeTableBase() const { |
| 280 |
return (controlRegs[11] << 15) | (controlRegs[5] << 7); |
| 281 |
} |
| 282 |
|
| 283 |
[[nodiscard]] int getVramPointer() const { |
| 284 |
return vramPointer; |
| 285 |
} |
| 286 |
|
| 287 |
|
| 288 |
|
| 289 |
|
| 290 |
|
| 291 |
|
| 292 |
[[nodiscard]] uint16_t getPalette(unsigned index) const { |
| 293 |
return palette[index]; |
| 294 |
} |
| 295 |
[[nodiscard]] std::span<const uint16_t, 16> getPalette() const { |
| 296 |
return palette; |
| 297 |
} |
| 298 |
|
| 299 |
|
| 300 |
|
| 301 |
|
| 302 |
|
| 303 |
|
| 304 |
|
| 305 |
void setPalette(unsigned index, uint16_t grb, EmuTime time); |
| 306 |
|
| 307 |
|
| 308 |
|
| 309 |
|
| 310 |
|
| 311 |
|
| 312 |
[[nodiscard]] bool isDisplayEnabled() const { |
| 313 |
return isDisplayArea && displayEnabled; |
| 314 |
} |
| 315 |
|
| 316 |
|
| 317 |
|
| 318 |
|
| 319 |
|
| 320 |
|
| 321 |
|
| 322 |
|
| 323 |
|
| 324 |
[[nodiscard]] bool isSlotTableDisplayEnabled() const { |
| 325 |
return isSlotTableDisplayArea && displayEnabled; |
| 326 |
} |
| 327 |
|
| 328 |
|
| 329 |
|
| 330 |
|
| 331 |
|
| 332 |
[[nodiscard]] bool spritesEnabled() const { |
| 333 |
return displayEnabled && |
| 334 |
(displayMode.getSpriteMode(isMSX1VDP()) != 0) && |
| 335 |
spriteEnabled; |
| 336 |
} |
| 337 |
|
| 338 |
|
| 339 |
|
| 340 |
|
| 341 |
[[nodiscard]] bool spritesEnabledFast() const { |
| 342 |
assert(displayMode.getSpriteMode(isMSX1VDP()) != 0); |
| 343 |
return displayEnabled && spriteEnabled; |
| 344 |
} |
| 345 |
|
| 346 |
|
| 347 |
|
| 348 |
|
| 349 |
[[nodiscard]] bool spritesEnabledRegister() const { |
| 350 |
return spriteEnabled; |
| 351 |
} |
| 352 |
|
| 353 |
|
| 354 |
|
| 355 |
|
| 356 |
[[nodiscard]] uint8_t getVerticalScroll() const { |
| 357 |
return controlRegs[23]; |
| 358 |
} |
| 359 |
|
| 360 |
|
| 361 |
|
| 362 |
|
| 363 |
|
| 364 |
|
| 365 |
[[nodiscard]] uint8_t getHorizontalScrollLow() const { |
| 366 |
return controlRegs[27]; |
| 367 |
} |
| 368 |
|
| 369 |
|
| 370 |
|
| 371 |
|
| 372 |
|
| 373 |
|
| 374 |
[[nodiscard]] uint8_t getHorizontalScrollHigh() const { |
| 375 |
return controlRegs[26]; |
| 376 |
} |
| 377 |
|
| 378 |
|
| 379 |
|
| 380 |
|
| 381 |
|
| 382 |
|
| 383 |
[[nodiscard]] bool isBorderMasked() const { |
| 384 |
return (controlRegs[25] & 0x02) != 0; |
| 385 |
} |
| 386 |
|
| 387 |
|
| 388 |
|
| 389 |
|
| 390 |
|
| 391 |
|
| 392 |
|
| 393 |
[[nodiscard]] bool isMultiPageScrolling() const { |
| 394 |
return (controlRegs[25] & 0x01) && (controlRegs[2] & 0x20); |
| 395 |
} |
| 396 |
|
| 397 |
|
| 398 |
|
| 399 |
|
| 400 |
[[nodiscard]] int getDisplayPage() const { |
| 401 |
return (controlRegs[2] >> 5) & 3; |
| 402 |
} |
| 403 |
|
| 404 |
|
| 405 |
|
| 406 |
|
| 407 |
|
| 408 |
|
| 409 |
|
| 410 |
|
| 411 |
|
| 412 |
[[nodiscard]] int getLineZero() const { |
| 413 |
|
| 414 |
|
| 415 |
int line = displayStart / TICKS_PER_LINE; |
| 416 |
if ((displayStart % TICKS_PER_LINE) < 0) --line; |
| 417 |
return line; |
| 418 |
} |
| 419 |
|
| 420 |
|
| 421 |
|
| 422 |
|
| 423 |
|
| 424 |
[[nodiscard]] bool isPalTiming() const { |
| 425 |
return palTiming; |
| 426 |
} |
| 427 |
|
| 428 |
|
| 429 |
|
| 430 |
|
| 431 |
|
| 432 |
|
| 433 |
|
| 434 |
|
| 435 |
[[nodiscard]] bool isInterlaced() const { |
| 436 |
return interlaced; |
| 437 |
} |
| 438 |
|
| 439 |
|
| 440 |
|
| 441 |
|
| 442 |
|
| 443 |
|
| 444 |
|
| 445 |
|
| 446 |
|
| 447 |
|
| 448 |
|
| 449 |
[[nodiscard]] bool isFastBlinkEnabled() const { |
| 450 |
return (controlRegs[1] & 4) != 0; |
| 451 |
} |
| 452 |
|
| 453 |
|
| 454 |
|
| 455 |
|
| 456 |
|
| 457 |
|
| 458 |
|
| 459 |
|
| 460 |
|
| 461 |
|
| 462 |
|
| 463 |
|
| 464 |
[[nodiscard]] bool isEvenOddEnabled() const { |
| 465 |
if (isFastBlinkEnabled()) return false; |
| 466 |
return (controlRegs[9] & 4) != 0; |
| 467 |
} |
| 468 |
|
| 469 |
|
| 470 |
|
| 471 |
|
| 472 |
[[nodiscard]] bool getEvenOdd() const { |
| 473 |
return (statusReg2 & 2) != 0; |
| 474 |
} |
| 475 |
|
| 476 |
|
| 477 |
|
| 478 |
|
| 479 |
|
| 480 |
|
| 481 |
|
| 482 |
|
| 483 |
|
| 484 |
|
| 485 |
|
| 486 |
|
| 487 |
[[nodiscard]] unsigned getEvenOddMask() const { |
| 488 |
|
| 489 |
assert(!isFastBlinkEnabled()); |
| 490 |
return (((~controlRegs[9] & 4) << 6) | ((statusReg2 & 2) << 7)) & |
| 491 |
(!blinkState << 8); |
| 492 |
} |
| 493 |
|
| 494 |
|
| 495 |
|
| 496 |
|
| 497 |
|
| 498 |
|
| 499 |
|
| 500 |
[[nodiscard]] unsigned getEvenOddMask(int line) const { |
| 501 |
if (isFastBlinkEnabled()) { |
| 502 |
|
| 503 |
auto p = calculateLineBlinkState(line); |
| 504 |
return (!p.state) << 8; |
| 505 |
} else { |
| 506 |
return getEvenOddMask(); |
| 507 |
} |
| 508 |
} |
| 509 |
|
| 510 |
|
| 511 |
|
| 512 |
|
| 513 |
|
| 514 |
struct BlinkStateCount { |
| 515 |
bool state; |
| 516 |
int count; |
| 517 |
}; |
| 518 |
[[nodiscard]] BlinkStateCount calculateLineBlinkState(unsigned line) const { |
| 519 |
assert(isFastBlinkEnabled()); |
| 520 |
|
| 521 |
if (blinkCount == 0) { |
| 522 |
return {.state = blinkState, .count = blinkCount}; |
| 523 |
} |
| 524 |
|
| 525 |
unsigned evenLen = ((controlRegs[13] >> 4) & 0x0F) * 10; |
| 526 |
unsigned oddLen = ((controlRegs[13] >> 0) & 0x0F) * 10; |
| 527 |
unsigned totalLen = evenLen + oddLen; |
| 528 |
assert(totalLen != 0); |
| 529 |
line %= totalLen; |
| 530 |
|
| 531 |
bool resultState = blinkState; |
| 532 |
if (blinkState) { |
| 533 |
|
| 534 |
|
| 535 |
} else { |
| 536 |
|
| 537 |
std::swap(evenLen, oddLen); |
| 538 |
} |
| 539 |
int newCount = blinkCount - narrow<int>(line); |
| 540 |
if (newCount <= 0) { |
| 541 |
|
| 542 |
resultState = !resultState; |
| 543 |
newCount += narrow<int>(oddLen); |
| 544 |
if (newCount <= 0) { |
| 545 |
|
| 546 |
resultState = !resultState; |
| 547 |
newCount += narrow<int>(evenLen); |
| 548 |
assert(newCount > 0); |
| 549 |
} |
| 550 |
} |
| 551 |
return {.state = resultState, .count = newCount}; |
| 552 |
} |
| 553 |
|
| 554 |
|
| 555 |
|
| 556 |
|
| 557 |
[[nodiscard]] int getTicksThisFrame(EmuTime time) const { |
| 558 |
return narrow<int>(frameStartTime.getTicksTill(time)); |
| 559 |
} |
| 560 |
[[nodiscard]] EmuTime getTimeInFrame(int ticks) const { |
| 561 |
return frameStartTime + ticks; |
| 562 |
} |
| 563 |
|
| 564 |
|
| 565 |
|
| 566 |
|
| 567 |
|
| 568 |
|
| 569 |
[[nodiscard]] int getScrollBurstTicks(EmuTime time) const; |
| 570 |
|
| 571 |
[[nodiscard]] EmuTime getFrameStartTime() const { |
| 572 |
return frameStartTime.getTime(); |
| 573 |
} |
| 574 |
|
| 575 |
|
| 576 |
|
| 577 |
[[nodiscard]] std::optional<EmuTime> getVScanTime() const { |
| 578 |
if (!(controlRegs[1] & 0x20)) return {}; |
| 579 |
return syncVScan.isPending(); |
| 580 |
} |
| 581 |
[[nodiscard]] std::optional<EmuTime> getHScanTime() const { |
| 582 |
if (!(controlRegs[0] & 0x10)) return {}; |
| 583 |
return syncHScan.isPending(); |
| 584 |
} |
| 585 |
|
| 586 |
|
| 587 |
|
| 588 |
[[nodiscard]] int getSpriteSize() const { |
| 589 |
return ((controlRegs[1] & 2) << 2) + 8; |
| 590 |
} |
| 591 |
|
| 592 |
|
| 593 |
|
| 594 |
[[nodiscard]] bool isSpriteMag() const { |
| 595 |
return controlRegs[1] & 1; |
| 596 |
} |
| 597 |
|
| 598 |
|
| 599 |
|
| 600 |
|
| 601 |
[[nodiscard]] bool getCmdBit() const { |
| 602 |
return (controlRegs[25] & 0x40) != 0; |
| 603 |
} |
| 604 |
|
| 605 |
|
| 606 |
|
| 607 |
[[nodiscard]] int getLinesPerFrame() const { |
| 608 |
return palTiming ? PAL_LINES : NTSC_LINES; |
| 609 |
} |
| 610 |
|
| 611 |
|
| 612 |
|
| 613 |
|
| 614 |
[[nodiscard]] int getNumberOfLines() const { |
| 615 |
return controlRegs[9] & 0x80 ? 212 : 192; |
| 616 |
} |
| 617 |
|
| 618 |
|
| 619 |
|
| 620 |
[[nodiscard]] int getTicksPerFrame() const { |
| 621 |
return getLinesPerFrame() * TICKS_PER_LINE; |
| 622 |
} |
| 623 |
|
| 624 |
|
| 625 |
|
| 626 |
[[nodiscard]] EmuDuration getFrameDuration() const { |
| 627 |
return VDPClock::duration(getTicksPerFrame()); |
| 628 |
} |
| 629 |
|
| 630 |
|
| 631 |
|
| 632 |
|
| 633 |
|
| 634 |
|
| 635 |
|
| 636 |
|
| 637 |
|
| 638 |
|
| 639 |
[[nodiscard]] bool isInsideFrame(EmuTime time) const { |
| 640 |
return time >= frameStartTime.getTime() && |
| 641 |
getTicksThisFrame(time) <= getTicksPerFrame(); |
| 642 |
} |
| 643 |
|
| 644 |
|
| 645 |
|
| 646 |
|
| 647 |
[[nodiscard]] int getHorizontalAdjust() const { |
| 648 |
return horizontalAdjust; |
| 649 |
} |
| 650 |
|
| 651 |
|
| 652 |
|
| 653 |
|
| 654 |
|
| 655 |
|
| 656 |
|
| 657 |
|
| 658 |
[[nodiscard]] int getLeftSprites() const { |
| 659 |
|
| 660 |
|
| 661 |
|
| 662 |
return 100 + 102 + 56 |
| 663 |
+ (horizontalAdjust - 7) * 4 |
| 664 |
+ (displayMode.isTextMode() ? (isMSX1VDP() ? 6 : 9) : 0) * 4; |
| 665 |
} |
| 666 |
|
| 667 |
|
| 668 |
|
| 669 |
|
| 670 |
|
| 671 |
|
| 672 |
[[nodiscard]] int getLeftBorder() const { |
| 673 |
return getLeftSprites() + (isBorderMasked() ? 8 * 4 : 0); |
| 674 |
} |
| 675 |
|
| 676 |
|
| 677 |
|
| 678 |
|
| 679 |
[[nodiscard]] int getRightBorder() const { |
| 680 |
return getLeftSprites() |
| 681 |
+ (displayMode.isTextMode() ? 960 : 1024); |
| 682 |
} |
| 683 |
|
| 684 |
|
| 685 |
|
| 686 |
|
| 687 |
|
| 688 |
|
| 689 |
[[nodiscard]] int getLeftBackground() const { |
| 690 |
return getLeftSprites() + getHorizontalScrollLow() * 4; |
| 691 |
} |
| 692 |
|
| 693 |
|
| 694 |
|
| 695 |
|
| 696 |
[[nodiscard]] uint8_t getStatusReg0() const { return statusReg0; } |
| 697 |
|
| 698 |
|
| 699 |
|
| 700 |
|
| 701 |
|
| 702 |
|
| 703 |
|
| 704 |
|
| 705 |
|
| 706 |
void setSpriteStatus(uint8_t value) |
| 707 |
{ |
| 708 |
statusReg0 = (statusReg0 & 0x80) | (value & 0x7F); |
| 709 |
} |
| 710 |
|
| 711 |
|
| 712 |
|
| 713 |
|
| 714 |
[[nodiscard]] bool getVRMode() const { |
| 715 |
return (controlRegs[8] & 8) != 0; |
| 716 |
} |
| 717 |
|
| 718 |
|
| 719 |
|
| 720 |
void setExternalVideoSource(const RawFrame* externalSource) { |
| 721 |
externalVideo = externalSource; |
| 722 |
} |
| 723 |
|
| 724 |
|
| 725 |
|
| 726 |
[[nodiscard]] bool getBrokenCmdTiming() const { |
| 727 |
return brokenCmdTiming; |
| 728 |
} |
| 729 |
|
| 730 |
|
| 731 |
|
| 732 |
[[nodiscard]] EmuTime getAccessSlot(EmuTime time, VDPAccessSlots::Delta delta) const; |
| 733 |
|
| 734 |
|
| 735 |
|
| 736 |
|
| 737 |
|
| 738 |
|
| 739 |
|
| 740 |
|
| 741 |
|
| 742 |
|
| 743 |
[[nodiscard]] VDPAccessSlots::Calculator getAccessSlotCalculator( |
| 744 |
EmuTime time, EmuTime limit) const; |
| 745 |
|
| 746 |
|
| 747 |
|
| 748 |
|
| 749 |
|
| 750 |
|
| 751 |
|
| 752 |
|
| 753 |
|
| 754 |
|
| 755 |
|
| 756 |
|
| 757 |
|
| 758 |
|
| 759 |
|
| 760 |
|
| 761 |
|
| 762 |
|
| 763 |
void scheduleCmdSync(EmuTime t) { |
| 764 |
if (auto now = getCurrentTime(); t <= now) { |
| 765 |
|
| 766 |
|
| 767 |
|
| 768 |
|
| 769 |
|
| 770 |
int LARGEST_STALL = 184 + 2 * 70; |
| 771 |
|
| 772 |
t = now + VDPClock::duration(LARGEST_STALL); |
| 773 |
} |
| 774 |
syncCmdDone.setSyncPoint(t); |
| 775 |
} |
| 776 |
|
| 777 |
|
| 778 |
|
| 779 |
|
| 780 |
|
| 781 |
|
| 782 |
|
| 783 |
|
| 784 |
|
| 785 |
|
| 786 |
|
| 787 |
|
| 788 |
|
| 789 |
|
| 790 |
|
| 791 |
|
| 792 |
[[nodiscard]] gl::ivec2 getMSXPos(EmuTime time) const { |
| 793 |
auto ticks = getTicksThisFrame(time); |
| 794 |
return {((ticks % VDP::TICKS_PER_LINE) - getLeftSprites()) / 2, |
| 795 |
(ticks / VDP::TICKS_PER_LINE) - getLineZero()}; |
| 796 |
} |
| 797 |
|
| 798 |
|
| 799 |
VDPCmdEngine& getCmdEngine() { return *cmdEngine; } |
| 800 |
|
| 801 |
|
| 802 |
[[nodiscard]] const RawFrame* getWorkingFrame(EmuTime time); |
| 803 |
|
| 804 |
|
| 805 |
[[nodiscard]] const RawFrame* getLastFrame() const; |
| 806 |
|
| 807 |
template<typename Archive> |
| 808 |
void serialize(Archive& ar, unsigned version); |
| 809 |
|
| 810 |
private: |
| 811 |
void initTables(); |
| 812 |
|
| 813 |
|
| 814 |
static constexpr unsigned VM_MSX1 = 1; |
| 815 |
static constexpr unsigned VM_PAL = 2; |
| 816 |
static constexpr unsigned VM_NO_MIRRORING = 4; |
| 817 |
static constexpr unsigned VM_PALCOL_MIRRORING = 8; |
| 818 |
static constexpr unsigned VM_VRAM_REMAPPING = 16; |
| 819 |
static constexpr unsigned VM_TOSHIBA_PALETTE = 32; |
| 820 |
static constexpr unsigned VM_YJK = 64; |
| 821 |
static constexpr unsigned VM_YM2220_PALETTE = 128; |
| 822 |
|
| 823 |
|
| 824 |
enum VdpVersion : uint8_t { |
| 825 |
|
| 826 |
|
| 827 |
|
| 828 |
|
| 829 |
TMS99X8A = VM_MSX1 | VM_PALCOL_MIRRORING | VM_VRAM_REMAPPING, |
| 830 |
|
| 831 |
|
| 832 |
TMS9929A = VM_MSX1 | VM_PALCOL_MIRRORING | VM_VRAM_REMAPPING | VM_PAL, |
| 833 |
|
| 834 |
|
| 835 |
TMS9129 = VM_MSX1 | VM_PAL, |
| 836 |
|
| 837 |
|
| 838 |
TMS91X8 = VM_MSX1, |
| 839 |
|
| 840 |
|
| 841 |
T6950PAL = VM_MSX1 | VM_TOSHIBA_PALETTE | VM_NO_MIRRORING | VM_PAL, |
| 842 |
|
| 843 |
|
| 844 |
T6950NTSC = VM_MSX1 | VM_TOSHIBA_PALETTE | VM_NO_MIRRORING, |
| 845 |
|
| 846 |
|
| 847 |
T7937APAL = VM_MSX1 | VM_TOSHIBA_PALETTE | VM_PAL, |
| 848 |
|
| 849 |
|
| 850 |
T7937ANTSC = VM_MSX1 | VM_TOSHIBA_PALETTE, |
| 851 |
|
| 852 |
|
| 853 |
YM2220PAL = VM_MSX1 | VM_YM2220_PALETTE | VM_PALCOL_MIRRORING | VM_PAL, |
| 854 |
|
| 855 |
|
| 856 |
YM2220NTSC = VM_MSX1 | VM_YM2220_PALETTE | VM_PALCOL_MIRRORING, |
| 857 |
|
| 858 |
|
| 859 |
V9938 = 0, |
| 860 |
|
| 861 |
|
| 862 |
V9958 = VM_YJK, |
| 863 |
}; |
| 864 |
|
| 865 |
struct SyncBase : public Schedulable { |
| 866 |
explicit SyncBase(const VDP& vdp_) : Schedulable(vdp_.getScheduler()) {} |
| 867 |
using Schedulable::removeSyncPoint; |
| 868 |
using Schedulable::setSyncPoint; |
| 869 |
protected: |
| 870 |
~SyncBase() = default; |
| 871 |
}; |
| 872 |
|
| 873 |
struct SyncVSync final : public SyncBase { |
| 874 |
using SyncBase::SyncBase; |
| 875 |
void executeUntil(EmuTime time) override { |
| 876 |
auto& vdp = OUTER(VDP, syncVSync); |
| 877 |
vdp.execVSync(time); |
| 878 |
} |
| 879 |
} syncVSync; |
| 880 |
|
| 881 |
struct SyncLineCountReset final : public SyncBase { |
| 882 |
using SyncBase::SyncBase; |
| 883 |
void executeUntil(EmuTime time) override { |
| 884 |
auto& vdp = OUTER(VDP, syncLineCountReset); |
| 885 |
vdp.execLineCountReset(time); |
| 886 |
} |
| 887 |
} syncLineCountReset; |
| 888 |
|
| 889 |
struct SyncDisplayStart final : public SyncBase { |
| 890 |
using SyncBase::SyncBase; |
| 891 |
void executeUntil(EmuTime time) override { |
| 892 |
auto& vdp = OUTER(VDP, syncDisplayStart); |
| 893 |
vdp.execDisplayStart(time); |
| 894 |
} |
| 895 |
} syncDisplayStart; |
| 896 |
|
| 897 |
struct SyncSlotTableStart final : public SyncBase { |
| 898 |
using SyncBase::SyncBase; |
| 899 |
void executeUntil(EmuTime time) override { |
| 900 |
auto& vdp = OUTER(VDP, syncSlotTableStart); |
| 901 |
vdp.execSlotTableStart(time); |
| 902 |
} |
| 903 |
} syncSlotTableStart; |
| 904 |
|
| 905 |
struct SyncSlotTableEnd final : public SyncBase { |
| 906 |
using SyncBase::SyncBase; |
| 907 |
void executeUntil(EmuTime time) override { |
| 908 |
auto& vdp = OUTER(VDP, syncSlotTableEnd); |
| 909 |
vdp.execSlotTableEnd(time); |
| 910 |
} |
| 911 |
} syncSlotTableEnd; |
| 912 |
|
| 913 |
struct SyncVScan final : public SyncBase { |
| 914 |
using SyncBase::SyncBase; |
| 915 |
void executeUntil(EmuTime time) override { |
| 916 |
auto& vdp = OUTER(VDP, syncVScan); |
| 917 |
vdp.execVScan(time); |
| 918 |
} |
| 919 |
} syncVScan; |
| 920 |
|
| 921 |
struct SyncHScan final : public SyncBase { |
| 922 |
using SyncBase::SyncBase; |
| 923 |
void executeUntil(EmuTime ) override { |
| 924 |
auto& vdp = OUTER(VDP, syncHScan); |
| 925 |
vdp.execHScan(); |
| 926 |
} |
| 927 |
} syncHScan; |
| 928 |
|
| 929 |
struct SyncHorAdjust final : public SyncBase { |
| 930 |
using SyncBase::SyncBase; |
| 931 |
void executeUntil(EmuTime time) override { |
| 932 |
auto& vdp = OUTER(VDP, syncHorAdjust); |
| 933 |
vdp.execHorAdjust(time); |
| 934 |
} |
| 935 |
} syncHorAdjust; |
| 936 |
|
| 937 |
struct SyncSetMode final : public SyncBase { |
| 938 |
using SyncBase::SyncBase; |
| 939 |
void executeUntil(EmuTime time) override { |
| 940 |
auto& vdp = OUTER(VDP, syncSetMode); |
| 941 |
vdp.execSetMode(time); |
| 942 |
} |
| 943 |
} syncSetMode; |
| 944 |
|
| 945 |
struct SyncSetBlank final : public SyncBase { |
| 946 |
using SyncBase::SyncBase; |
| 947 |
void executeUntil(EmuTime time) override { |
| 948 |
auto& vdp = OUTER(VDP, syncSetBlank); |
| 949 |
vdp.execSetBlank(time); |
| 950 |
} |
| 951 |
} syncSetBlank; |
| 952 |
|
| 953 |
struct SyncSetSprites final : public SyncBase { |
| 954 |
using SyncBase::SyncBase; |
| 955 |
void executeUntil(EmuTime time) override { |
| 956 |
auto& vdp = OUTER(VDP, syncSetSprites); |
| 957 |
vdp.execSetSprites(time); |
| 958 |
} |
| 959 |
} syncSetSprites; |
| 960 |
|
| 961 |
struct SyncCpuVramAccess final : public SyncBase { |
| 962 |
using SyncBase::SyncBase; |
| 963 |
void executeUntil(EmuTime time) override { |
| 964 |
auto& vdp = OUTER(VDP, syncCpuVramAccess); |
| 965 |
vdp.execCpuVramAccess(time); |
| 966 |
} |
| 967 |
} syncCpuVramAccess; |
| 968 |
|
| 969 |
struct SyncCpuVramDummy final : public SyncBase { |
| 970 |
using SyncBase::SyncBase; |
| 971 |
void executeUntil(EmuTime time) override { |
| 972 |
auto& vdp = OUTER(VDP, syncCpuVramDummy); |
| 973 |
vdp.execCpuVramDummy(time); |
| 974 |
} |
| 975 |
} syncCpuVramDummy; |
| 976 |
|
| 977 |
struct SyncCmdDone final : public SyncBase { |
| 978 |
using SyncBase::SyncBase; |
| 979 |
void executeUntil(EmuTime time) override { |
| 980 |
auto& vdp = OUTER(VDP, syncCmdDone); |
| 981 |
vdp.execSyncCmdDone(time); |
| 982 |
} |
| 983 |
} syncCmdDone; |
| 984 |
|
| 985 |
void execVSync(EmuTime time); |
| 986 |
void execLineCountReset(EmuTime time); |
| 987 |
void execDisplayStart(EmuTime time); |
| 988 |
void execVScan(EmuTime time); |
| 989 |
void setSlotTableDisplayArea(bool enabled, EmuTime time); |
| 990 |
void execSlotTableStart(EmuTime time); |
| 991 |
void execSlotTableEnd(EmuTime time); |
| 992 |
void execHScan(); |
| 993 |
void execHorAdjust(EmuTime time); |
| 994 |
void execSetMode(EmuTime time); |
| 995 |
void execSetBlank(EmuTime time); |
| 996 |
void execSetSprites(EmuTime time); |
| 997 |
void execCpuVramAccess(EmuTime time); |
| 998 |
void execSyncCmdDone(EmuTime time); |
| 999 |
|
| 1000 |
|
| 1001 |
|
| 1002 |
|
| 1003 |
[[nodiscard]] int getVerticalAdjust() const { |
| 1004 |
return (controlRegs[18] >> 4) ^ 0x07; |
| 1005 |
} |
| 1006 |
|
| 1007 |
|
| 1008 |
|
| 1009 |
|
| 1010 |
|
| 1011 |
|
| 1012 |
|
| 1013 |
|
| 1014 |
|
| 1015 |
|
| 1016 |
[[nodiscard]] bool getHR(int ticksThisFrame) const { |
| 1017 |
|
| 1018 |
|
| 1019 |
|
| 1020 |
|
| 1021 |
|
| 1022 |
static constexpr int HBLANK_LEN_TXT = 404; |
| 1023 |
|
| 1024 |
|
| 1025 |
|
| 1026 |
static constexpr int HBLANK_LEN_GFX = 312; |
| 1027 |
return (ticksThisFrame + TICKS_PER_LINE - getRightBorder()) % TICKS_PER_LINE |
| 1028 |
< (displayMode.isTextMode() ? HBLANK_LEN_TXT : HBLANK_LEN_GFX); |
| 1029 |
} |
| 1030 |
|
| 1031 |
|
| 1032 |
void preVideoSystemChange() noexcept override; |
| 1033 |
void postVideoSystemChange() noexcept override; |
| 1034 |
|
| 1035 |
|
| 1036 |
|
| 1037 |
|
| 1038 |
|
| 1039 |
void resetInit(); |
| 1040 |
|
| 1041 |
|
| 1042 |
|
| 1043 |
|
| 1044 |
|
| 1045 |
void resetMasks(EmuTime time); |
| 1046 |
|
| 1047 |
|
| 1048 |
|
| 1049 |
|
| 1050 |
void frameStart(EmuTime time); |
| 1051 |
|
| 1052 |
|
| 1053 |
|
| 1054 |
|
| 1055 |
|
| 1056 |
|
| 1057 |
|
| 1058 |
|
| 1059 |
void scheduleLineCountReset(EmuTime time); |
| 1060 |
|
| 1061 |
|
| 1062 |
|
| 1063 |
|
| 1064 |
|
| 1065 |
|
| 1066 |
void scheduleVScan(EmuTime time); |
| 1067 |
|
| 1068 |
|
| 1069 |
|
| 1070 |
|
| 1071 |
|
| 1072 |
|
| 1073 |
void scheduleHScan(EmuTime time); |
| 1074 |
|
| 1075 |
|
| 1076 |
|
| 1077 |
void vramWrite(uint8_t value, EmuTime time); |
| 1078 |
|
| 1079 |
|
| 1080 |
|
| 1081 |
[[nodiscard]] uint8_t vramRead(EmuTime time); |
| 1082 |
|
| 1083 |
|
| 1084 |
void scheduleCpuVramAccess(bool isRead, uint8_t write, EmuTime time); |
| 1085 |
void execCpuVramDummy(EmuTime time); |
| 1086 |
void scheduleTMS99x8VramAccess(bool isRead, EmuTime time); |
| 1087 |
void scheduleV99x8VramAccess(bool isRead, EmuTime time); |
| 1088 |
[[nodiscard]] bool cpuRequestIsTooEarly(EmuTime request) const; |
| 1089 |
void flushCpuVramAccesses(EmuTime time); |
| 1090 |
void executeCpuVramAccess(EmuTime time); |
| 1091 |
|
| 1092 |
|
| 1093 |
|
| 1094 |
[[nodiscard]] uint8_t readStatusReg(uint8_t reg, EmuTime time); |
| 1095 |
|
| 1096 |
|
| 1097 |
|
| 1098 |
void syncAtNextLine(SyncBase& type, EmuTime time) const; |
| 1099 |
|
| 1100 |
|
| 1101 |
|
| 1102 |
void createRenderer(); |
| 1103 |
|
| 1104 |
|
| 1105 |
|
| 1106 |
|
| 1107 |
void updateNameBase(EmuTime time); |
| 1108 |
|
| 1109 |
|
| 1110 |
|
| 1111 |
|
| 1112 |
void updateColorBase(EmuTime time); |
| 1113 |
|
| 1114 |
|
| 1115 |
|
| 1116 |
|
| 1117 |
void updatePatternBase(EmuTime time); |
| 1118 |
|
| 1119 |
|
| 1120 |
|
| 1121 |
|
| 1122 |
void updateSpriteAttributeBase(EmuTime time); |
| 1123 |
|
| 1124 |
|
| 1125 |
|
| 1126 |
|
| 1127 |
void updateSpritePatternBase(EmuTime time); |
| 1128 |
|
| 1129 |
|
| 1130 |
|
| 1131 |
|
| 1132 |
void updateDisplayMode(DisplayMode newMode, bool cmdBit, EmuTime time); |
| 1133 |
|
| 1134 |
|
| 1135 |
void update(const Setting& setting) noexcept override; |
| 1136 |
|
| 1137 |
private: |
| 1138 |
Display& display; |
| 1139 |
EnumSetting<bool>& cmdTiming; |
| 1140 |
EnumSetting<bool>& tooFastAccess; |
| 1141 |
|
| 1142 |
struct RegDebug final : SimpleDebuggable { |
| 1143 |
explicit RegDebug(const VDP& vdp); |
| 1144 |
[[nodiscard]] uint8_t read(unsigned address, EmuTime time) override; |
| 1145 |
void write(unsigned address, uint8_t value, EmuTime time) override; |
| 1146 |
} vdpRegDebug; |
| 1147 |
|
| 1148 |
struct StatusRegDebug final : SimpleDebuggable { |
| 1149 |
explicit StatusRegDebug(const VDP& vdp); |
| 1150 |
[[nodiscard]] uint8_t read(unsigned address, EmuTime time) override; |
| 1151 |
} vdpStatusRegDebug; |
| 1152 |
|
| 1153 |
struct PaletteDebug final : SimpleDebuggable { |
| 1154 |
explicit PaletteDebug(const VDP& vdp); |
| 1155 |
[[nodiscard]] uint8_t read(unsigned address) override; |
| 1156 |
void write(unsigned address, uint8_t value, EmuTime time) override; |
| 1157 |
} vdpPaletteDebug; |
| 1158 |
|
| 1159 |
struct VRAMPointerDebug final : SimpleDebuggable { |
| 1160 |
explicit VRAMPointerDebug(const VDP& vdp); |
| 1161 |
[[nodiscard]] uint8_t read(unsigned address) override; |
| 1162 |
void write(unsigned address, uint8_t value, EmuTime time) override; |
| 1163 |
} vramPointerDebug; |
| 1164 |
|
| 1165 |
struct RegisterLatchStatusDebug final : SimpleDebuggable { |
| 1166 |
explicit RegisterLatchStatusDebug(const VDP& vdp); |
| 1167 |
[[nodiscard]] uint8_t read(unsigned address) override; |
| 1168 |
} registerLatchStatusDebug; |
| 1169 |
|
| 1170 |
struct VramAccessStatusDebug final : SimpleDebuggable { |
| 1171 |
explicit VramAccessStatusDebug(const VDP& vdp); |
| 1172 |
[[nodiscard]] uint8_t read(unsigned address) override; |
| 1173 |
} vramAccessStatusDebug; |
| 1174 |
|
| 1175 |
struct PaletteLatchStatusDebug final : SimpleDebuggable { |
| 1176 |
explicit PaletteLatchStatusDebug(const VDP& vdp); |
| 1177 |
[[nodiscard]] uint8_t read(unsigned address) override; |
| 1178 |
} paletteLatchStatusDebug; |
| 1179 |
|
| 1180 |
struct DataLatchDebug final : SimpleDebuggable { |
| 1181 |
explicit DataLatchDebug(const VDP& vdp); |
| 1182 |
[[nodiscard]] uint8_t read(unsigned address) override; |
| 1183 |
} dataLatchDebug; |
| 1184 |
|
| 1185 |
class Info : public InfoTopic { |
| 1186 |
public: |
| 1187 |
void execute(std::span<const TclObject> tokens, |
| 1188 |
TclObject& result) const override; |
| 1189 |
[[nodiscard]] std::string help(std::span<const TclObject> tokens) const override; |
| 1190 |
[[nodiscard]] virtual int calc(EmuTime time) const = 0; |
| 1191 |
protected: |
| 1192 |
Info(VDP& vdp_, const std::string& name, std::string helpText_); |
| 1193 |
~Info() = default; |
| 1194 |
VDP& vdp; |
| 1195 |
const std::string helpText; |
| 1196 |
}; |
| 1197 |
|
| 1198 |
struct FrameCountInfo final : Info { |
| 1199 |
explicit FrameCountInfo(VDP& vdp); |
| 1200 |
[[nodiscard]] int calc(EmuTime time) const override; |
| 1201 |
} frameCountInfo; |
| 1202 |
|
| 1203 |
struct CycleInFrameInfo final : Info { |
| 1204 |
explicit CycleInFrameInfo(VDP& vdp); |
| 1205 |
[[nodiscard]] int calc(EmuTime time) const override; |
| 1206 |
} cycleInFrameInfo; |
| 1207 |
|
| 1208 |
struct LineInFrameInfo final : Info { |
| 1209 |
explicit LineInFrameInfo(VDP& vdp); |
| 1210 |
[[nodiscard]] int calc(EmuTime time) const override; |
| 1211 |
} lineInFrameInfo; |
| 1212 |
|
| 1213 |
struct CycleInLineInfo final : Info { |
| 1214 |
explicit CycleInLineInfo(VDP& vdp); |
| 1215 |
[[nodiscard]] int calc(EmuTime time) const override; |
| 1216 |
} cycleInLineInfo; |
| 1217 |
|
| 1218 |
struct MsxYPosInfo final : Info { |
| 1219 |
explicit MsxYPosInfo(VDP& vdp); |
| 1220 |
[[nodiscard]] int calc(EmuTime time) const override; |
| 1221 |
} msxYPosInfo; |
| 1222 |
|
| 1223 |
struct MsxX256PosInfo final : Info { |
| 1224 |
explicit MsxX256PosInfo(VDP& vdp); |
| 1225 |
[[nodiscard]] int calc(EmuTime time) const override; |
| 1226 |
} msxX256PosInfo; |
| 1227 |
|
| 1228 |
struct MsxX512PosInfo final : Info { |
| 1229 |
explicit MsxX512PosInfo(VDP& vdp); |
| 1230 |
[[nodiscard]] int calc(EmuTime time) const override; |
| 1231 |
} msxX512PosInfo; |
| 1232 |
|
| 1233 |
|
| 1234 |
|
| 1235 |
std::unique_ptr<Renderer> renderer; |
| 1236 |
|
| 1237 |
|
| 1238 |
|
| 1239 |
std::unique_ptr<VDPCmdEngine> cmdEngine; |
| 1240 |
|
| 1241 |
|
| 1242 |
|
| 1243 |
std::unique_ptr<SpriteChecker> spriteChecker; |
| 1244 |
|
| 1245 |
|
| 1246 |
|
| 1247 |
std::unique_ptr<VDPVRAM> vram; |
| 1248 |
|
| 1249 |
|
| 1250 |
|
| 1251 |
|
| 1252 |
const RawFrame* externalVideo; |
| 1253 |
|
| 1254 |
|
| 1255 |
|
| 1256 |
|
| 1257 |
|
| 1258 |
|
| 1259 |
const RawFrame* superimposing; |
| 1260 |
|
| 1261 |
|
| 1262 |
|
| 1263 |
VDPClock frameStartTime; |
| 1264 |
|
| 1265 |
|
| 1266 |
|
| 1267 |
OptionalIRQHelper irqVertical; |
| 1268 |
|
| 1269 |
|
| 1270 |
|
| 1271 |
OptionalIRQHelper irqHorizontal; |
| 1272 |
|
| 1273 |
|
| 1274 |
|
| 1275 |
|
| 1276 |
|
| 1277 |
EmuTime lineCountResetSyncTime; |
| 1278 |
|
| 1279 |
|
| 1280 |
|
| 1281 |
EmuTime displayStartSyncTime; |
| 1282 |
|
| 1283 |
|
| 1284 |
|
| 1285 |
|
| 1286 |
EmuTime slotTableStartSyncTime; |
| 1287 |
EmuTime slotTableEndSyncTime; |
| 1288 |
|
| 1289 |
|
| 1290 |
|
| 1291 |
EmuTime vScanSyncTime; |
| 1292 |
|
| 1293 |
|
| 1294 |
|
| 1295 |
EmuTime hScanSyncTime; |
| 1296 |
|
| 1297 |
TclCallback tooFastCallback; |
| 1298 |
TclCallback dotClockDirectionCallback; |
| 1299 |
|
| 1300 |
|
| 1301 |
|
| 1302 |
VdpVersion version; |
| 1303 |
|
| 1304 |
|
| 1305 |
|
| 1306 |
|
| 1307 |
|
| 1308 |
int saturationPr; |
| 1309 |
|
| 1310 |
|
| 1311 |
|
| 1312 |
|
| 1313 |
|
| 1314 |
int saturationPb; |
| 1315 |
|
| 1316 |
|
| 1317 |
|
| 1318 |
|
| 1319 |
|
| 1320 |
|
| 1321 |
int frameCount; |
| 1322 |
|
| 1323 |
|
| 1324 |
|
| 1325 |
|
| 1326 |
|
| 1327 |
|
| 1328 |
|
| 1329 |
|
| 1330 |
int displayStart; |
| 1331 |
|
| 1332 |
|
| 1333 |
|
| 1334 |
|
| 1335 |
|
| 1336 |
int horizontalScanOffset; |
| 1337 |
|
| 1338 |
|
| 1339 |
|
| 1340 |
|
| 1341 |
int horizontalAdjust; |
| 1342 |
|
| 1343 |
|
| 1344 |
|
| 1345 |
std::array<uint8_t, 32> controlRegs; |
| 1346 |
|
| 1347 |
|
| 1348 |
|
| 1349 |
|
| 1350 |
|
| 1351 |
uint8_t controlRegMask; |
| 1352 |
|
| 1353 |
|
| 1354 |
|
| 1355 |
|
| 1356 |
|
| 1357 |
|
| 1358 |
|
| 1359 |
std::array<uint8_t, 32> controlValueMasks; |
| 1360 |
|
| 1361 |
|
| 1362 |
|
| 1363 |
|
| 1364 |
int blinkCount; |
| 1365 |
|
| 1366 |
|
| 1367 |
|
| 1368 |
|
| 1369 |
int vramPointer; |
| 1370 |
|
| 1371 |
|
| 1372 |
|
| 1373 |
std::array<uint16_t, 16> palette; |
| 1374 |
|
| 1375 |
|
| 1376 |
|
| 1377 |
bool isDisplayArea; |
| 1378 |
|
| 1379 |
|
| 1380 |
|
| 1381 |
bool isSlotTableDisplayArea; |
| 1382 |
|
| 1383 |
|
| 1384 |
|
| 1385 |
|
| 1386 |
|
| 1387 |
|
| 1388 |
bool palTiming; |
| 1389 |
|
| 1390 |
|
| 1391 |
|
| 1392 |
|
| 1393 |
bool interlaced = false; |
| 1394 |
|
| 1395 |
|
| 1396 |
|
| 1397 |
|
| 1398 |
|
| 1399 |
uint8_t statusReg0; |
| 1400 |
|
| 1401 |
|
| 1402 |
|
| 1403 |
|
| 1404 |
|
| 1405 |
|
| 1406 |
uint8_t statusReg1; |
| 1407 |
|
| 1408 |
|
| 1409 |
|
| 1410 |
|
| 1411 |
|
| 1412 |
uint8_t statusReg2; |
| 1413 |
|
| 1414 |
|
| 1415 |
|
| 1416 |
bool blinkState; |
| 1417 |
|
| 1418 |
|
| 1419 |
|
| 1420 |
uint8_t dataLatch; |
| 1421 |
|
| 1422 |
|
| 1423 |
|
| 1424 |
|
| 1425 |
|
| 1426 |
|
| 1427 |
|
| 1428 |
bool writeAccess; |
| 1429 |
|
| 1430 |
|
| 1431 |
|
| 1432 |
bool registerDataStored; |
| 1433 |
|
| 1434 |
|
| 1435 |
|
| 1436 |
bool paletteDataStored; |
| 1437 |
|
| 1438 |
|
| 1439 |
|
| 1440 |
|
| 1441 |
|
| 1442 |
|
| 1443 |
|
| 1444 |
|
| 1445 |
uint8_t cpuVramData; |
| 1446 |
|
| 1447 |
|
| 1448 |
|
| 1449 |
|
| 1450 |
|
| 1451 |
|
| 1452 |
|
| 1453 |
bool cpuVramReqIsRead; |
| 1454 |
uint8_t cpuVramReqData; |
| 1455 |
bool pendingCpuAccess; |
| 1456 |
|
| 1457 |
|
| 1458 |
|
| 1459 |
|
| 1460 |
|
| 1461 |
|
| 1462 |
|
| 1463 |
EmuTime previousCpuSlot = EmuTime::zero(); |
| 1464 |
bool previousCpuSlotIsLate = false; |
| 1465 |
|
| 1466 |
|
| 1467 |
|
| 1468 |
|
| 1469 |
|
| 1470 |
EmuTime secondCpuSlot = EmuTime::infinity(); |
| 1471 |
bool secondCpuVramReqIsRead = false; |
| 1472 |
uint8_t secondCpuVramReqData = 0; |
| 1473 |
|
| 1474 |
|
| 1475 |
|
| 1476 |
|
| 1477 |
bool cpuExtendedVram; |
| 1478 |
|
| 1479 |
|
| 1480 |
|
| 1481 |
|
| 1482 |
|
| 1483 |
|
| 1484 |
DisplayMode displayMode; |
| 1485 |
|
| 1486 |
|
| 1487 |
|
| 1488 |
|
| 1489 |
|
| 1490 |
bool displayEnabled; |
| 1491 |
|
| 1492 |
|
| 1493 |
|
| 1494 |
|
| 1495 |
|
| 1496 |
|
| 1497 |
bool spriteEnabled; |
| 1498 |
|
| 1499 |
|
| 1500 |
|
| 1501 |
|
| 1502 |
bool warningPrinted = false; |
| 1503 |
|
| 1504 |
|
| 1505 |
bool brokenCmdTiming; |
| 1506 |
bool allowTooFastAccess; |
| 1507 |
|
| 1508 |
|
| 1509 |
MSXCPU& cpu; |
| 1510 |
const uint8_t fixedVDPIOdelayCycles; |
| 1511 |
}; |
| 1512 |
SERIALIZE_CLASS_VERSION(VDP, 14); |
| 1513 |
|
| 1514 |
} |
| 1515 |
|
| 1516 |
#endif |