From 6cd595a305c71f0540a3ecf4c4038891a7eba762 Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Tue, 17 Jun 2014 19:01:01 -0700 Subject: Partially working switch to having a vcounter and hslot counter in the context rather than trying to derive them from the cycle count. This should allow for more accurate handling of mid screen mode switches. Interrupt timing is broken currently though --- vdp.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'vdp.h') diff --git a/vdp.h b/vdp.h index 830aa5a..2fa8f36 100644 --- a/vdp.h +++ b/vdp.h @@ -142,9 +142,11 @@ typedef struct { uint32_t colors[CRAM_SIZE*3]; uint32_t debugcolors[1 << (3 + 1 + 1 + 1)];//3 bits for source, 1 bit for priority, 1 bit for shadow, 1 bit for hilight uint16_t vsram[VSRAM_SIZE]; - uint8_t latched_mode; + uint16_t vcounter; + uint16_t hslot; //hcounter/2 uint16_t hscroll_a; uint16_t hscroll_b; + uint8_t latched_mode; uint8_t sprite_index; uint8_t sprite_draws; int8_t slot_counter; -- cgit v1.2.3 From b28dc876ea3d900787f2c953ddd84056924f7308 Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Wed, 18 Jun 2014 16:30:19 -0700 Subject: Fix most of the breakage caused by the vcounter/hcounter changes --- vdp.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'vdp.h') diff --git a/vdp.h b/vdp.h index 2fa8f36..184521a 100644 --- a/vdp.h +++ b/vdp.h @@ -49,6 +49,7 @@ #define FLAG2_HINT_PENDING 0x02 #define FLAG2_READ_PENDING 0x04 #define FLAG2_SPRITE_COLLIDE 0x08 +#define FLAG2_REGION_PAL 0x10 #define DISPLAY_ENABLE 0x40 @@ -169,7 +170,7 @@ typedef struct { uint8_t *tmp_buf_b; } vdp_context; -void init_vdp_context(vdp_context * context); +void init_vdp_context(vdp_context * context, uint8_t region_pal); void vdp_run_context(vdp_context * context, uint32_t target_cycles); //runs from current cycle count to VBLANK for the current mode, returns ending cycle count uint32_t vdp_run_to_vblank(vdp_context * context); @@ -192,6 +193,7 @@ void vdp_int_ack(vdp_context * context, uint16_t int_num); void vdp_print_sprite_table(vdp_context * context); void vdp_print_reg_explain(vdp_context * context); void latch_mode(vdp_context * context); +uint32_t vdp_cycles_to_frame_end(vdp_context * context); extern int32_t color_map[1 << 12]; -- cgit v1.2.3 From d8bb1db03b5f3c3beb86dce633f89872d05318a5 Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Sun, 4 Jan 2015 23:05:37 -0800 Subject: Some small synchronization improvements that do not seem to fix anything --- vdp.h | 1 + 1 file changed, 1 insertion(+) (limited to 'vdp.h') diff --git a/vdp.h b/vdp.h index 184521a..70c0953 100644 --- a/vdp.h +++ b/vdp.h @@ -194,6 +194,7 @@ void vdp_print_sprite_table(vdp_context * context); void vdp_print_reg_explain(vdp_context * context); void latch_mode(vdp_context * context); uint32_t vdp_cycles_to_frame_end(vdp_context * context); +uint8_t vdp_is_frame_over(vdp_context * context); extern int32_t color_map[1 << 12]; -- cgit v1.2.3 From b3e40bd29176e1c4cf53f8542628e48e1eb5dcb0 Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Mon, 11 May 2015 00:28:47 -0700 Subject: Sync fixes and logging to fix more sync issues --- vdp.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'vdp.h') diff --git a/vdp.h b/vdp.h index 70c0953..31bd4e7 100644 --- a/vdp.h +++ b/vdp.h @@ -143,6 +143,7 @@ typedef struct { uint32_t colors[CRAM_SIZE*3]; uint32_t debugcolors[1 << (3 + 1 + 1 + 1)];//3 bits for source, 1 bit for priority, 1 bit for shadow, 1 bit for hilight uint16_t vsram[VSRAM_SIZE]; + uint32_t frame; uint16_t vcounter; uint16_t hslot; //hcounter/2 uint16_t hscroll_a; @@ -194,7 +195,7 @@ void vdp_print_sprite_table(vdp_context * context); void vdp_print_reg_explain(vdp_context * context); void latch_mode(vdp_context * context); uint32_t vdp_cycles_to_frame_end(vdp_context * context); -uint8_t vdp_is_frame_over(vdp_context * context); +uint32_t vdp_frame_end_line(vdp_context *context); extern int32_t color_map[1 << 12]; -- cgit v1.2.3 From 7e2fdcb2f3378827b1286e8d7ee5290303e71d6b Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Sat, 16 May 2015 23:04:57 -0700 Subject: First pass at emulating a vscroll latch. Titan's Overdrive demo seems to depend on the scroll value being latched early in the line before the HINT gets a chance to change it --- vdp.h | 1 + 1 file changed, 1 insertion(+) (limited to 'vdp.h') diff --git a/vdp.h b/vdp.h index 31bd4e7..7950c38 100644 --- a/vdp.h +++ b/vdp.h @@ -143,6 +143,7 @@ typedef struct { uint32_t colors[CRAM_SIZE*3]; uint32_t debugcolors[1 << (3 + 1 + 1 + 1)];//3 bits for source, 1 bit for priority, 1 bit for shadow, 1 bit for hilight uint16_t vsram[VSRAM_SIZE]; + uint16_t vscroll_latch[2]; uint32_t frame; uint16_t vcounter; uint16_t hslot; //hcounter/2 -- cgit v1.2.3 From b06a76dab4014a5ea1046eee6e4fdd819dbe7cbb Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Tue, 19 May 2015 23:23:53 -0700 Subject: Small correction to VBLANK flag timing. Fixed some inconsistencies in interrupt timing calculation. --- vdp.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'vdp.h') diff --git a/vdp.h b/vdp.h index 7950c38..a05501c 100644 --- a/vdp.h +++ b/vdp.h @@ -132,6 +132,8 @@ typedef struct { uint8_t regs[VDP_REGS]; //cycle count in MCLKs uint32_t cycles; + uint32_t pending_vint_start; + uint32_t pending_hint_start; uint8_t *vdpmem; //stores 2-bit palette + 4-bit palette index + priority for current sprite line uint8_t *linebuf; -- cgit v1.2.3 From da1788598fe5f71295b6086ed8ef54fa39bbbd22 Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Thu, 21 May 2015 00:55:46 -0700 Subject: Restore the other 2 debug display modes --- vdp.h | 1 + 1 file changed, 1 insertion(+) (limited to 'vdp.h') diff --git a/vdp.h b/vdp.h index a05501c..5627057 100644 --- a/vdp.h +++ b/vdp.h @@ -170,6 +170,7 @@ typedef struct { uint8_t buf_a_off; uint8_t buf_b_off; uint8_t debug; + uint8_t debug_pal; uint8_t *tmp_buf_a; uint8_t *tmp_buf_b; } vdp_context; -- cgit v1.2.3