1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-06-25 18:30:07 +00:00

Ups the 65816 test machine to a full 16mb RAM.

This commit is contained in:
Thomas Harte 2020-10-11 21:18:01 -04:00
parent 82797fd395
commit 3039a445f0
4 changed files with 13 additions and 12 deletions

View File

@ -21,12 +21,13 @@ using Type = CPU::MOS6502Esque::Type;
template <Type type> class ConcreteAllRAMProcessor: public AllRAMProcessor, public BusHandler {
public:
ConcreteAllRAMProcessor() :
ConcreteAllRAMProcessor(size_t memory_size) :
AllRAMProcessor(memory_size),
mos6502_(*this) {
mos6502_.set_power_on(false);
}
inline Cycles perform_bus_operation(BusOperation operation, uint16_t address, uint8_t *value) {
inline Cycles perform_bus_operation(BusOperation operation, uint32_t address, uint8_t *value) {
timestamp_ += Cycles(1);
if(operation == BusOperation::ReadOpcode) {
@ -91,7 +92,7 @@ template <Type type> class ConcreteAllRAMProcessor: public AllRAMProcessor, publ
}
AllRAMProcessor *AllRAMProcessor::Processor(Type type) {
#define Bind(p) case p: return new ConcreteAllRAMProcessor<p>();
#define Bind(p) case p: return new ConcreteAllRAMProcessor<p>(type == Type::TWDC65816 ? 16*1024*1024 : 64*1024);
switch(type) {
default:
Bind(Type::T6502)

View File

@ -29,7 +29,7 @@ class AllRAMProcessor:
virtual void set_value_of_register(Register r, uint16_t value) = 0;
protected:
AllRAMProcessor() : ::CPU::AllRAMProcessor(65536) {}
AllRAMProcessor(size_t memory_size) : ::CPU::AllRAMProcessor(memory_size) {}
};
}

View File

@ -15,14 +15,14 @@ AllRAMProcessor::AllRAMProcessor(std::size_t memory_size) :
traps_(memory_size, false),
timestamp_(0) {}
void AllRAMProcessor::set_data_at_address(uint16_t startAddress, std::size_t length, const uint8_t *data) {
std::size_t endAddress = std::min(startAddress + length, size_t(65536));
std::memcpy(&memory_[startAddress], data, endAddress - startAddress);
void AllRAMProcessor::set_data_at_address(size_t start_address, std::size_t length, const uint8_t *data) {
const size_t end_address = std::min(start_address + length, memory_.size());
memcpy(&memory_[start_address], data, end_address - start_address);
}
void AllRAMProcessor::get_data_at_address(uint16_t startAddress, std::size_t length, uint8_t *data) {
std::size_t endAddress = std::min(startAddress + length, size_t(65536));
std::memcpy(data, &memory_[startAddress], endAddress - startAddress);
void AllRAMProcessor::get_data_at_address(size_t start_address, std::size_t length, uint8_t *data) {
const size_t end_address = std::min(start_address + length, memory_.size());
memcpy(data, &memory_[start_address], end_address - start_address);
}
HalfCycles AllRAMProcessor::get_timestamp() {

View File

@ -21,8 +21,8 @@ class AllRAMProcessor {
public:
AllRAMProcessor(std::size_t memory_size);
HalfCycles get_timestamp();
void set_data_at_address(uint16_t startAddress, std::size_t length, const uint8_t *data);
void get_data_at_address(uint16_t startAddress, std::size_t length, uint8_t *data);
void set_data_at_address(size_t startAddress, size_t length, const uint8_t *data);
void get_data_at_address(size_t startAddress, size_t length, uint8_t *data);
class TrapHandler {
public: