mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-22 12:33:29 +00:00
Adds a shell of a Nick.
This commit is contained in:
parent
3eb4dd74a2
commit
1d1e6d1820
@ -8,12 +8,15 @@
|
||||
|
||||
#include "Enterprise.hpp"
|
||||
|
||||
#include "Nick.hpp"
|
||||
|
||||
#include "../MachineTypes.hpp"
|
||||
|
||||
#include "../../Processors/Z80/Z80.hpp"
|
||||
|
||||
#include "../../Analyser/Static/Enterprise/Target.hpp"
|
||||
|
||||
#include "../../ClockReceiver/JustInTime.hpp"
|
||||
|
||||
namespace Enterprise {
|
||||
|
||||
@ -38,7 +41,13 @@ class ConcreteMachine:
|
||||
const auto &exos = roms.find(exos_name)->second;
|
||||
memcpy(exos_.data(), exos.data(), std::min(exos_.size(), exos.size()));
|
||||
|
||||
// Take a reasonable guess at the initial memory configuration.
|
||||
// Take a reasonable guess at the initial memory configuration:
|
||||
// put EXOS into the first bank since this is a Z80 and therefore
|
||||
// starts from address 0; the third instruction in EXOS is a jump
|
||||
// to $c02e so it's reasonable to assume EXOS is in the highest bank
|
||||
// too, and it appears to act correctly if it's the first 16kb that's
|
||||
// in the highest bank. From there I guess: all banks are initialised
|
||||
// to 0.
|
||||
page<0>(0x00);
|
||||
page<1>(0x00);
|
||||
page<2>(0x00);
|
||||
@ -76,6 +85,13 @@ class ConcreteMachine:
|
||||
assert(false);
|
||||
break;
|
||||
|
||||
case 0x80: case 0x81: case 0x82: case 0x83:
|
||||
case 0x84: case 0x85: case 0x86: case 0x87:
|
||||
case 0x88: case 0x89: case 0x8a: case 0x8b:
|
||||
case 0x8c: case 0x8d: case 0x8e: case 0x8f:
|
||||
nick_->write(address, *cycle.value);
|
||||
break;
|
||||
|
||||
case 0xb0: page<0>(*cycle.value); break;
|
||||
case 0xb1: page<1>(*cycle.value); break;
|
||||
case 0xb2: page<2>(*cycle.value); break;
|
||||
@ -106,16 +122,21 @@ class ConcreteMachine:
|
||||
return HalfCycles(0);
|
||||
}
|
||||
|
||||
void flush() {
|
||||
nick_.flush();
|
||||
}
|
||||
|
||||
private:
|
||||
CPU::Z80::Processor<ConcreteMachine, false, false> z80_;
|
||||
|
||||
// MARK: - Memory layout
|
||||
std::array<uint8_t, 32 * 1024> exos_;
|
||||
std::array<uint8_t, 256 * 1024> ram_;
|
||||
const uint8_t min_ram_slot_ = 0xff - 3;
|
||||
|
||||
const uint8_t *read_pointers_[4];
|
||||
uint8_t *write_pointers_[4];
|
||||
uint8_t pages_[4];
|
||||
const uint8_t *read_pointers_[4] = {nullptr, nullptr, nullptr, nullptr};
|
||||
uint8_t *write_pointers_[4] = {nullptr, nullptr, nullptr, nullptr};
|
||||
uint8_t pages_[4] = {0x80, 0x80, 0x80, 0x80};
|
||||
|
||||
template <size_t slot> void page(uint8_t offset) {
|
||||
pages_[slot] = offset;
|
||||
@ -152,6 +173,9 @@ class ConcreteMachine:
|
||||
void run_for(const Cycles cycles) override {
|
||||
z80_.run_for(cycles);
|
||||
}
|
||||
|
||||
// MARK: - Video.
|
||||
JustInTimeActor<Nick> nick_;
|
||||
};
|
||||
|
||||
}
|
||||
|
29
Machines/Enterprise/Nick.cpp
Normal file
29
Machines/Enterprise/Nick.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
//
|
||||
// Nick.cpp
|
||||
// Clock Signal
|
||||
//
|
||||
// Created by Thomas Harte on 14/06/2021.
|
||||
// Copyright © 2021 Thomas Harte. All rights reserved.
|
||||
//
|
||||
|
||||
#include "Nick.hpp"
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
using namespace Enterprise;
|
||||
|
||||
void Nick::write(uint16_t address, uint8_t value) {
|
||||
switch(address & 3) {
|
||||
default:
|
||||
printf("Unhandled Nick write: %02x -> %d\n", value, address & 3);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t Nick::read([[maybe_unused]] uint16_t address) {
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
void Nick::run_for(HalfCycles) {
|
||||
|
||||
}
|
28
Machines/Enterprise/Nick.hpp
Normal file
28
Machines/Enterprise/Nick.hpp
Normal file
@ -0,0 +1,28 @@
|
||||
//
|
||||
// Nick.hpp
|
||||
// Clock Signal
|
||||
//
|
||||
// Created by Thomas Harte on 14/06/2021.
|
||||
// Copyright © 2021 Thomas Harte. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef Nick_hpp
|
||||
#define Nick_hpp
|
||||
|
||||
#include <cstdint>
|
||||
#include "../../ClockReceiver/ClockReceiver.hpp"
|
||||
|
||||
namespace Enterprise {
|
||||
|
||||
class Nick {
|
||||
public:
|
||||
void write(uint16_t address, uint8_t value);
|
||||
uint8_t read(uint16_t address);
|
||||
|
||||
void run_for(HalfCycles);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif /* Nick_hpp */
|
@ -21,6 +21,8 @@
|
||||
4B051CA32676F52200CA44E8 /* Enterprise.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B051CA12676F52200CA44E8 /* Enterprise.cpp */; };
|
||||
4B051CA826781D6500CA44E8 /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B051CA726781D6500CA44E8 /* StaticAnalyser.cpp */; };
|
||||
4B051CA926781D6500CA44E8 /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B051CA726781D6500CA44E8 /* StaticAnalyser.cpp */; };
|
||||
4B051CAC26783E2000CA44E8 /* Nick.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B051CAA26783E2000CA44E8 /* Nick.cpp */; };
|
||||
4B051CAD26783E2000CA44E8 /* Nick.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B051CAA26783E2000CA44E8 /* Nick.cpp */; };
|
||||
4B05401E219D1618001BF69C /* ScanTarget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B05401D219D1618001BF69C /* ScanTarget.cpp */; };
|
||||
4B05401F219D1618001BF69C /* ScanTarget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B05401D219D1618001BF69C /* ScanTarget.cpp */; };
|
||||
4B055A7A1FAE78A00060FFFF /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B055A771FAE78210060FFFF /* SDL2.framework */; };
|
||||
@ -1037,6 +1039,8 @@
|
||||
4B051CA526781D6500CA44E8 /* StaticAnalyser.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = StaticAnalyser.hpp; sourceTree = "<group>"; };
|
||||
4B051CA626781D6500CA44E8 /* Target.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Target.hpp; sourceTree = "<group>"; };
|
||||
4B051CA726781D6500CA44E8 /* StaticAnalyser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StaticAnalyser.cpp; sourceTree = "<group>"; };
|
||||
4B051CAA26783E2000CA44E8 /* Nick.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Nick.cpp; sourceTree = "<group>"; };
|
||||
4B051CAB26783E2000CA44E8 /* Nick.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Nick.hpp; sourceTree = "<group>"; };
|
||||
4B05401D219D1618001BF69C /* ScanTarget.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ScanTarget.cpp; sourceTree = "<group>"; };
|
||||
4B055A6A1FAE763F0060FFFF /* Clock Signal Kiosk */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "Clock Signal Kiosk"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
4B055A771FAE78210060FFFF /* SDL2.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL2.framework; path = ../../../../Library/Frameworks/SDL2.framework; sourceTree = SOURCE_ROOT; };
|
||||
@ -2102,8 +2106,10 @@
|
||||
4B051C9F2676F52200CA44E8 /* Enterprise */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4B051CA02676F52200CA44E8 /* Enterprise.hpp */,
|
||||
4B051CA12676F52200CA44E8 /* Enterprise.cpp */,
|
||||
4B051CAA26783E2000CA44E8 /* Nick.cpp */,
|
||||
4B051CA02676F52200CA44E8 /* Enterprise.hpp */,
|
||||
4B051CAB26783E2000CA44E8 /* Nick.hpp */,
|
||||
);
|
||||
path = Enterprise;
|
||||
sourceTree = "<group>";
|
||||
@ -5324,6 +5330,7 @@
|
||||
4B055AAD1FAE85FD0060FFFF /* PCMTrack.cpp in Sources */,
|
||||
4BD67DD1209BF27B00AB2146 /* Encoder.cpp in Sources */,
|
||||
4BE2121A253FCE9C00435408 /* AppleIIgs.cpp in Sources */,
|
||||
4B051CAD26783E2000CA44E8 /* Nick.cpp in Sources */,
|
||||
4B89451F201967B4007DE474 /* Tape.cpp in Sources */,
|
||||
4B055AA81FAE85EF0060FFFF /* Shifter.cpp in Sources */,
|
||||
4BEDA3BC25B25563000C2DBD /* Decoder.cpp in Sources */,
|
||||
@ -5586,6 +5593,7 @@
|
||||
4B8805FB1DCFF807003085B1 /* Oric.cpp in Sources */,
|
||||
4B6ED2F0208E2F8A0047B343 /* WOZ.cpp in Sources */,
|
||||
4B15A9FC208249BB005E6C8D /* StaticAnalyser.cpp in Sources */,
|
||||
4B051CAC26783E2000CA44E8 /* Nick.cpp in Sources */,
|
||||
4B5FADC01DE3BF2B00AEC565 /* Microdisc.cpp in Sources */,
|
||||
4B0F1BDA2602FF9800B85C66 /* Video.cpp in Sources */,
|
||||
4B051C922669C90B00CA44E8 /* ROMCatalogue.cpp in Sources */,
|
||||
|
Loading…
Reference in New Issue
Block a user