mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-26 15:32:04 +00:00
The Vic now captures the ROMs sent to it and has just enough infrastructure to get to a black screen. Progress!
This commit is contained in:
parent
12243c40ad
commit
f922d38ed2
21
Components/6560/6560.cpp
Normal file
21
Components/6560/6560.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
//
|
||||
// 6560.cpp
|
||||
// Clock Signal
|
||||
//
|
||||
// Created by Thomas Harte on 05/06/2016.
|
||||
// Copyright © 2016 Thomas Harte. All rights reserved.
|
||||
//
|
||||
|
||||
#include "6560.hpp"
|
||||
|
||||
using namespace MOS;
|
||||
|
||||
MOS6560::MOS6560() :
|
||||
_crt(new Outputs::CRT::CRT(65, 1, Outputs::CRT::DisplayType::NTSC60, 1))
|
||||
{
|
||||
_crt->set_rgb_sampling_function(
|
||||
"vec3 rgb_sample(usampler2D sampler, vec2 coordinate, vec2 icoordinate)"
|
||||
"{"
|
||||
"return vec3(1.0);"
|
||||
"}");
|
||||
}
|
27
Components/6560/6560.hpp
Normal file
27
Components/6560/6560.hpp
Normal file
@ -0,0 +1,27 @@
|
||||
//
|
||||
// 6560.hpp
|
||||
// Clock Signal
|
||||
//
|
||||
// Created by Thomas Harte on 05/06/2016.
|
||||
// Copyright © 2016 Thomas Harte. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef _560_hpp
|
||||
#define _560_hpp
|
||||
|
||||
#include "../../Outputs/CRT/CRT.hpp"
|
||||
|
||||
namespace MOS {
|
||||
|
||||
class MOS6560 {
|
||||
public:
|
||||
MOS6560();
|
||||
Outputs::CRT::CRT *get_crt() { return _crt.get(); }
|
||||
|
||||
private:
|
||||
std::unique_ptr<Outputs::CRT::CRT> _crt;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* _560_hpp */
|
@ -8,15 +8,38 @@
|
||||
|
||||
#include "Vic20.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
using namespace Vic20;
|
||||
|
||||
Machine::Machine()
|
||||
{}
|
||||
|
||||
unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uint16_t address, uint8_t *value)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void Machine::setup_output(float aspect_ratio)
|
||||
{
|
||||
_mos6560 = std::unique_ptr<MOS::MOS6560>(new MOS::MOS6560());
|
||||
}
|
||||
|
||||
void Machine::set_rom(ROMSlot slot, size_t length, const uint8_t *data)
|
||||
{
|
||||
uint8_t *target = nullptr;
|
||||
switch(slot)
|
||||
{
|
||||
case ROMSlotKernel: target = _kernelROM; break;
|
||||
case ROMSlotCharacters: target = _characterROM; break;
|
||||
case ROMSlotBASIC: target = _basicROM; break;
|
||||
}
|
||||
|
||||
if(target)
|
||||
{
|
||||
size_t length_to_copy = std::max((size_t)0x1000, length);
|
||||
memcpy(target, data, length_to_copy);
|
||||
}
|
||||
}
|
||||
|
||||
void Machine::add_prg(size_t length, const uint8_t *data)
|
||||
|
@ -10,6 +10,7 @@
|
||||
#define Vic20_hpp
|
||||
|
||||
#include "../../Processors/6502/CPU6502.hpp"
|
||||
#include "../../Components/6560/6560.hpp"
|
||||
#include "../CRTMachine.hpp"
|
||||
|
||||
namespace Vic20 {
|
||||
@ -22,6 +23,7 @@ enum ROMSlot {
|
||||
|
||||
class Machine: public CPU6502::Processor<Machine>, public CRTMachine::Machine {
|
||||
public:
|
||||
Machine();
|
||||
|
||||
void set_rom(ROMSlot slot, size_t length, const uint8_t *data);
|
||||
void add_prg(size_t length, const uint8_t *data);
|
||||
@ -31,11 +33,18 @@ class Machine: public CPU6502::Processor<Machine>, public CRTMachine::Machine {
|
||||
void synchronise() {}
|
||||
|
||||
// to satisfy CRTMachine::Machine
|
||||
virtual void setup_output(float aspect_ratio) {}
|
||||
virtual void setup_output(float aspect_ratio);
|
||||
virtual void close_output() {}
|
||||
virtual Outputs::CRT::CRT *get_crt() { return nullptr; } // TODO
|
||||
virtual Outputs::CRT::CRT *get_crt() { return _mos6560->get_crt(); }
|
||||
virtual Outputs::Speaker *get_speaker() { return nullptr; } // TODO
|
||||
virtual void run_for_cycles(int number_of_cycles) { CPU6502::Processor<Machine>::run_for_cycles(number_of_cycles); }
|
||||
|
||||
private:
|
||||
uint8_t _characterROM[0x1000];
|
||||
uint8_t _basicROM[0x1000];
|
||||
uint8_t _kernelROM[0x1000];
|
||||
|
||||
std::unique_ptr<MOS::MOS6560> _mos6560;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -316,6 +316,7 @@
|
||||
4BC76E691C98E31700E6EF73 /* FIRFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC76E671C98E31700E6EF73 /* FIRFilter.cpp */; };
|
||||
4BC76E6B1C98F43700E6EF73 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BC76E6A1C98F43700E6EF73 /* Accelerate.framework */; };
|
||||
4BC9DF451D044FCA00F44158 /* ROMImages in Resources */ = {isa = PBXBuildFile; fileRef = 4BC9DF441D044FCA00F44158 /* ROMImages */; };
|
||||
4BC9DF4F1D04691600F44158 /* 6560.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC9DF4D1D04691600F44158 /* 6560.cpp */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
@ -686,6 +687,8 @@
|
||||
4BC76E6A1C98F43700E6EF73 /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; };
|
||||
4BC9DF441D044FCA00F44158 /* ROMImages */ = {isa = PBXFileReference; lastKnownFileType = folder; name = ROMImages; path = ../../../../ROMImages; sourceTree = "<group>"; };
|
||||
4BC9DF461D04565200F44158 /* CSKeyboardMachine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSKeyboardMachine.h; sourceTree = "<group>"; };
|
||||
4BC9DF4D1D04691600F44158 /* 6560.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = 6560.cpp; sourceTree = "<group>"; };
|
||||
4BC9DF4E1D04691600F44158 /* 6560.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = 6560.hpp; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@ -1148,6 +1151,7 @@
|
||||
4BB73EA01B587A5100552FC2 /* Clock Signal */,
|
||||
4BB73EB51B587A5100552FC2 /* Clock SignalTests */,
|
||||
4BB73EC01B587A5100552FC2 /* Clock SignalUITests */,
|
||||
4BC9DF4A1D04691600F44158 /* Components */,
|
||||
4BB73EDC1B587CA500552FC2 /* Machines */,
|
||||
4B366DFD1B5C165F0026627B /* Outputs */,
|
||||
4BB73EDD1B587CA500552FC2 /* Processors */,
|
||||
@ -1260,6 +1264,32 @@
|
||||
path = Shaders;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
4BC9DF4A1D04691600F44158 /* Components */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4BC9DF4B1D04691600F44158 /* 6522 */,
|
||||
4BC9DF4C1D04691600F44158 /* 6560 */,
|
||||
);
|
||||
name = Components;
|
||||
path = ../../Components;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
4BC9DF4B1D04691600F44158 /* 6522 */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
path = 6522;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
4BC9DF4C1D04691600F44158 /* 6560 */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4BC9DF4D1D04691600F44158 /* 6560.cpp */,
|
||||
4BC9DF4E1D04691600F44158 /* 6560.hpp */,
|
||||
);
|
||||
path = 6560;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
4BE5F85A1C3E1C2500C43F01 /* Resources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@ -1674,6 +1704,7 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
4BC9DF4F1D04691600F44158 /* 6560.cpp in Sources */,
|
||||
4BBF99151C8FBA6F0075DAFB /* CRTOpenGL.cpp in Sources */,
|
||||
4B55CE541C3B7ABF0093A61B /* CSElectron.mm in Sources */,
|
||||
4B0CCC451C62D0B3001CAC5F /* CRT.cpp in Sources */,
|
||||
|
Loading…
x
Reference in New Issue
Block a user