From 7274084cc07a473c530b129aa217f586781ba70c Mon Sep 17 00:00:00 2001 From: user Date: Thu, 16 Jul 2026 15:45:09 +0200 Subject: syscall: mirror console output to the LCD terminal KPutc's console path now renders each byte on the LCD terminal via term_putc in addition to the serial write. Serial is kept so scripted tests still capture output (and for link-cable/debug), while the shell, command output, and echoed input now appear on-screen in the 40-col font with a live cursor and scrolling. Dropped the boot-time term_demo; the terminal starts blank and fills from real console traffic. term_putc now saves/forces/restores SVBK=1 so it always reads and writes the terminal buffer/state in WRAM bank 1, regardless of which process context KPutc is invoked from (defensive; all procs currently use bank 1). The stack lives in non-banked WRAM, so saving SVBK across the switch is safe. Verified: a headless run of `uname; ls; echo hello world` renders each prompt, the echoed command, and its output on the LCD (captured via the new `--headless --shot` path), and serial capture is unchanged. --- src/term.asm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/term.asm') diff --git a/src/term.asm b/src/term.asm index deb6748..10cdccc 100644 --- a/src/term.asm +++ b/src/term.asm @@ -493,7 +493,21 @@ cursor_down: ; ----------------------------------------------------------------------------- ; term_putc - A = character. Print at the cursor, advance, handle \n \r \b. ; ----------------------------------------------------------------------------- +; term_putc guarantees SVBK=1 so the buffer/state at $D5xx/$D6xx are the ones +; we built, no matter which process context KPutc calls us from. The stack is +; in non-banked WRAM ($Cxxx/$Axxx), so saving SVBK across the switch is safe. term_putc:: + ld d, a + ld a, [rSVBK] + push af + ld a, 1 + ld [rSVBK], a + ld a, d + call term_putc_body + pop af + ld [rSVBK], a + ret +term_putc_body: cp 10 jr z, .newline cp 13 -- cgit v1.3.1-sl0p