/***************************************************************************************1* Genesis Plus2* Virtual System emulation3*4* Support for "Genesis", "Genesis + CD" & "Master System" modes5*6* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)7* Copyright (C) 2007-2013 Eke-Eke (Genesis Plus GX)8*9* Redistribution and use of this code or any derivative works are permitted10* provided that the following conditions are met:11*12* - Redistributions may not be sold, nor may they be used in a commercial13* product or activity.14*15* - Redistributions that are modified from the original source must include the16* complete source code, including the source code for all components used by a17* binary built from the modified sources. However, as a special exception, the18* source code distributed need not include anything that is normally distributed19* (in either source or binary form) with the major components (compiler, kernel,20* and so on) of the operating system on which the executable runs, unless that21* component itself accompanies the executable.22*23* - Redistributions must reproduce the above copyright notice, this list of24* conditions and the following disclaimer in the documentation and/or other25* materials provided with the distribution.26*27* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"28* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE29* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE30* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE31* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR32* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF33* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS34* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN35* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)36* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE37* POSSIBILITY OF SUCH DAMAGE.38*39****************************************************************************************/4041#ifndef _SYSTEM_H_42#define _SYSTEM_H_4344#include "blip_buf.h"4546/* Supported hardware models */47#define SYSTEM_SG 0x1048#define SYSTEM_MARKIII 0x1149#define SYSTEM_SMS 0x2050#define SYSTEM_SMS2 0x2151#define SYSTEM_GG 0x4052#define SYSTEM_GGMS 0x4153#define SYSTEM_MD 0x8054#define SYSTEM_PBC 0x8155#define SYSTEM_PICO 0x8256#define SYSTEM_MCD 0x845758/* NTSC & PAL Master Clock frequencies */59#define MCLOCK_NTSC 5369317560#define MCLOCK_PAL 532034246162/* Number of M-Cycles executed per line */63#define MCYCLES_PER_LINE 34206465/* Horizontal timing offsets when running in Z80 mode */66#define SMS_CYCLE_OFFSET 53067#define PBC_CYCLE_OFFSET 5606869typedef struct70{71uint8 *data; /* Bitmap data */72int width; /* Bitmap width */73int height; /* Bitmap height */74int pitch; /* Bitmap pitch */75struct76{77int x; /* X offset of viewport within bitmap */78int y; /* Y offset of viewport within bitmap */79int w; /* Width of viewport */80int h; /* Height of viewport */81int ow; /* Previous width of viewport */82int oh; /* Previous height of viewport */83int changed; /* 1= Viewport width or height have changed */84} viewport;85} t_bitmap;8687typedef struct88{89int sample_rate; /* Output Sample rate (8000-48000) */90double frame_rate; /* Output Frame rate (usually 50 or 60 frames per second) */91int enabled; /* 1= sound emulation is enabled */92blip_t* blips[3][2]; /* Blip Buffer resampling */93} t_snd;949596/* Global variables */97extern t_bitmap bitmap;98extern t_snd snd;99extern uint32 mcycles_vdp;100extern const int16 SVP_cycles;101extern uint8 system_hw;102extern uint8 system_bios;103extern uint32 system_clock;104105/* Function prototypes */106extern int audio_init(int samplerate, double framerate);107extern void audio_reset(void);108extern void audio_shutdown(void);109extern int audio_update(int16 *buffer);110extern void audio_set_equalizer(void);111extern void system_init(void);112extern void system_reset(void);113extern void system_frame_gen(int do_skip);114extern void system_frame_scd(int do_skip);115extern void system_frame_sms(int do_skip);116117#endif /* _SYSTEM_H_ */118119120121