/***************************************************************************

	ncdz.c

	NEOGEO CDZ emulation core.

***************************************************************************/

#ifndef NCDZ_H
#define NCDZ_H

#include "psp/psp.h"
#include "timer.h"
#include "memintrf.h"
#include "inptport.h"
#include "state.h"
#include "drivers/driver.h"
#include "cpu/m68000/m68000.h"
#include "cpu/z80/z80.h"
#include "machine/cdda.h"
#include "machine/cdrom.h"
#include "vidhrdw/vidhrdw.h"
#include "vidhrdw/sprite.h"
#include "sound/sndintrf.h"
#include "sound/2610intf.h"


#define FPS				60
//#define FPS			(15625.0/264.0)

#define PSP_REFRESHRATE	59.9369	// avarage


#define M68K_CLOCKS		12000000
#define Z80_CLOCKS		 4000000

#define SECS_PER_SCANLINE (TIME_IN_HZ(FPS) / (double)RASTER_LINES)


enum
{
	/* line states */
	CLEAR_LINE = 0,				/* clear (a fired, held or pulsed) line */
	ASSERT_LINE,				/* assert an interrupt immediately */
	HOLD_LINE,					/* hold interrupt line until acknowledged */
	PULSE_LINE,					/* pulse interrupt line for one instruction */

	/* internal flags (not for use by drivers!) */
	INTERNAL_CLEAR_LINE = 100 + CLEAR_LINE,
	INTERNAL_ASSERT_LINE = 100 + ASSERT_LINE,

	/* interrupt parameters */
	MAX_IRQ_LINES =	8,			/* maximum number of IRQ lines per CPU */
	IRQ_LINE_NMI = 127			/* IRQ line for NMIs */
};


extern int neogeo_region;
extern int neogeo_showfps;
extern int neogeo_autoframeskip;
extern int neogeo_autoframeskip_limit;
extern int neogeo_frameskip;
extern int neogeo_speedlimit;
extern int neogeo_vsync;

extern int neogeo_boot_bios;
extern u32 frames_displayed;

extern char	global_error[80];

void init_autoframeskip(void);
void show_loading_image(void);

void neogeo_main(void);
void neogeo_restart(void);
void neogeo_exit(void);
void show_fps(void);
void ui_popup(const char *text, ...);
void ui_show_popup(void);

#ifdef DEBUG
void logerror(const char *text, ...);
#endif

#endif /* NCDZ_H */
