1 /* 2 * KCemu -- The emulator for the KC85 homecomputer series and much more. 3 * Copyright (C) 1997-2010 Torsten Paul 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License along 16 * with this program; if not, write to the Free Software Foundation, Inc., 17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 */ 19 20 #ifndef __kc_ic_h 21 #define __kc_ic_h 22 23 #include <stdlib.h> 24 #include <string.h> 25 #include <iostream> 26 27 #include "kc/system.h" 28 29 #define IRQ_NOT_ACK (0x100) 30 31 class InterfaceCircuit 32 { 33 private: 34 35 /** 36 * input value of the daisy chain. 37 */ 38 int _iei; 39 40 /** 41 * will be set between reti_ED() and reti_4D() by elements 42 * of the daisy chain that have an interrupt pending but 43 * not acknowledged 44 */ 45 int _ieo_reti; 46 47 /** 48 * interrupt is requested but not yet aknowledged by the cpu 49 */ 50 int _irqreq; 51 52 /** 53 * interrupt is aknowledged and the interrupt service routine 54 * is still running 55 */ 56 int _irqactive; 57 58 char *_name; 59 InterfaceCircuit *_next; 60 InterfaceCircuit *_prev; 61 62 public: 63 InterfaceCircuit(const char *name); 64 virtual ~InterfaceCircuit(void); 65 66 virtual void debug(void); 67 virtual const char * const get_ic_name(); 68 69 virtual void reti(void) = 0; 70 virtual void irqreq(void) = 0; 71 virtual word_t irqack(void) = 0; 72 73 virtual void irq(void); 74 virtual word_t ack(void); 75 virtual void iei(byte_t val); 76 virtual byte_t ieo(void); 77 78 virtual void prev(InterfaceCircuit *ic); 79 virtual void next(InterfaceCircuit *ic); 80 virtual InterfaceCircuit * get_prev(); 81 virtual InterfaceCircuit * get_next(); 82 virtual InterfaceCircuit * get_first(); 83 virtual InterfaceCircuit * get_last(); 84 85 virtual void reti_ED(void); 86 virtual void reti_4D(void); 87 virtual void reset(bool power_on = false); 88 }; 89 90 #endif /* __kc_ic_h */ 91