Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/genplus-gx/core/vdp_ctrl.h
2 views
1
/***************************************************************************************
2
* Genesis Plus
3
* Video Display Processor (68k & Z80 CPU interface)
4
*
5
* Support for SG-1000, Master System (315-5124 & 315-5246), Game Gear & Mega Drive VDP
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 _VDP_H_
43
#define _VDP_H_
44
45
/* VDP context */
46
extern uint8 reg[0x20];
47
extern uint8 sat[0x400];
48
extern uint8 vram[0x10000];
49
extern uint8 cram[0x80];
50
extern uint8 vsram[0x80];
51
extern uint8 hint_pending;
52
extern uint8 vint_pending;
53
extern uint16 status;
54
extern uint32 dma_length;
55
56
/* Global variables */
57
extern uint16 ntab;
58
extern uint16 ntbb;
59
extern uint16 ntwb;
60
extern uint16 satb;
61
extern uint16 hscb;
62
extern uint8 bg_name_dirty[0x800];
63
extern uint16 bg_name_list[0x800];
64
extern uint16 bg_list_index;
65
extern uint8 hscroll_mask;
66
extern uint8 playfield_shift;
67
extern uint8 playfield_col_mask;
68
extern uint16 playfield_row_mask;
69
extern uint8 odd_frame;
70
extern uint8 im2_flag;
71
extern uint8 interlaced;
72
extern uint8 vdp_pal;
73
extern uint16 v_counter;
74
extern uint16 vc_max;
75
extern uint16 vscroll;
76
extern uint16 lines_per_frame;
77
extern uint16 max_sprite_pixels;
78
extern int32 fifo_write_cnt;
79
extern uint32 fifo_slots;
80
extern uint32 hvc_latch;
81
extern const uint8 *hctab;
82
83
/* Function pointers */
84
extern void (*vdp_68k_data_w)(unsigned int data);
85
extern void (*vdp_z80_data_w)(unsigned int data);
86
extern unsigned int (*vdp_68k_data_r)(void);
87
extern unsigned int (*vdp_z80_data_r)(void);
88
89
/* Function prototypes */
90
extern void vdp_init(void);
91
extern void vdp_reset(void);
92
extern int vdp_context_save(uint8 *state);
93
extern int vdp_context_load(uint8 *state, uint8 version);
94
extern void vdp_dma_update(unsigned int cycles);
95
extern void vdp_68k_ctrl_w(unsigned int data);
96
extern void vdp_z80_ctrl_w(unsigned int data);
97
extern void vdp_sms_ctrl_w(unsigned int data);
98
extern void vdp_tms_ctrl_w(unsigned int data);
99
extern unsigned int vdp_68k_ctrl_r(unsigned int cycles);
100
extern unsigned int vdp_z80_ctrl_r(unsigned int cycles);
101
extern unsigned int vdp_hvc_r(unsigned int cycles);
102
extern void vdp_test_w(unsigned int data);
103
extern int vdp_68k_irq_ack(int int_level);
104
105
void write_vram_byte(int addr, uint8 val);
106
void flush_vram_cache(void);
107
108
#endif /* _VDP_H_ */
109
110