2017-05-16 21:19:17 -04:00
|
|
|
//
|
|
|
|
// Z80AllRAM.hpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 16/05/2017.
|
2018-05-13 15:19:52 -04:00
|
|
|
// Copyright 2017 Thomas Harte. All rights reserved.
|
2017-05-16 21:19:17 -04:00
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef Z80AllRAM_hpp
|
|
|
|
#define Z80AllRAM_hpp
|
|
|
|
|
2017-09-01 20:50:24 -04:00
|
|
|
#include "../Z80.hpp"
|
|
|
|
#include "../../AllRAMProcessor.hpp"
|
2017-05-16 21:19:17 -04:00
|
|
|
|
2023-05-10 16:02:18 -05:00
|
|
|
namespace CPU::Z80 {
|
2017-05-16 21:19:17 -04:00
|
|
|
|
2017-05-16 21:28:17 -04:00
|
|
|
class AllRAMProcessor:
|
2017-05-30 22:41:23 -04:00
|
|
|
public ::CPU::AllRAMProcessor {
|
2017-05-16 21:28:17 -04:00
|
|
|
|
2017-05-16 21:19:17 -04:00
|
|
|
public:
|
2017-05-30 22:41:23 -04:00
|
|
|
static AllRAMProcessor *Processor();
|
2017-05-22 19:24:11 -04:00
|
|
|
|
|
|
|
struct MemoryAccessDelegate {
|
2017-07-27 20:17:13 -04: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 19:24:11 -04:00
|
|
|
};
|
2017-05-30 22:41:23 -04:00
|
|
|
inline void set_memory_access_delegate(MemoryAccessDelegate *delegate) {
|
2020-02-23 16:12:28 -05:00
|
|
|
memory_delegate_ = delegate;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct PortAccessDelegate {
|
2020-09-27 15:10:29 -04:00
|
|
|
virtual uint8_t z80_all_ram_processor_input(uint16_t) { return 0xff; }
|
2020-02-23 16:12:28 -05:00
|
|
|
};
|
|
|
|
inline void set_port_access_delegate(PortAccessDelegate *delegate) {
|
|
|
|
port_delegate_ = delegate;
|
2017-05-22 19:24:11 -04:00
|
|
|
}
|
|
|
|
|
2017-07-27 22:05:29 -04:00
|
|
|
virtual void run_for(const Cycles cycles) = 0;
|
2020-02-24 23:31:42 -05:00
|
|
|
virtual void run_for_instruction() = 0;
|
2023-05-10 18:46:21 -05:00
|
|
|
virtual uint16_t value_of(Register r) = 0;
|
|
|
|
virtual void set_value_of(Register r, uint16_t value) = 0;
|
2017-05-30 22:41:23 -04:00
|
|
|
virtual bool get_halt_line() = 0;
|
2017-06-01 22:33:05 -04:00
|
|
|
virtual void reset_power_on() = 0;
|
2017-06-22 21:09:26 -04:00
|
|
|
|
2017-06-03 17:41:45 -04:00
|
|
|
virtual void set_interrupt_line(bool value) = 0;
|
|
|
|
virtual void set_non_maskable_interrupt_line(bool value) = 0;
|
2017-06-22 21:09:26 -04:00
|
|
|
virtual void set_wait_line(bool value) = 0;
|
2017-05-30 22:41:23 -04:00
|
|
|
|
|
|
|
protected:
|
2020-02-23 16:12:28 -05:00
|
|
|
MemoryAccessDelegate *memory_delegate_ = nullptr;
|
|
|
|
PortAccessDelegate *port_delegate_ = nullptr;
|
|
|
|
AllRAMProcessor() : ::CPU::AllRAMProcessor(65536) {}
|
2017-05-16 21:19:17 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* Z80AllRAM_hpp */
|