From da1436abd2ee666a08f412d6e8ec3e36ee9af91c Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Fri, 4 Oct 2019 21:34:15 -0400 Subject: [PATCH] Gifts the Atari ST a 68000 and non-functional video. --- Machines/AtariST/AtariST.cpp | 40 ++++++++++++++++++- Machines/AtariST/Video.cpp | 22 ++++++++++ Machines/AtariST/Video.hpp | 39 ++++++++++++++++++ .../Clock Signal.xcodeproj/project.pbxproj | 8 ++++ 4 files changed, 107 insertions(+), 2 deletions(-) create mode 100644 Machines/AtariST/Video.cpp create mode 100644 Machines/AtariST/Video.hpp diff --git a/Machines/AtariST/AtariST.cpp b/Machines/AtariST/AtariST.cpp index da56271ee..eff85308c 100644 --- a/Machines/AtariST/AtariST.cpp +++ b/Machines/AtariST/AtariST.cpp @@ -10,7 +10,13 @@ #include "../CRTMachine.hpp" -namespace { +#include "../../Processors/68000/68000.hpp" + +#include "Video.hpp" +#include "../../ClockReceiver/JustInTime.hpp" + +namespace Atari { +namespace ST { const int CLOCK_RATE = 8000000; @@ -18,13 +24,28 @@ using Target = Analyser::Static::Target; class ConcreteMachine: public Atari::ST::Machine, + public CPU::MC68000::BusHandler, public CRTMachine::Machine { public: - ConcreteMachine(const Target &target, const ROMMachine::ROMFetcher &rom_fetcher) { + ConcreteMachine(const Target &target, const ROMMachine::ROMFetcher &rom_fetcher) : + mc68000_(*this) { set_clock_rate(CLOCK_RATE); + + ram_.resize(512 * 1024); + + std::vector rom_descriptions = { + {"AtariST", "the TOS ROM", "tos100.img", 192*1024, 0x1a586c64} + }; + const auto roms = rom_fetcher(rom_descriptions); + if(!roms[0]) { + throw ROMMachine::Error::MissingROMs; + } + rom_ = *roms[0]; } + // MARK: CRTMachine::Machine void set_scan_target(Outputs::Display::ScanTarget *scan_target) final { + video_->set_scan_target(scan_target); } Outputs::Speaker::Speaker *get_speaker() final { @@ -32,9 +53,24 @@ class ConcreteMachine: } void run_for(const Cycles cycles) final { + mc68000_.run_for(cycles); } + + // MARK: MC68000::BusHandler + HalfCycles perform_bus_operation(const CPU::MC68000::Microcycle &cycle, int is_supervisor) { + return HalfCycles(0); + } + + private: + CPU::MC68000::Processor mc68000_; + JustInTimeActor video_; + + std::vector ram_; + std::vector rom_; + }; +} } using namespace Atari::ST; diff --git a/Machines/AtariST/Video.cpp b/Machines/AtariST/Video.cpp new file mode 100644 index 000000000..5387799fd --- /dev/null +++ b/Machines/AtariST/Video.cpp @@ -0,0 +1,22 @@ +// +// Video.cpp +// Clock Signal +// +// Created by Thomas Harte on 04/10/2019. +// Copyright © 2019 Thomas Harte. All rights reserved. +// + +#include "Video.hpp" + +using namespace Atari::ST; + +Video::Video() : + crt_(512, 1, Outputs::Display::Type::PAL50, Outputs::Display::InputDataType::Red4Green4Blue4) { +} + +void Video::set_scan_target(Outputs::Display::ScanTarget *scan_target) { + crt_.set_scan_target(scan_target); +} + +void Video::run_for(HalfCycles duration) { +} diff --git a/Machines/AtariST/Video.hpp b/Machines/AtariST/Video.hpp new file mode 100644 index 000000000..8a93e5c6b --- /dev/null +++ b/Machines/AtariST/Video.hpp @@ -0,0 +1,39 @@ +// +// Video.hpp +// Clock Signal +// +// Created by Thomas Harte on 04/10/2019. +// Copyright © 2019 Thomas Harte. All rights reserved. +// + +#ifndef Video_hpp +#define Video_hpp + +#include "../../Outputs/CRT/CRT.hpp" +#include "../../ClockReceiver/ClockReceiver.hpp" + +namespace Atari { +namespace ST { + +class Video { + public: + Video(); + + /*! + Sets the target device for video data. + */ + void set_scan_target(Outputs::Display::ScanTarget *scan_target); + + /*! + Produces the next @c duration period of pixels. + */ + void run_for(HalfCycles duration); + + private: + Outputs::CRT::CRT crt_; +}; + +} +} + +#endif /* Video_hpp */ diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index b083d6697..26fcce5e6 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -618,6 +618,8 @@ 4BB4BFB022A42F290069048D /* MacintoshIMG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BB4BFAE22A42F290069048D /* MacintoshIMG.cpp */; }; 4BB4BFB922A4372F0069048D /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BB4BFB822A4372E0069048D /* StaticAnalyser.cpp */; }; 4BB4BFBA22A4372F0069048D /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BB4BFB822A4372E0069048D /* StaticAnalyser.cpp */; }; + 4BB50DC8234828A20057B9CA /* Video.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BB50DC6234828A20057B9CA /* Video.cpp */; }; + 4BB50DC9234828A70057B9CA /* Video.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BB50DC6234828A20057B9CA /* Video.cpp */; }; 4BB697CB1D4B6D3E00248BDF /* TimedEventLoop.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BB697C91D4B6D3E00248BDF /* TimedEventLoop.cpp */; }; 4BB697CE1D4BA44400248BDF /* CommodoreGCR.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BB697CC1D4BA44400248BDF /* CommodoreGCR.cpp */; }; 4BB73EA21B587A5100552FC2 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BB73EA11B587A5100552FC2 /* AppDelegate.swift */; }; @@ -1416,6 +1418,8 @@ 4BB4BFAF22A42F290069048D /* MacintoshIMG.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = MacintoshIMG.hpp; sourceTree = ""; }; 4BB4BFB722A4372E0069048D /* StaticAnalyser.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = StaticAnalyser.hpp; sourceTree = ""; }; 4BB4BFB822A4372E0069048D /* StaticAnalyser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StaticAnalyser.cpp; sourceTree = ""; }; + 4BB50DC6234828A20057B9CA /* Video.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Video.cpp; sourceTree = ""; }; + 4BB50DC7234828A20057B9CA /* Video.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Video.hpp; sourceTree = ""; }; 4BB697C61D4B558F00248BDF /* Factors.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Factors.hpp; path = ../../NumberTheory/Factors.hpp; sourceTree = ""; }; 4BB697C91D4B6D3E00248BDF /* TimedEventLoop.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TimedEventLoop.cpp; sourceTree = ""; }; 4BB697CA1D4B6D3E00248BDF /* TimedEventLoop.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = TimedEventLoop.hpp; sourceTree = ""; }; @@ -3191,6 +3195,8 @@ children = ( 4BC131682346C61100E4FF3D /* AtariST.cpp */, 4BC131692346C61100E4FF3D /* AtariST.hpp */, + 4BB50DC6234828A20057B9CA /* Video.cpp */, + 4BB50DC7234828A20057B9CA /* Video.hpp */, ); path = AtariST; sourceTree = ""; @@ -4063,6 +4069,7 @@ 4B055AC31FAE9AE80060FFFF /* AmstradCPC.cpp in Sources */, 4B055A9E1FAE85DA0060FFFF /* G64.cpp in Sources */, 4B055AB81FAE860F0060FFFF /* ZX80O81P.cpp in Sources */, + 4BB50DC9234828A70057B9CA /* Video.cpp in Sources */, 4B055A8E1FAE85920060FFFF /* BestEffortUpdater.cpp in Sources */, 4B055AB01FAE86070060FFFF /* PulseQueuedTape.cpp in Sources */, 4B055AAC1FAE85FD0060FFFF /* PCMSegment.cpp in Sources */, @@ -4269,6 +4276,7 @@ 4B302184208A550100773308 /* DiskII.cpp in Sources */, 4BEA52631DF339D7007E74F2 /* SoundGenerator.cpp in Sources */, 4BD67DD0209BF27B00AB2146 /* Encoder.cpp in Sources */, + 4BB50DC8234828A20057B9CA /* Video.cpp in Sources */, 4BAE495920328897004BE78E /* ZX8081OptionsPanel.swift in Sources */, 4B89451A201967B4007DE474 /* ConfidenceSummary.cpp in Sources */, 4B54C0C51F8D91D90050900F /* Keyboard.cpp in Sources */,