2017-05-17 01:19:17 +00:00
|
|
|
//
|
|
|
|
// Z80AllRAM.hpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 16/05/2017.
|
2018-05-13 19:19:52 +00:00
|
|
|
// Copyright 2017 Thomas Harte. All rights reserved.
|
2017-05-17 01:19:17 +00:00
|
|
|
//
|
|
|
|
|
2024-01-17 04:34:46 +00:00
|
|
|
#pragma once
|
2017-05-17 01:19:17 +00:00
|
|
|
|
2017-09-02 00:50:24 +00:00
|
|
|
#include "../Z80.hpp"
|
|
|
|
#include "../../AllRAMProcessor.hpp"
|
2017-05-17 01:19:17 +00:00
|
|
|
|
2023-05-10 21:02:18 +00:00
|
|
|
namespace CPU::Z80 {
|
2017-05-17 01:19:17 +00:00
|
|
|
|
2017-05-17 01:28:17 +00:00
|
|
|
class AllRAMProcessor:
|
2017-05-31 02:41:23 +00:00
|
|
|
public ::CPU::AllRAMProcessor {
|
2017-05-17 01:28:17 +00:00
|
|
|
|
2017-05-17 01:19:17 +00:00
|
|
|
public:
|
2017-05-31 02:41:23 +00:00
|
|
|
static AllRAMProcessor *Processor();
|
2017-05-22 23:24:11 +00:00
|
|
|
|
|
|
|
struct MemoryAccessDelegate {
|
2017-07-28 00:17:13 +00:00
|
|
|
virtual void z80_all_ram_processor_did_perform_bus_operation(CPU::Z80::AllRAMProcessor &processor, CPU::Z80::PartialMachineCycle::Operation operation, uint16_t address, uint8_t value, HalfCycles time_stamp) = 0;
|
2017-05-22 23:24:11 +00:00
|
|
|
};
|
2017-05-31 02:41:23 +00:00
|
|
|
inline void set_memory_access_delegate(MemoryAccessDelegate *delegate) {
|
2020-02-23 21:12:28 +00:00
|
|
|
memory_delegate_ = delegate;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct PortAccessDelegate {
|
2020-09-27 19:10:29 +00:00
|
|
|
virtual uint8_t z80_all_ram_processor_input(uint16_t) { return 0xff; }
|
2020-02-23 21:12:28 +00:00
|
|
|
};
|
|
|
|
inline void set_port_access_delegate(PortAccessDelegate *delegate) {
|
|
|
|
port_delegate_ = delegate;
|
2017-05-22 23:24:11 +00:00
|
|
|
}
|
|
|
|
|
2017-07-28 02:05:29 +00:00
|
|
|
virtual void run_for(const Cycles cycles) = 0;
|
2020-02-25 04:31:42 +00:00
|
|
|
virtual void run_for_instruction() = 0;
|
2023-05-10 23:46:21 +00:00
|
|
|
virtual uint16_t value_of(Register r) = 0;
|
|
|
|
virtual void set_value_of(Register r, uint16_t value) = 0;
|
2017-05-31 02:41:23 +00:00
|
|
|
virtual bool get_halt_line() = 0;
|
2017-06-02 02:33:05 +00:00
|
|
|
virtual void reset_power_on() = 0;
|
2017-06-23 01:09:26 +00:00
|
|
|
|
2017-06-03 21:41:45 +00:00
|
|
|
virtual void set_interrupt_line(bool value) = 0;
|
|
|
|
virtual void set_non_maskable_interrupt_line(bool value) = 0;
|
2017-06-23 01:09:26 +00:00
|
|
|
virtual void set_wait_line(bool value) = 0;
|
2017-05-31 02:41:23 +00:00
|
|
|
|
|
|
|
protected:
|
2020-02-23 21:12:28 +00:00
|
|
|
MemoryAccessDelegate *memory_delegate_ = nullptr;
|
|
|
|
PortAccessDelegate *port_delegate_ = nullptr;
|
|
|
|
AllRAMProcessor() : ::CPU::AllRAMProcessor(65536) {}
|
2017-05-17 01:19:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|