aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/boot.asm2
-rw-r--r--src/syscall.asm4
-rw-r--r--src/term.asm14
3 files changed, 18 insertions, 2 deletions
diff --git a/src/boot.asm b/src/boot.asm
index ea52858..973bc8e 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_demo ; cursor + scroll demo
+ ; terminal starts blank; shell output flows in via KPutc
; --- spawn the init task (pid 1); it fork()s the rest ---
ld hl, TaskInit
diff --git a/src/syscall.asm b/src/syscall.asm
index 5557b5f..870a2ff 100644
--- a/src/syscall.asm
+++ b/src/syscall.asm
@@ -149,9 +149,11 @@ KPutc::
jp sys_putb ; B=fd, E=byte
.console
ld a, [wKChar]
- ld [rSB], a
+ ld [rSB], a ; mirror to serial (test capture / link)
ld a, $81
ld [rSC], a
+ ld a, [wKChar]
+ call term_putc ; and render on the LCD terminal
ret
; -----------------------------------------------------------------------------
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