1 //---------------------------------------------------------------------------
2 // NEOPOP : Emulator as in Dreamland
3 //
4 // Copyright (c) 2001-2002 by neopop_uk
5 //---------------------------------------------------------------------------
6 
7 //---------------------------------------------------------------------------
8 //	This program is free software; you can redistribute it and/or modify
9 //	it under the terms of the GNU General Public License as published by
10 //	the Free Software Foundation; either version 2 of the License, or
11 //	(at your option) any later version. See also the license.txt file for
12 //	additional informations.
13 //---------------------------------------------------------------------------
14 
15 #ifndef __INTERRUPT__
16 #define __INTERRUPT__
17 
18 #include <boolean.h>
19 #include <stdint.h>
20 
21 #define TIMER_HINT_RATE		515		/* CPU Ticks between horizontal interrupts */
22 
23 #define TIMER_BASE_RATE		32 		/* ticks */
24 
25 #define TIMER_T1_RATE		(8    * TIMER_BASE_RATE)
26 #define TIMER_T4_RATE		(32   * TIMER_BASE_RATE)
27 #define TIMER_T16_RATE		(128  * TIMER_BASE_RATE)
28 #define TIMER_T256_RATE		(2048 * TIMER_BASE_RATE)
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 /* Set this value to fix problems with glitching extra lines. */
35 extern bool gfx_hack;
36 
37 void interrupt(uint8_t index, uint8_t level);
38 void set_interrupt(uint8_t index, bool set);
39 
40 void reset_timers(void);
41 void reset_int(void);
42 
43 /* Call this after each instruction */
44 bool updateTimers(void *data, int cputicks);
45 
46 /* H-INT Timer */
47 extern uint32_t timer_hint;
48 
49 void timer_write8(uint32_t address, uint8_t data);
50 uint8_t timer_read8(uint32_t address);
51 
52 void int_write8(uint32_t address, uint8_t data);
53 uint8_t int_read8(uint32_t address);
54 void int_check_pending(void);
55 void TestIntHDMA(int bios_num, int vec_num);
56 
57 int int_timer_StateAction(void *data, int load, int data_only);
58 
59 #ifdef __cplusplus
60 }
61 #endif
62 
63 #endif
64