diff --git a/Machines/Apple/AppleIIgs/AppleIIgs.cpp b/Machines/Apple/AppleIIgs/AppleIIgs.cpp index 0ee52a36c..7cfe395df 100644 --- a/Machines/Apple/AppleIIgs/AppleIIgs.cpp +++ b/Machines/Apple/AppleIIgs/AppleIIgs.cpp @@ -15,6 +15,7 @@ #include "ADB.hpp" #include "MemoryMap.hpp" #include "Video.hpp" +#include "Sound.hpp" #include "../../../Components/8530/z8530.hpp" #include "../../../Components/AppleClock/AppleClock.hpp" @@ -275,6 +276,37 @@ class ConcreteMachine: } break; + // The audio GLU. + case 0xc03c: + if(is_read) { + *value = sound_glu_.get_control(); + } else { + sound_glu_.set_control(*value); + } + break; + case 0xc03d: + if(is_read) { + *value = sound_glu_.get_data(); + } else { + sound_glu_.set_data(*value); + } + break; + case 0xc03e: + if(is_read) { + *value = sound_glu_.get_address_low(); + } else { + sound_glu_.set_address_low(*value); + } + break; + case 0xc03f: + if(is_read) { + *value = sound_glu_.get_address_high(); + } else { + sound_glu_.set_address_high(*value); + } + break; + + // These were all dealt with by the call to memory_.access. // TODO: subject to read data? Does vapour lock apply? case 0xc002: case 0xc003: case 0xc004: case 0xc005: @@ -458,6 +490,7 @@ class ConcreteMachine: Apple::Clock::ParallelClock clock_; Apple::IIgs::Video::Video video_; Apple::IIgs::ADB::GLU adb_glu_; + Apple::IIgs::Sound::GLU sound_glu_; Zilog::SCC::z8530 scc_; // MARK: - Cards. diff --git a/Machines/Apple/AppleIIgs/Sound.cpp b/Machines/Apple/AppleIIgs/Sound.cpp new file mode 100644 index 000000000..3c0b2ef0b --- /dev/null +++ b/Machines/Apple/AppleIIgs/Sound.cpp @@ -0,0 +1,45 @@ +// +// Sound.cpp +// Clock Signal +// +// Created by Thomas Harte on 04/11/2020. +// Copyright © 2020 Thomas Harte. All rights reserved. +// + +#include "Sound.hpp" + +#include + +using namespace Apple::IIgs::Sound; + +void GLU::set_control(uint8_t control) { + printf("UNIMPLEMENTED: set control %02x\n", control); +} + +uint8_t GLU::get_control() { + return 0; +} + +void GLU::set_data(uint8_t data) { + printf("UNIMPLEMENTED: set data %02x\n", data); +} + +uint8_t GLU::get_data() { + return 0; +} + +void GLU::set_address_low(uint8_t low) { + address_ = uint16_t((address_ & 0xff00) | low); +} + +uint8_t GLU::get_address_low() { + return address_ & 0xff; +} + +void GLU::set_address_high(uint8_t high) { + address_ = uint16_t((high << 8) | (address_ & 0x00ff)); +} + +uint8_t GLU::get_address_high() { + return address_ >> 8; +} diff --git a/Machines/Apple/AppleIIgs/Sound.hpp b/Machines/Apple/AppleIIgs/Sound.hpp new file mode 100644 index 000000000..975807c2a --- /dev/null +++ b/Machines/Apple/AppleIIgs/Sound.hpp @@ -0,0 +1,38 @@ +// +// Sound.hpp +// Clock Signal +// +// Created by Thomas Harte on 04/11/2020. +// Copyright © 2020 Thomas Harte. All rights reserved. +// + +#ifndef Apple_IIgs_Sound_hpp +#define Apple_IIgs_Sound_hpp + +#include "../../../ClockReceiver/ClockReceiver.hpp" + +namespace Apple { +namespace IIgs { +namespace Sound { + +class GLU { + + public: + void set_control(uint8_t); + uint8_t get_control(); + void set_data(uint8_t); + uint8_t get_data(); + void set_address_low(uint8_t); + uint8_t get_address_low(); + void set_address_high(uint8_t); + uint8_t get_address_high(); + + private: + uint16_t address_ = 0; +}; + +} +} +} + +#endif /* SoundGLU_hpp */ diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index 4d881003b..f95b32c66 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -153,6 +153,8 @@ 4B1B88C9202E469400B67DFF /* MultiJoystickMachine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B1B88C6202E469300B67DFF /* MultiJoystickMachine.cpp */; }; 4B1D08061E0F7A1100763741 /* TimeTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B1D08051E0F7A1100763741 /* TimeTests.mm */; }; 4B1E85811D176468001EF87D /* 6532Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B1E85801D176468001EF87D /* 6532Tests.swift */; }; + 4B1EC716255398B000A1F44B /* Sound.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B1EC714255398B000A1F44B /* Sound.cpp */; }; + 4B1EC717255398B000A1F44B /* Sound.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B1EC714255398B000A1F44B /* Sound.cpp */; }; 4B1EDB451E39A0AC009D6819 /* chip.png in Resources */ = {isa = PBXBuildFile; fileRef = 4B1EDB431E39A0AC009D6819 /* chip.png */; }; 4B228CD524D773B40077EF25 /* CSScanTarget.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B228CD424D773B30077EF25 /* CSScanTarget.mm */; }; 4B228CD924DA12C60077EF25 /* CSScanTargetView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B228CD824DA12C60077EF25 /* CSScanTargetView.m */; }; @@ -1066,6 +1068,8 @@ 4B1D08051E0F7A1100763741 /* TimeTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TimeTests.mm; sourceTree = ""; }; 4B1E857B1D174DEC001EF87D /* 6532.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = 6532.hpp; sourceTree = ""; }; 4B1E85801D176468001EF87D /* 6532Tests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = 6532Tests.swift; sourceTree = ""; }; + 4B1EC714255398B000A1F44B /* Sound.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Sound.cpp; sourceTree = ""; }; + 4B1EC715255398B000A1F44B /* Sound.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Sound.hpp; sourceTree = ""; }; 4B1EDB431E39A0AC009D6819 /* chip.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = chip.png; sourceTree = ""; }; 4B228CD424D773B30077EF25 /* CSScanTarget.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CSScanTarget.mm; sourceTree = ""; }; 4B228CD624D773CA0077EF25 /* CSScanTarget.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CSScanTarget.h; sourceTree = ""; }; @@ -4275,10 +4279,12 @@ children = ( 4B8DF503254E3C9D00F3433C /* ADB.cpp */, 4BE21214253FCE9C00435408 /* AppleIIgs.cpp */, + 4B1EC714255398B000A1F44B /* Sound.cpp */, 4B8DF4F7254E36AD00F3433C /* Video.cpp */, 4B8DF504254E3C9D00F3433C /* ADB.hpp */, 4BE2120E253FCE9C00435408 /* AppleIIgs.hpp */, 4B8DF4D62546561300F3433C /* MemoryMap.hpp */, + 4B1EC715255398B000A1F44B /* Sound.hpp */, 4B8DF4F8254E36AD00F3433C /* Video.hpp */, ); path = AppleIIgs; @@ -5042,6 +5048,7 @@ 4BEBFB522002DB30000708CC /* DiskROM.cpp in Sources */, 4BC23A2D2467600F001A6030 /* OPLL.cpp in Sources */, 4B055AA11FAE85DA0060FFFF /* OricMFMDSK.cpp in Sources */, + 4B1EC717255398B000A1F44B /* Sound.cpp in Sources */, 4BB8616F24E22DC500A00E03 /* BufferingScanTarget.cpp in Sources */, 4B0ACC2923775819008902D0 /* DMAController.cpp in Sources */, 4B055A951FAE85BB0060FFFF /* BitReverse.cpp in Sources */, @@ -5228,6 +5235,7 @@ 4BA61EB01D91515900B3C876 /* NSData+StdVector.mm in Sources */, 4BDA00E022E644AF00AC3CD0 /* CSROMReceiverView.m in Sources */, 4B228CDB24DA41890077EF25 /* ScanTarget.metal in Sources */, + 4B1EC716255398B000A1F44B /* Sound.cpp in Sources */, 4B228CD524D773B40077EF25 /* CSScanTarget.mm in Sources */, 4BCD634922D6756400F567F1 /* MacintoshDoubleDensityDrive.cpp in Sources */, 4B0F94FE208C1A1600FE41D9 /* NIB.cpp in Sources */,