mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-26 15:32:04 +00:00
Added just enough wiring to add something that will generate the video, one day.
This commit is contained in:
parent
e6937d8003
commit
8c8a71107e
@ -10,7 +10,7 @@
|
||||
|
||||
using namespace Oric;
|
||||
|
||||
Machine::Machine()
|
||||
Machine::Machine() : _cycles_since_video_update(0)
|
||||
{
|
||||
set_clock_rate(1000000);
|
||||
}
|
||||
@ -35,12 +35,22 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
|
||||
if(isReadOperation(operation))
|
||||
*value = _ram[address];
|
||||
else
|
||||
{
|
||||
if(address >= 0xa000) update_video();
|
||||
_ram[address] = *value;
|
||||
}
|
||||
}
|
||||
|
||||
_cycles_since_video_update++;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void Machine::update_video()
|
||||
{
|
||||
_videoOutput->run_for_cycles(_cycles_since_video_update);
|
||||
_cycles_since_video_update = 0;
|
||||
}
|
||||
|
||||
void Machine::setup_output(float aspect_ratio)
|
||||
{
|
||||
// TODO: this is a copy and paste from the Electron; correct.
|
||||
@ -53,6 +63,9 @@ void Machine::setup_output(float aspect_ratio)
|
||||
"texValue >>= 4 - (int(icoordinate.x * 8) & 4);"
|
||||
"return vec3( uvec3(texValue) & uvec3(4u, 2u, 1u));"
|
||||
"}");
|
||||
|
||||
_videoOutput.reset(new VideoOutput(_ram));
|
||||
_videoOutput->set_crt(_crt);
|
||||
}
|
||||
|
||||
void Machine::close_output()
|
||||
|
@ -16,6 +16,8 @@
|
||||
#include "../CRTMachine.hpp"
|
||||
#include "../Typer.hpp"
|
||||
|
||||
#include "Video.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
@ -36,7 +38,7 @@ class Machine:
|
||||
|
||||
// to satisfy CPU6502::Processor
|
||||
unsigned int perform_bus_operation(CPU6502::BusOperation operation, uint16_t address, uint8_t *value);
|
||||
// void synchronise();
|
||||
void synchronise() { update_video(); }
|
||||
|
||||
// to satisfy CRTMachine::Machine
|
||||
virtual void setup_output(float aspect_ratio);
|
||||
@ -48,9 +50,12 @@ class Machine:
|
||||
private:
|
||||
// RAM and ROM
|
||||
uint8_t _ram[65536], _rom[16384];
|
||||
int _cycles_since_video_update;
|
||||
inline void update_video();
|
||||
|
||||
// Outputs
|
||||
std::shared_ptr<Outputs::CRT::CRT> _crt;
|
||||
std::unique_ptr<VideoOutput> _videoOutput;
|
||||
};
|
||||
|
||||
}
|
||||
|
23
Machines/Oric/Video.cpp
Normal file
23
Machines/Oric/Video.cpp
Normal file
@ -0,0 +1,23 @@
|
||||
//
|
||||
// Video.cpp
|
||||
// Clock Signal
|
||||
//
|
||||
// Created by Thomas Harte on 12/10/2016.
|
||||
// Copyright © 2016 Thomas Harte. All rights reserved.
|
||||
//
|
||||
|
||||
#include "Video.hpp"
|
||||
|
||||
using namespace Oric;
|
||||
|
||||
VideoOutput::VideoOutput(uint8_t *memory) : _ram(memory)
|
||||
{
|
||||
}
|
||||
|
||||
void VideoOutput::set_crt(std::shared_ptr<Outputs::CRT::CRT> crt)
|
||||
{
|
||||
}
|
||||
|
||||
void VideoOutput::run_for_cycles(int number_of_cycles)
|
||||
{
|
||||
}
|
28
Machines/Oric/Video.hpp
Normal file
28
Machines/Oric/Video.hpp
Normal file
@ -0,0 +1,28 @@
|
||||
//
|
||||
// Video.hpp
|
||||
// Clock Signal
|
||||
//
|
||||
// Created by Thomas Harte on 12/10/2016.
|
||||
// Copyright © 2016 Thomas Harte. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef Video_hpp
|
||||
#define Video_hpp
|
||||
|
||||
#include "../../Outputs/CRT/CRT.hpp"
|
||||
|
||||
namespace Oric {
|
||||
|
||||
class VideoOutput {
|
||||
public:
|
||||
VideoOutput(uint8_t *memory);
|
||||
void set_crt(std::shared_ptr<Outputs::CRT::CRT> crt);
|
||||
void run_for_cycles(int number_of_cycles);
|
||||
|
||||
private:
|
||||
uint8_t *_ram;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* Video_hpp */
|
@ -25,6 +25,7 @@
|
||||
4B2A53A21D117D36003C6002 /* CSElectron.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B2A539C1D117D36003C6002 /* CSElectron.mm */; };
|
||||
4B2A53A31D117D36003C6002 /* CSVic20.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B2A539E1D117D36003C6002 /* CSVic20.mm */; };
|
||||
4B2BFC5F1D613E0200BA3AA9 /* TapePRG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B2BFC5D1D613E0200BA3AA9 /* TapePRG.cpp */; };
|
||||
4B2BFDB21DAEF5FF001A68B8 /* Video.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B2BFDB01DAEF5FF001A68B8 /* Video.cpp */; };
|
||||
4B2E2D9A1C3A06EC00138695 /* Atari2600.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B2E2D971C3A06EC00138695 /* Atari2600.cpp */; };
|
||||
4B2E2D9D1C3A070400138695 /* Electron.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B2E2D9B1C3A070400138695 /* Electron.cpp */; };
|
||||
4B30512D1D989E2200B4FED8 /* Drive.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B30512B1D989E2200B4FED8 /* Drive.cpp */; };
|
||||
@ -432,6 +433,8 @@
|
||||
4B2A539E1D117D36003C6002 /* CSVic20.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CSVic20.mm; sourceTree = "<group>"; };
|
||||
4B2BFC5D1D613E0200BA3AA9 /* TapePRG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TapePRG.cpp; sourceTree = "<group>"; };
|
||||
4B2BFC5E1D613E0200BA3AA9 /* TapePRG.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = TapePRG.hpp; sourceTree = "<group>"; };
|
||||
4B2BFDB01DAEF5FF001A68B8 /* Video.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Video.cpp; path = Oric/Video.cpp; sourceTree = "<group>"; };
|
||||
4B2BFDB11DAEF5FF001A68B8 /* Video.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Video.hpp; path = Oric/Video.hpp; sourceTree = "<group>"; };
|
||||
4B2E2D971C3A06EC00138695 /* Atari2600.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Atari2600.cpp; sourceTree = "<group>"; };
|
||||
4B2E2D981C3A06EC00138695 /* Atari2600.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Atari2600.hpp; sourceTree = "<group>"; };
|
||||
4B2E2D991C3A06EC00138695 /* Atari2600Inputs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Atari2600Inputs.h; sourceTree = "<group>"; };
|
||||
@ -1691,6 +1694,8 @@
|
||||
children = (
|
||||
4BCF1FA21DADC3DD0039D2E7 /* Oric.cpp */,
|
||||
4BCF1FA31DADC3DD0039D2E7 /* Oric.hpp */,
|
||||
4B2BFDB01DAEF5FF001A68B8 /* Video.cpp */,
|
||||
4B2BFDB11DAEF5FF001A68B8 /* Video.hpp */,
|
||||
);
|
||||
name = Oric;
|
||||
sourceTree = "<group>";
|
||||
@ -2205,6 +2210,7 @@
|
||||
4B643F3F1D77B88000D431D6 /* DocumentController.swift in Sources */,
|
||||
4BA799951D8B656E0045123D /* StaticAnalyser.cpp in Sources */,
|
||||
4BF829601D8F3C87001BAE39 /* CRC.cpp in Sources */,
|
||||
4B2BFDB21DAEF5FF001A68B8 /* Video.cpp in Sources */,
|
||||
4B4DC82B1D2C27A4003C5BF8 /* SerialBus.cpp in Sources */,
|
||||
4BC3B74F1CD194CC00F86E85 /* Shader.cpp in Sources */,
|
||||
4B8FE2221DA19FB20090D3CE /* MachinePanel.swift in Sources */,
|
||||
|
Loading…
x
Reference in New Issue
Block a user