1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-29 12:50:28 +00:00

Institutes colour/monochrome screen selection as an Apple II option.

Allowing me to test that straight-through composite still works.
This commit is contained in:
Thomas Harte 2019-02-12 19:52:32 -05:00
parent ec8f1157c8
commit 3e0b5433b9
10 changed files with 84 additions and 29 deletions

View File

@ -28,12 +28,19 @@
#include "../../Analyser/Static/AppleII/Target.hpp" #include "../../Analyser/Static/AppleII/Target.hpp"
#include "../../ClockReceiver/ForceInline.hpp" #include "../../ClockReceiver/ForceInline.hpp"
#include "../../Configurable/StandardOptions.hpp"
#include <algorithm> #include <algorithm>
#include <array> #include <array>
#include <memory> #include <memory>
namespace { namespace AppleII {
std::vector<std::unique_ptr<Configurable::Option>> get_options() {
return Configurable::standard_options(
static_cast<Configurable::StandardOptions>(Configurable::DisplayCompositeMonochrome | Configurable::DisplayCompositeColour)
);
}
#define is_iie() ((model == Analyser::Static::AppleII::Target::Model::IIe) || (model == Analyser::Static::AppleII::Target::Model::EnhancedIIe)) #define is_iie() ((model == Analyser::Static::AppleII::Target::Model::IIe) || (model == Analyser::Static::AppleII::Target::Model::EnhancedIIe))
@ -43,6 +50,7 @@ template <Analyser::Static::AppleII::Target::Model model> class ConcreteMachine:
public KeyboardMachine::MappedMachine, public KeyboardMachine::MappedMachine,
public CPU::MOS6502::BusHandler, public CPU::MOS6502::BusHandler,
public Inputs::Keyboard, public Inputs::Keyboard,
public Configurable::Device,
public AppleII::Machine, public AppleII::Machine,
public Activity::Source, public Activity::Source,
public JoystickMachine::Machine, public JoystickMachine::Machine,
@ -84,7 +92,6 @@ template <Analyser::Static::AppleII::Target::Model model> class ConcreteMachine:
uint8_t ram_[65536], aux_ram_[65536]; uint8_t ram_[65536], aux_ram_[65536];
std::vector<uint8_t> rom_; std::vector<uint8_t> rom_;
// std::vector<uint8_t> character_rom_;
uint8_t keyboard_input_ = 0x00; uint8_t keyboard_input_ = 0x00;
bool key_is_down_ = false; bool key_is_down_ = false;
@ -401,6 +408,11 @@ template <Analyser::Static::AppleII::Target::Model model> class ConcreteMachine:
video_.set_scan_target(scan_target); video_.set_scan_target(scan_target);
} }
/// Sets the type of display.
void set_display_type(Outputs::Display::DisplayType display_type) override {
video_.set_display_type(display_type);
}
Outputs::Speaker::Speaker *get_speaker() override { Outputs::Speaker::Speaker *get_speaker() override {
return &speaker_; return &speaker_;
} }
@ -804,6 +816,28 @@ template <Analyser::Static::AppleII::Target::Model model> class ConcreteMachine:
string_serialiser_.reset(new Utility::StringSerialiser(string, true)); string_serialiser_.reset(new Utility::StringSerialiser(string, true));
} }
// MARK:: Configuration options.
std::vector<std::unique_ptr<Configurable::Option>> get_options() override {
return AppleII::get_options();
}
void set_selections(const Configurable::SelectionSet &selections_by_option) override {
Configurable::Display display;
if(Configurable::get_display(selections_by_option, display)) {
set_video_signal_configurable(display);
}
}
Configurable::SelectionSet get_accurate_selections() override {
Configurable::SelectionSet selection_set;
Configurable::append_display_selection(selection_set, Configurable::Display::CompositeColour);
return selection_set;
}
Configurable::SelectionSet get_user_friendly_selections() override {
return get_accurate_selections();
}
// MARK: MediaTarget // MARK: MediaTarget
bool insert_media(const Analyser::Static::Media &media) override { bool insert_media(const Analyser::Static::Media &media) override {
if(!media.disks.empty()) { if(!media.disks.empty()) {

View File

@ -18,6 +18,9 @@
namespace AppleII { namespace AppleII {
/// @returns The options available for an Apple II.
std::vector<std::unique_ptr<Configurable::Option>> get_options();
class Machine { class Machine {
public: public:
virtual ~Machine(); virtual ~Machine();

View File

@ -42,6 +42,10 @@ void VideoBase::set_scan_target(Outputs::Display::ScanTarget *scan_target) {
crt_.set_scan_target(scan_target); crt_.set_scan_target(scan_target);
} }
void VideoBase::set_display_type(Outputs::Display::DisplayType display_type) {
crt_.set_display_type(display_type);
}
/* /*
Rote setters and getters. Rote setters and getters.
*/ */

View File

@ -39,6 +39,9 @@ class VideoBase {
/// Sets the scan target. /// Sets the scan target.
void set_scan_target(Outputs::Display::ScanTarget *scan_target); void set_scan_target(Outputs::Display::ScanTarget *scan_target);
/// Sets the type of output.
void set_display_type(Outputs::Display::DisplayType);
/* /*
Descriptions for the setters below are taken verbatim from Descriptions for the setters below are taken verbatim from
the Apple IIe Technical Reference. Addresses are the conventional the Apple IIe Technical Reference. Addresses are the conventional

View File

@ -132,6 +132,7 @@ std::map<std::string, std::vector<std::unique_ptr<Configurable::Option>>> Machin
std::map<std::string, std::vector<std::unique_ptr<Configurable::Option>>> options; std::map<std::string, std::vector<std::unique_ptr<Configurable::Option>>> options;
options.emplace(std::make_pair(LongNameForTargetMachine(Analyser::Machine::AmstradCPC), AmstradCPC::get_options())); options.emplace(std::make_pair(LongNameForTargetMachine(Analyser::Machine::AmstradCPC), AmstradCPC::get_options()));
options.emplace(std::make_pair(LongNameForTargetMachine(Analyser::Machine::AppleII), AppleII::get_options()));
options.emplace(std::make_pair(LongNameForTargetMachine(Analyser::Machine::Electron), Electron::get_options())); options.emplace(std::make_pair(LongNameForTargetMachine(Analyser::Machine::Electron), Electron::get_options()));
options.emplace(std::make_pair(LongNameForTargetMachine(Analyser::Machine::MSX), MSX::get_options())); options.emplace(std::make_pair(LongNameForTargetMachine(Analyser::Machine::MSX), MSX::get_options()));
options.emplace(std::make_pair(LongNameForTargetMachine(Analyser::Machine::Oric), Oric::get_options())); options.emplace(std::make_pair(LongNameForTargetMachine(Analyser::Machine::Oric), Oric::get_options()));

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14113" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct"> <document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies> <dependencies>
<deployment identifier="macosx"/> <deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14113"/> <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14460.31"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies> </dependencies>
<objects> <objects>
@ -13,37 +13,43 @@
</customObject> </customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/> <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/> <customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Options" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" hidesOnDeactivate="YES" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" id="ZW7-Bw-4RP" customClass="MachinePanel" customModule="Clock_Signal" customModuleProvider="target"> <window title="Options" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" hidesOnDeactivate="YES" releasedWhenClosed="NO" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" id="ZW7-Bw-4RP" customClass="MachinePanel" customModule="Clock_Signal" customModuleProvider="target">
<windowStyleMask key="styleMask" titled="YES" closable="YES" utility="YES" nonactivatingPanel="YES" HUD="YES"/> <windowStyleMask key="styleMask" titled="YES" closable="YES" utility="YES" nonactivatingPanel="YES" HUD="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/> <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="80" y="150" width="200" height="54"/> <rect key="contentRect" x="80" y="150" width="200" height="61"/>
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="900"/> <rect key="screenRect" x="0.0" y="0.0" width="1440" height="900"/>
<view key="contentView" id="tpZ-0B-QQu"> <view key="contentView" id="tpZ-0B-QQu">
<rect key="frame" x="0.0" y="0.0" width="200" height="54"/> <rect key="frame" x="0.0" y="0.0" width="200" height="61"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<subviews> <subviews>
<button translatesAutoresizingMaskIntoConstraints="NO" id="e1J-pw-zGw"> <popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ex3-VM-58z">
<rect key="frame" x="18" y="18" width="164" height="18"/> <rect key="frame" x="18" y="17" width="165" height="25"/>
<buttonCell key="cell" type="check" title="Accelerate DOS 3.3" bezelStyle="regularSquare" imagePosition="left" alignment="left" state="on" inset="2" id="tD6-UB-ESB"> <popUpButtonCell key="cell" type="push" title="Colour" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" tag="1" imageScaling="proportionallyDown" inset="2" selectedItem="gOu-dv-tre" id="u3N-Je-c2L">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/> <font key="font" metaFont="menu"/>
</buttonCell> <menu key="menu" id="BUS-Pl-jBm">
<items>
<menuItem title="Colour" state="on" tag="1" id="gOu-dv-tre"/>
<menuItem title="Monochrome" tag="3" id="qhQ-ab-jRo"/>
</items>
</menu>
</popUpButtonCell>
<connections> <connections>
<action selector="setFastLoading:" target="ZW7-Bw-4RP" id="JmG-Ks-jSh"/> <action selector="setDisplayType:" target="ZW7-Bw-4RP" id="f7A-2O-wR8"/>
</connections> </connections>
</button> </popUpButton>
</subviews> </subviews>
<constraints> <constraints>
<constraint firstAttribute="bottom" secondItem="e1J-pw-zGw" secondAttribute="bottom" constant="20" id="5ce-DO-a4T"/> <constraint firstAttribute="bottom" secondItem="ex3-VM-58z" secondAttribute="bottom" constant="20" id="4ZS-q5-TJL"/>
<constraint firstItem="e1J-pw-zGw" firstAttribute="leading" secondItem="tpZ-0B-QQu" secondAttribute="leading" constant="20" id="HSD-3d-Bl7"/> <constraint firstItem="ex3-VM-58z" firstAttribute="leading" secondItem="tpZ-0B-QQu" secondAttribute="leading" constant="20" id="8Pj-Ns-TrJ"/>
<constraint firstAttribute="trailing" secondItem="e1J-pw-zGw" secondAttribute="trailing" constant="20" id="Q9M-FH-92N"/> <constraint firstAttribute="trailing" secondItem="ex3-VM-58z" secondAttribute="trailing" constant="20" id="QWA-lY-ugz"/>
<constraint firstItem="e1J-pw-zGw" firstAttribute="top" secondItem="tpZ-0B-QQu" secondAttribute="top" constant="20" id="ul9-lf-Y3u"/> <constraint firstItem="ex3-VM-58z" firstAttribute="top" secondItem="tpZ-0B-QQu" secondAttribute="top" constant="20" id="szw-WO-3tS"/>
</constraints> </constraints>
</view> </view>
<connections> <connections>
<outlet property="fastLoadingButton" destination="e1J-pw-zGw" id="jj7-OZ-mOH"/> <outlet property="displayTypeButton" destination="ex3-VM-58z" id="lmZ-aN-lcj"/>
</connections> </connections>
<point key="canvasLocation" x="175" y="30"/> <point key="canvasLocation" x="-161" y="38.5"/>
</window> </window>
</objects> </objects>
</document> </document>

View File

@ -32,6 +32,7 @@ class MachinePanel: NSPanel {
switch tag { switch tag {
case 1: return .composite case 1: return .composite
case 2: return .sVideo case 2: return .sVideo
case 3: return .monochromeComposite
default: break default: break
} }
return .RGB return .RGB

View File

@ -24,7 +24,8 @@
typedef NS_ENUM(NSInteger, CSMachineVideoSignal) { typedef NS_ENUM(NSInteger, CSMachineVideoSignal) {
CSMachineVideoSignalComposite, CSMachineVideoSignalComposite,
CSMachineVideoSignalSVideo, CSMachineVideoSignalSVideo,
CSMachineVideoSignalRGB CSMachineVideoSignalRGB,
CSMachineVideoSignalMonochromeComposite
}; };
typedef NS_ENUM(NSInteger, CSMachineKeyboardInputMode) { typedef NS_ENUM(NSInteger, CSMachineKeyboardInputMode) {

View File

@ -461,9 +461,10 @@ struct ActivityObserver: public Activity::Observer {
Configurable::SelectionSet selection_set; Configurable::SelectionSet selection_set;
Configurable::Display display; Configurable::Display display;
switch(videoSignal) { switch(videoSignal) {
case CSMachineVideoSignalRGB: display = Configurable::Display::RGB; break; case CSMachineVideoSignalRGB: display = Configurable::Display::RGB; break;
case CSMachineVideoSignalSVideo: display = Configurable::Display::SVideo; break; case CSMachineVideoSignalSVideo: display = Configurable::Display::SVideo; break;
case CSMachineVideoSignalComposite: display = Configurable::Display::CompositeColour; break; case CSMachineVideoSignalComposite: display = Configurable::Display::CompositeColour; break;
case CSMachineVideoSignalMonochromeComposite: display = Configurable::Display::CompositeMonochrome; break;
} }
append_display_selection(selection_set, display); append_display_selection(selection_set, display);
configurable_device->set_selections(selection_set); configurable_device->set_selections(selection_set);
@ -483,9 +484,10 @@ struct ActivityObserver: public Activity::Observer {
// Get the standard option for this video signal. // Get the standard option for this video signal.
Configurable::StandardOptions option; Configurable::StandardOptions option;
switch(videoSignal) { switch(videoSignal) {
case CSMachineVideoSignalRGB: option = Configurable::DisplayRGB; break; case CSMachineVideoSignalRGB: option = Configurable::DisplayRGB; break;
case CSMachineVideoSignalSVideo: option = Configurable::DisplaySVideo; break; case CSMachineVideoSignalSVideo: option = Configurable::DisplaySVideo; break;
case CSMachineVideoSignalComposite: option = Configurable::DisplayCompositeColour; break; case CSMachineVideoSignalComposite: option = Configurable::DisplayCompositeColour; break;
case CSMachineVideoSignalMonochromeComposite: option = Configurable::DisplayCompositeMonochrome; break;
} }
std::unique_ptr<Configurable::Option> display_option = std::move(standard_options(option).front()); std::unique_ptr<Configurable::Option> display_option = std::move(standard_options(option).front());
Configurable::ListOption *display_list_option = dynamic_cast<Configurable::ListOption *>(display_option.get()); Configurable::ListOption *display_list_option = dynamic_cast<Configurable::ListOption *>(display_option.get());

View File

@ -189,7 +189,7 @@ static Analyser::Static::ZX8081::Target::MemoryModel ZX8081MemoryModelFromSize(K
- (NSString *)optionsPanelNibName { - (NSString *)optionsPanelNibName {
switch(_targets.front()->machine) { switch(_targets.front()->machine) {
case Analyser::Machine::AmstradCPC: return @"CompositeOptions"; case Analyser::Machine::AmstradCPC: return @"CompositeOptions";
// case Analyser::Machine::AppleII: return @"AppleIIOptions"; case Analyser::Machine::AppleII: return @"AppleIIOptions";
case Analyser::Machine::Atari2600: return @"Atari2600Options"; case Analyser::Machine::Atari2600: return @"Atari2600Options";
case Analyser::Machine::Electron: return @"QuickLoadCompositeOptions"; case Analyser::Machine::Electron: return @"QuickLoadCompositeOptions";
case Analyser::Machine::MasterSystem: return @"CompositeOptions"; case Analyser::Machine::MasterSystem: return @"CompositeOptions";