aboutsummaryrefslogtreecommitdiffstats
path: root/src/term.asm
diff options
context:
space:
mode:
authoruser <user@clank>2026-07-16 16:07:01 +0200
committeruser <user@clank>2026-07-16 16:07:01 +0200
commita5557c75767f7201d5df8c6f95c162044072ef10 (patch)
treeed4ddd29ba3e6411b1b20f41fcbf8f67c023c93e /src/term.asm
parentsyscall: mirror console output to the LCD terminal (diff)
downloadgbos-a5557c75767f7201d5df8c6f95c162044072ef10.tar.gz
gbos-a5557c75767f7201d5df8c6f95c162044072ef10.tar.xz
gbos-a5557c75767f7201d5df8c6f95c162044072ef10.zip
osk: toggle-able on-screen keyboard on the window layer
A joypad-driven keyboard that costs zero permanent screen space: it lives on the GB window layer, so SELECT just flips LCDC bit 5 (window enable) and the terminal's background layer underneath is never disturbed. - src/joypad.asm: read $FF00 with edge detection (wPadCur/Prev/New). - src/osk.asm: 3x20 key grid (letters, digits, space, punctuation, plus Enter/Backspace) built once into spare bank-1 VRAM tiles (104+) and laid out on the $9C00 window map, docked to the bottom 3 rows. The highlighted key is a palette swap on its window attribute byte (CGB BG palette 1 = inverted), so moving the cursor is 1-2 attribute writes with no tile rebuilding. SELECT toggles, d-pad moves, A types. - KGetc's console poll loop now polls the joypad and osk_handle each iteration; a key press returns its byte to the reader exactly like a serial byte, so the shell is oblivious to the input source. Verified in the emulator (via --keys): SELECT shows the keyboard, the highlight tracks the d-pad, and typing "ls"+Enter runs the command and lists the files; a second SELECT hides it and reclaims the full 18 rows. Known limitation: the OSK overlays the bottom 3 terminal rows, so if the prompt has scrolled to the very bottom the current input line can be hidden. A follow-up can add a scroll region (terminal uses rows 0-14 while the OSK is up). Input over serial still works unchanged.
Diffstat (limited to 'src/term.asm')
-rw-r--r--src/term.asm3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/term.asm b/src/term.asm
index 10cdccc..ba9ff93 100644
--- a/src/term.asm
+++ b/src/term.asm
@@ -31,7 +31,6 @@ DEF wVram EQU $D584 ; 2
DEF wCurRow EQU $D586 ; cursor screen row 0..17
DEF wCurCol EQU $D587 ; cursor screen col 0..39
DEF wCursorOn EQU $D588 ; draw the cursor?
-DEF wCurMask EQU $D589 ; underline bits to OR into a tile's last row
DEF wRT_sr EQU $D58A ; render_tile scratch
DEF wRT_tcol EQU $D58B
DEF wRT_cL EQU $D58C
@@ -230,7 +229,7 @@ glyph_ptr:
; build_tile - build tile for tile-position DE (E=index, D=bank) from chars
; B (left) and C (right). ORs wCurMask into the last pixel row (cursor).
; -----------------------------------------------------------------------------
-build_tile:
+build_tile::
ld a, d
ld [rVBK], a ; VRAM bank for this tile
ld h, 0