From fe51f65be393161da81d6db6144418c97a8e0fe7 Mon Sep 17 00:00:00 2001 From: user Date: Thu, 16 Jul 2026 16:30:33 +0200 Subject: term/osk: scroll region so the OSK never hides the input line The terminal now has a variable usable height (wTermRows). term_scroll and cursor_down operate within [0 .. wTermRows-1], and term_set_rows(n) shrinks or grows that region, scrolling the cursor up into view when it would fall outside. osk_toggle shrinks the terminal to the rows above the keyboard on show (18 - OSK_ROWS = 15) and restores full height on hide, so the active line is always visible just above the docked keyboard, and hiding the OSK reclaims all 18 rows. Also add c/count.c ("count [n]", default 25): prints n numbered lines to observe/debug scrolling and the scroll-region behavior. Registered as program id 21 / bank 23. Fixed the arg to read argv[0] (getargs returns the string after the command name). Verified: filling the screen then opening the OSK scrolls the latest line to row 14 (visible) with the keyboard at 15-17; closing it restores rows 15-17; count N prints exactly N lines. --- src/osk.asm | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/osk.asm') diff --git a/src/osk.asm b/src/osk.asm index c761aed..a34a863 100644 --- a/src/osk.asm +++ b/src/osk.asm @@ -236,6 +236,9 @@ osk_toggle:: ld [wOskVisible], a or a jr z, .hide + ; show: shrink the terminal to the rows above the keyboard, then enable window + ld a, 18 - OSK_ROWS + call term_set_rows ld a, [rLCDC] or %00100000 ld [rLCDC], a @@ -244,6 +247,8 @@ osk_toggle:: ld a, [rLCDC] and %11011111 ld [rLCDC], a + ld a, 18 ; restore full-height terminal + call term_set_rows ret ; movement with wrap-around; each moves the highlight -- cgit v1.3.1-sl0p