1
0
mirror of https://github.com/TomHarte/CLK.git synced 2026-04-24 05:18:36 +00:00

Move point of templature to tube processors.

This commit is contained in:
Thomas Harte
2025-11-07 17:27:52 -05:00
parent 273e23bd98
commit 32cd142629
5 changed files with 40 additions and 29 deletions
+10 -23
View File
@@ -687,35 +687,22 @@ using CRTC = Motorola::CRTC::CRTC6845<
// MARK: - Tube.
template <typename HostT, TubeProcessor> struct Tube;
template <typename HostT, TubeProcessor tube_processor>
struct Tube {
using TubeULA = Acorn::Tube::ULA<HostT>;
TubeULA ula;
Acorn::Tube::Processor<TubeULA, tube_processor> processor;
Tube(HostT &owner) :
ula(owner),
processor(ula) {}
};
template <typename HostT>
struct Tube<HostT, TubeProcessor::None> {
Tube(HostT &) {}
};
template <typename HostT>
struct Tube<HostT, TubeProcessor::WDC65C02> {
using TubeULA = Acorn::Tube::ULA<HostT>;
TubeULA ula;
Acorn::Tube::Tube6502<TubeULA> processor;
Tube(HostT &owner) :
ula(owner),
processor(ula) {}
};
template <typename HostT>
struct Tube<HostT, TubeProcessor::Z80> {
using TubeULA = Acorn::Tube::ULA<HostT>;
TubeULA ula;
Acorn::Tube::TubeZ80<TubeULA> processor;
Tube(HostT &owner) :
ula(owner),
processor(ula) {}
};
// MARK: - ConcreteMachine.
template <TubeProcessor tube_processor, bool has_1770>
+5 -3
View File
@@ -8,6 +8,8 @@
#pragma once
#include "TubeProcessor.hpp"
#include "Processors/6502Mk2/6502Mk2.hpp"
#include "Machines/Utility/ROMCatalogue.hpp"
@@ -16,7 +18,7 @@
namespace Acorn::Tube {
template <typename ULAT>
struct Tube6502 {
class Processor<ULAT, TubeProcessor::WDC65C02> {
public:
static constexpr auto ROM = ROM::Name::BBCMicro6502Tube110;
void set_rom(std::vector<uint8_t> source) {
@@ -24,7 +26,7 @@ public:
std::copy(source.begin(), source.end(), rom_);
}
Tube6502(ULAT &ula) : m6502_(*this), ula_(ula) {}
Processor(ULAT &ula) : m6502_(*this), ula_(ula) {}
// By convention, these are cycles relative to the host's 2Mhz bus.
// Multiply by 3/2 to turn that into the tube 6502's usual 3Mhz bus.
@@ -68,7 +70,7 @@ private:
struct M6502Traits {
static constexpr auto uses_ready_line = false;
static constexpr auto pause_precision = CPU::MOS6502Mk2::PausePrecision::AnyCycle;
using BusHandlerT = Tube6502;
using BusHandlerT = Processor;
};
CPU::MOS6502Mk2::Processor<CPU::MOS6502Mk2::Model::WDC65C02, M6502Traits> m6502_;
bool rom_visible_ = true;
+18
View File
@@ -0,0 +1,18 @@
//
// TubeProcessor.hpp
// Clock Signal
//
// Created by Thomas Harte on 07/11/2025.
// Copyright © 2025 Thomas Harte. All rights reserved.
//
#pragma once
#include "Analyser/Static/Acorn/Target.hpp"
namespace Acorn::Tube {
using TubeProcessor = Analyser::Static::Acorn::BBCMicroTarget::TubeProcessor;
template <typename ULAT, TubeProcessor> class Processor;
}
+5 -3
View File
@@ -8,6 +8,8 @@
#pragma once
#include "TubeProcessor.hpp"
#include "Processors/Z80/Z80.hpp"
#include "Machines/Utility/ROMCatalogue.hpp"
@@ -16,7 +18,7 @@
namespace Acorn::Tube {
template <typename ULAT>
struct TubeZ80: public CPU::Z80::BusHandler {
class Processor<ULAT, TubeProcessor::Z80>: public CPU::Z80::BusHandler {
public:
static constexpr auto ROM = ROM::Name::BBCMicroZ80Tube122;
void set_rom(std::vector<uint8_t> rom) {
@@ -24,7 +26,7 @@ public:
std::copy(rom.begin(), rom.end(), std::begin(rom_));
}
TubeZ80(ULAT &ula) : z80_(*this), ula_(ula) {}
Processor(ULAT &ula) : z80_(*this), ula_(ula) {}
void run_for(const Cycles cycles) {
// Map from 2Mhz to 6Mhz.
@@ -84,7 +86,7 @@ public:
private:
CPU::Z80::Processor<TubeZ80, false, false> z80_;
CPU::Z80::Processor<Processor, false, false> z80_;
bool rom_visible_ = true;
uint8_t rom_[4096];
@@ -1951,6 +1951,7 @@
4B9378E322A199C600973513 /* Audio.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Audio.hpp; sourceTree = "<group>"; };
4B95FA9C1F11893B0008E395 /* ZX8081Controller.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ZX8081Controller.swift; sourceTree = "<group>"; };
4B961408222760E0001A7BF2 /* Screenshot.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Screenshot.hpp; sourceTree = "<group>"; };
4B96DEC32EBEA88C00505298 /* TubeProcessor.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = TubeProcessor.hpp; sourceTree = "<group>"; };
4B96F7CB263E30B00092AEE1 /* RawSectorDump.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = RawSectorDump.hpp; sourceTree = "<group>"; };
4B96F7CC263E33B10092AEE1 /* DSK.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DSK.cpp; sourceTree = "<group>"; };
4B96F7CD263E33B10092AEE1 /* DSK.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = DSK.hpp; sourceTree = "<group>"; };
@@ -3365,6 +3366,7 @@
4B4195F52EB92630001C966D /* Tube6502.hpp */,
4B4195F62EBAB06C001C966D /* TubeZ80.hpp */,
4B4195F42EB8F061001C966D /* ULA.hpp */,
4B96DEC32EBEA88C00505298 /* TubeProcessor.hpp */,
);
path = Tube;
sourceTree = "<group>";