Hardware sprites: 32 x 16x16 from 64 shapes, collisions, frame counter

rtl/sprites.v draws sprites between the graphics and the text from a pair
of line buffers filled one graphics line ahead. Ports 70h-77h set
position, shape, flip and on/off and load shapes; 78h is a frame counter;
80h-87h report sprite-sprite and sprite-graphics collisions per frame.
The graphics fill (CLS) turns sprites off unless bit 7 is set.
Testbench checks pixels, priority, flip, edge clipping, collisions and
CLS. Manual, README and basic/examples/sprites.bas demo.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
brad ArantandClaude Opus 5.5 committed 2026-11-29 08:36:41 -08:00
1 parent c78073320b
commit 13373244e8
9 files changed
+480 -7

No files matched your search

+9 -1
View File
@@ -319,6 +319,10 @@ module basys3_terminal #(
wire fl_sck;
wire [16:0] gfx_addr;
wire [3:0] gfx_pix;
wire sp_go, sp_buf, sp_on, pix_frame;
wire [7:0] sp_line;
wire [8:0] sp_x;
wire [3:0] sp_pix;
// The Pause key (its scan codes start E1, used by nothing else) enters the
// Z-80 monitor: a toggle crosses to the CPU clock.
@@ -333,6 +337,8 @@ module basys3_terminal #(
.tx_req(ztx_req), .tx_data(ztx_data), .tx_ack(ztx_ack),
.seg_val(z80_seg), .halted(), .brk_key(brk_s[2] ^ brk_s[1]),
.vclk(pix_clk), .gfx_vaddr(gfx_addr), .gfx_vpix(gfx_pix),
.sp_go(sp_go), .sp_line(sp_line), .sp_buf(sp_buf), .sp_x(sp_x), .sp_on(sp_on),
.sp_pix(sp_pix), .sp_ftick(pix_frame),
.fl_cs_n(QspiCSn), .fl_sck(fl_sck), .fl_mosi(QspiDB[0]), .fl_miso(QspiDB[1])
);
@@ -410,7 +416,7 @@ module basys3_terminal #(
wire cur_vis, sm_on, sm_dir;
wire [3:0] dec_leds;
wire bell;
wire frame_tick, pix_frame;
wire frame_tick;
// start of vertical blanking, from the pixel clock to this one
reg frame_t = 1'b0;
@@ -448,6 +454,8 @@ module basys3_terminal #(
.cur_row(cur_row), .cur_col(cur_col), .cur_vis(cur_vis),
.stop(stop), .sbot(sbot), .sm_on(sm_on), .sm_dir(sm_dir), .sm_off(sm_off),
.ram_addr(v_addr), .ram_data(v_data), .gfx_addr(gfx_addr), .gfx_pix(alt_scr ? 4'd0 : gfx_pix),
.sp_go(sp_go), .sp_line(sp_line), .sp_buf(sp_buf), .sp_x(sp_x), .sp_on(sp_on),
.sp_pix(alt_scr ? 4'd0 : sp_pix),
.red(vgaRed), .green(vgaGreen), .blue(vgaBlue), .hsync(Hsync), .vsync(Vsync),
.frame_tick(pix_frame)
);