From bea52bc8f99ee6dbcc8154a366560fc18e7b24c8 Mon Sep 17 00:00:00 2001 From: user Date: Sat, 18 Jul 2026 21:56:21 +0200 Subject: term: latch SCY in VBlank - fix ring-scroll shear on live displays The ring-scroll wrote SCY mid-frame; SCY is sampled per scanline (on hardware and in sl0pboy's PPU), so a scroll landing mid-frame rendered the top of the frame at the old offset and the bottom at the new one - a one-frame shear, invisible in frame-sampled GIF captures but ugly on a live sixel view. term_view_update now writes hSCY (HRAM) and a transparent VBlank ISR (push af / apply / pop af / reti, same profile as TimerISR) copies it to rSCY, so the view only ever moves at frame boundaries. The scroll's tile+map writes stay immediate: the new map row is invisible at the old SCY by construction (it's the ring row one past the visible 18). --- src/term.asm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/term.asm') diff --git a/src/term.asm b/src/term.asm index 6a94024..46cd23e 100644 --- a/src/term.asm +++ b/src/term.asm @@ -60,6 +60,7 @@ term_init:: ld [rLCDC], a ; LCD off ld [rSCX], a ld [rSCY], a + ldh [hSCY], a ; keep the VBlank latch in sync ; Load all 8 CGB BG palettes from PalData (see tools/gencolor.py). Palettes ; 0 and 2..7 are the 7 Fano-plane text palettes (each = bg + 3 of our 7 @@ -168,8 +169,8 @@ term_view_update:: add a add a add a ; *8 px - ld [rSCY], a - ret + ldh [hSCY], a ; latched: the VBlank ISR applies it, so the + ret ; view never moves mid-frame (no shear) ; ----------------------------------------------------------------------------- ; map_row_one - write the BG-map row for logical row A (0..17): tile indices -- cgit v1.3.1-sl0p