Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/genplus-gx/core/system.h
2 views
1
/***************************************************************************************
2
* Genesis Plus
3
* Virtual System emulation
4
*
5
* Support for "Genesis", "Genesis + CD" & "Master System" modes
6
*
7
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
8
* Copyright (C) 2007-2013 Eke-Eke (Genesis Plus GX)
9
*
10
* Redistribution and use of this code or any derivative works are permitted
11
* provided that the following conditions are met:
12
*
13
* - Redistributions may not be sold, nor may they be used in a commercial
14
* product or activity.
15
*
16
* - Redistributions that are modified from the original source must include the
17
* complete source code, including the source code for all components used by a
18
* binary built from the modified sources. However, as a special exception, the
19
* source code distributed need not include anything that is normally distributed
20
* (in either source or binary form) with the major components (compiler, kernel,
21
* and so on) of the operating system on which the executable runs, unless that
22
* component itself accompanies the executable.
23
*
24
* - Redistributions must reproduce the above copyright notice, this list of
25
* conditions and the following disclaimer in the documentation and/or other
26
* materials provided with the distribution.
27
*
28
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
29
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
32
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
33
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
34
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
35
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
36
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
37
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38
* POSSIBILITY OF SUCH DAMAGE.
39
*
40
****************************************************************************************/
41
42
#ifndef _SYSTEM_H_
43
#define _SYSTEM_H_
44
45
#include "blip_buf.h"
46
47
/* Supported hardware models */
48
#define SYSTEM_SG 0x10
49
#define SYSTEM_MARKIII 0x11
50
#define SYSTEM_SMS 0x20
51
#define SYSTEM_SMS2 0x21
52
#define SYSTEM_GG 0x40
53
#define SYSTEM_GGMS 0x41
54
#define SYSTEM_MD 0x80
55
#define SYSTEM_PBC 0x81
56
#define SYSTEM_PICO 0x82
57
#define SYSTEM_MCD 0x84
58
59
/* NTSC & PAL Master Clock frequencies */
60
#define MCLOCK_NTSC 53693175
61
#define MCLOCK_PAL 53203424
62
63
/* Number of M-Cycles executed per line */
64
#define MCYCLES_PER_LINE 3420
65
66
/* Horizontal timing offsets when running in Z80 mode */
67
#define SMS_CYCLE_OFFSET 530
68
#define PBC_CYCLE_OFFSET 560
69
70
typedef struct
71
{
72
uint8 *data; /* Bitmap data */
73
int width; /* Bitmap width */
74
int height; /* Bitmap height */
75
int pitch; /* Bitmap pitch */
76
struct
77
{
78
int x; /* X offset of viewport within bitmap */
79
int y; /* Y offset of viewport within bitmap */
80
int w; /* Width of viewport */
81
int h; /* Height of viewport */
82
int ow; /* Previous width of viewport */
83
int oh; /* Previous height of viewport */
84
int changed; /* 1= Viewport width or height have changed */
85
} viewport;
86
} t_bitmap;
87
88
typedef struct
89
{
90
int sample_rate; /* Output Sample rate (8000-48000) */
91
double frame_rate; /* Output Frame rate (usually 50 or 60 frames per second) */
92
int enabled; /* 1= sound emulation is enabled */
93
blip_t* blips[3][2]; /* Blip Buffer resampling */
94
} t_snd;
95
96
97
/* Global variables */
98
extern t_bitmap bitmap;
99
extern t_snd snd;
100
extern uint32 mcycles_vdp;
101
extern const int16 SVP_cycles;
102
extern uint8 system_hw;
103
extern uint8 system_bios;
104
extern uint32 system_clock;
105
106
/* Function prototypes */
107
extern int audio_init(int samplerate, double framerate);
108
extern void audio_reset(void);
109
extern void audio_shutdown(void);
110
extern int audio_update(int16 *buffer);
111
extern void audio_set_equalizer(void);
112
extern void system_init(void);
113
extern void system_reset(void);
114
extern void system_frame_gen(int do_skip);
115
extern void system_frame_scd(int do_skip);
116
extern void system_frame_sms(int do_skip);
117
118
#endif /* _SYSTEM_H_ */
119
120
121