diff --git a/Machines/Apple/AppleIIgs/ADB.cpp b/Machines/Apple/AppleIIgs/ADB.cpp new file mode 100644 index 000000000..4ec09e6ea --- /dev/null +++ b/Machines/Apple/AppleIIgs/ADB.cpp @@ -0,0 +1,41 @@ +// +// ADB.cpp +// Clock Signal +// +// Created by Thomas Harte on 31/10/2020. +// Copyright © 2020 Thomas Harte. All rights reserved. +// + +#include "ADB.hpp" + +#include + +using namespace Apple::IIgs::ADB; + +uint8_t GLU::get_keyboard_data() { + return 0; +} + +uint8_t GLU::get_mouse_data() { + return 0x80; +} + +uint8_t GLU::get_modifier_status() { + return 0x00; +} + +uint8_t GLU::get_data() { + return 0x00; +} + +uint8_t GLU::get_status() { + return 0x00; +} + +void GLU::set_command(uint8_t) { + printf("TODO: set ADB command\n"); +} + +void GLU::set_status(uint8_t) { + printf("TODO: set ADB status\n"); +} diff --git a/Machines/Apple/AppleIIgs/ADB.hpp b/Machines/Apple/AppleIIgs/ADB.hpp new file mode 100644 index 000000000..aa5a38184 --- /dev/null +++ b/Machines/Apple/AppleIIgs/ADB.hpp @@ -0,0 +1,35 @@ +// +// ADB.hpp +// Clock Signal +// +// Created by Thomas Harte on 31/10/2020. +// Copyright © 2020 Thomas Harte. All rights reserved. +// + +#ifndef Apple_IIgs_ADB_hpp +#define Apple_IIgs_ADB_hpp + +#include + +namespace Apple { +namespace IIgs { +namespace ADB { + +class GLU { + public: + uint8_t get_keyboard_data(); + uint8_t get_mouse_data(); + uint8_t get_modifier_status(); + + uint8_t get_data(); + uint8_t get_status(); + + void set_command(uint8_t); + void set_status(uint8_t); +}; + +} +} +} + +#endif /* Apple_IIgs_ADB_hpp */ diff --git a/Machines/Apple/AppleIIgs/AppleIIgs.cpp b/Machines/Apple/AppleIIgs/AppleIIgs.cpp index 81bcda576..599f21859 100644 --- a/Machines/Apple/AppleIIgs/AppleIIgs.cpp +++ b/Machines/Apple/AppleIIgs/AppleIIgs.cpp @@ -12,6 +12,7 @@ #include "../../../Processors/65816/65816.hpp" #include "../../../Analyser/Static/AppleIIgs/Target.hpp" +#include "ADB.hpp" #include "MemoryMap.hpp" #include "Video.hpp" @@ -208,10 +209,52 @@ class ConcreteMachine: case 0xc05e: case 0xc05f: video_.set_annunciator_3(!(address&1)); break; + case 0xc001: /* 0xc000 is dealt with in the ADB section. */ + if(!is_read) video_.set_80_store(true); + break; + case 0xc00c: case 0xc00d: + if(!is_read) video_.set_80_columns(address & 1); + break; + case 0xc00e: case 0xc00f: + if(!is_read) video_.set_alternative_character_set(address & 1); + break; + + // ADB. + case 0xc000: + if(is_read) { + *value = adb_glu_.get_keyboard_data(); + } else { + video_.set_80_store(false); + } + break; + case 0xc024: + if(is_read) { + *value = adb_glu_.get_mouse_data(); + } + break; + case 0xc025: + if(is_read) { + *value = adb_glu_.get_modifier_status(); + } + break; + case 0xc026: + if(is_read) { + *value = adb_glu_.get_data(); + } else { + adb_glu_.set_command(*value); + } + break; + case 0xc027: + if(is_read) { + *value = adb_glu_.get_status(); + } else { + adb_glu_.set_status(*value); + } + break; // The SCC. case 0xc038: case 0xc039: case 0xc03a: case 0xc03b: - if(isReadOperation(operation)) { + if(is_read) { *value = scc_.read(int(address)); } else { scc_.write(int(address), *value); @@ -220,14 +263,14 @@ class ConcreteMachine: // These were all dealt with by the call to memory_.access. // TODO: subject to read data? Does vapour lock apply? - case 0xc000: case 0xc001: case 0xc002: case 0xc003: case 0xc004: case 0xc005: + case 0xc002: case 0xc003: case 0xc004: case 0xc005: case 0xc006: case 0xc007: case 0xc008: case 0xc009: case 0xc00a: case 0xc00b: break; // Interrupt ROM addresses; Cf. P25 of the Hardware Reference. case 0xc071: case 0xc072: case 0xc073: case 0xc074: case 0xc075: case 0xc076: case 0xc077: case 0xc078: case 0xc079: case 0xc07a: case 0xc07b: case 0xc07c: case 0xc07d: case 0xc07e: case 0xc07f: - if(isReadOperation(operation)) { + if(is_read) { *value = rom_[rom_.size() - 65536 + (address & 0xffff)]; } break; @@ -292,6 +335,7 @@ class ConcreteMachine: Apple::Clock::ParallelClock clock_; Apple::IIgs::Video::Video video_; + Apple::IIgs::ADB::GLU adb_glu_; int fast_access_phase_ = 0; int slow_access_phase_ = 0; diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index 798ce7e17..7f957a233 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -456,6 +456,8 @@ 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 */; }; + 4B8DF505254E3C9D00F3433C /* ADB.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8DF503254E3C9D00F3433C /* ADB.cpp */; }; + 4B8DF506254E3C9D00F3433C /* ADB.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8DF503254E3C9D00F3433C /* ADB.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 */; }; @@ -1320,6 +1322,8 @@ 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 = ""; }; + 4B8DF503254E3C9D00F3433C /* ADB.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ADB.cpp; sourceTree = ""; }; + 4B8DF504254E3C9D00F3433C /* ADB.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = ADB.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; }; @@ -3925,8 +3929,10 @@ 4BE2120D253FCE9C00435408 /* AppleIIgs */ = { isa = PBXGroup; children = ( + 4B8DF503254E3C9D00F3433C /* ADB.cpp */, 4BE21214253FCE9C00435408 /* AppleIIgs.cpp */, 4B8DF4F7254E36AD00F3433C /* Video.cpp */, + 4B8DF504254E3C9D00F3433C /* ADB.hpp */, 4BE2120E253FCE9C00435408 /* AppleIIgs.hpp */, 4B8DF4D62546561300F3433C /* MemoryMap.hpp */, 4B8DF4F8254E36AD00F3433C /* Video.hpp */, @@ -4652,6 +4658,7 @@ 4B055A8D1FAE85920060FFFF /* AsyncTaskQueue.cpp in Sources */, 4BAD13441FF709C700FD114A /* MSX.cpp in Sources */, 4B055AC41FAE9AE80060FFFF /* Keyboard.cpp in Sources */, + 4B8DF506254E3C9D00F3433C /* ADB.cpp in Sources */, 4B055A941FAE85B50060FFFF /* CommodoreROM.cpp in Sources */, 4BBB70A5202011C2002FE009 /* MultiMediaTarget.cpp in Sources */, 4B8318BC22D3E588006DB630 /* DisplayMetrics.cpp in Sources */, @@ -4736,6 +4743,7 @@ 4B4518A01F75FD1C00926311 /* CPCDSK.cpp in Sources */, 4B0CCC451C62D0B3001CAC5F /* CRT.cpp in Sources */, 4BC23A2C2467600F001A6030 /* OPLL.cpp in Sources */, + 4B8DF505254E3C9D00F3433C /* ADB.cpp in Sources */, 4B322E041F5A2E3C004EB04C /* Z80Base.cpp in Sources */, 4B0ACC2623775819008902D0 /* AtariST.cpp in Sources */, 4B894530201967B4007DE474 /* StaticAnalyser.cpp in Sources */,