From c69a052d495065dc0972b2c09cb33907359e35aa Mon Sep 17 00:00:00 2001 From: Martin Donlon Date: Mon, 1 May 2023 08:57:12 -0700 Subject: [PATCH] Correct wide layer offset when flipped. Only the most significant bit of the vram base should be used for wide layers. --- rtl/ga23_layer.sv | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rtl/ga23_layer.sv b/rtl/ga23_layer.sv index 1993bd8..a9f682e 100644 --- a/rtl/ga23_layer.sv +++ b/rtl/ga23_layer.sv @@ -58,10 +58,10 @@ wire wide = control[2]; wire enabled = ~control[4] & dbg_enabled; wire en_rowscroll = control[6]; wire [9:0] x = x_base + ( en_rowscroll ? rowscroll : x_ofs ); -wire [6:0] tile_x = x[9:3] + ( wide ? 7'd32 : 7'd0); +wire [6:0] tile_x = NL ? ( x[9:3] - ( wide ? 7'd32 : 7'd0) ) : ( x[9:3] + ( wide ? 7'd32 : 7'd0) ); wire [5:0] tile_y = y[8:3]; -assign vram_addr = vram_base + (wide ? {1'b0, tile_y, tile_x[6:0], 1'b0} : {2'b00, tile_y, tile_x[5:0], 1'b0}); +assign vram_addr = wide ? {vram_base[14], tile_y, tile_x[6:0], 1'b0} : {vram_base[14:13], tile_y, tile_x[5:0], 1'b0}; reg [3:0] cnt;