From 0db949c3a3ab07b264c21c3a15efea6b6055be0d Mon Sep 17 00:00:00 2001 From: user Date: Thu, 16 Jul 2026 16:46:21 +0200 Subject: term: compute the OSK view offset from the cursor row (keep input visible) A fixed offset of OSK_ROWS pushed the cursor off the top of the screen when there was little backlog (e.g. a fresh terminal: cursor at logical row 0 -> screen row -3, hidden). Now the offset is max(0, wCurRow - 14): 0 when the cursor is within the visible area, growing only enough to keep the cursor line at the bottom visible row (14) once the terminal has filled past it. compute_offset (from wOskVisible + wCurRow) runs at the top of term_write_tilemap; cursor_down re-runs the tilemap when the cursor changes rows while the OSK is up; osk_toggle just re-runs it. Shared OSK_DOCK constant in gbos.inc keeps term.asm and osk.asm in sync. Verified: fresh terminal + OSK shows the input at row 0; filling past row 14 shifts the view to hold the input at row 14; full screen + OSK puts it at row 14; toggle on+off is still lossless. --- include/gbos.inc | 1 + 1 file changed, 1 insertion(+) (limited to 'include/gbos.inc') diff --git a/include/gbos.inc b/include/gbos.inc index 6dcefce..9b44b33 100644 --- a/include/gbos.inc +++ b/include/gbos.inc @@ -12,6 +12,7 @@ DEF rIF EQU $FF0F ; interrupt flags DEF rIE EQU $FFFF ; interrupt enable DEF rSVBK EQU $FF70 ; CGB WRAM bank select ($D000-$DFFF): 1..7 DEF wCurMask EQU $D589 ; term/osk: cursor underline bits OR'd into a tile's last row +DEF OSK_DOCK EQU 3 ; on-screen keyboard height in rows (dock at the bottom) DEF rKEY1 EQU $FF4D ; CGB speed switch DEF rSB EQU $FF01 ; serial data DEF rSC EQU $FF02 ; serial control -- cgit v1.3.1-sl0p