Exemplo n.º 1
0
        public IIRQRead m_int_read;         // opcode reader for IM2 interrupt handling

        /// <summary>
        /// Creates Z80 CPU emulation class
        /// </summary>
        /// <param name="memory">Memory access provider class</param>
        /// <param name="inputOutputPortPorts">IO provider class</param>
        /// <param name="irqRead">Interrupt provider for IM2 mode</param>
        /// <param name="reset">True for reset the CPU after creating</param>
        public Z80(IZ80Memory memory, IZ80Port inputOutputPortPorts, IIRQRead irqRead, bool reset = true)
        {
            m_memory = memory;
            m_memory?.SetCPU(this);

            m_ports = inputOutputPortPorts;
            m_ports?.SetCPU(this);

            m_int_read = irqRead;

            m_registers = new Z80Registers();

            InitializeOpcodes();
            if (reset)
            {
                Reset();
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Sets/changes memory access provider
 /// </summary>
 /// <param name="in_memory"></param>
 public void SetMemory(IZ80Memory in_memory)
 {
     m_memory = in_memory;
     m_memory.SetCPU(this);
 }