From c6cf439511e83f2f157c5bcb064a76cb46dcaf33 Mon Sep 17 00:00:00 2001 From: Bruno Duarte Gouveia Date: Thu, 6 Jun 2019 22:00:16 +0100 Subject: [PATCH] VIDEO: sprite priority fixed for GBC handed differently (sprite index in oam is used instead of X position) --- sprite.v | 4 +++- sprites.v | 4 ++++ video.v | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/sprite.v b/sprite.v index 6a3b285..ebfe74f 100644 --- a/sprite.v +++ b/sprite.v @@ -22,6 +22,8 @@ module sprite ( input clk, input size16, + input isGBC, + input [7:0] sprite_index, input [7:0] v_cnt, input [7:0] h_cnt, @@ -50,7 +52,7 @@ module sprite ( // x position for priority detection. Invisible sprites are far to the right and // have minimum priority -assign x = v_visible?x_pos:8'hff; +assign x = v_visible?isGBC?sprite_index:x_pos:8'hff; // register used to store pixel data for current line reg [7:0] data0; diff --git a/sprites.v b/sprites.v index a4fb3b2..9797c2c 100644 --- a/sprites.v +++ b/sprites.v @@ -23,6 +23,7 @@ module sprites ( input clk, input clk_reg, input size16, + input isGBC, // pixel position input which the current pixel is generated for input [7:0] v_cnt, @@ -98,6 +99,9 @@ for(i=0;i