mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-12 15:31:09 +00:00
Continued edging towards getting the absolute basics of a testable Z80, for test-driven development. Corrected old-fashioned instance naming issues with the corresponding 6502 class and removed an unnecessary source file while at it.
This commit is contained in:
parent
2562306802
commit
d559d8b901
@ -33,7 +33,6 @@
|
||||
4B2BFC5F1D613E0200BA3AA9 /* TapePRG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B2BFC5D1D613E0200BA3AA9 /* TapePRG.cpp */; };
|
||||
4B2BFDB21DAEF5FF001A68B8 /* Video.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B2BFDB01DAEF5FF001A68B8 /* Video.cpp */; };
|
||||
4B2C45421E3C3896002A2389 /* cartridge.png in Resources */ = {isa = PBXBuildFile; fileRef = 4B2C45411E3C3896002A2389 /* cartridge.png */; };
|
||||
4B2C455D1EC9442600FC74DD /* RegisterSizes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B2C455B1EC9442600FC74DD /* RegisterSizes.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 */; };
|
||||
@ -412,6 +411,7 @@
|
||||
4BF8295D1D8F048B001BAE39 /* MFM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8295B1D8F048B001BAE39 /* MFM.cpp */; };
|
||||
4BF829631D8F536B001BAE39 /* SSD.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF829611D8F536B001BAE39 /* SSD.cpp */; };
|
||||
4BF829661D8F732B001BAE39 /* Disk.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF829641D8F732B001BAE39 /* Disk.cpp */; };
|
||||
4BFCA1201ECBDC1500AC40C1 /* Z80AllRAM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFCA11D1ECBD9BD00AC40C1 /* Z80AllRAM.cpp */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
@ -481,7 +481,6 @@
|
||||
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>"; };
|
||||
4B2C45411E3C3896002A2389 /* cartridge.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = cartridge.png; sourceTree = "<group>"; };
|
||||
4B2C455B1EC9442600FC74DD /* RegisterSizes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RegisterSizes.cpp; sourceTree = "<group>"; };
|
||||
4B2C455C1EC9442600FC74DD /* RegisterSizes.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = RegisterSizes.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>"; };
|
||||
@ -974,6 +973,8 @@
|
||||
4BF829641D8F732B001BAE39 /* Disk.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Disk.cpp; path = ../../StaticAnalyser/Acorn/Disk.cpp; sourceTree = "<group>"; };
|
||||
4BF829651D8F732B001BAE39 /* Disk.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Disk.hpp; path = ../../StaticAnalyser/Acorn/Disk.hpp; sourceTree = "<group>"; };
|
||||
4BF829681D8F7361001BAE39 /* File.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = File.hpp; path = ../../StaticAnalyser/Acorn/File.hpp; sourceTree = "<group>"; };
|
||||
4BFCA11D1ECBD9BD00AC40C1 /* Z80AllRAM.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Z80AllRAM.cpp; path = Z80/Z80AllRAM.cpp; sourceTree = "<group>"; };
|
||||
4BFCA11E1ECBD9BD00AC40C1 /* Z80AllRAM.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Z80AllRAM.hpp; path = Z80/Z80AllRAM.hpp; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@ -1327,6 +1328,8 @@
|
||||
children = (
|
||||
4B77069B1EC904570053B588 /* Z80.cpp */,
|
||||
4B77069C1EC904570053B588 /* Z80.hpp */,
|
||||
4BFCA11D1ECBD9BD00AC40C1 /* Z80AllRAM.cpp */,
|
||||
4BFCA11E1ECBD9BD00AC40C1 /* Z80AllRAM.hpp */,
|
||||
);
|
||||
name = Z80;
|
||||
sourceTree = "<group>";
|
||||
@ -1809,7 +1812,6 @@
|
||||
4B1414561B58879D00E04248 /* 6502 */,
|
||||
4B77069E1EC9045B0053B588 /* Z80 */,
|
||||
4B7706A01EC9398D0053B588 /* MicroOpScheduler.hpp */,
|
||||
4B2C455B1EC9442600FC74DD /* RegisterSizes.cpp */,
|
||||
4B2C455C1EC9442600FC74DD /* RegisterSizes.hpp */,
|
||||
);
|
||||
name = Processors;
|
||||
@ -2516,7 +2518,6 @@
|
||||
4B9CCDA11DA279CA0098B625 /* Vic20OptionsPanel.swift in Sources */,
|
||||
4B8805F01DCFC99C003085B1 /* Acorn.cpp in Sources */,
|
||||
4B3051301D98ACC600B4FED8 /* Plus3.cpp in Sources */,
|
||||
4B2C455D1EC9442600FC74DD /* RegisterSizes.cpp in Sources */,
|
||||
4B30512D1D989E2200B4FED8 /* Drive.cpp in Sources */,
|
||||
4BCA6CC81D9DD9F000C2D7B2 /* CommodoreROM.cpp in Sources */,
|
||||
4BA22B071D8817CE0008C640 /* Disk.cpp in Sources */,
|
||||
@ -2555,6 +2556,7 @@
|
||||
4B3BA0CE1D318B44005DD7A7 /* C1540Bridge.mm in Sources */,
|
||||
4B3BA0D11D318B44005DD7A7 /* TestMachine6502.mm in Sources */,
|
||||
4B92EACA1B7C112B00246143 /* 6502TimingTests.swift in Sources */,
|
||||
4BFCA1201ECBDC1500AC40C1 /* Z80AllRAM.cpp in Sources */,
|
||||
4BB73EB71B587A5100552FC2 /* AllSuiteATests.swift in Sources */,
|
||||
4B121F9B1E06293F00BFDA12 /* PCMSegmentEventSourceTests.mm in Sources */,
|
||||
4BEF6AAC1D35D1C400E73575 /* DPLLTests.swift in Sources */,
|
||||
|
@ -17,12 +17,12 @@ AllRAMProcessor::AllRAMProcessor() : _timestamp(0) {
|
||||
}
|
||||
|
||||
int AllRAMProcessor::perform_bus_operation(MOS6502::BusOperation operation, uint16_t address, uint8_t *value) {
|
||||
_timestamp++;
|
||||
timestamp_++;
|
||||
|
||||
if(isReadOperation(operation)) {
|
||||
*value = _memory[address];
|
||||
*value = memory_[address];
|
||||
} else {
|
||||
_memory[address] = *value;
|
||||
memory_[address] = *value;
|
||||
}
|
||||
|
||||
return 1;
|
||||
@ -30,9 +30,9 @@ int AllRAMProcessor::perform_bus_operation(MOS6502::BusOperation operation, uint
|
||||
|
||||
void AllRAMProcessor::set_data_at_address(uint16_t startAddress, size_t length, const uint8_t *data) {
|
||||
size_t endAddress = std::min(startAddress + length, (size_t)65536);
|
||||
memcpy(&_memory[startAddress], data, endAddress - startAddress);
|
||||
memcpy(&memory_[startAddress], data, endAddress - startAddress);
|
||||
}
|
||||
|
||||
uint32_t AllRAMProcessor::get_timestamp() {
|
||||
return _timestamp;
|
||||
return timestamp_;
|
||||
}
|
||||
|
@ -15,9 +15,7 @@ namespace CPU {
|
||||
namespace MOS6502 {
|
||||
|
||||
class AllRAMProcessor: public Processor<AllRAMProcessor> {
|
||||
|
||||
public:
|
||||
|
||||
AllRAMProcessor();
|
||||
|
||||
int perform_bus_operation(MOS6502::BusOperation operation, uint16_t address, uint8_t *value);
|
||||
@ -26,8 +24,8 @@ class AllRAMProcessor: public Processor<AllRAMProcessor> {
|
||||
uint32_t get_timestamp();
|
||||
|
||||
private:
|
||||
uint8_t _memory[65536];
|
||||
uint32_t _timestamp;
|
||||
uint8_t memory_[65536];
|
||||
uint32_t timestamp_;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -1,9 +0,0 @@
|
||||
//
|
||||
// RegisterSizes.cpp
|
||||
// Clock Signal
|
||||
//
|
||||
// Created by Thomas Harte on 14/05/2017.
|
||||
// Copyright © 2017 Thomas Harte. All rights reserved.
|
||||
//
|
||||
|
||||
#include "RegisterSizes.hpp"
|
@ -167,7 +167,7 @@ template <class T> class Processor: public MicroOpScheduler<MicroOp> {
|
||||
*/
|
||||
void flush() {}
|
||||
|
||||
void perform_machine_cycle(const MachineCycle *cycle) {
|
||||
int perform_machine_cycle(const MachineCycle *cycle) {
|
||||
}
|
||||
|
||||
/*!
|
||||
|
27
Processors/Z80/Z80AllRAM.cpp
Normal file
27
Processors/Z80/Z80AllRAM.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
//
|
||||
// Z80AllRAM.cpp
|
||||
// Clock Signal
|
||||
//
|
||||
// Created by Thomas Harte on 16/05/2017.
|
||||
// Copyright © 2017 Thomas Harte. All rights reserved.
|
||||
//
|
||||
|
||||
#include "Z80AllRAM.hpp"
|
||||
#include <algorithm>
|
||||
|
||||
using namespace CPU::Z80;
|
||||
|
||||
AllRAMProcessor::AllRAMProcessor() {}
|
||||
|
||||
int AllRAMProcessor::perform_machine_cycle(const MachineCycle *cycle) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void AllRAMProcessor::set_data_at_address(uint16_t startAddress, size_t length, const uint8_t *data) {
|
||||
size_t endAddress = std::min(startAddress + length, (size_t)65536);
|
||||
memcpy(&memory_[startAddress], data, endAddress - startAddress);
|
||||
}
|
||||
|
||||
uint32_t AllRAMProcessor::get_timestamp() {
|
||||
return timestamp_;
|
||||
}
|
34
Processors/Z80/Z80AllRAM.hpp
Normal file
34
Processors/Z80/Z80AllRAM.hpp
Normal file
@ -0,0 +1,34 @@
|
||||
//
|
||||
// Z80AllRAM.hpp
|
||||
// Clock Signal
|
||||
//
|
||||
// Created by Thomas Harte on 16/05/2017.
|
||||
// Copyright © 2017 Thomas Harte. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef Z80AllRAM_hpp
|
||||
#define Z80AllRAM_hpp
|
||||
|
||||
#include "Z80.hpp"
|
||||
|
||||
namespace CPU {
|
||||
namespace Z80 {
|
||||
|
||||
class AllRAMProcessor: public Processor<AllRAMProcessor> {
|
||||
public:
|
||||
AllRAMProcessor();
|
||||
|
||||
int perform_machine_cycle(const MachineCycle *cycle);
|
||||
|
||||
void set_data_at_address(uint16_t startAddress, size_t length, const uint8_t *data);
|
||||
uint32_t get_timestamp();
|
||||
|
||||
private:
|
||||
uint8_t memory_[65536];
|
||||
uint32_t timestamp_;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* Z80AllRAM_hpp */
|
Loading…
x
Reference in New Issue
Block a user