/***************************************************************************************1* Genesis Plus2* Video Display Processor (68k & Z80 CPU interface)3*4* Support for SG-1000, Master System (315-5124 & 315-5246), Game Gear & Mega Drive VDP5*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 _VDP_H_42#define _VDP_H_4344/* VDP context */45extern uint8 reg[0x20];46extern uint8 sat[0x400];47extern uint8 vram[0x10000];48extern uint8 cram[0x80];49extern uint8 vsram[0x80];50extern uint8 hint_pending;51extern uint8 vint_pending;52extern uint16 status;53extern uint32 dma_length;5455/* Global variables */56extern uint16 ntab;57extern uint16 ntbb;58extern uint16 ntwb;59extern uint16 satb;60extern uint16 hscb;61extern uint8 bg_name_dirty[0x800];62extern uint16 bg_name_list[0x800];63extern uint16 bg_list_index;64extern uint8 hscroll_mask;65extern uint8 playfield_shift;66extern uint8 playfield_col_mask;67extern uint16 playfield_row_mask;68extern uint8 odd_frame;69extern uint8 im2_flag;70extern uint8 interlaced;71extern uint8 vdp_pal;72extern uint16 v_counter;73extern uint16 vc_max;74extern uint16 vscroll;75extern uint16 lines_per_frame;76extern uint16 max_sprite_pixels;77extern int32 fifo_write_cnt;78extern uint32 fifo_slots;79extern uint32 hvc_latch;80extern const uint8 *hctab;8182/* Function pointers */83extern void (*vdp_68k_data_w)(unsigned int data);84extern void (*vdp_z80_data_w)(unsigned int data);85extern unsigned int (*vdp_68k_data_r)(void);86extern unsigned int (*vdp_z80_data_r)(void);8788/* Function prototypes */89extern void vdp_init(void);90extern void vdp_reset(void);91extern void vdp_dma_update(unsigned int cycles);92extern void vdp_68k_ctrl_w(unsigned int data);93extern void vdp_z80_ctrl_w(unsigned int data);94extern void vdp_sms_ctrl_w(unsigned int data);95extern void vdp_tms_ctrl_w(unsigned int data);96extern unsigned int vdp_68k_ctrl_r(unsigned int cycles);97extern unsigned int vdp_z80_ctrl_r(unsigned int cycles);98extern unsigned int vdp_hvc_r(unsigned int cycles);99extern void vdp_test_w(unsigned int data);100extern int vdp_68k_irq_ack(int int_level);101102void write_vram_byte(int addr, uint8 val);103void flush_vram_cache(void);104void vdp_invalidate_full_cache(void);105106#endif /* _VDP_H_ */107108109