comparison vdp.h @ 744:fc68992cf18d

Merge windows branch with latest changes
author Michael Pavone <pavone@retrodev.com>
date Thu, 28 May 2015 21:19:55 -0700
parents 8f5339961903
children 252dfd29831d
comparison
equal deleted inserted replaced
743:cf78cb045fa4 744:fc68992cf18d
47 47
48 #define FLAG2_VINT_PENDING 0x01 48 #define FLAG2_VINT_PENDING 0x01
49 #define FLAG2_HINT_PENDING 0x02 49 #define FLAG2_HINT_PENDING 0x02
50 #define FLAG2_READ_PENDING 0x04 50 #define FLAG2_READ_PENDING 0x04
51 #define FLAG2_SPRITE_COLLIDE 0x08 51 #define FLAG2_SPRITE_COLLIDE 0x08
52 #define FLAG2_REGION_PAL 0x10
52 53
53 #define DISPLAY_ENABLE 0x40 54 #define DISPLAY_ENABLE 0x40
54 55
55 enum { 56 enum {
56 REG_MODE_1=0, 57 REG_MODE_1=0,
129 uint8_t cd; 130 uint8_t cd;
130 uint8_t flags; 131 uint8_t flags;
131 uint8_t regs[VDP_REGS]; 132 uint8_t regs[VDP_REGS];
132 //cycle count in MCLKs 133 //cycle count in MCLKs
133 uint32_t cycles; 134 uint32_t cycles;
135 uint32_t pending_vint_start;
136 uint32_t pending_hint_start;
134 uint8_t *vdpmem; 137 uint8_t *vdpmem;
135 //stores 2-bit palette + 4-bit palette index + priority for current sprite line 138 //stores 2-bit palette + 4-bit palette index + priority for current sprite line
136 uint8_t *linebuf; 139 uint8_t *linebuf;
137 //stores 12-bit color + shadow/highlight bits 140 //stores 12-bit color + shadow/highlight bits
138 void *framebuf; 141 void *framebuf;
140 void *evenbuf; 143 void *evenbuf;
141 uint16_t cram[CRAM_SIZE]; 144 uint16_t cram[CRAM_SIZE];
142 uint32_t colors[CRAM_SIZE*3]; 145 uint32_t colors[CRAM_SIZE*3];
143 uint32_t debugcolors[1 << (3 + 1 + 1 + 1)];//3 bits for source, 1 bit for priority, 1 bit for shadow, 1 bit for hilight 146 uint32_t debugcolors[1 << (3 + 1 + 1 + 1)];//3 bits for source, 1 bit for priority, 1 bit for shadow, 1 bit for hilight
144 uint16_t vsram[VSRAM_SIZE]; 147 uint16_t vsram[VSRAM_SIZE];
145 uint8_t latched_mode; 148 uint16_t vscroll_latch[2];
149 uint32_t frame;
150 uint16_t vcounter;
151 uint16_t hslot; //hcounter/2
146 uint16_t hscroll_a; 152 uint16_t hscroll_a;
147 uint16_t hscroll_b; 153 uint16_t hscroll_b;
154 uint8_t latched_mode;
148 uint8_t sprite_index; 155 uint8_t sprite_index;
149 uint8_t sprite_draws; 156 uint8_t sprite_draws;
150 int8_t slot_counter; 157 int8_t slot_counter;
151 int8_t cur_slot; 158 int8_t cur_slot;
152 sprite_draw sprite_draw_list[MAX_DRAWS]; 159 sprite_draw sprite_draw_list[MAX_DRAWS];
161 uint8_t double_res; 168 uint8_t double_res;
162 uint8_t b32; 169 uint8_t b32;
163 uint8_t buf_a_off; 170 uint8_t buf_a_off;
164 uint8_t buf_b_off; 171 uint8_t buf_b_off;
165 uint8_t debug; 172 uint8_t debug;
173 uint8_t debug_pal;
166 uint8_t *tmp_buf_a; 174 uint8_t *tmp_buf_a;
167 uint8_t *tmp_buf_b; 175 uint8_t *tmp_buf_b;
168 } vdp_context; 176 } vdp_context;
169 177
170 void init_vdp_context(vdp_context * context); 178 void init_vdp_context(vdp_context * context, uint8_t region_pal);
171 void vdp_run_context(vdp_context * context, uint32_t target_cycles); 179 void vdp_run_context(vdp_context * context, uint32_t target_cycles);
172 //runs from current cycle count to VBLANK for the current mode, returns ending cycle count 180 //runs from current cycle count to VBLANK for the current mode, returns ending cycle count
173 uint32_t vdp_run_to_vblank(vdp_context * context); 181 uint32_t vdp_run_to_vblank(vdp_context * context);
174 //runs until the target cycle is reached or the current DMA operation has completed, whicever comes first 182 //runs until the target cycle is reached or the current DMA operation has completed, whicever comes first
175 void vdp_run_dma_done(vdp_context * context, uint32_t target_cycles); 183 void vdp_run_dma_done(vdp_context * context, uint32_t target_cycles);
188 uint32_t vdp_next_vint_z80(vdp_context * context); 196 uint32_t vdp_next_vint_z80(vdp_context * context);
189 void vdp_int_ack(vdp_context * context, uint16_t int_num); 197 void vdp_int_ack(vdp_context * context, uint16_t int_num);
190 void vdp_print_sprite_table(vdp_context * context); 198 void vdp_print_sprite_table(vdp_context * context);
191 void vdp_print_reg_explain(vdp_context * context); 199 void vdp_print_reg_explain(vdp_context * context);
192 void latch_mode(vdp_context * context); 200 void latch_mode(vdp_context * context);
201 uint32_t vdp_cycles_to_frame_end(vdp_context * context);
202 uint32_t vdp_frame_end_line(vdp_context *context);
193 203
194 extern int32_t color_map[1 << 12]; 204 extern int32_t color_map[1 << 12];
195 205
196 #endif //VDP_H_ 206 #endif //VDP_H_