From f6f9024631d989463d0849508bf80e7d4ae04b4d Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Thu, 13 Jun 2019 18:41:38 -0400 Subject: [PATCH] Corrects Macintosh aspect ratio (and framing). --- Components/8530/z8530.cpp | 2 +- Components/DiskII/IWM.cpp | 2 +- Machines/Apple/Macintosh/Macintosh.cpp | 2 +- Machines/Apple/Macintosh/Video.cpp | 3 ++- .../xcshareddata/xcschemes/Clock Signal.xcscheme | 2 +- Outputs/CRT/CRT.cpp | 5 +++++ Outputs/CRT/CRT.hpp | 4 ++++ Outputs/OpenGL/ScanTargetGLSLFragments.cpp | 2 +- Outputs/ScanTarget.hpp | 3 +++ .../68000/Implementation/68000Implementation.hpp | 10 +++++++++- 10 files changed, 28 insertions(+), 7 deletions(-) diff --git a/Components/8530/z8530.cpp b/Components/8530/z8530.cpp index d758fc84b..77ccf5e50 100644 --- a/Components/8530/z8530.cpp +++ b/Components/8530/z8530.cpp @@ -89,7 +89,7 @@ void z8530::write(int address, std::uint8_t value) { break; case 9: // Master interrupt and reset register; also shared between both channels. - LOG("[SCC] TODO: master interrupt and reset register " << PADHEX(2) << int(value)); + LOG("[SCC] Master interrupt and reset register: " << PADHEX(2) << int(value)); master_interrupt_control_ = value; break; } diff --git a/Components/DiskII/IWM.cpp b/Components/DiskII/IWM.cpp index 0de1f4354..6e2a0553c 100644 --- a/Components/DiskII/IWM.cpp +++ b/Components/DiskII/IWM.cpp @@ -140,7 +140,7 @@ uint8_t IWM::read(int address) { // case CA2|CA1: // Single- or double-sided drive. LOG("single- or double-sided drive)"); - sense = drives_[active_drive_] && (drives_[active_drive_]->get_head_count() == 1) ? 0x00 : 0x80; + sense = drives_[active_drive_] && (drives_[active_drive_]->get_head_count() == 1) ? 0x80 : 0x00; break; case CA2|CA1|CA0: // Drive installed. (per the Mac Plus ROM) diff --git a/Machines/Apple/Macintosh/Macintosh.cpp b/Machines/Apple/Macintosh/Macintosh.cpp index 97da812f8..bceb72964 100644 --- a/Machines/Apple/Macintosh/Macintosh.cpp +++ b/Machines/Apple/Macintosh/Macintosh.cpp @@ -102,7 +102,7 @@ template class ConcreteMachin Memory::PackBigEndian16(*roms[0], rom_); // Randomise memory contents. - Memory::Fuzz(ram_, sizeof(ram_)); + Memory::Fuzz(ram_, sizeof(ram_) / sizeof(*ram_)); // Attach the drives to the IWM. iwm_.iwm.set_drive(0, &drives_[0]); diff --git a/Machines/Apple/Macintosh/Video.cpp b/Machines/Apple/Macintosh/Video.cpp index 977e4491a..3c6a92ff9 100644 --- a/Machines/Apple/Macintosh/Video.cpp +++ b/Machines/Apple/Macintosh/Video.cpp @@ -40,7 +40,8 @@ Video::Video(uint16_t *ram, DeferredAudio &audio, DriveSpeedAccumulator &drive_s ram_(ram) { crt_.set_display_type(Outputs::Display::DisplayType::RGB); - crt_.set_visible_area(Outputs::Display::Rect(0.02f, 0.025f, 0.94f, 0.94f)); + crt_.set_visible_area(Outputs::Display::Rect(0.08f, -0.025f, 0.82f, 0.82f)); + crt_.set_aspect_ratio(1.73f); // The Mac uses a non-standard scanning area. } void Video::set_scan_target(Outputs::Display::ScanTarget *scan_target) { diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/xcshareddata/xcschemes/Clock Signal.xcscheme b/OSBindings/Mac/Clock Signal.xcodeproj/xcshareddata/xcschemes/Clock Signal.xcscheme index 9c2dca9ce..cdac581d4 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/xcshareddata/xcschemes/Clock Signal.xcscheme +++ b/OSBindings/Mac/Clock Signal.xcodeproj/xcshareddata/xcschemes/Clock Signal.xcscheme @@ -69,7 +69,7 @@ set_modals(scan_target_modals_); } +void CRT::set_aspect_ratio(float aspect_ratio) { + scan_target_modals_.aspect_ratio = aspect_ratio; + scan_target_->set_modals(scan_target_modals_); +} + void CRT::set_visible_area(Outputs::Display::Rect visible_area) { scan_target_modals_.visible_area = visible_area; scan_target_->set_modals(scan_target_modals_); diff --git a/Outputs/CRT/CRT.hpp b/Outputs/CRT/CRT.hpp index 41e96f3a4..042521cc8 100644 --- a/Outputs/CRT/CRT.hpp +++ b/Outputs/CRT/CRT.hpp @@ -146,6 +146,10 @@ class CRT { */ void set_new_data_type(Outputs::Display::InputDataType data_type); + /*! Sets the CRT's intended aspect ratio — 4.0/3.0 by default. + */ + void set_aspect_ratio(float aspect_ratio); + /*! Output at the sync level. @param number_of_cycles The amount of time to putput sync for. diff --git a/Outputs/OpenGL/ScanTargetGLSLFragments.cpp b/Outputs/OpenGL/ScanTargetGLSLFragments.cpp index 743dacedb..1d5d3ca14 100644 --- a/Outputs/OpenGL/ScanTargetGLSLFragments.cpp +++ b/Outputs/OpenGL/ScanTargetGLSLFragments.cpp @@ -23,7 +23,7 @@ void ScanTarget::set_uniforms(ShaderType type, Shader &target) const { case ShaderType::Composition: break; default: target.set_uniform("rowHeight", GLfloat(1.05f / modals_.expected_vertical_lines)); - target.set_uniform("scale", GLfloat(modals_.output_scale.x), GLfloat(modals_.output_scale.y)); + target.set_uniform("scale", GLfloat(modals_.output_scale.x), GLfloat(modals_.output_scale.y) * modals_.aspect_ratio * (3.0f / 4.0f)); target.set_uniform("phaseOffset", GLfloat(modals_.input_data_tweaks.phase_linked_luminance_offset)); const float clocks_per_angle = float(modals_.cycles_per_line) * float(modals_.colour_cycle_denominator) / float(modals_.colour_cycle_numerator); diff --git a/Outputs/ScanTarget.hpp b/Outputs/ScanTarget.hpp index 83de2ef1c..f2695a4ac 100644 --- a/Outputs/ScanTarget.hpp +++ b/Outputs/ScanTarget.hpp @@ -190,6 +190,9 @@ struct ScanTarget { struct { uint16_t x, y; } output_scale; + + /// Describes the intended display aspect ratio. + float aspect_ratio = 4.0f / 3.0f; }; /// Sets the total format of input data. diff --git a/Processors/68000/Implementation/68000Implementation.hpp b/Processors/68000/Implementation/68000Implementation.hpp index cfad42334..b871b1122 100644 --- a/Processors/68000/Implementation/68000Implementation.hpp +++ b/Processors/68000/Implementation/68000Implementation.hpp @@ -289,7 +289,15 @@ template void Proces } #ifdef LOG_TRACE - should_log |= (program_counter_.full - 4) == 0x401A84; + const uint32_t fetched_pc = (program_counter_.full - 4)&0xffffff; + +//1300 + should_log = (fetched_pc >= 0x400D9A) && (fetched_pc <= 0x400EAA); + // == 0x0003ea); +// should_log |= +// (((program_counter_.full - 4)&0xffffff) == 0x418CDE) || // E_Sony_RdData +// (((program_counter_.full - 4)&0xffffff) == 0x4182DC) || // E_Sony_ReSeek +// (((program_counter_.full - 4)&0xffffff) == 0x418C18); // E_Sony_RdAddr //4176b6 // should_log |= (program_counter_.full - 4) == 0x418A0A;//0x41806A;//180A2; // should_log = ((program_counter_.full - 4) >= 0x417D9E) && ((program_counter_.full - 4) <= 0x419D96);