comparison vdp.h @ 1077:1a66d5165ea7

Cleanup the separation of render backend and VDP code in preparation for having extra debug windows. Make determination of H40/H32 based on number of lines in each mode.
author Michael Pavone <pavone@retrodev.com>
date Mon, 22 Aug 2016 09:46:18 -0700
parents e34334e6c682
children c15896605bf2
comparison
equal deleted inserted replaced
1076:fa6fe03f218a 1077:1a66d5165ea7
11 11
12 #define VDP_REGS 24 12 #define VDP_REGS 24
13 #define CRAM_SIZE 64 13 #define CRAM_SIZE 64
14 #define VSRAM_SIZE 40 14 #define VSRAM_SIZE 40
15 #define VRAM_SIZE (64*1024) 15 #define VRAM_SIZE (64*1024)
16 #define LINEBUF_SIZE 320 16 #define LINEBUF_SIZE (320+27) //H40 + full border
17 #define FRAMEBUF_ENTRIES (320+27)*(240+27) //PAL active display + full border 17 #define BORDER_BOTTOM 13 //TODO: Replace with actual value
18 #define MAX_DRAWS 40 18 #define MAX_DRAWS 40
19 #define MAX_DRAWS_H32 32 19 #define MAX_DRAWS_H32 32
20 #define MAX_SPRITES_LINE 20 20 #define MAX_SPRITES_LINE 20
21 #define MAX_SPRITES_LINE_H32 16 21 #define MAX_SPRITES_LINE_H32 16
22 #define MAX_SPRITES_FRAME 80 22 #define MAX_SPRITES_FRAME 80
49 #define FLAG2_VINT_PENDING 0x01 49 #define FLAG2_VINT_PENDING 0x01
50 #define FLAG2_HINT_PENDING 0x02 50 #define FLAG2_HINT_PENDING 0x02
51 #define FLAG2_READ_PENDING 0x04 51 #define FLAG2_READ_PENDING 0x04
52 #define FLAG2_SPRITE_COLLIDE 0x08 52 #define FLAG2_SPRITE_COLLIDE 0x08
53 #define FLAG2_REGION_PAL 0x10 53 #define FLAG2_REGION_PAL 0x10
54 #define FLAG2_EVEN_FIELD 0x20
54 55
55 #define DISPLAY_ENABLE 0x40 56 #define DISPLAY_ENABLE 0x40
56 57
57 enum { 58 enum {
58 REG_MODE_1=0, 59 REG_MODE_1=0,
136 uint32_t pending_vint_start; 137 uint32_t pending_vint_start;
137 uint32_t pending_hint_start; 138 uint32_t pending_hint_start;
138 uint8_t *vdpmem; 139 uint8_t *vdpmem;
139 //stores 2-bit palette + 4-bit palette index + priority for current sprite line 140 //stores 2-bit palette + 4-bit palette index + priority for current sprite line
140 uint8_t *linebuf; 141 uint8_t *linebuf;
141 //stores 12-bit color + shadow/highlight bits 142 //pointer to current line in framebuffer
142 void *framebuf; 143 uint32_t *output;
143 void *oddbuf;
144 void *evenbuf;
145 uint16_t cram[CRAM_SIZE]; 144 uint16_t cram[CRAM_SIZE];
146 uint32_t colors[CRAM_SIZE*3]; 145 uint32_t colors[CRAM_SIZE*3];
147 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
148 uint16_t vsram[VSRAM_SIZE]; 147 uint16_t vsram[VSRAM_SIZE];
149 uint16_t vscroll_latch[2]; 148 uint16_t vscroll_latch[2];
149 uint32_t output_pitch;
150 uint32_t frame; 150 uint32_t frame;
151 uint16_t vcounter; 151 uint16_t vcounter;
152 uint16_t hscroll_a; 152 uint16_t hscroll_a;
153 uint16_t hscroll_b; 153 uint16_t hscroll_b;
154 uint8_t hslot; //hcounter/2 154 uint8_t hslot; //hcounter/2
155 uint8_t latched_mode; 155 uint8_t latched_mode;
156 uint8_t sprite_index; 156 uint8_t sprite_index;
157 uint8_t sprite_draws; 157 uint8_t sprite_draws;
158 uint8_t h40_lines;
158 int8_t slot_counter; 159 int8_t slot_counter;
159 int8_t cur_slot; 160 int8_t cur_slot;
160 sprite_draw sprite_draw_list[MAX_DRAWS]; 161 sprite_draw sprite_draw_list[MAX_DRAWS];
161 sprite_info sprite_info_list[MAX_SPRITES_LINE]; 162 sprite_info sprite_info_list[MAX_SPRITES_LINE];
162 uint8_t sat_cache[SAT_CACHE_SIZE]; 163 uint8_t sat_cache[SAT_CACHE_SIZE];