Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/genplus-gx32/core/cd_hw/gfx.h
2 views
1
/***************************************************************************************
2
* Genesis Plus
3
* CD graphics processor
4
*
5
* Copyright (C) 2012 Eke-Eke (Genesis Plus GX)
6
*
7
* Redistribution and use of this code or any derivative works are permitted
8
* provided that the following conditions are met:
9
*
10
* - Redistributions may not be sold, nor may they be used in a commercial
11
* product or activity.
12
*
13
* - Redistributions that are modified from the original source must include the
14
* complete source code, including the source code for all components used by a
15
* binary built from the modified sources. However, as a special exception, the
16
* source code distributed need not include anything that is normally distributed
17
* (in either source or binary form) with the major components (compiler, kernel,
18
* and so on) of the operating system on which the executable runs, unless that
19
* component itself accompanies the executable.
20
*
21
* - Redistributions must reproduce the above copyright notice, this list of
22
* conditions and the following disclaimer in the documentation and/or other
23
* materials provided with the distribution.
24
*
25
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
29
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35
* POSSIBILITY OF SUCH DAMAGE.
36
*
37
****************************************************************************************/
38
#ifndef _CD_GFX_
39
#define _CD_GFX_
40
41
#define gfx scd.gfx_hw
42
43
typedef struct
44
{
45
uint32 cycles; /* current cycles count for graphics operation */
46
uint32 cyclesPerLine; /* current graphics operation timings */
47
uint32 dotMask; /* stamp map size mask */
48
uint16 *tracePtr; /* trace vector pointer */
49
uint16 *mapPtr; /* stamp map table base address */
50
uint8 stampShift; /* stamp pixel shift value (related to stamp size) */
51
uint8 mapShift; /* stamp map table shift value (related to stamp map size) */
52
uint16 bufferOffset; /* image buffer column offset */
53
uint32 bufferStart; /* image buffer start index */
54
uint16 lut_offset[0x8000]; /* Cell Image -> WORD-RAM offset lookup table (1M Mode) */
55
uint8 lut_prio[4][0x100][0x100]; /* WORD-RAM data writes priority lookup table */
56
uint8 lut_pixel[0x200]; /* Graphics operation dot offset lookup table */
57
uint8 lut_cell[0x100]; /* Graphics operation stamp offset lookup table */
58
} gfx_t;
59
60
61
/***************************************************************/
62
/* WORD-RAM DMA interfaces (1M & 2M modes) */
63
/***************************************************************/
64
extern void word_ram_0_dma_w(unsigned int words);
65
extern void word_ram_1_dma_w(unsigned int words);
66
extern void word_ram_2M_dma_w(unsigned int words);
67
68
/***************************************************************/
69
/* WORD-RAM 0 & 1 CPU interfaces (1M mode) */
70
/***************************************************************/
71
extern unsigned int word_ram_0_read16(unsigned int address);
72
extern unsigned int word_ram_1_read16(unsigned int address);
73
extern void word_ram_0_write16(unsigned int address, unsigned int data);
74
extern void word_ram_1_write16(unsigned int address, unsigned int data);
75
extern unsigned int word_ram_0_read8(unsigned int address);
76
extern unsigned int word_ram_1_read8(unsigned int address);
77
extern void word_ram_0_write8(unsigned int address, unsigned int data);
78
extern void word_ram_1_write8(unsigned int address, unsigned int data);
79
80
/***************************************************************/
81
/* WORD-RAM 0 & 1 DOT image SUB-CPU interface (1M mode) */
82
/***************************************************************/
83
extern unsigned int dot_ram_0_read16(unsigned int address);
84
extern unsigned int dot_ram_1_read16(unsigned int address);
85
extern void dot_ram_0_write16(unsigned int address, unsigned int data);
86
extern void dot_ram_1_write16(unsigned int address, unsigned int data);
87
extern unsigned int dot_ram_0_read8(unsigned int address);
88
extern unsigned int dot_ram_1_read8(unsigned int address);
89
extern void dot_ram_0_write8(unsigned int address, unsigned int data);
90
extern void dot_ram_1_write8(unsigned int address, unsigned int data);
91
92
93
/***************************************************************/
94
/* WORD-RAM 0 & 1 CELL image MAIN-CPU interface (1M mode) */
95
/***************************************************************/
96
extern unsigned int cell_ram_0_read16(unsigned int address);
97
extern unsigned int cell_ram_1_read16(unsigned int address);
98
extern void cell_ram_0_write16(unsigned int address, unsigned int data);
99
extern void cell_ram_1_write16(unsigned int address, unsigned int data);
100
extern unsigned int cell_ram_0_read8(unsigned int address);
101
extern unsigned int cell_ram_1_read8(unsigned int address);
102
extern void cell_ram_0_write8(unsigned int address, unsigned int data);
103
extern void cell_ram_1_write8(unsigned int address, unsigned int data);
104
105
106
/***************************************************************/
107
/* Rotation / Scaling operation (2M mode) */
108
/***************************************************************/
109
extern void gfx_init(void);
110
extern void gfx_reset(void);
111
extern int gfx_context_save(uint8 *state);
112
extern int gfx_context_load(uint8 *state);
113
extern void gfx_start(unsigned int base, int cycles);
114
extern void gfx_update(int cycles);
115
116
#endif
117
118