From b8ae2830494ce7ff64dbda2400ca0c3afc60e65c Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Thu, 19 Apr 2018 22:14:22 -0400 Subject: [PATCH] Implements correct text inverse/flashing. --- Machines/AppleII/AppleII.cpp | 2 +- Machines/AppleII/Video.hpp | 18 +++++++++++++----- ROMImages/AppleII/readme.txt | 2 +- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/Machines/AppleII/AppleII.cpp b/Machines/AppleII/AppleII.cpp index 1ed4875f6..7095a4aa9 100644 --- a/Machines/AppleII/AppleII.cpp +++ b/Machines/AppleII/AppleII.cpp @@ -182,7 +182,7 @@ class ConcreteMachine: "AppleII", { "apple2o.rom", - "apple2o-character.rom" + "apple2-character.rom" }); if(!roms[0] || !roms[1]) return false; diff --git a/Machines/AppleII/Video.hpp b/Machines/AppleII/Video.hpp index 32d19ef8c..5b53324b7 100644 --- a/Machines/AppleII/Video.hpp +++ b/Machines/AppleII/Video.hpp @@ -47,7 +47,7 @@ class VideoBase { std::unique_ptr crt_; int video_page_ = 0; - int row_ = 0, column_ = 0; + int row_ = 0, column_ = 0, flash_ = 0; uint16_t *pixel_pointer_ = nullptr; std::vector character_rom_; @@ -115,15 +115,21 @@ template class Video: public VideoBase { GraphicsMode pixel_mode = (!mixed_mode_ || row_ < 160) ? line_mode : GraphicsMode::Text; switch(pixel_mode) { - case GraphicsMode::Text: + case GraphicsMode::Text: { + const uint8_t inverses[] = { + 0xff, + static_cast((flash_ / flash_length) * 0xff), + 0x00, + 0x00 + }; for(int c = column_; c < pixel_end; ++c) { const uint8_t character = bus_handler_.perform_read(static_cast(text_address + c)); - const std::size_t character_address = static_cast(((character & 0x7f) << 3) + pixel_row); + const std::size_t character_address = static_cast(((character & 0x3f) << 3) + pixel_row); - const uint8_t character_pattern = character_rom_[character_address] ^ ((character & 0x80) ? 0x00 : 0xff); + const uint8_t character_pattern = character_rom_[character_address] ^ inverses[character >> 6]; pixel_pointer_[c] = scaled_byte[character_pattern & 0x7f]; } - break; + } break; case GraphicsMode::LowRes: for(int c = column_; c < pixel_end; ++c) { @@ -193,6 +199,7 @@ template class Video: public VideoBase { column_ = (column_ + cycles_this_line) % 65; if(!column_) { row_ = (row_ + 1) % 262; + flash_ = (flash_ + 1) % (2 * flash_length); // Add an extra half a colour cycle of blank; this isn't counted in the run_for // count explicitly but is promised. @@ -202,6 +209,7 @@ template class Video: public VideoBase { } private: + const int flash_length = 8406; BusHandler &bus_handler_; }; diff --git a/ROMImages/AppleII/readme.txt b/ROMImages/AppleII/readme.txt index f930d3e49..397b6905e 100644 --- a/ROMImages/AppleII/readme.txt +++ b/ROMImages/AppleII/readme.txt @@ -3,4 +3,4 @@ ROM files would ordinarily go here; they are copyright Apple so are not included Expected files: apple2o.rom — a 12kb image of the original Apple II's ROMs. -apple2o-character.rom — a 2kb image of the original Apple II's character ROM. \ No newline at end of file +apple2-character.rom — a 2kb image of the Apple II+'s character ROM. \ No newline at end of file