From 3bb3d8c5c1e4a01a0f223dcae682a91995c111f7 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sat, 7 Nov 2020 23:14:50 -0500 Subject: [PATCH] Adds text colour register. Oddly this isn't currently being set. So probably another latent fault elsewhere. --- Machines/Apple/AppleIIgs/AppleIIgs.cpp | 10 ++++++++-- Machines/Apple/AppleIIgs/Video.cpp | 11 +++++++++-- Machines/Apple/AppleIIgs/Video.hpp | 6 ++++++ 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/Machines/Apple/AppleIIgs/AppleIIgs.cpp b/Machines/Apple/AppleIIgs/AppleIIgs.cpp index 2780f29c1..9d607ed31 100644 --- a/Machines/Apple/AppleIIgs/AppleIIgs.cpp +++ b/Machines/Apple/AppleIIgs/AppleIIgs.cpp @@ -187,8 +187,14 @@ class ConcreteMachine: *value = clock_.get_control(); } else { clock_.set_control(*value); - video_->set_border_colour(*value & 0xf); - // TODO: also set border colour. + video_->set_border_colour(*value); + } + break; + + // Colour text control. + case 0xc022: + if(!is_read) { + video_->set_text_colour(*value); } break; diff --git a/Machines/Apple/AppleIIgs/Video.cpp b/Machines/Apple/AppleIIgs/Video.cpp index 02acd098f..9363ebd3c 100644 --- a/Machines/Apple/AppleIIgs/Video.cpp +++ b/Machines/Apple/AppleIIgs/Video.cpp @@ -152,7 +152,7 @@ void VideoBase::output_row(int row, int start, int end) { } // Possibly output border, pixels, border, if this is a pixel line. - if(row < 200) { // TODO: use real test here; should be 192 for classic Apple II modes. + if(row < 192 + ((new_video_&0x80) >> 4)) { // i.e. 192 lines for classic Apple II video, 200 for IIgs video. // Output left border as far as currently known. if(start >= start_of_left_border && start < start_of_pixels) { @@ -211,6 +211,8 @@ void VideoBase::output_row(int row, int start, int end) { } bool VideoBase::get_is_vertical_blank() { + // Cf. http://www.1000bit.it/support/manuali/apple/technotes/iigs/tn.iigs.040.html ; + // this bit covers the entire vertical border area, not just the NTSC-sense vertical blank. return cycles_into_frame_ >= FinalPixelLine * CyclesPerLine; } @@ -245,5 +247,10 @@ void VideoBase::set_interrupts(uint8_t new_value) { } void VideoBase::set_border_colour(uint8_t colour) { - border_colour_ = appleii_palette[colour]; + border_colour_ = appleii_palette[colour & 0xf]; +} + +void VideoBase::set_text_colour(uint8_t colour) { + text_colour_ = appleii_palette[colour >> 4]; + background_colour_ = appleii_palette[colour & 0xf]; } diff --git a/Machines/Apple/AppleIIgs/Video.hpp b/Machines/Apple/AppleIIgs/Video.hpp index f5e29b7f4..fb12a081d 100644 --- a/Machines/Apple/AppleIIgs/Video.hpp +++ b/Machines/Apple/AppleIIgs/Video.hpp @@ -37,7 +37,9 @@ class VideoBase: public Apple::II::VideoSwitches { void set_interrupt_register(uint8_t); void notify_clock_tick(); + void set_border_colour(uint8_t); + void set_text_colour(uint8_t); /// Sets the scan target. void set_scan_target(Outputs::Display::ScanTarget *scan_target); @@ -62,7 +64,11 @@ class VideoBase: public Apple::II::VideoSwitches { int cycles_into_frame_ = 0; const uint8_t *ram_ = nullptr; + + // The modal colours. uint16_t border_colour_ = 0; + uint16_t text_colour_ = 0xfff; + uint16_t background_colour_ = 0; void output_row(int row, int start, int end); };