VIDEO: sprite priority fixed for GBC handed differently (sprite index in oam is used instead of X position)

This commit is contained in:
Bruno Duarte Gouveia
2019-06-06 22:00:16 +01:00
parent 59914de8bd
commit c6cf439511
3 changed files with 8 additions and 1 deletions

View File

@@ -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;

View File

@@ -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<SPRITES;i=i+1) begin : spr
sprite sprite (
.clk ( clk_reg ),
.size16 ( size16 ),
.isGBC ( isGBC ),
.sprite_index ( i ),
.v_cnt ( v_cnt ),
.h_cnt ( h_cnt ),

View File

@@ -81,6 +81,7 @@ sprites sprites (
.clk ( clk ),
.clk_reg ( clk_reg ),
.size16 ( lcdc_spr_siz ),
.isGBC ( isGBC ),
.v_cnt ( v_cnt ),
.h_cnt ( h_cnt-STAGE2 ), // sprites are added in second stage