aboutsummaryrefslogtreecommitdiffstats
path: root/src/boot.asm
diff options
context:
space:
mode:
authoruser <user@clank>2026-07-16 15:35:07 +0200
committeruser <user@clank>2026-07-16 15:35:07 +0200
commit61c9595901b86ca60eaeb9a65db6a7ddb1309976 (patch)
tree4789a7c3478d36dce292996c2d120cc1eb860c16 /src/boot.asm
parentfont: full mixed-case + punctuation glyph set (not uppercase-only) (diff)
downloadgbos-61c9595901b86ca60eaeb9a65db6a7ddb1309976.tar.gz
gbos-61c9595901b86ca60eaeb9a65db6a7ddb1309976.tar.xz
gbos-61c9595901b86ca60eaeb9a65db6a7ddb1309976.zip
term: cursor + O(1) line scrolling
Rework the terminal from a static one-tile-per-screen-position model to LINE-BOUND tiles with an assign[] indirection, so scrolling is cheap: - Each line-slot L owns the 20 VRAM tiles at positions [L*20..L*20+19]. - assign[screen_row] -> line-slot; the tilemap points each screen row at its slot's tiles. - Scroll = rotate assign[], blank+rebuild only the new bottom line (20 tiles), and rewrite the tilemap. O(1 line) instead of rebuilding all 360 tiles. - term_putc: printable + \n \r \b, line wrap at col 40, cursor advance with scroll-on-overflow. - Cursor: an underline OR'd into the current cell's tile via wCurMask (no sprites/OAM); moving it just re-renders the old and new tiles. - term_demo drives 24 lines through term_putc to exercise scroll+cursor. Also fixes a vicious bug this shook out: build_tile advanced its 16-bit glyph pointers with `ld hl, wGlyphL+1 / inc [hl]`, which CLOBBERS HL -- and HL is the live VRAM destination pointer. Whenever a glyph's 8 bytes straddled a page boundary (common with long/varied lines) the next tile bytes were written into WRAM at $D580+, corrupting wGlyphL/wVram/wCurRow/ wCurCol and freezing the display. Now the pointers are bumped via A so HL is preserved. (Note: the emulator build had also been silently failing on an unrelated debug edit, masking this for a while.) Verified by screenshot: 24 lines scroll to show the last 18 + a visible cursor at the "ready$" prompt; serial shell and filesystem still work.
Diffstat (limited to '')
-rw-r--r--src/boot.asm2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/boot.asm b/src/boot.asm
index 0a5f2e3..ea52858 100644
--- a/src/boot.asm
+++ b/src/boot.asm
@@ -57,7 +57,7 @@ KernelInit:
ld [wCurProc+1], a
call fs_init ; mount the disk (format on first boot; persists)
call term_init ; set up the LCD text terminal
- call term_test ; render a test pattern
+ call term_demo ; cursor + scroll demo
; --- spawn the init task (pid 1); it fork()s the rest ---
ld hl, TaskInit