Mercurial > repos > blastem
comparison vdp.h @ 1648:b7ecd0d6a77b mame_interp
Merge from default
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 25 Dec 2018 11:12:26 -0800 |
parents | 6909c5d0bbb5 |
children | b500e971da75 |
comparison
equal
deleted
inserted
replaced
1509:36732f5c2281 | 1648:b7ecd0d6a77b |
---|---|
17 #define VRAM_SIZE (64*1024) | 17 #define VRAM_SIZE (64*1024) |
18 #define BORDER_LEFT 13 | 18 #define BORDER_LEFT 13 |
19 #define BORDER_RIGHT 14 | 19 #define BORDER_RIGHT 14 |
20 #define HORIZ_BORDER (BORDER_LEFT+BORDER_RIGHT) | 20 #define HORIZ_BORDER (BORDER_LEFT+BORDER_RIGHT) |
21 #define LINEBUF_SIZE (320+HORIZ_BORDER) //H40 + full border | 21 #define LINEBUF_SIZE (320+HORIZ_BORDER) //H40 + full border |
22 #define SCROLL_BUFFER_SIZE 32 | |
22 #define BORDER_BOTTOM 13 //TODO: Replace with actual value | 23 #define BORDER_BOTTOM 13 //TODO: Replace with actual value |
23 #define MAX_DRAWS 40 | 24 #define MAX_DRAWS 40 |
24 #define MAX_DRAWS_H32 32 | 25 #define MAX_DRAWS_H32 32 |
25 #define MAX_DRAWS_H32_MODE4 8 | 26 #define MAX_DRAWS_H32_MODE4 8 |
26 #define MAX_SPRITES_LINE 20 | 27 #define MAX_SPRITES_LINE 20 |
145 uint16_t value; | 146 uint16_t value; |
146 uint8_t cd; | 147 uint8_t cd; |
147 uint8_t partial; | 148 uint8_t partial; |
148 } fifo_entry; | 149 } fifo_entry; |
149 | 150 |
150 typedef struct { | 151 enum { |
151 fifo_entry fifo[FIFO_SIZE]; | 152 VDP_DEBUG_PLANE, |
152 int32_t fifo_write; | 153 VDP_DEBUG_VRAM, |
153 int32_t fifo_read; | 154 VDP_DEBUG_CRAM, |
154 uint32_t address; | 155 VDP_DEBUG_COMPOSITE, |
155 uint32_t serial_address; | 156 VDP_NUM_DEBUG_TYPES |
156 uint8_t cd; | 157 }; |
157 uint8_t flags; | 158 |
158 uint8_t regs[VDP_REGS]; | 159 typedef struct { |
160 system_header *system; | |
161 //pointer to current line in framebuffer | |
162 uint32_t *output; | |
163 uint32_t *done_output; | |
164 //pointer to current framebuffer | |
165 uint32_t *fb; | |
166 uint32_t *debug_fbs[VDP_NUM_DEBUG_TYPES]; | |
167 uint32_t output_pitch; | |
168 uint32_t debug_fb_pitch[VDP_NUM_DEBUG_TYPES]; | |
169 fifo_entry fifo[FIFO_SIZE]; | |
170 int32_t fifo_write; | |
171 int32_t fifo_read; | |
172 uint32_t address; | |
173 uint32_t serial_address; | |
174 uint32_t colors[CRAM_SIZE*4]; | |
175 uint32_t debugcolors[1 << (3 + 1 + 1 + 1)];//3 bits for source, 1 bit for priority, 1 bit for shadow, 1 bit for hilight | |
176 uint16_t cram[CRAM_SIZE]; | |
177 uint32_t frame; | |
178 uint8_t cd; | |
179 uint8_t flags; | |
180 uint8_t regs[VDP_REGS]; | |
159 //cycle count in MCLKs | 181 //cycle count in MCLKs |
160 uint32_t cycles; | 182 uint32_t cycles; |
161 uint32_t pending_vint_start; | 183 uint32_t pending_vint_start; |
162 uint32_t pending_hint_start; | 184 uint32_t pending_hint_start; |
163 uint8_t *vdpmem; | 185 uint16_t vsram[VSRAM_SIZE]; |
186 uint16_t vscroll_latch[2]; | |
187 uint16_t vcounter; | |
188 uint16_t inactive_start; | |
189 uint16_t border_top; | |
190 uint16_t border_bot; | |
191 uint16_t hscroll_a; | |
192 uint16_t hscroll_b; | |
193 uint16_t h40_lines; | |
194 uint16_t output_lines; | |
195 sprite_draw sprite_draw_list[MAX_DRAWS]; | |
196 sprite_info sprite_info_list[MAX_SPRITES_LINE]; | |
197 uint8_t sat_cache[SAT_CACHE_SIZE]; | |
198 uint16_t col_1; | |
199 uint16_t col_2; | |
200 uint16_t hv_latch; | |
201 uint16_t prefetch; | |
202 uint16_t test_port; | |
164 //stores 2-bit palette + 4-bit palette index + priority for current sprite line | 203 //stores 2-bit palette + 4-bit palette index + priority for current sprite line |
165 uint8_t *linebuf; | 204 uint8_t linebuf[LINEBUF_SIZE]; |
166 //pointer to current line in framebuffer | 205 uint8_t layer_debug_buf[LINEBUF_SIZE]; |
167 uint32_t *output; | 206 uint8_t hslot; //hcounter/2 |
168 uint32_t *done_output; | 207 uint8_t sprite_index; |
169 uint32_t *fb; | 208 uint8_t sprite_draws; |
170 system_header *system; | 209 int8_t slot_counter; |
171 uint16_t cram[CRAM_SIZE]; | 210 int8_t cur_slot; |
172 uint32_t colors[CRAM_SIZE*4]; | 211 uint8_t max_sprites_frame; |
173 uint32_t debugcolors[1 << (3 + 1 + 1 + 1)];//3 bits for source, 1 bit for priority, 1 bit for shadow, 1 bit for hilight | 212 uint8_t max_sprites_line; |
174 uint16_t vsram[VSRAM_SIZE]; | 213 uint8_t fetch_tmp[2]; |
175 uint16_t vscroll_latch[2]; | 214 uint8_t v_offset; |
176 uint32_t output_pitch; | 215 uint8_t hint_counter; |
177 uint32_t frame; | 216 uint8_t flags2; |
178 uint16_t vcounter; | 217 uint8_t double_res; |
179 uint16_t inactive_start; | 218 uint8_t buf_a_off; |
180 uint16_t border_top; | 219 uint8_t buf_b_off; |
181 uint16_t border_bot; | 220 uint8_t pending_byte; |
182 uint16_t hscroll_a; | 221 uint8_t state; |
183 uint16_t hscroll_b; | 222 uint8_t cur_buffer; |
184 uint16_t h40_lines; | 223 uint8_t tmp_buf_a[SCROLL_BUFFER_SIZE]; |
185 uint16_t output_lines; | 224 uint8_t tmp_buf_b[SCROLL_BUFFER_SIZE]; |
186 sprite_draw sprite_draw_list[MAX_DRAWS]; | 225 uint8_t enabled_debuggers; |
187 sprite_info sprite_info_list[MAX_SPRITES_LINE]; | 226 uint8_t debug_fb_indices[VDP_NUM_DEBUG_TYPES]; |
188 uint8_t sat_cache[SAT_CACHE_SIZE]; | 227 uint8_t debug_modes[VDP_NUM_DEBUG_TYPES]; |
189 uint16_t col_1; | 228 uint8_t vdpmem[]; |
190 uint16_t col_2; | |
191 uint16_t hv_latch; | |
192 uint16_t prefetch; | |
193 uint16_t test_port; | |
194 uint8_t hslot; //hcounter/2 | |
195 uint8_t sprite_index; | |
196 uint8_t sprite_draws; | |
197 int8_t slot_counter; | |
198 int8_t cur_slot; | |
199 uint8_t max_sprites_frame; | |
200 uint8_t max_sprites_line; | |
201 uint8_t fetch_tmp[2]; | |
202 uint8_t v_offset; | |
203 uint8_t hint_counter; | |
204 uint8_t flags2; | |
205 uint8_t double_res; | |
206 uint8_t buf_a_off; | |
207 uint8_t buf_b_off; | |
208 uint8_t debug; | |
209 uint8_t debug_pal; | |
210 uint8_t pending_byte; | |
211 uint8_t state; | |
212 uint8_t cur_buffer; | |
213 uint8_t *tmp_buf_a; | |
214 uint8_t *tmp_buf_b; | |
215 } vdp_context; | 229 } vdp_context; |
216 | 230 |
217 void init_vdp_context(vdp_context * context, uint8_t region_pal); | 231 |
232 | |
233 vdp_context *init_vdp_context(uint8_t region_pal); | |
218 void vdp_free(vdp_context *context); | 234 void vdp_free(vdp_context *context); |
219 void vdp_run_context_full(vdp_context * context, uint32_t target_cycles); | 235 void vdp_run_context_full(vdp_context * context, uint32_t target_cycles); |
220 void vdp_run_context(vdp_context * context, uint32_t target_cycles); | 236 void vdp_run_context(vdp_context * context, uint32_t target_cycles); |
221 //runs from current cycle count to VBLANK for the current mode, returns ending cycle count | 237 //runs from current cycle count to VBLANK for the current mode, returns ending cycle count |
222 uint32_t vdp_run_to_vblank(vdp_context * context); | 238 uint32_t vdp_run_to_vblank(vdp_context * context); |
250 void vdp_pbc_pause(vdp_context *context); | 266 void vdp_pbc_pause(vdp_context *context); |
251 void vdp_release_framebuffer(vdp_context *context); | 267 void vdp_release_framebuffer(vdp_context *context); |
252 void vdp_reacquire_framebuffer(vdp_context *context); | 268 void vdp_reacquire_framebuffer(vdp_context *context); |
253 void vdp_serialize(vdp_context *context, serialize_buffer *buf); | 269 void vdp_serialize(vdp_context *context, serialize_buffer *buf); |
254 void vdp_deserialize(deserialize_buffer *buf, void *vcontext); | 270 void vdp_deserialize(deserialize_buffer *buf, void *vcontext); |
271 void vdp_force_update_framebuffer(vdp_context *context); | |
272 void vdp_toggle_debug_view(vdp_context *context, uint8_t debug_type); | |
273 void vdp_inc_debug_mode(vdp_context *context); | |
255 | 274 |
256 #endif //VDP_H_ | 275 #endif //VDP_H_ |