From 45f5896b7646265baadca1c38bcb2678e3f7a883 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sat, 31 Oct 2020 20:39:32 -0400 Subject: [PATCH] Stubs video switches into the IIgs. --- Machines/Apple/AppleII/Video.hpp | 6 ++-- Machines/Apple/AppleII/VideoSwitches.hpp | 2 +- Machines/Apple/AppleIIgs/AppleIIgs.cpp | 32 ++++++++++++++++- Machines/Apple/AppleIIgs/MemoryMap.hpp | 1 - Machines/Apple/AppleIIgs/Video.cpp | 18 ++++++++++ Machines/Apple/AppleIIgs/Video.hpp | 36 +++++++++++++++++++ .../Clock Signal.xcodeproj/project.pbxproj | 8 +++++ 7 files changed, 97 insertions(+), 6 deletions(-) create mode 100644 Machines/Apple/AppleIIgs/Video.cpp create mode 100644 Machines/Apple/AppleIIgs/Video.hpp diff --git a/Machines/Apple/AppleII/Video.hpp b/Machines/Apple/AppleII/Video.hpp index fa23ff713..d246bea33 100644 --- a/Machines/Apple/AppleII/Video.hpp +++ b/Machines/Apple/AppleII/Video.hpp @@ -6,8 +6,8 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef Video_hpp -#define Video_hpp +#ifndef Apple_II_Video_hpp +#define Apple_II_Video_hpp #include "../../../Outputs/CRT/CRT.hpp" #include "../../../ClockReceiver/ClockReceiver.hpp" @@ -462,4 +462,4 @@ template class Video: public VideoBase { } } -#endif /* Video_hpp */ +#endif /* Apple_II_Video_hpp */ diff --git a/Machines/Apple/AppleII/VideoSwitches.hpp b/Machines/Apple/AppleII/VideoSwitches.hpp index ff506fdbe..e5360a395 100644 --- a/Machines/Apple/AppleII/VideoSwitches.hpp +++ b/Machines/Apple/AppleII/VideoSwitches.hpp @@ -31,7 +31,7 @@ constexpr bool is_double_mode(GraphicsMode m) { return int(m) & 1; } template class VideoSwitches { public: /*! - Constructs a new instance of VideoSwitches in which changes to the switch + Constructs a new instance of VideoSwitches in which changes to relevant switches affect the video mode only after @c delay cycles. */ VideoSwitches(TimeUnit delay, std::function &&target) : delay_(delay), deferrer_(std::move(target)) {} diff --git a/Machines/Apple/AppleIIgs/AppleIIgs.cpp b/Machines/Apple/AppleIIgs/AppleIIgs.cpp index b30ba02f5..81bcda576 100644 --- a/Machines/Apple/AppleIIgs/AppleIIgs.cpp +++ b/Machines/Apple/AppleIIgs/AppleIIgs.cpp @@ -13,6 +13,7 @@ #include "../../../Analyser/Static/AppleIIgs/Target.hpp" #include "MemoryMap.hpp" +#include "Video.hpp" #include "../../../Components/8530/z8530.hpp" #include "../../../Components/AppleClock/AppleClock.hpp" @@ -169,6 +170,7 @@ class ConcreteMachine: #define SwitchRead(s) *value = memory_.s ? 0x80 : 0x00 #define LanguageRead(s) SwitchRead(language_card_switches().state().s) #define AuxiliaryRead(s) SwitchRead(auxiliary_switches().switches().s) +#define VideoRead(s) video_.s case 0xc011: LanguageRead(bank1); break; case 0xc012: LanguageRead(read); break; case 0xc013: AuxiliaryRead(read_auxiliary_memory); break; @@ -176,10 +178,37 @@ class ConcreteMachine: case 0xc015: AuxiliaryRead(internal_CX_rom); break; case 0xc016: AuxiliaryRead(alternative_zero_page); break; case 0xc017: AuxiliaryRead(slot_C3_rom); break; + case 0xc018: VideoRead(get_80_store()); break; +// case 0xc019: VideoRead(get_is_vertical_blank(cycles_since_video_update_)); break; + case 0xc01a: VideoRead(get_text()); break; + case 0xc01b: VideoRead(get_mixed()); break; + case 0xc01c: VideoRead(get_page2()); break; + case 0xc01d: VideoRead(get_high_resolution()); break; + case 0xc01e: VideoRead(get_alternative_character_set()); break; + case 0xc01f: VideoRead(get_80_columns()); break; + case 0xc046: VideoRead(get_annunciator_3()); break; +#undef VideoRead #undef AuxiliaryRead #undef LanguageRead #undef SwitchRead + // Video switches. + case 0xc050: case 0xc051: + video_.set_text(address & 1); + break; + case 0xc052: case 0xc053: + video_.set_mixed(address & 1); + break; + case 0xc054: case 0xc055: + video_.set_page2(address&1); + break; + case 0xc056: case 0xc057: + video_.set_high_resolution(address&1); + break; + case 0xc05e: case 0xc05f: + video_.set_annunciator_3(!(address&1)); + break; + // The SCC. case 0xc038: case 0xc039: case 0xc03a: case 0xc03b: if(isReadOperation(operation)) { @@ -193,7 +222,6 @@ class ConcreteMachine: // TODO: subject to read data? Does vapour lock apply? case 0xc000: case 0xc001: case 0xc002: case 0xc003: case 0xc004: case 0xc005: case 0xc006: case 0xc007: case 0xc008: case 0xc009: case 0xc00a: case 0xc00b: - case 0xc054: case 0xc055: case 0xc056: case 0xc057: break; // Interrupt ROM addresses; Cf. P25 of the Hardware Reference. @@ -261,7 +289,9 @@ class ConcreteMachine: private: CPU::WDC65816::Processor m65816_; MemoryMap memory_; + Apple::Clock::ParallelClock clock_; + Apple::IIgs::Video::Video video_; int fast_access_phase_ = 0; int slow_access_phase_ = 0; diff --git a/Machines/Apple/AppleIIgs/MemoryMap.hpp b/Machines/Apple/AppleIIgs/MemoryMap.hpp index 377b7155e..f5d697ca2 100644 --- a/Machines/Apple/AppleIIgs/MemoryMap.hpp +++ b/Machines/Apple/AppleIIgs/MemoryMap.hpp @@ -18,7 +18,6 @@ namespace Apple { namespace IIgs { - class MemoryMap { public: // MARK: - Initial construction and configuration. diff --git a/Machines/Apple/AppleIIgs/Video.cpp b/Machines/Apple/AppleIIgs/Video.cpp new file mode 100644 index 000000000..fc489f2e8 --- /dev/null +++ b/Machines/Apple/AppleIIgs/Video.cpp @@ -0,0 +1,18 @@ +// +// Video.cpp +// Clock Signal +// +// Created by Thomas Harte on 31/10/2020. +// Copyright © 2020 Thomas Harte. All rights reserved. +// + +#include "Video.hpp" + +using namespace Apple::IIgs::Video; + +VideoBase::VideoBase() : + VideoSwitches(Cycles(2), [] (Cycles) {}) { +} + +void VideoBase::did_set_annunciator_3(bool) {} +void VideoBase::did_set_alternative_character_set(bool) {} diff --git a/Machines/Apple/AppleIIgs/Video.hpp b/Machines/Apple/AppleIIgs/Video.hpp new file mode 100644 index 000000000..204cc2cf7 --- /dev/null +++ b/Machines/Apple/AppleIIgs/Video.hpp @@ -0,0 +1,36 @@ +// +// Video.hpp +// Clock Signal +// +// Created by Thomas Harte on 31/10/2020. +// Copyright © 2020 Thomas Harte. All rights reserved. +// + +#ifndef Apple_IIgs_Video_hpp +#define Apple_IIgs_Video_hpp + +#include "../AppleII/VideoSwitches.hpp" + +namespace Apple { +namespace IIgs { +namespace Video { + +class VideoBase: public Apple::II::VideoSwitches { + public: + VideoBase(); + + private: + void did_set_annunciator_3(bool) override; + void did_set_alternative_character_set(bool) override; +}; + +class Video: public VideoBase { + public: + using VideoBase::VideoBase; +}; + +} +} +} + +#endif /* Video_hpp */ diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index d29a0661b..798ce7e17 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -454,6 +454,8 @@ 4B89453E201967B4007DE474 /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B894517201967B4007DE474 /* StaticAnalyser.cpp */; }; 4B89453F201967B4007DE474 /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B894517201967B4007DE474 /* StaticAnalyser.cpp */; }; 4B8DF4D825465B7500F3433C /* IIgsMemoryMapTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B8DF4D725465B7500F3433C /* IIgsMemoryMapTests.mm */; }; + 4B8DF4F9254E36AE00F3433C /* Video.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8DF4F7254E36AD00F3433C /* Video.cpp */; }; + 4B8DF4FA254E36AE00F3433C /* Video.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8DF4F7254E36AD00F3433C /* Video.cpp */; }; 4B8FE21B1DA19D5F0090D3CE /* Atari2600Options.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4B8FE2131DA19D5F0090D3CE /* Atari2600Options.xib */; }; 4B8FE21C1DA19D5F0090D3CE /* MachineDocument.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4B8FE2151DA19D5F0090D3CE /* MachineDocument.xib */; }; 4B8FE21D1DA19D5F0090D3CE /* QuickLoadCompositeOptions.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4B8FE2171DA19D5F0090D3CE /* QuickLoadCompositeOptions.xib */; }; @@ -1316,6 +1318,8 @@ 4B8DF4D725465B7500F3433C /* IIgsMemoryMapTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = IIgsMemoryMapTests.mm; sourceTree = ""; }; 4B8DF4ED254B840B00F3433C /* AppleClock.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = AppleClock.hpp; sourceTree = ""; }; 4B8DF4F2254E141700F3433C /* VideoSwitches.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = VideoSwitches.hpp; sourceTree = ""; }; + 4B8DF4F7254E36AD00F3433C /* Video.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Video.cpp; sourceTree = ""; }; + 4B8DF4F8254E36AD00F3433C /* Video.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Video.hpp; sourceTree = ""; }; 4B8E4ECD1DCE483D003716C3 /* KeyboardMachine.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = KeyboardMachine.hpp; sourceTree = ""; }; 4B8EF6071FE5AF830076CCDD /* LowpassSpeaker.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = LowpassSpeaker.hpp; sourceTree = ""; }; 4B8FE2141DA19D5F0090D3CE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = "Clock Signal/Base.lproj/Atari2600Options.xib"; sourceTree = SOURCE_ROOT; }; @@ -3922,8 +3926,10 @@ isa = PBXGroup; children = ( 4BE21214253FCE9C00435408 /* AppleIIgs.cpp */, + 4B8DF4F7254E36AD00F3433C /* Video.cpp */, 4BE2120E253FCE9C00435408 /* AppleIIgs.hpp */, 4B8DF4D62546561300F3433C /* MemoryMap.hpp */, + 4B8DF4F8254E36AD00F3433C /* Video.hpp */, ); path = AppleIIgs; sourceTree = ""; @@ -4529,6 +4535,7 @@ 4B055AD51FAE9B0B0060FFFF /* Video.cpp in Sources */, 4B894521201967B4007DE474 /* StaticAnalyser.cpp in Sources */, 4B8318B522D3E548006DB630 /* Macintosh.cpp in Sources */, + 4B8DF4FA254E36AE00F3433C /* Video.cpp in Sources */, 4B7BA03123C2B19C00B98D9E /* Jasmin.cpp in Sources */, 4B7F188F2154825E00388727 /* MasterSystem.cpp in Sources */, 4B055AA51FAE85EF0060FFFF /* Encoder.cpp in Sources */, @@ -4796,6 +4803,7 @@ 4BC57CD92436A62900FBC404 /* State.cpp in Sources */, 4BDA00E622E699B000AC3CD0 /* CSMachine.mm in Sources */, 4B4518831F75E91A00926311 /* PCMTrack.cpp in Sources */, + 4B8DF4F9254E36AE00F3433C /* Video.cpp in Sources */, 4B0ACC3223775819008902D0 /* Atari2600.cpp in Sources */, 4B45189F1F75FD1C00926311 /* AcornADF.cpp in Sources */, 4B7BA03023C2B19C00B98D9E /* Jasmin.cpp in Sources */,