From f55d4a3023f1dc520b54bca1cd4bcb334a0ba25c Mon Sep 17 00:00:00 2001 From: Mike Pavone Date: Fri, 12 Jul 2013 19:11:55 -0700 Subject: Implement the scroll ring buffer properly without memcpy --- vdp.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'vdp.h') diff --git a/vdp.h b/vdp.h index c43a2d9..2cad1f3 100644 --- a/vdp.h +++ b/vdp.h @@ -147,6 +147,8 @@ typedef struct { uint8_t flags2; uint8_t double_res; uint8_t b32; + uint8_t buf_a_off; + uint8_t buf_b_off; uint8_t *tmp_buf_a; uint8_t *tmp_buf_b; } vdp_context; -- cgit v1.2.3 From de1c3145d57e6efc3022012d26744f7a79e3cde2 Mon Sep 17 00:00:00 2001 From: Mike Pavone Date: Mon, 15 Jul 2013 23:07:45 -0700 Subject: Restore one of the VDP debugging modes --- vdp.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'vdp.h') diff --git a/vdp.h b/vdp.h index 2cad1f3..97be57b 100644 --- a/vdp.h +++ b/vdp.h @@ -19,13 +19,15 @@ #define FBUF_SHADOW 0x0001 #define FBUF_HILIGHT 0x0010 -#define FBUF_BIT_PRIORITY 0x1000 -#define FBUF_SRC_MASK 0xE000 -#define FBUF_SRC_A 0x0000 -#define FBUF_SRC_W 0x2000 -#define FBUF_SRC_B 0x4000 -#define FBUF_SRC_S 0x6000 -#define FBUF_SRC_BG 0x8000 +#define DBG_SHADOW 0x10 +#define DBG_HILIGHT 0x20 +#define DBG_PRIORITY 0x8 +#define DBG_SRC_MASK 0x7 +#define DBG_SRC_A 0x1 +#define DBG_SRC_W 0x2 +#define DBG_SRC_B 0x3 +#define DBG_SRC_S 0x4 +#define DBG_SRC_BG 0x0 #define MCLKS_LINE 3420 @@ -128,6 +130,7 @@ typedef struct { void *evenbuf; uint16_t cram[CRAM_SIZE]; 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 hscroll_a; @@ -149,6 +152,7 @@ typedef struct { uint8_t b32; uint8_t buf_a_off; uint8_t buf_b_off; + uint8_t debug; uint8_t *tmp_buf_a; uint8_t *tmp_buf_b; } vdp_context; -- cgit v1.2.3 From a75eb24bfbbf0dd3492c8414cfaafa0569a1539a Mon Sep 17 00:00:00 2001 From: Mike Pavone Date: Fri, 26 Jul 2013 19:55:04 -0700 Subject: Added support for saving savestates. Added gst savestate format test harness --- vdp.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'vdp.h') diff --git a/vdp.h b/vdp.h index 97be57b..15f86b1 100644 --- a/vdp.h +++ b/vdp.h @@ -164,7 +164,7 @@ uint32_t vdp_run_to_vblank(vdp_context * context); //runs until the target cycle is reached or the current DMA operation has completed, whicever comes first void vdp_run_dma_done(vdp_context * context, uint32_t target_cycles); uint8_t vdp_load_gst(vdp_context * context, FILE * state_file); -void vdp_save_state(vdp_context * context, FILE * outfile); +uint8_t vdp_save_gst(vdp_context * context, FILE * outfile); int vdp_control_port_write(vdp_context * context, uint16_t value); int vdp_data_port_write(vdp_context * context, uint16_t value); uint16_t vdp_control_port_read(vdp_context * context); @@ -177,5 +177,8 @@ uint32_t vdp_next_vint_z80(vdp_context * context); 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); + +extern int32_t color_map[1 << 12]; #endif //VDP_H_ -- cgit v1.2.3 From 929bc24ebe9477fec8993be92b24dd0a96d001cd Mon Sep 17 00:00:00 2001 From: Mike Pavone Date: Tue, 10 Sep 2013 00:29:46 -0700 Subject: Implement FIFO latency and improve DMA accuracy --- vdp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vdp.h') diff --git a/vdp.h b/vdp.h index 15f86b1..eda72fe 100644 --- a/vdp.h +++ b/vdp.h @@ -143,7 +143,7 @@ typedef struct { sprite_info sprite_info_list[MAX_SPRITES_LINE]; uint16_t col_1; uint16_t col_2; - uint16_t dma_val; + uint16_t last_write_val; uint8_t v_offset; uint8_t dma_cd; uint8_t hint_counter; -- cgit v1.2.3 From 2c302a78d201d9b594774cec505d14c22e03662c Mon Sep 17 00:00:00 2001 From: Mike Pavone Date: Tue, 10 Sep 2013 23:31:08 -0700 Subject: Added copyright notice to source files and added GPL license text in COPYING --- vdp.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'vdp.h') diff --git a/vdp.h b/vdp.h index eda72fe..79f28c0 100644 --- a/vdp.h +++ b/vdp.h @@ -1,3 +1,8 @@ +/* + Copyright 2013 Michael Pavone + This file is part of BlastEm. + BlastEm is free software distributed under the terms of the GNU General Public License version 3 or greater. See COPYING for full license text. +*/ #ifndef VDP_H_ #define VDP_H_ -- cgit v1.2.3 From 0f6f021093e9b54ca2379fd7d9359648cca03734 Mon Sep 17 00:00:00 2001 From: Mike Pavone Date: Fri, 13 Sep 2013 19:22:46 -0700 Subject: Properly delay 68K on VDP reads. Dummy VDP test port implementation. Initial stab at handling undefined bits of VSRAM and CRAM. --- vdp.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'vdp.h') diff --git a/vdp.h b/vdp.h index 79f28c0..4cb61e2 100644 --- a/vdp.h +++ b/vdp.h @@ -1,6 +1,6 @@ /* Copyright 2013 Michael Pavone - This file is part of BlastEm. + This file is part of BlastEm. BlastEm is free software distributed under the terms of the GNU General Public License version 3 or greater. See COPYING for full license text. */ #ifndef VDP_H_ @@ -47,6 +47,7 @@ #define FLAG2_VINT_PENDING 0x01 #define FLAG2_HINT_PENDING 0x02 +#define FLAG2_READ_PENDING 0x04 #define DISPLAY_ENABLE 0x40 @@ -149,6 +150,7 @@ typedef struct { uint16_t col_1; uint16_t col_2; uint16_t last_write_val; + uint16_t last_fifo_val; uint8_t v_offset; uint8_t dma_cd; uint8_t hint_counter; @@ -172,9 +174,11 @@ uint8_t vdp_load_gst(vdp_context * context, FILE * state_file); uint8_t vdp_save_gst(vdp_context * context, FILE * outfile); int vdp_control_port_write(vdp_context * context, uint16_t value); int vdp_data_port_write(vdp_context * context, uint16_t value); +void vdp_test_port_write(vdp_context * context, uint16_t value); uint16_t vdp_control_port_read(vdp_context * context); uint16_t vdp_data_port_read(vdp_context * context); uint16_t vdp_hv_counter_read(vdp_context * context); +uint16_t vdp_test_port_read(vdp_context * context); void vdp_adjust_cycles(vdp_context * context, uint32_t deduction); uint32_t vdp_next_hint(vdp_context * context); uint32_t vdp_next_vint(vdp_context * context); -- cgit v1.2.3 From e154139fdaa57c8c805167641b9ac0c30bb9d115 Mon Sep 17 00:00:00 2001 From: Mike Pavone Date: Sun, 15 Sep 2013 22:20:43 -0700 Subject: Implement FIFO as a ring buffer so the behavior of reads from invalid CRAM and VSRAM bits can be implemented properly --- vdp.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'vdp.h') diff --git a/vdp.h b/vdp.h index 4cb61e2..75a603d 100644 --- a/vdp.h +++ b/vdp.h @@ -110,6 +110,8 @@ typedef struct { int16_t y; } sprite_info; +#define FIFO_SIZE 4 + typedef struct { uint32_t cycle; uint16_t address; @@ -119,8 +121,9 @@ typedef struct { } fifo_entry; typedef struct { - fifo_entry *fifo_cur; - fifo_entry *fifo_end; + fifo_entry fifo[FIFO_SIZE]; + int32_t fifo_write; + int32_t fifo_read; uint16_t address; uint8_t cd; uint8_t flags; -- cgit v1.2.3 From 74af15299f37e5c95f4498cfb2f9456c9d4d61bc Mon Sep 17 00:00:00 2001 From: Mike Pavone Date: Tue, 17 Sep 2013 00:11:45 -0700 Subject: Fix DMA fill so that it does not cause observable changes to the FIFO. Get DMA copy mostly correct from an observable ffect perspective. DMA copy probably does not reflect internal implementation still given that evidence seems to suggest no FIFO usage at all. --- vdp.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'vdp.h') diff --git a/vdp.h b/vdp.h index 75a603d..9d976e4 100644 --- a/vdp.h +++ b/vdp.h @@ -152,8 +152,6 @@ typedef struct { sprite_info sprite_info_list[MAX_SPRITES_LINE]; uint16_t col_1; uint16_t col_2; - uint16_t last_write_val; - uint16_t last_fifo_val; uint8_t v_offset; uint8_t dma_cd; uint8_t hint_counter; -- cgit v1.2.3 From b1170b0ee50fdb523fdb65e6f99851fe67acd1c1 Mon Sep 17 00:00:00 2001 From: Mike Pavone Date: Tue, 17 Sep 2013 09:45:14 -0700 Subject: Implement HV counter latch --- vdp.h | 1 + 1 file changed, 1 insertion(+) (limited to 'vdp.h') diff --git a/vdp.h b/vdp.h index 9d976e4..9b99b97 100644 --- a/vdp.h +++ b/vdp.h @@ -152,6 +152,7 @@ typedef struct { sprite_info sprite_info_list[MAX_SPRITES_LINE]; uint16_t col_1; uint16_t col_2; + uint16_t hv_latch; uint8_t v_offset; uint8_t dma_cd; uint8_t hint_counter; -- cgit v1.2.3