--- hatari/src/includes/cycInt.h 2019/04/09 08:49:28 1.1.1.2 +++ hatari/src/includes/cycInt.h 2019/04/09 08:58:07 1.1.1.8 @@ -1,8 +1,8 @@ /* Hatari - cycInt.h - This file is distributed under the GNU Public License, version 2 or at - your option any later version. Read the file gpl.txt for details. + This file is distributed under the GNU General Public License, version 2 + or at your option any later version. Read the file gpl.txt for details. */ #ifndef HATARI_CYCINT_H @@ -19,11 +19,10 @@ typedef enum INTERRUPT_MFP_TIMERB, INTERRUPT_MFP_TIMERC, INTERRUPT_MFP_TIMERD, + INTERRUPT_ACIA_IKBD, INTERRUPT_IKBD_RESETTIMER, - INTERRUPT_IKBD_ACIA, - INTERRUPT_IKBD_MFP, INTERRUPT_IKBD_AUTOSEND, - INTERRUPT_DMASOUND_MICROWIRE, + INTERRUPT_DMASOUND_MICROWIRE, /* Used for both STE and Falcon Microwire emulation */ INTERRUPT_CROSSBAR_25MHZ, INTERRUPT_CROSSBAR_32MHZ, INTERRUPT_FDC, @@ -36,23 +35,28 @@ typedef enum #define INT_CPU_CYCLE 1 #define INT_MFP_CYCLE 2 +#define INT_CPU8_CYCLE 3 #define INT_CPU_TO_INTERNAL 9600 #define INT_MFP_TO_INTERNAL 31333 /* Convert cpu or mfp cycles to internal cycles */ -#define INT_CONVERT_TO_INTERNAL( cyc , type ) ( type == INT_CPU_CYCLE ? (cyc)*INT_CPU_TO_INTERNAL : (cyc)*INT_MFP_TO_INTERNAL ) -/* -#define INT_CONVERT_TO_INTERNAL( cyc , type ) ( type == INT_CPU_CYCLE ? cyc*INT_CPU_TO_INTERNAL :\ - ( ( (cyc*INT_MFP_TO_INTERNAL + INT_CPU_TO_INTERNAL*4 - 1) / (INT_CPU_TO_INTERNAL*4) ) * INT_CPU_TO_INTERNAL*4 ) ) -*/ +#define INT_CONVERT_TO_INTERNAL( cyc , type ) ( type == INT_CPU_CYCLE ? (cyc)*INT_CPU_TO_INTERNAL : \ + type == INT_MFP_CYCLE ? ( (cyc)*INT_MFP_TO_INTERNAL ) << nCpuFreqShift : \ + ( (cyc)*INT_CPU_TO_INTERNAL ) << nCpuFreqShift ) + +//#define INT_CONVERT_TO_INTERNAL( cyc , type ) ( ( type == INT_CPU_CYCLE ? (cyc)*INT_CPU_TO_INTERNAL : (cyc)*INT_MFP_TO_INTERNAL ) << nCpuFreqShift ) +//#define INT_CONVERT_TO_INTERNAL_NO_FREQSHIFT( cyc , type ) ( type == INT_CPU_CYCLE ? (cyc)*INT_CPU_TO_INTERNAL : (cyc)*INT_MFP_TO_INTERNAL ) /* Convert internal cycles to real mfp or cpu cycles */ /* Rounding is important : for example 9500 internal is 0.98 cpu and should give 1 cpu cycle, not 0 */ /* so we do (9500+9600-1)/9600 to get the closest higher integer */ //#define INT_CONVERT_FROM_INTERNAL( cyc , type ) ( type == INT_CPU_CYCLE ? (cyc+INT_CPU_TO_INTERNAL-1)/INT_CPU_TO_INTERNAL : (cyc+INT_MFP_TO_INTERNAL-1)/INT_MFP_TO_INTERNAL ) -#define INT_CONVERT_FROM_INTERNAL( cyc , type ) ( type == INT_CPU_CYCLE ? (cyc)/INT_CPU_TO_INTERNAL : ((cyc)+INT_MFP_TO_INTERNAL-1)/INT_MFP_TO_INTERNAL ) +//#define INT_CONVERT_FROM_INTERNAL( cyc , type ) ( ( type == INT_CPU_CYCLE ? (cyc)/INT_CPU_TO_INTERNAL : ((cyc)+INT_MFP_TO_INTERNAL-1)/INT_MFP_TO_INTERNAL ) >> nCpuFreqShift ) +#define INT_CONVERT_FROM_INTERNAL( cyc , type ) ( type == INT_CPU_CYCLE ? (cyc)/INT_CPU_TO_INTERNAL : \ + type == INT_MFP_CYCLE ? ( ((cyc)+INT_MFP_TO_INTERNAL-1)/INT_MFP_TO_INTERNAL ) >> nCpuFreqShift : \ + ( (cyc)/INT_CPU_TO_INTERNAL ) >> nCpuFreqShift ) extern void (*PendingInterruptFunction)(void); @@ -63,11 +67,12 @@ extern void CycInt_MemorySnapShot_Captur extern void CycInt_AcknowledgeInterrupt(void); extern void CycInt_AddAbsoluteInterrupt(int CycleTime, int CycleType, interrupt_id Handler); extern void CycInt_AddRelativeInterrupt(int CycleTime, int CycleType, interrupt_id Handler); -extern void CycInt_AddRelativeInterruptNoOffset(int CycleTime, int CycleType, interrupt_id Handler); extern void CycInt_AddRelativeInterruptWithOffset(int CycleTime, int CycleType, interrupt_id Handler, int CycleOffset); +extern void CycInt_ModifyInterrupt(int CycleTime, int CycleType, interrupt_id Handler); extern void CycInt_RemovePendingInterrupt(interrupt_id Handler); extern void CycInt_ResumeStoppedInterrupt(interrupt_id Handler); extern bool CycInt_InterruptActive(interrupt_id Handler); +extern int CycInt_GetActiveInt(void); extern int CycInt_FindCyclesPassed(interrupt_id Handler, int CycleType); #endif /* ifndef HATARI_CYCINT_H */