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
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef Z80AllRAM_hpp
|
|
|
|
#define Z80AllRAM_hpp
|
|
|
|
|
2017-09-02 00:50:24 +00:00
|
|
|
#include "../Z80.hpp"
|
|
|
|
#include "../../AllRAMProcessor.hpp"
|
2017-05-17 01:19:17 +00:00
|
|
|
|
|
|
|
namespace CPU {
|
|
|
|
namespace Z80 {
|
|
|
|
|
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 {
|
|
|
|
virtual uint8_t z80_all_ram_processor_input(uint16_t port) { return 0xff; }
|
|
|
|
};
|
|
|
|
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;
|
2017-05-31 02:41:23 +00:00
|
|
|
virtual uint16_t get_value_of_register(Register r) = 0;
|
|
|
|
virtual void set_value_of_register(Register r, uint16_t value) = 0;
|
|
|
|
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
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* Z80AllRAM_hpp */
|