diff --git a/Components/6850/6850.cpp b/Components/6850/6850.cpp new file mode 100644 index 000000000..dfdfd9a4c --- /dev/null +++ b/Components/6850/6850.cpp @@ -0,0 +1,21 @@ +// +// 6850.cpp +// Clock Signal +// +// Created by Thomas Harte on 10/10/2019. +// Copyright © 2019 Thomas Harte. All rights reserved. +// + +#include "6850.hpp" + +using namespace Motorola::ACIA; + +uint8_t ACIA::read(int address) { + return 0xff; +} + +void ACIA::write(int address, uint8_t value) { +} + +void ACIA::run_for(HalfCycles) { +} diff --git a/Components/6850/6850.hpp b/Components/6850/6850.hpp new file mode 100644 index 000000000..a833a906c --- /dev/null +++ b/Components/6850/6850.hpp @@ -0,0 +1,29 @@ +// +// 6850.hpp +// Clock Signal +// +// Created by Thomas Harte on 10/10/2019. +// Copyright © 2019 Thomas Harte. All rights reserved. +// + +#ifndef Motorola_ACIA_6850_hpp +#define Motorola_ACIA_6850_hpp + +#include +#include "../../ClockReceiver/ClockReceiver.hpp" + +namespace Motorola { +namespace ACIA { + +class ACIA { + public: + uint8_t read(int address); + void write(int address, uint8_t value); + + void run_for(HalfCycles); +}; + +} +} + +#endif /* Motorola_ACIA_6850_hpp */ diff --git a/Machines/AtariST/AtariST.cpp b/Machines/AtariST/AtariST.cpp index d2bec7bbc..9b839d7ea 100644 --- a/Machines/AtariST/AtariST.cpp +++ b/Machines/AtariST/AtariST.cpp @@ -14,6 +14,7 @@ #include "../../Components/AY38910/AY38910.hpp" #include "../../Components/68901/MFP68901.hpp" +#include "../../Components/6850/6850.hpp" #include "Video.hpp" #include "../../ClockReceiver/JustInTime.hpp" @@ -267,6 +268,31 @@ class ConcreteMachine: } } break; + + // ACIAs. + case 0x7ffe00: case 0x7ffe01: case 0x7ffe02: case 0x7ffe03: { + // Set VPA. + mc68000_.set_is_peripheral_address(!cycle.data_select_active()); + if(!cycle.data_select_active()) return HalfCycles(0); + + const auto acia_ = (address < 0x7ffe02) ? &keyboard_acia_ : &midi_acia_; + + if(cycle.operation & Microcycle::Read) { + const uint8_t value = (*acia_)->read(int(address)); + if(cycle.operation & Microcycle::SelectByte) { + cycle.value->halves.low = value; + } else { + cycle.value->halves.high = value; + cycle.value->halves.low = 0xff; + } + } else { + if(cycle.operation & Microcycle::SelectByte) { + (*acia_)->write(int(address), cycle.value->halves.low); + } else { + (*acia_)->write(int(address), cycle.value->halves.high); + } + } + } break; } return HalfCycles(0); } @@ -325,9 +351,12 @@ class ConcreteMachine: CPU::MC68000::Processor mc68000_; JustInTimeActor video_; - JustInTimeActor mfp_; HalfCycles cycles_until_video_event_; + JustInTimeActor mfp_; + JustInTimeActor keyboard_acia_; + JustInTimeActor midi_acia_; + Concurrency::DeferringAsyncTaskQueue audio_queue_; GI::AY38910::AY38910 ay_; Outputs::Speaker::LowpassSpeaker speaker_; diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index e8ab56003..5aca36465 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -616,6 +616,8 @@ 4BB299F81B587D8400A49093 /* txsn in Resources */ = {isa = PBXBuildFile; fileRef = 4BB298EC1B587D8400A49093 /* txsn */; }; 4BB299F91B587D8400A49093 /* tyan in Resources */ = {isa = PBXBuildFile; fileRef = 4BB298ED1B587D8400A49093 /* tyan */; }; 4BB2A9AF1E13367E001A5C23 /* CRCTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4BB2A9AE1E13367E001A5C23 /* CRCTests.mm */; }; + 4BB307BB235001C300457D33 /* 6850.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BB307BA235001C300457D33 /* 6850.cpp */; }; + 4BB307BC235001C300457D33 /* 6850.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BB307BA235001C300457D33 /* 6850.cpp */; }; 4BB4BFAD22A33DE50069048D /* DriveSpeedAccumulator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BB4BFAC22A33DE50069048D /* DriveSpeedAccumulator.cpp */; }; 4BB4BFB022A42F290069048D /* MacintoshIMG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BB4BFAE22A42F290069048D /* MacintoshIMG.cpp */; }; 4BB4BFB922A4372F0069048D /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BB4BFB822A4372E0069048D /* StaticAnalyser.cpp */; }; @@ -1415,6 +1417,8 @@ 4BB298EC1B587D8400A49093 /* txsn */ = {isa = PBXFileReference; lastKnownFileType = file; path = txsn; sourceTree = ""; }; 4BB298ED1B587D8400A49093 /* tyan */ = {isa = PBXFileReference; lastKnownFileType = file; path = tyan; sourceTree = ""; }; 4BB2A9AE1E13367E001A5C23 /* CRCTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CRCTests.mm; sourceTree = ""; }; + 4BB307B9235001C300457D33 /* 6850.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = 6850.hpp; sourceTree = ""; }; + 4BB307BA235001C300457D33 /* 6850.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = 6850.cpp; sourceTree = ""; }; 4BB4BFAA22A300710069048D /* DeferredAudio.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = DeferredAudio.hpp; sourceTree = ""; }; 4BB4BFAB22A33D710069048D /* DriveSpeedAccumulator.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = DriveSpeedAccumulator.hpp; sourceTree = ""; }; 4BB4BFAC22A33DE50069048D /* DriveSpeedAccumulator.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DriveSpeedAccumulator.cpp; sourceTree = ""; }; @@ -2956,6 +2960,15 @@ path = "Wolfgang Lorenz 6502 test suite"; sourceTree = ""; }; + 4BB307B8235001C300457D33 /* 6850 */ = { + isa = PBXGroup; + children = ( + 4BB307B9235001C300457D33 /* 6850.hpp */, + 4BB307BA235001C300457D33 /* 6850.cpp */, + ); + path = 6850; + sourceTree = ""; + }; 4BB4BFB622A4372E0069048D /* Macintosh */ = { isa = PBXGroup; children = ( @@ -3243,6 +3256,7 @@ 4B1E85791D174DEC001EF87D /* 6532 */, 4BC9DF4C1D04691600F44158 /* 6560 */, 4BE845221F2FF7F400A5EA22 /* 6845 */, + 4BB307B8235001C300457D33 /* 6850 */, 4BD9137C1F3115AC009BCF85 /* 8255 */, 4BBC951F1F368D87008F4C34 /* 8272 */, 4BB244D222AABAF500BE20E5 /* 8530 */, @@ -4088,6 +4102,7 @@ 4B055A8E1FAE85920060FFFF /* BestEffortUpdater.cpp in Sources */, 4B055AB01FAE86070060FFFF /* PulseQueuedTape.cpp in Sources */, 4B055AAC1FAE85FD0060FFFF /* PCMSegment.cpp in Sources */, + 4BB307BC235001C300457D33 /* 6850.cpp in Sources */, 4B055AB31FAE860F0060FFFF /* CSW.cpp in Sources */, 4B89451D201967B4007DE474 /* Disk.cpp in Sources */, 4BDACBED22FFA5D20045EF7E /* ncr5380.cpp in Sources */, @@ -4376,6 +4391,7 @@ 4B54C0C81F8D91E50050900F /* Keyboard.cpp in Sources */, 4B79A5011FC913C900EEDAD5 /* MSX.cpp in Sources */, 4BEE0A701D72496600532C7B /* PRG.cpp in Sources */, + 4BB307BB235001C300457D33 /* 6850.cpp in Sources */, 4BF437EE209D0F7E008CBD6B /* SegmentParser.cpp in Sources */, 4BC131762346DE9100E4FF3D /* StaticAnalyser.cpp in Sources */, 4B8334861F5DA3780097E338 /* 6502Storage.cpp in Sources */,