comparison vdp.h @ 1906:2d462aa78349

Make VDP VSRAM capacity respect model selection
author Michael Pavone <pavone@retrodev.com>
date Thu, 27 Feb 2020 18:38:15 -0800
parents 7bb4081e9e52
children 039553703c20
comparison
equal deleted inserted replaced
1905:1ec6931d0a49 1906:2d462aa78349
14 #define VDP_REGS 24 14 #define VDP_REGS 24
15 #define CRAM_SIZE 64 15 #define CRAM_SIZE 64
16 #define SHADOW_OFFSET CRAM_SIZE 16 #define SHADOW_OFFSET CRAM_SIZE
17 #define HIGHLIGHT_OFFSET (SHADOW_OFFSET+CRAM_SIZE) 17 #define HIGHLIGHT_OFFSET (SHADOW_OFFSET+CRAM_SIZE)
18 #define MODE4_OFFSET (HIGHLIGHT_OFFSET+CRAM_SIZE) 18 #define MODE4_OFFSET (HIGHLIGHT_OFFSET+CRAM_SIZE)
19 #define VSRAM_SIZE 40 19 #define MIN_VSRAM_SIZE 40
20 #define MAX_VSRAM_SIZE 64
20 #define VRAM_SIZE (64*1024) 21 #define VRAM_SIZE (64*1024)
21 #define BORDER_LEFT 13 22 #define BORDER_LEFT 13
22 #define BORDER_RIGHT 14 23 #define BORDER_RIGHT 14
23 #define HORIZ_BORDER (BORDER_LEFT+BORDER_RIGHT) 24 #define HORIZ_BORDER (BORDER_LEFT+BORDER_RIGHT)
24 #define LINEBUF_SIZE (320+HORIZ_BORDER) //H40 + full border 25 #define LINEBUF_SIZE (320+HORIZ_BORDER) //H40 + full border
176 uint32_t serial_address; 177 uint32_t serial_address;
177 uint32_t colors[CRAM_SIZE*4]; 178 uint32_t colors[CRAM_SIZE*4];
178 uint32_t debugcolors[1 << (3 + 1 + 1 + 1)];//3 bits for source, 1 bit for priority, 1 bit for shadow, 1 bit for hilight 179 uint32_t debugcolors[1 << (3 + 1 + 1 + 1)];//3 bits for source, 1 bit for priority, 1 bit for shadow, 1 bit for hilight
179 uint16_t cram[CRAM_SIZE]; 180 uint16_t cram[CRAM_SIZE];
180 uint32_t frame; 181 uint32_t frame;
182 uint32_t vsram_size;
181 uint8_t cd; 183 uint8_t cd;
182 uint8_t flags; 184 uint8_t flags;
183 uint8_t regs[VDP_REGS]; 185 uint8_t regs[VDP_REGS];
184 //cycle count in MCLKs 186 //cycle count in MCLKs
185 uint32_t cycles; 187 uint32_t cycles;
186 uint32_t pending_vint_start; 188 uint32_t pending_vint_start;
187 uint32_t pending_hint_start; 189 uint32_t pending_hint_start;
188 uint32_t top_offset; 190 uint32_t top_offset;
189 uint16_t vsram[VSRAM_SIZE]; 191 uint16_t vsram[MAX_VSRAM_SIZE];
190 uint16_t vscroll_latch[2]; 192 uint16_t vscroll_latch[2];
191 uint16_t vcounter; 193 uint16_t vcounter;
192 uint16_t inactive_start; 194 uint16_t inactive_start;
193 uint16_t border_top; 195 uint16_t border_top;
194 uint16_t border_bot; 196 uint16_t border_bot;
237 uint8_t vdpmem[]; 239 uint8_t vdpmem[];
238 } vdp_context; 240 } vdp_context;
239 241
240 242
241 243
242 vdp_context *init_vdp_context(uint8_t region_pal); 244 vdp_context *init_vdp_context(uint8_t region_pal, uint8_t has_max_vsram);
243 void vdp_free(vdp_context *context); 245 void vdp_free(vdp_context *context);
244 void vdp_run_context_full(vdp_context * context, uint32_t target_cycles); 246 void vdp_run_context_full(vdp_context * context, uint32_t target_cycles);
245 void vdp_run_context(vdp_context * context, uint32_t target_cycles); 247 void vdp_run_context(vdp_context * context, uint32_t target_cycles);
246 //runs from current cycle count to VBLANK for the current mode, returns ending cycle count 248 //runs from current cycle count to VBLANK for the current mode, returns ending cycle count
247 uint32_t vdp_run_to_vblank(vdp_context * context); 249 uint32_t vdp_run_to_vblank(vdp_context * context);