1
0
mirror of https://github.com/TomHarte/CLK.git synced 2026-04-19 19:16:34 +00:00

Factored out the stuff that both all-RAM processors would share, rather than duplicating it.

This commit is contained in:
Thomas Harte
2017-05-16 21:28:17 -04:00
parent d559d8b901
commit 7190f927b7
7 changed files with 72 additions and 38 deletions
+24
View File
@@ -0,0 +1,24 @@
//
// AllRAMProcessor.cpp
// Clock Signal
//
// Created by Thomas Harte on 16/05/2017.
// Copyright © 2017 Thomas Harte. All rights reserved.
//
#include "AllRAMProcessor.hpp"
using namespace CPU;
AllRAMProcessor::AllRAMProcessor(size_t memory_size) :
memory_(memory_size),
timestamp_(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_;
}